Commit 1f5d4f0e authored by Fabio Pelosin's avatar Fabio Pelosin

[Xcodeproj][Project] Remove build configurations from initialization

parent 4dcef288
...@@ -17,7 +17,7 @@ GIT ...@@ -17,7 +17,7 @@ GIT
GIT GIT
remote: https://github.com/CocoaPods/Xcodeproj.git remote: https://github.com/CocoaPods/Xcodeproj.git
revision: b1878be0ea3e2f212a2f61be089c757d13b637db revision: 5f0fc07355716817b7591a859774a93f6773d559
branch: paths-refactor branch: paths-refactor
specs: specs:
xcodeproj (0.9.0) xcodeproj (0.9.0)
......
...@@ -285,7 +285,10 @@ module Pod ...@@ -285,7 +285,10 @@ 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, analysis_result.all_user_build_configurations) @pods_project = Pod::Project.new(sandbox)
analysis_result.all_user_build_configurations.each do |name, type|
@pods_project.add_build_configuration(name, type)
end
if config.podfile_path if config.podfile_path
@pods_project.add_podfile(config.podfile_path) @pods_project.add_podfile(config.podfile_path)
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, build_configurations) def initialize(sandbox)
super(sandbox.project_path, build_configurations) # Recreate the project from scratch for now. super(sandbox.project_path) # 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
......
...@@ -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, nil) @project = Project.new(config.sandbox)
@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, nil) @project = Project.new(config.sandbox)
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,8 +9,7 @@ module Pod ...@@ -9,8 +9,7 @@ module Pod
xcodeproj 'dummy' xcodeproj 'dummy'
end end
@target_definition = @podfile.target_definitions['Pods'] @target_definition = @podfile.target_definitions['Pods']
user_build_configurations = { 'Debug' => :debug, 'Release' => :release, 'AppStore' => :release, 'Test' => :debug } @project = Project.new(config.sandbox)
@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'))
...@@ -20,9 +19,8 @@ module Pod ...@@ -20,9 +19,8 @@ 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 = user_build_configurations
@pod_target.file_accessors = [file_accessor] @pod_target.file_accessors = [file_accessor]
@pod_target.user_build_configurations = { 'Debug' => :debug, 'Release' => :release }
@installer = Installer::PodTargetInstaller.new(config.sandbox, @pod_target) @installer = Installer::PodTargetInstaller.new(config.sandbox, @pod_target)
@spec.prefix_header_contents = '#import "BlocksKit.h"' @spec.prefix_header_contents = '#import "BlocksKit.h"'
...@@ -48,13 +46,6 @@ module Pod ...@@ -48,13 +46,6 @@ module Pod
@project.targets.first.name.should == 'Pods-BananaLib' @project.targets.first.name.should == 'Pods-BananaLib'
end end
it "adds the user build configurations to the target" do
@installer.install!
target = @project.targets.first
target.build_settings('Test')["VALIDATE_PRODUCT"].should == nil
target.build_settings('AppStore')["VALIDATE_PRODUCT"].should == "YES"
end
it "sets VALIDATE_PRODUCT to YES for the Release configuration for iOS targets" do it "sets VALIDATE_PRODUCT to YES for the Release configuration for iOS targets" do
@installer.install! @installer.install!
target = @project.targets.first target = @project.targets.first
...@@ -67,7 +58,6 @@ module Pod ...@@ -67,7 +58,6 @@ module Pod
target.platform_name.should == :ios target.platform_name.should == :ios
target.deployment_target.should == "6.0" target.deployment_target.should == "6.0"
target.build_settings('Debug')["IPHONEOS_DEPLOYMENT_TARGET"].should == "6.0" target.build_settings('Debug')["IPHONEOS_DEPLOYMENT_TARGET"].should == "6.0"
target.build_settings('AppStore')["IPHONEOS_DEPLOYMENT_TARGET"].should == "6.0"
end end
it "sets the platform and the deployment target for OS X targets" do it "sets the platform and the deployment target for OS X targets" do
...@@ -77,10 +67,10 @@ module Pod ...@@ -77,10 +67,10 @@ module Pod
target.platform_name.should == :osx target.platform_name.should == :osx
target.deployment_target.should == "10.8" target.deployment_target.should == "10.8"
target.build_settings('Debug')["MACOSX_DEPLOYMENT_TARGET"].should == "10.8" target.build_settings('Debug')["MACOSX_DEPLOYMENT_TARGET"].should == "10.8"
target.build_settings('AppStore')["MACOSX_DEPLOYMENT_TARGET"].should == "10.8"
end end
it "adds the user's build configurations to the target" do it "adds the user's build configurations to the target" do
@pod_target.user_build_configurations.merge!({ 'AppStore' => :release, 'Test' => :debug })
@installer.install! @installer.install!
@project.targets.first.build_configurations.map(&:name).sort.should == %w{ AppStore Debug Release Test } @project.targets.first.build_configurations.map(&:name).sort.should == %w{ AppStore Debug Release Test }
end end
...@@ -88,7 +78,7 @@ module Pod ...@@ -88,7 +78,7 @@ module Pod
it "it creates different hash instances for the build settings of various build configurations" do it "it creates different hash instances for the build settings of various build configurations" do
@installer.install! @installer.install!
build_settings = @project.targets.first.build_configurations.map(&:build_settings) build_settings = @project.targets.first.build_configurations.map(&:build_settings)
build_settings.map(&:object_id).uniq.count.should == 4 build_settings.map(&:object_id).uniq.count.should == 2
end end
it "does not enable the GCC_WARN_INHIBIT_ALL_WARNINGS flag by default" do it "does not enable the GCC_WARN_INHIBIT_ALL_WARNINGS flag by default" do
......
...@@ -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, nil) @project = Project.new(config.sandbox)
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, nil) config.sandbox.project = Project.new(config.sandbox)
Xcodeproj::Project.new(config.sandbox.project_path).save Xcodeproj::Project.new(config.sandbox.project_path).save
@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
......
...@@ -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, nil) @project = Project.new(config.sandbox)
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