Commit 7fa98144 authored by Eloy Durán's avatar Eloy Durán

Merge pull request #1294 from CocoaPods/0xced/copy-user_project-build_configurations

Pass the user build configurations to the Pods project
parents 80b0dc9c 63c80b18
......@@ -17,7 +17,7 @@ GIT
GIT
remote: https://github.com/CocoaPods/Xcodeproj.git
revision: e2a6fb7466b26c3628c726271be60700bc635a62
revision: 9d2f8cef72466cb3f155a9a5a3cfb12c94802656
branch: master
specs:
xcodeproj (0.9.0)
......
......@@ -220,6 +220,7 @@ namespace :spec do
title 'Running the specs'
sh "bundle exec bacon #{specs('**')}"
require 'pathname'
unless Pathname.new(ENV['HOME']+'/.cocoapods/repos/master').exist?
title 'Ensuring specs repo is up to date'
sh "./bin/pod setup"
......@@ -343,7 +344,8 @@ namespace :examples do
Dir.chdir(example.to_s) do
execute_command "rm -rf Pods DerivedData"
# WARNING: This appeart to use sytem gems instead of the bundle ones.
execute_command "#{'../../bin/' unless ENV['FROM_GEM']}sandbox-pod install --verbose --no-repo-update"
pod_command = ENV['FROM_GEM'] ? 'sandbox-pod' : 'bundle exec ../../bin/sandbox-pod'
execute_command "#{pod_command} install --verbose --no-repo-update"
command = "xcodebuild -workspace '#{example.basename}.xcworkspace' -scheme '#{example.basename}'"
if (example + 'Podfile').read.include?('platform :ios')
# Specifically build against the simulator SDK so we don't have to deal with code signing.
......
......@@ -6,7 +6,7 @@ module Pod
self.summary = 'Setup the CocoaPods environment'
self.description = <<-DESC
Creates a directory at `~/.cocoapods` which will hold your spec-repos.
Creates a directory at `~/.cocoapods/repos` which will hold your spec-repos.
This is where it will create a clone of the public `master` spec-repo from:
https://github.com/CocoaPods/Specs
......
......@@ -285,7 +285,7 @@ module Pod
#
def prepare_pods_project
UI.message "- Creating Pods project" do
@pods_project = Pod::Project.new(sandbox)
@pods_project = Pod::Project.new(sandbox, analysis_result.all_user_build_configurations)
if config.podfile_path
@pods_project.add_podfile(config.podfile_path)
end
......
......@@ -488,6 +488,16 @@ module Pod
#
attr_accessor :targets
# @return [Hash{String=>Symbol}] A hash representing all the user build
# configurations across all integration targets. Each key
# corresponds to the name of a configuration and its value to
# its type (`:debug` or `:release`).
#
def all_user_build_configurations
targets.inject({}) do |result, target|
result.merge(target.user_build_configurations)
end
end
end
#-----------------------------------------------------------------------#
......
......@@ -17,8 +17,8 @@ module Pod
# @param [Sandbox] sandbox @see #sandbox
#
def initialize(sandbox)
super(nil) # Recreate the project from scratch for now.
def initialize(sandbox, build_configurations)
super(nil, build_configurations) # Recreate the project from scratch for now.
# TODO
raise unless sandbox.is_a?(Sandbox)
@sandbox = sandbox
......
Subproject commit e5a4609aee415fe4588fd08eb9eebe6a8b7c707c
Subproject commit fa5c727b65b4499b39d981685f93fc6369f46489
......@@ -89,7 +89,7 @@ module Pod
target.user_target_uuids.should == ["A346496C14F9BE9A0080D870"]
user_proj = Xcodeproj::Project.new(target.user_project_path)
user_proj.objects_by_uuid[target.user_target_uuids.first].name.should == 'SampleProject'
target.user_build_configurations.should == {"Test"=>:release, "App Store"=>:release}
target.user_build_configurations.should == { "Test" => :release, "App Store" => :release }
target.platform.to_s.should == 'iOS 6.0'
end
......@@ -103,6 +103,12 @@ module Pod
target.platform.to_s.should == 'iOS 6.0'
end
it "returns all the configurations the user has in any of its projects and/or targets" do
target_definition = @analyzer.podfile.target_definition_list.first
target_definition.stubs(:build_configurations).returns("AdHoc" => :test)
@analyzer.analyze.all_user_build_configurations.should == { "AdHoc" => :test, "Test" => :release, "App Store" => :release }
end
#--------------------------------------#
it "locks the version of the dependencies which did not change in the Podfile" do
......@@ -314,7 +320,6 @@ module Pod
configurations.should == { 'AppStore' => :release }
end
it "returns the user build configurations specified in the target definition" do
target_definition = Podfile::TargetDefinition.new(:default, nil)
target_definition.build_configurations = { 'AppStore' => :release }
......
......@@ -7,7 +7,7 @@ module Pod
@file_accessor = fixture_file_accessor('banana-lib/BananaLib.podspec')
@pod_target = PodTarget.new([], nil, config.sandbox)
@pod_target.file_accessors = [@file_accessor]
@project = Project.new(config.sandbox)
@project = Project.new(config.sandbox, nil)
@installer = Installer::FileReferencesInstaller.new(config.sandbox, [@pod_target], @project)
end
......
......@@ -9,7 +9,7 @@ module Pod
xcodeproj 'dummy'
end
@target_definition = @podfile.target_definitions['Pods']
@project = Project.new(config.sandbox)
@project = Project.new(config.sandbox, nil)
config.sandbox.project = @project
path_list = Sandbox::PathList.new(fixture('banana-lib'))
......
......@@ -9,7 +9,8 @@ module Pod
xcodeproj 'dummy'
end
@target_definition = @podfile.target_definitions['Pods']
@project = Project.new(config.sandbox)
user_build_configurations = { 'Debug' => :debug, 'Release' => :release, 'AppStore' => :release, 'Test' => :debug }
@project = Project.new(config.sandbox, user_build_configurations)
config.sandbox.project = @project
path_list = Sandbox::PathList.new(fixture('banana-lib'))
......@@ -19,7 +20,7 @@ module Pod
@pod_target = PodTarget.new([@spec], @target_definition, config.sandbox)
@pod_target.stubs(:platform).returns(Platform.new(:ios, '6.0'))
@pod_target.user_build_configurations = { 'Debug' => :debug, 'Release' => :release, 'AppStore' => :release, 'Test' => :debug }
@pod_target.user_build_configurations = user_build_configurations
@pod_target.file_accessors = [file_accessor]
@installer = Installer::PodTargetInstaller.new(config.sandbox, @pod_target)
......
......@@ -9,7 +9,7 @@ module Pod
xcodeproj 'dummy'
end
@target_definition = @podfile.target_definitions['Pods']
@project = Project.new(config.sandbox)
@project = Project.new(config.sandbox, nil)
config.sandbox.project = @project
path_list = Sandbox::PathList.new(fixture('banana-lib'))
......
......@@ -16,7 +16,7 @@ module Pod
end
end
config.sandbox.project = Project.new(config.sandbox)
config.sandbox.project = Project.new(config.sandbox, nil)
Xcodeproj::Project.new.save_as(config.sandbox.project_path)
@library = AggregateTarget.new(@podfile.target_definitions['Pods'], config.sandbox)
@library.client_root = sample_project_path.dirname
......
......@@ -16,7 +16,7 @@ end
def generate_podfile(pods = ['JSONKit'])
podfile = Pod::Podfile.new do
platform :ios
xcodeproj 'SampleProject/SampleProject'
xcodeproj SpecHelper.fixture('SampleProject/SampleProject'), 'Test' => :debug, 'App Store' => :release
pods.each { |name| pod name }
end
end
......@@ -112,7 +112,7 @@ module Pod
@installer.pod_targets.map(&:name).sort.should == ['Pods-JSONKit']
end
it "configures the analizer to use update mode if appropriate" do
it "configures the analyzer to use update mode if appropriate" do
@installer.update_mode = true
Installer::Analyzer.any_instance.expects(:update_mode=).with(true)
@installer.send(:analyze)
......@@ -217,14 +217,37 @@ module Pod
describe "#prepare_pods_project" do
it "creates the Pods project" do
before do
@installer.stubs(:aggregate_targets).returns([])
end
it "creates build configurations for all of the user's targets" do
config.integrate_targets = true
@installer.send(:analyze)
@installer.send(:prepare_pods_project)
@installer.pods_project.build_configurations.map(&:name).sort.should == ['App Store', 'Debug', 'Release', 'Test']
end
it "sets STRIP_INSTALLED_PRODUCT to NO for all configurations for the whole project" do
config.integrate_targets = true
@installer.send(:analyze)
@installer.send(:prepare_pods_project)
@installer.pods_project.build_settings('Debug')["STRIP_INSTALLED_PRODUCT"].should == "NO"
@installer.pods_project.build_settings('Test')["STRIP_INSTALLED_PRODUCT"].should == "NO"
@installer.pods_project.build_settings('Release')["STRIP_INSTALLED_PRODUCT"].should == "NO"
@installer.pods_project.build_settings('App Store')["STRIP_INSTALLED_PRODUCT"].should == "NO"
end
before do
@installer.stubs(:analysis_result).returns(stub(:all_user_build_configurations => {}))
end
it "creates the Pods project" do
@installer.send(:prepare_pods_project)
@installer.pods_project.class.should == Pod::Project
end
it "adds the Podfile to the Pods project" do
@installer.stubs(:aggregate_targets).returns([])
config.stubs(:podfile_path).returns(Pathname.new('/Podfile'))
@installer.send(:prepare_pods_project)
@installer.pods_project['Podfile'].should.be.not.nil
......@@ -243,6 +266,7 @@ module Pod
build_setting["IPHONEOS_DEPLOYMENT_TARGET"].should == '6.0'
end
end
end
#--------------------------------------#
......@@ -308,6 +332,7 @@ module Pod
before do
@installer.stubs(:aggregate_targets).returns([])
@installer.stubs(:analysis_result).returns(stub(:all_user_build_configurations => {}))
@installer.send(:prepare_pods_project)
end
......
......@@ -4,7 +4,7 @@ module Pod
describe Project do
before do
@project = Project.new(config.sandbox)
@project = Project.new(config.sandbox, nil)
end
#-------------------------------------------------------------------------#
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment