Commit ea48cd48 authored by Joachim Bengtsson's avatar Joachim Bengtsson Committed by Eloy Durán

config whitelisting: fix specs I broke

Fixes all the tests that broke with API changes of cocoapods internals
related to build configuration whitelisting

Should've fixed these inline when I made the changes, but I didn't :(
parent 1e749bb8
...@@ -9,6 +9,7 @@ module Pod ...@@ -9,6 +9,7 @@ module Pod
@spec = fixture_spec('banana-lib/BananaLib.podspec') @spec = fixture_spec('banana-lib/BananaLib.podspec')
@consumer = @spec.consumer(:ios) @consumer = @spec.consumer(:ios)
target_definition = Podfile::TargetDefinition.new('Pods', nil) target_definition = Podfile::TargetDefinition.new('Pods', nil)
target_definition.whitelist_pod_for_configuration("BananaLib", "Release")
@target = AggregateTarget.new(target_definition, config.sandbox) @target = AggregateTarget.new(target_definition, config.sandbox)
@target.client_root = config.sandbox.root.dirname @target.client_root = config.sandbox.root.dirname
@target.stubs(:platform).returns(:ios) @target.stubs(:platform).returns(:ios)
...@@ -16,7 +17,7 @@ module Pod ...@@ -16,7 +17,7 @@ module Pod
@pod_target.stubs(:platform).returns(:ios) @pod_target.stubs(:platform).returns(:ios)
@pod_target.stubs(:spec_consumers).returns([@consumer]) @pod_target.stubs(:spec_consumers).returns([@consumer])
@target.pod_targets = [@pod_target] @target.pod_targets = [@pod_target]
@generator = AggregateXCConfig.new(@target) @generator = AggregateXCConfig.new(@target, "Release")
end end
it "returns the path of the pods root relative to the user project" do it "returns the path of the pods root relative to the user project" do
...@@ -73,6 +74,16 @@ module Pod ...@@ -73,6 +74,16 @@ module Pod
@xcconfig.to_hash['GCC_PREPROCESSOR_DEFINITIONS'].should.include '$(inherited)' @xcconfig.to_hash['GCC_PREPROCESSOR_DEFINITIONS'].should.include '$(inherited)'
end end
it "links the pod targets with the aggregate integration library target" do
@xcconfig.to_hash['OTHER_LDFLAGS'].should.include '-lPods-BananaLib'
end
it "does not links the pod targets with the aggregate integration library target for non-whitelisted configuration" do
@generator = AggregateXCConfig.new(@target, "Debug")
@xcconfig = @generator.generate
@xcconfig.to_hash['OTHER_LDFLAGS'].should.not.include '-lPods-BananaLib'
end
#-----------------------------------------------------------------------# #-----------------------------------------------------------------------#
before do before do
......
...@@ -48,7 +48,10 @@ module Pod ...@@ -48,7 +48,10 @@ module Pod
"Pods-dummy.m", "Pods-dummy.m",
"Pods-environment.h", "Pods-environment.h",
"Pods-resources.sh", "Pods-resources.sh",
"Pods.xcconfig" "Pods.AppStore.xcconfig",
"Pods.Debug.xcconfig",
"Pods.Release.xcconfig",
"Pods.Test.xcconfig"
] ]
end end
...@@ -114,7 +117,7 @@ module Pod ...@@ -114,7 +117,7 @@ module Pod
it "creates the xcconfig file" do it "creates the xcconfig file" do
@installer.install! @installer.install!
file = config.sandbox.root + @target.xcconfig_path file = config.sandbox.root + @target.xcconfig_path("Release")
xcconfig = Xcodeproj::Config.new(file) xcconfig = Xcodeproj::Config.new(file)
xcconfig.to_hash['PODS_ROOT'].should == '${SRCROOT}/Pods' xcconfig.to_hash['PODS_ROOT'].should == '${SRCROOT}/Pods'
end end
......
...@@ -65,8 +65,8 @@ module Pod ...@@ -65,8 +65,8 @@ module Pod
end end
it 'sets the Pods xcconfig as the base config for each build configuration' do it 'sets the Pods xcconfig as the base config for each build configuration' do
xcconfig_file = @sample_project.files.find { |f| f.path == @lib.xcconfig_relative_path }
@target.build_configurations.each do |config| @target.build_configurations.each do |config|
xcconfig_file = @sample_project.files.find { |f| f.path == @lib.xcconfig_relative_path(config) }
config.base_configuration_reference.should == xcconfig_file config.base_configuration_reference.should == xcconfig_file
end end
end end
......
...@@ -392,30 +392,6 @@ module Pod ...@@ -392,30 +392,6 @@ module Pod
describe "Integrating client projects" do describe "Integrating client projects" do
it "links the pod targets with the aggregate integration library target" do
spec = fixture_spec('banana-lib/BananaLib.podspec')
target_definition = Podfile::TargetDefinition.new('Pods', nil)
target = AggregateTarget.new(target_definition, config.sandbox)
lib_definition = Podfile::TargetDefinition.new('BananaLib', nil)
lib_definition.store_pod('BananaLib')
pod_target = PodTarget.new([spec], lib_definition, config.sandbox)
target.pod_targets = [pod_target]
project = Xcodeproj::Project.new('path')
pods_target = project.new_target(:static_library, target.name, :ios)
target.target = pods_target
native_target = project.new_target(:static_library, pod_target.name, :ios)
pod_target.target = pods_target
@installer.stubs(:pods_project).returns(project)
@installer.stubs(:aggregate_targets).returns([target])
@installer.stubs(:pod_targets).returns([pod_target])
@installer.send(:link_aggregate_target)
pods_target.frameworks_build_phase.files.map(&:file_ref).should.include?(pod_target.target.product_reference)
end
it "integrates the client projects" do it "integrates the client projects" do
@installer.stubs(:aggregate_targets).returns([AggregateTarget.new(nil, config.sandbox)]) @installer.stubs(:aggregate_targets).returns([AggregateTarget.new(nil, config.sandbox)])
Installer::UserProjectIntegrator.any_instance.expects(:integrate!) Installer::UserProjectIntegrator.any_instance.expects(:integrate!)
......
...@@ -35,7 +35,7 @@ module Pod ...@@ -35,7 +35,7 @@ module Pod
end end
it "returns the absolute path of the xcconfig file" do it "returns the absolute path of the xcconfig file" do
@target.xcconfig_path.to_s.should.include?('Pods/Pods.xcconfig') @target.xcconfig_path("Release").to_s.should.include?('Pods/Pods.Release.xcconfig')
end end
it "returns the absolute path of the resources script" do it "returns the absolute path of the resources script" do
...@@ -65,7 +65,7 @@ module Pod ...@@ -65,7 +65,7 @@ module Pod
end end
it "returns the path of the xcconfig file relative to the user project" do it "returns the path of the xcconfig file relative to the user project" do
@target.xcconfig_relative_path.should == 'Pods/Pods.xcconfig' @target.xcconfig_relative_path("Release").should == 'Pods/Pods.Release.xcconfig'
end end
end end
......
...@@ -41,7 +41,7 @@ module Pod ...@@ -41,7 +41,7 @@ module Pod
describe "Support files" do describe "Support files" do
it "returns the absolute path of the xcconfig file" do it "returns the absolute path of the xcconfig file" do
@pod_target.xcconfig_path.to_s.should.include 'Pods/Pods-BananaLib.xcconfig' @pod_target.xcconfig_path("Release").to_s.should.include 'Pods/Pods-BananaLib.Release.xcconfig'
end end
it "returns the absolute path of the target header file" do it "returns the absolute path of the target header file" do
...@@ -57,7 +57,7 @@ module Pod ...@@ -57,7 +57,7 @@ module Pod
end end
it "returns the absolute path of the public and private xcconfig files" do it "returns the absolute path of the public and private xcconfig files" do
@pod_target.xcconfig_path.to_s.should.include 'Pods/Pods-BananaLib.xcconfig' @pod_target.xcconfig_path(nil).to_s.should.include 'Pods/Pods-BananaLib.xcconfig'
@pod_target.xcconfig_private_path.to_s.should.include 'Pods/Pods-BananaLib-Private.xcconfig' @pod_target.xcconfig_private_path.to_s.should.include 'Pods/Pods-BananaLib-Private.xcconfig'
end end
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