Commit 6cc8ec58 authored by Samuel E. Giddins's avatar Samuel E. Giddins

Merge pull request #3469 from CocoaPods/use-user-object-version-for-pods

Use user project's object version for pods project
parents 3395336a c3981ad0
......@@ -13,6 +13,10 @@ To install release candidates run `[sudo] gem install cocoapods --pre`
[Andrea Mazzini](https://github.com/andreamazz)
[#3364](https://github.com/CocoaPods/CocoaPods/issues/3364)
* Use user project's object version for pods project.
[Boris Bügling](https://github.com/neonichu)
[#253](https://github.com/CocoaPods/Xcodeproj/issues/253)
##### Bug Fixes
* Adding `$(inherited)` to `FRAMEWORK_SEARCH_PATHS` build setting in xcconfig for aggregate.
......
......@@ -24,7 +24,7 @@ GIT
GIT
remote: https://github.com/CocoaPods/Xcodeproj.git
revision: 6dbb3c73e5d0de6a2c171da0cabd90a5c4d20c09
revision: 7c37e41dafa5f6394900dab19eac9cc6580a9718
branch: master
specs:
xcodeproj (0.24.0)
......
......@@ -444,7 +444,15 @@ module Pod
#
def prepare_pods_project
UI.message '- Creating Pods project' do
@pods_project = Pod::Project.new(sandbox.project_path)
object_version = aggregate_targets.map(&:user_project_path).compact.map do |path|
Xcodeproj::Project.open(path).object_version.to_i
end.min
if object_version
@pods_project = Pod::Project.new(sandbox.project_path, false, object_version)
else
@pods_project = Pod::Project.new(sandbox.project_path)
end
analysis_result.all_user_build_configurations.each do |name, type|
@pods_project.add_build_configuration(name, type)
......
......@@ -10,9 +10,12 @@ module Pod
# @param [Pathname, String] path @see path
# @param [Bool] skip_initialization
# Whether the project should be initialized from scratch.
# @param [Int] object_version
# Object version to use for serialization, defaults to Xcode 3.2 compatible.
#
def initialize(path, skip_initialization = false)
super(path, skip_initialization)
def initialize(path, skip_initialization = false,
object_version = Xcodeproj::Constants::DEFAULT_OBJECT_VERSION)
super(path, skip_initialization, object_version)
@support_files_group = new_group('Targets Support Files')
@refs_by_absolute_path = {}
@pods = new_group('Pods')
......
......@@ -440,7 +440,11 @@ module Pod
pod_target_osx = PodTarget.new([], nil, config.sandbox)
pod_target_ios.stubs(:platform).returns(Platform.new(:ios, '6.0'))
pod_target_osx.stubs(:platform).returns(Platform.new(:osx, '10.8'))
@installer.stubs(:aggregate_targets).returns([pod_target_ios, pod_target_osx])
aggregate_target_ios = AggregateTarget.new(nil, config.sandbox)
aggregate_target_osx = AggregateTarget.new(nil, config.sandbox)
aggregate_target_ios.stubs(:platform).returns(Platform.new(:ios, '6.0'))
aggregate_target_osx.stubs(:platform).returns(Platform.new(:osx, '10.8'))
@installer.stubs(:aggregate_targets).returns([aggregate_target_ios, aggregate_target_osx])
@installer.stubs(:pod_targets).returns([])
@installer.send(:prepare_pods_project)
build_settings = @installer.pods_project.build_configurations.map(&:build_settings)
......@@ -585,6 +589,23 @@ module Pod
@installer.pods_project.expects(:save)
@installer.send(:write_pod_project)
end
it "uses the user project's object version for the pods project" do
tmp_directory = Pathname(Dir.tmpdir) + 'CocoaPods'
FileUtils.mkdir_p(tmp_directory)
proj = Xcodeproj::Project.new(tmp_directory + 'Yolo.xcodeproj', false, 1)
proj.save
aggregate_target = AggregateTarget.new(nil, config.sandbox)
aggregate_target.stubs(:platform).returns(Platform.new(:ios, '6.0'))
aggregate_target.stubs(:user_project_path).returns(proj.path)
@installer.stubs(:aggregate_targets).returns([aggregate_target])
@installer.send(:prepare_pods_project)
@installer.pods_project.object_version.should == '1'
FileUtils.rm_rf(tmp_directory)
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