Commit c95e3cf4 authored by Fabio Pelosin's avatar Fabio Pelosin

Merge branch 'master' into pod-init

* master:
  Update CHANGELOG for #1294
  [rake] Welcome to the real world, where envs don’t automagically work.
  [Installer] Add all the user's build configurations to the Pods project.
  [Analyzer] Resolve all user build configurations.
  Misc small changes.
  Rebuild integration specs.
  Update Xcodeproj to the latest master revision
  Use the build configurations from the Podfile for the Pods project
  Add test for STRIP_INSTALLED_PRODUCT = NO at project level
  Fix all callers of Pod::Project.new()
  Handle the build_configurations parameter in Xcodeproj::Project subclasses
  Pass the user build configurations to the Pods project
parents 3feeaf38 65e7a399
...@@ -6,6 +6,13 @@ To install or update CocoaPods see this [guide](http://docs.cocoapods.org/guides ...@@ -6,6 +6,13 @@ To install or update CocoaPods see this [guide](http://docs.cocoapods.org/guides
###### Enhancements ###### Enhancements
* Create all necessary build configurations for *Pods.xcodeproj* at the project level. If the user’s project has more than just *Debug* and *Release* build configurations, they may be explicitly specified in the Podfile:
`xcodeproj 'MyApp', 'App Store' => :release, 'Debug' => :debug, 'Release' => :release`
If build configurations aren’t specified in the Podfile then they will be automatically picked from the user’s project in *Release* mode.
These changes will ensure that the `libPods.a` static library is not stripped for all configurations, as explained in [#1217](https://github.com/CocoaPods/CocoaPods/pull/1217).
[Cédric Luthi](https://github.com/0xced)
[#1294](https://github.com/CocoaPods/CocoaPods/issues/1294)
* Added `pod init` command which generates a Podfile according to the * Added `pod init` command which generates a Podfile according to the
targets of the project stored in the working directory and to the templates targets of the project stored in the working directory and to the templates
stored in the `~/.cocoapods/templates` folder. Tow templates are supported: stored in the `~/.cocoapods/templates` folder. Tow templates are supported:
......
...@@ -220,6 +220,7 @@ namespace :spec do ...@@ -220,6 +220,7 @@ namespace :spec do
title 'Running the specs' title 'Running the specs'
sh "bundle exec bacon #{specs('**')}" sh "bundle exec bacon #{specs('**')}"
require 'pathname'
unless Pathname.new(ENV['HOME']+'/.cocoapods/repos/master').exist? unless Pathname.new(ENV['HOME']+'/.cocoapods/repos/master').exist?
title 'Ensuring specs repo is up to date' title 'Ensuring specs repo is up to date'
sh "./bin/pod setup" sh "./bin/pod setup"
...@@ -343,7 +344,8 @@ namespace :examples do ...@@ -343,7 +344,8 @@ namespace :examples do
Dir.chdir(example.to_s) do Dir.chdir(example.to_s) do
execute_command "rm -rf Pods DerivedData" execute_command "rm -rf Pods DerivedData"
# WARNING: This appeart to use sytem gems instead of the bundle ones. # 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}'" command = "xcodebuild -workspace '#{example.basename}.xcworkspace' -scheme '#{example.basename}'"
if (example + 'Podfile').read.include?('platform :ios') if (example + 'Podfile').read.include?('platform :ios')
# Specifically build against the simulator SDK so we don't have to deal with code signing. # Specifically build against the simulator SDK so we don't have to deal with code signing.
......
...@@ -6,7 +6,7 @@ module Pod ...@@ -6,7 +6,7 @@ module Pod
self.summary = 'Setup the CocoaPods environment' self.summary = 'Setup the CocoaPods environment'
self.description = <<-DESC 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: This is where it will create a clone of the public `master` spec-repo from:
https://github.com/CocoaPods/Specs https://github.com/CocoaPods/Specs
......
...@@ -285,7 +285,7 @@ module Pod ...@@ -285,7 +285,7 @@ module Pod
# #
def prepare_pods_project def prepare_pods_project
UI.message "- Creating Pods project" do 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 if config.podfile_path
@pods_project.add_podfile(config.podfile_path) @pods_project.add_podfile(config.podfile_path)
end end
......
...@@ -488,6 +488,16 @@ module Pod ...@@ -488,6 +488,16 @@ module Pod
# #
attr_accessor :targets 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 end
#-----------------------------------------------------------------------# #-----------------------------------------------------------------------#
......
...@@ -17,8 +17,8 @@ module Pod ...@@ -17,8 +17,8 @@ module Pod
# @param [Sandbox] sandbox @see #sandbox # @param [Sandbox] sandbox @see #sandbox
# #
def initialize(sandbox) def initialize(sandbox, build_configurations)
super(nil) # Recreate the project from scratch for now. super(nil, build_configurations) # Recreate the project from scratch for now.
# TODO # TODO
raise unless sandbox.is_a?(Sandbox) raise unless sandbox.is_a?(Sandbox)
@sandbox = sandbox @sandbox = sandbox
......
Subproject commit e5a4609aee415fe4588fd08eb9eebe6a8b7c707c Subproject commit fa5c727b65b4499b39d981685f93fc6369f46489
...@@ -89,7 +89,7 @@ module Pod ...@@ -89,7 +89,7 @@ module Pod
target.user_target_uuids.should == ["A346496C14F9BE9A0080D870"] target.user_target_uuids.should == ["A346496C14F9BE9A0080D870"]
user_proj = Xcodeproj::Project.new(target.user_project_path) user_proj = Xcodeproj::Project.new(target.user_project_path)
user_proj.objects_by_uuid[target.user_target_uuids.first].name.should == 'SampleProject' 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' target.platform.to_s.should == 'iOS 6.0'
end end
...@@ -103,6 +103,12 @@ module Pod ...@@ -103,6 +103,12 @@ module Pod
target.platform.to_s.should == 'iOS 6.0' target.platform.to_s.should == 'iOS 6.0'
end 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 it "locks the version of the dependencies which did not change in the Podfile" do
...@@ -314,7 +320,6 @@ module Pod ...@@ -314,7 +320,6 @@ module Pod
configurations.should == { 'AppStore' => :release } configurations.should == { 'AppStore' => :release }
end end
it "returns the user build configurations specified in the target definition" do it "returns the user build configurations specified in the target definition" do
target_definition = Podfile::TargetDefinition.new(:default, nil) target_definition = Podfile::TargetDefinition.new(:default, nil)
target_definition.build_configurations = { 'AppStore' => :release } target_definition.build_configurations = { 'AppStore' => :release }
......
...@@ -7,7 +7,7 @@ module Pod ...@@ -7,7 +7,7 @@ module Pod
@file_accessor = fixture_file_accessor('banana-lib/BananaLib.podspec') @file_accessor = fixture_file_accessor('banana-lib/BananaLib.podspec')
@pod_target = PodTarget.new([], nil, config.sandbox) @pod_target = PodTarget.new([], nil, config.sandbox)
@pod_target.file_accessors = [@file_accessor] @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) @installer = Installer::FileReferencesInstaller.new(config.sandbox, [@pod_target], @project)
end end
......
...@@ -9,7 +9,7 @@ module Pod ...@@ -9,7 +9,7 @@ module Pod
xcodeproj 'dummy' xcodeproj 'dummy'
end end
@target_definition = @podfile.target_definitions['Pods'] @target_definition = @podfile.target_definitions['Pods']
@project = Project.new(config.sandbox) @project = Project.new(config.sandbox, nil)
config.sandbox.project = @project config.sandbox.project = @project
path_list = Sandbox::PathList.new(fixture('banana-lib')) path_list = Sandbox::PathList.new(fixture('banana-lib'))
......
...@@ -9,7 +9,8 @@ module Pod ...@@ -9,7 +9,8 @@ module Pod
xcodeproj 'dummy' xcodeproj 'dummy'
end end
@target_definition = @podfile.target_definitions['Pods'] @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 config.sandbox.project = @project
path_list = Sandbox::PathList.new(fixture('banana-lib')) path_list = Sandbox::PathList.new(fixture('banana-lib'))
...@@ -19,7 +20,7 @@ module Pod ...@@ -19,7 +20,7 @@ module Pod
@pod_target = PodTarget.new([@spec], @target_definition, config.sandbox) @pod_target = PodTarget.new([@spec], @target_definition, config.sandbox)
@pod_target.stubs(:platform).returns(Platform.new(:ios, '6.0')) @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] @pod_target.file_accessors = [file_accessor]
@installer = Installer::PodTargetInstaller.new(config.sandbox, @pod_target) @installer = Installer::PodTargetInstaller.new(config.sandbox, @pod_target)
......
...@@ -9,7 +9,7 @@ module Pod ...@@ -9,7 +9,7 @@ module Pod
xcodeproj 'dummy' xcodeproj 'dummy'
end end
@target_definition = @podfile.target_definitions['Pods'] @target_definition = @podfile.target_definitions['Pods']
@project = Project.new(config.sandbox) @project = Project.new(config.sandbox, nil)
config.sandbox.project = @project config.sandbox.project = @project
path_list = Sandbox::PathList.new(fixture('banana-lib')) path_list = Sandbox::PathList.new(fixture('banana-lib'))
......
...@@ -16,7 +16,7 @@ module Pod ...@@ -16,7 +16,7 @@ module Pod
end end
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) Xcodeproj::Project.new.save_as(config.sandbox.project_path)
@library = AggregateTarget.new(@podfile.target_definitions['Pods'], config.sandbox) @library = AggregateTarget.new(@podfile.target_definitions['Pods'], config.sandbox)
@library.client_root = sample_project_path.dirname @library.client_root = sample_project_path.dirname
......
...@@ -16,7 +16,7 @@ end ...@@ -16,7 +16,7 @@ end
def generate_podfile(pods = ['JSONKit']) def generate_podfile(pods = ['JSONKit'])
podfile = Pod::Podfile.new do podfile = Pod::Podfile.new do
platform :ios platform :ios
xcodeproj 'SampleProject/SampleProject' xcodeproj SpecHelper.fixture('SampleProject/SampleProject'), 'Test' => :debug, 'App Store' => :release
pods.each { |name| pod name } pods.each { |name| pod name }
end end
end end
...@@ -112,7 +112,7 @@ module Pod ...@@ -112,7 +112,7 @@ module Pod
@installer.pod_targets.map(&:name).sort.should == ['Pods-JSONKit'] @installer.pod_targets.map(&:name).sort.should == ['Pods-JSONKit']
end 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.update_mode = true
Installer::Analyzer.any_instance.expects(:update_mode=).with(true) Installer::Analyzer.any_instance.expects(:update_mode=).with(true)
@installer.send(:analyze) @installer.send(:analyze)
...@@ -217,14 +217,37 @@ module Pod ...@@ -217,14 +217,37 @@ module Pod
describe "#prepare_pods_project" do describe "#prepare_pods_project" do
it "creates the Pods project" do before do
@installer.stubs(:aggregate_targets).returns([]) @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.send(:prepare_pods_project)
@installer.pods_project.class.should == Pod::Project @installer.pods_project.class.should == Pod::Project
end end
it "adds the Podfile to the Pods project" do it "adds the Podfile to the Pods project" do
@installer.stubs(:aggregate_targets).returns([])
config.stubs(:podfile_path).returns(Pathname.new('/Podfile')) config.stubs(:podfile_path).returns(Pathname.new('/Podfile'))
@installer.send(:prepare_pods_project) @installer.send(:prepare_pods_project)
@installer.pods_project['Podfile'].should.be.not.nil @installer.pods_project['Podfile'].should.be.not.nil
...@@ -243,6 +266,7 @@ module Pod ...@@ -243,6 +266,7 @@ module Pod
build_setting["IPHONEOS_DEPLOYMENT_TARGET"].should == '6.0' build_setting["IPHONEOS_DEPLOYMENT_TARGET"].should == '6.0'
end end
end end
end end
#--------------------------------------# #--------------------------------------#
...@@ -308,6 +332,7 @@ module Pod ...@@ -308,6 +332,7 @@ module Pod
before do before do
@installer.stubs(:aggregate_targets).returns([]) @installer.stubs(:aggregate_targets).returns([])
@installer.stubs(:analysis_result).returns(stub(:all_user_build_configurations => {}))
@installer.send(:prepare_pods_project) @installer.send(:prepare_pods_project)
end end
......
...@@ -4,7 +4,7 @@ module Pod ...@@ -4,7 +4,7 @@ module Pod
describe Project do describe Project do
before do before do
@project = Project.new(config.sandbox) @project = Project.new(config.sandbox, nil)
end 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