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
###### 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
targets of the project stored in the working directory and to the templates
stored in the `~/.cocoapods/templates` folder. Tow templates are supported:
......@@ -20,7 +27,7 @@ To install or update CocoaPods see this [guide](http://docs.cocoapods.org/guides
projects. This will result in projects being serialized in the exact format
used by Xcode eliminating merge conflicts and other related issues. To learn
more about how to install xcproj see its
[readme](https://github.com/0xced/xcproj).
[readme](https://github.com/0xced/xcproj).
[Cédric Luthi](https://github.com/0xced)
[#1275](https://github.com/CocoaPods/CocoaPods/issues/1275)
......
......@@ -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