Commit 6e4ee6e7 authored by Luke Redpath's avatar Luke Redpath

Fixes for the latest version of xcodeproj

parent ce8650bb
...@@ -78,8 +78,8 @@ _before_ it’s written to disk. [[docs][3]] ...@@ -78,8 +78,8 @@ _before_ it’s written to disk. [[docs][3]]
# Enable garbage collection support for MacRuby applications. # Enable garbage collection support for MacRuby applications.
post_install do |installer| post_install do |installer|
installer.project.targets.each do |target| installer.project.targets.each do |target|
target.buildConfigurations.each do |config| target.build_configurations.each do |config|
config.buildSettings['GCC_ENABLE_OBJC_GC'] = 'supported' config.build_settings['GCC_ENABLE_OBJC_GC'] = 'supported'
end end
end end
end end
......
...@@ -16,8 +16,8 @@ end ...@@ -16,8 +16,8 @@ end
# Enable garbage collection support, which MacRuby requires. # Enable garbage collection support, which MacRuby requires.
post_install do |installer| post_install do |installer|
installer.project.targets.each do |target| installer.project.targets.each do |target|
target.buildConfigurations.each do |config| target.build_configurations.each do |config|
config.buildSettings['GCC_ENABLE_OBJC_GC'] = 'supported' config.build_settings['GCC_ENABLE_OBJC_GC'] = 'supported'
end end
end end
end end
module Pod
class DependencyInstaller
def initialize(sandbox)
@sandbox = sandbox
end
def install(dependency)
end
end
end
...@@ -83,11 +83,11 @@ module Pod ...@@ -83,11 +83,11 @@ module Pod
end end
def configure_build_configurations(xcconfig_file) def configure_build_configurations(xcconfig_file)
@target.buildConfigurations.each do |config| @target.build_configurations.each do |config|
config.baseConfiguration = xcconfig_file config.baseConfiguration = xcconfig_file
config.buildSettings['OTHER_LDFLAGS'] = '' config.build_settings['OTHER_LDFLAGS'] = ''
config.buildSettings['GCC_PREFIX_HEADER'] = prefix_header_filename config.build_settings['GCC_PREFIX_HEADER'] = prefix_header_filename
config.buildSettings['PODS_ROOT'] = '$(SRCROOT)' config.build_settings['PODS_ROOT'] = '$(SRCROOT)'
end end
end end
......
...@@ -206,8 +206,8 @@ module Pod ...@@ -206,8 +206,8 @@ module Pod
# #
# post_install do |installer| # post_install do |installer|
# installer.project.targets.each do |target| # installer.project.targets.each do |target|
# target.buildConfigurations.each do |config| # target.build_configurations.each do |config|
# config.buildSettings['GCC_ENABLE_OBJC_GC'] = 'supported' # config.build_settings['GCC_ENABLE_OBJC_GC'] = 'supported'
# end # end
# end # end
# end # end
......
...@@ -22,9 +22,13 @@ module Pod ...@@ -22,9 +22,13 @@ module Pod
pods.groups.new('name' => name) pods.groups.new('name' => name)
end end
def build_configuration_list
objects[root_object.attributes['buildConfigurationList']]
end
# Shortcut access to build configurations # Shortcut access to build configurations
def build_configurations def build_configurations
objects[root_object.attributes['buildConfigurationList']].buildConfigurations build_configuration_list.build_configurations
end end
def build_configuration(name) def build_configuration(name)
...@@ -32,7 +36,7 @@ module Pod ...@@ -32,7 +36,7 @@ module Pod
end end
def self.for_platform(platform) def self.for_platform(platform)
project = Pod::Project.new Pod::Project.new.tap do |project|
project.main_group << project.groups.new({ 'name' => 'Pods' }) project.main_group << project.groups.new({ 'name' => 'Pods' })
framework = project.add_system_framework(platform == :ios ? 'Foundation' : 'Cocoa') framework = project.add_system_framework(platform == :ios ? 'Foundation' : 'Cocoa')
framework.group = project.groups.new({ 'name' => 'Frameworks' }) framework.group = project.groups.new({ 'name' => 'Frameworks' })
...@@ -41,21 +45,23 @@ module Pod ...@@ -41,21 +45,23 @@ module Pod
project.main_group << products project.main_group << products
project.root_object.products = products project.root_object.products = products
project.root_object.attributes['buildConfigurationList'] = project.objects.add(Xcodeproj::Project::Object::XCConfigurationList, { configuration_list = project.objects.add(Xcodeproj::Project::Object::XCConfigurationList, {
'defaultConfigurationIsVisible' => '0', 'defaultConfigurationIsVisible' => '0',
'defaultConfigurationName' => 'Release', 'defaultConfigurationName' => 'Release',
'buildConfigurations' => [ })
project.objects.add(Xcodeproj::Project::Object::XCBuildConfiguration, {
config = configuration_list.build_configurations.new(
'name' => 'Debug', 'name' => 'Debug',
'buildSettings' => build_settings(platform, :debug) 'buildSettings' => build_settings(platform, :debug)
}), )
project.objects.add(Xcodeproj::Project::Object::XCBuildConfiguration, {
configuration_list.build_configurations.new(
'name' => 'Release', 'name' => 'Release',
'buildSettings' => build_settings(platform, :release) 'buildSettings' => build_settings(platform, :release)
}) )
].map(&:uuid)
}).uuid project.root_object.attributes['buildConfigurationList'] = configuration_list.uuid
project end
end end
private private
...@@ -69,20 +75,20 @@ module Pod ...@@ -69,20 +75,20 @@ module Pod
'GCC_WARN_ABOUT_RETURN_TYPE' => 'YES', 'GCC_WARN_ABOUT_RETURN_TYPE' => 'YES',
'GCC_WARN_UNUSED_VARIABLE' => 'YES', 'GCC_WARN_UNUSED_VARIABLE' => 'YES',
'OTHER_LDFLAGS' => '' 'OTHER_LDFLAGS' => ''
}, }.freeze,
:debug => { :debug => {
'GCC_DYNAMIC_NO_PIC' => 'NO', 'GCC_DYNAMIC_NO_PIC' => 'NO',
'GCC_PREPROCESSOR_DEFINITIONS' => ["DEBUG=1", "$(inherited)"], 'GCC_PREPROCESSOR_DEFINITIONS' => ["DEBUG=1", "$(inherited)"],
'GCC_SYMBOLS_PRIVATE_EXTERN' => 'NO', 'GCC_SYMBOLS_PRIVATE_EXTERN' => 'NO',
'GCC_OPTIMIZATION_LEVEL' => '0' 'GCC_OPTIMIZATION_LEVEL' => '0'
}, }.freeze,
:ios => { :ios => {
'ARCHS' => "$(ARCHS_STANDARD_32_BIT)", 'ARCHS' => "$(ARCHS_STANDARD_32_BIT)",
'GCC_VERSION' => 'com.apple.compilers.llvmgcc42', 'GCC_VERSION' => 'com.apple.compilers.llvmgcc42',
'IPHONEOS_DEPLOYMENT_TARGET' => '4.3', 'IPHONEOS_DEPLOYMENT_TARGET' => '4.3',
'PUBLIC_HEADERS_FOLDER_PATH' => "$(TARGET_NAME)", 'PUBLIC_HEADERS_FOLDER_PATH' => "$(TARGET_NAME)",
'SDKROOT' => 'iphoneos' 'SDKROOT' => 'iphoneos'
}, }.freeze,
:osx => { :osx => {
'ARCHS' => "$(ARCHS_STANDARD_64_BIT)", 'ARCHS' => "$(ARCHS_STANDARD_64_BIT)",
'GCC_ENABLE_OBJC_EXCEPTIONS' => 'YES', 'GCC_ENABLE_OBJC_EXCEPTIONS' => 'YES',
...@@ -90,12 +96,15 @@ module Pod ...@@ -90,12 +96,15 @@ module Pod
'GCC_VERSION' => 'com.apple.compilers.llvm.clang.1_0', 'GCC_VERSION' => 'com.apple.compilers.llvm.clang.1_0',
'MACOSX_DEPLOYMENT_TARGET' => '10.7', 'MACOSX_DEPLOYMENT_TARGET' => '10.7',
'SDKROOT' => 'macosx' 'SDKROOT' => 'macosx'
} }.freeze
} }.freeze
def self.build_settings(platform, scheme) def self.build_settings(platform, scheme)
settings = COMMON_BUILD_SETTINGS[:all].merge(COMMON_BUILD_SETTINGS[platform.name]) COMMON_BUILD_SETTINGS[:all].dup.tap do |settings|
settings.merge!(COMMON_BUILD_SETTINGS[platform.name])
settings['COPY_PHASE_STRIP'] = scheme == :debug ? 'NO' : 'YES' settings['COPY_PHASE_STRIP'] = scheme == :debug ? 'NO' : 'YES'
if platform.requires_legacy_ios_archs? if platform.requires_legacy_ios_archs?
settings['ARCHS'] = "armv6 armv7" settings['ARCHS'] = "armv6 armv7"
end end
...@@ -109,7 +118,7 @@ module Pod ...@@ -109,7 +118,7 @@ module Pod
settings['VALIDATE_PRODUCT'] = 'YES' if platform == :ios settings['VALIDATE_PRODUCT'] = 'YES' if platform == :ios
settings['DEBUG_INFORMATION_FORMAT'] = "dwarf-with-dsym" if platform == :osx settings['DEBUG_INFORMATION_FORMAT'] = "dwarf-with-dsym" if platform == :osx
end end
settings end
end end
end end
end end
...@@ -67,7 +67,7 @@ module Pod ...@@ -67,7 +67,7 @@ module Pod
def base_project_configurations_on_xcconfig(project, xcconfig_file) def base_project_configurations_on_xcconfig(project, xcconfig_file)
project.targets.each do |target| project.targets.each do |target|
target.buildConfigurations.each do |config| target.build_configurations.each do |config|
config.baseConfiguration = xcconfig_file config.baseConfiguration = xcconfig_file
end end
end end
...@@ -82,7 +82,7 @@ module Pod ...@@ -82,7 +82,7 @@ module Pod
end end
def add_copy_resources_script_phase_to_each_target_in_project(project, copy_resources_script_phase) def add_copy_resources_script_phase_to_each_target_in_project(project, copy_resources_script_phase)
project.targets.each { |target| target.buildPhases << copy_resources_script_phase } project.targets.each { |target| target.build_phases << copy_resources_script_phase }
end end
end end
end end
......
...@@ -31,7 +31,7 @@ describe Pod::ProjectIntegration do ...@@ -31,7 +31,7 @@ describe Pod::ProjectIntegration do
xcconfig_file = @sample_project.files.where(:path => "Pods/Pods.xcconfig") xcconfig_file = @sample_project.files.where(:path => "Pods/Pods.xcconfig")
@sample_project.targets.each do |target| @sample_project.targets.each do |target|
target.buildConfigurations.each do |config| target.build_configurations.each do |config|
config.baseConfiguration.should == xcconfig_file config.baseConfiguration.should == xcconfig_file
end end
end end
......
...@@ -136,16 +136,16 @@ else ...@@ -136,16 +136,16 @@ else
post_install do |installer| post_install do |installer|
target = installer.project.targets.first target = installer.project.targets.first
target.buildConfigurations.each do |config| target.build_configurations.each do |config|
config.buildSettings['GCC_ENABLE_OBJC_GC'] = 'supported' config.build_settings['GCC_ENABLE_OBJC_GC'] = 'supported'
end end
end end
end end
SpecHelper::Installer.new(podfile).install! SpecHelper::Installer.new(podfile).install!
project = Pod::Project.new(config.project_pods_root + 'Pods.xcodeproj') project = Pod::Project.new(config.project_pods_root + 'Pods.xcodeproj')
project.targets.first.buildConfigurations.map do |config| project.targets.first.build_configurations.map do |config|
config.buildSettings['GCC_ENABLE_OBJC_GC'] config.build_settings['GCC_ENABLE_OBJC_GC']
end.should == %w{ supported supported } end.should == %w{ supported supported }
end end
...@@ -325,7 +325,7 @@ else ...@@ -325,7 +325,7 @@ else
project = Pod::Project.new(projpath) project = Pod::Project.new(projpath)
libPods = project.files.find { |f| f.name == 'libPods.a' } libPods = project.files.find { |f| f.name == 'libPods.a' }
project.targets.each do |target| project.targets.each do |target|
target.buildConfigurations.each do |config| target.build_configurations.each do |config|
config.baseConfiguration.path.should == 'Pods/Pods.xcconfig' config.baseConfiguration.path.should == 'Pods/Pods.xcconfig'
end end
...@@ -333,7 +333,7 @@ else ...@@ -333,7 +333,7 @@ else
phase.files.map { |buildFile| buildFile.file }.should.include libPods phase.files.map { |buildFile| buildFile.file }.should.include libPods
# should be the last phase # should be the last phase
target.buildPhases.last.shellScript.should == %{"${SRCROOT}/Pods/Pods-resources.sh"\n} target.build_phases.last.shellScript.should == %{"${SRCROOT}/Pods/Pods-resources.sh"\n}
end end
end end
......
...@@ -13,7 +13,7 @@ describe 'Pod::Project' do ...@@ -13,7 +13,7 @@ describe 'Pod::Project' do
it "adds a group to the `Pods' group" do it "adds a group to the `Pods' group" do
group = @project.add_pod_group('JSONKit') group = @project.add_pod_group('JSONKit')
@project.pods.childReferences.should.include group.uuid @project.pods.child_references.should.include group.uuid
find_object({ find_object({
'isa' => 'PBXGroup', 'isa' => 'PBXGroup',
'name' => 'JSONKit', 'name' => 'JSONKit',
...@@ -30,7 +30,7 @@ describe 'Pod::Project' do ...@@ -30,7 +30,7 @@ describe 'Pod::Project' do
'dstPath' => 'Pods/Path/To/Source', 'dstPath' => 'Pods/Path/To/Source',
'name' => 'Copy SomePod Public Headers' 'name' => 'Copy SomePod Public Headers'
}).should.not == nil }).should.not == nil
@project.targets.first.buildPhases.should.include phase @project.targets.first.build_phases.should.include phase
end end
shared "for any platform" do shared "for any platform" do
...@@ -48,43 +48,43 @@ describe 'Pod::Project' do ...@@ -48,43 +48,43 @@ describe 'Pod::Project' do
behaves_like "for any platform" behaves_like "for any platform"
it "sets VALIDATE_PRODUCT to YES for the Release configuration" do it "sets VALIDATE_PRODUCT to YES for the Release configuration" do
@project.build_configuration("Release").buildSettings["VALIDATE_PRODUCT"].should == "YES" @project.build_configuration("Release").build_settings["VALIDATE_PRODUCT"].should == "YES"
end end
end end
describe "for the :ios platform with a deployment target" do describe "for the :ios platform with a deployment target" do
it "sets ARCHS to 'armv6 armv7' for both configurations if the deployment target is less than 4.3" do it "sets ARCHS to 'armv6 armv7' for both configurations if the deployment target is less than 4.3" do
@project = Pod::Project.for_platform(Pod::Platform.new(:ios, :deployment_target => "4.0")) @project = Pod::Project.for_platform(Pod::Platform.new(:ios, :deployment_target => "4.0"))
@project.build_configuration("Debug").buildSettings["ARCHS"].should == "armv6 armv7" @project.build_configuration("Debug").build_settings["ARCHS"].should == "armv6 armv7"
@project.build_configuration("Release").buildSettings["ARCHS"].should == "armv6 armv7" @project.build_configuration("Release").build_settings["ARCHS"].should == "armv6 armv7"
@project = Pod::Project.for_platform(Pod::Platform.new(:ios, :deployment_target => "4.1")) @project = Pod::Project.for_platform(Pod::Platform.new(:ios, :deployment_target => "4.1"))
@project.build_configuration("Debug").buildSettings["ARCHS"].should == "armv6 armv7" @project.build_configuration("Debug").build_settings["ARCHS"].should == "armv6 armv7"
@project.build_configuration("Release").buildSettings["ARCHS"].should == "armv6 armv7" @project.build_configuration("Release").build_settings["ARCHS"].should == "armv6 armv7"
@project = Pod::Project.for_platform(Pod::Platform.new(:ios, :deployment_target => "4.2")) @project = Pod::Project.for_platform(Pod::Platform.new(:ios, :deployment_target => "4.2"))
@project.build_configuration("Debug").buildSettings["ARCHS"].should == "armv6 armv7" @project.build_configuration("Debug").build_settings["ARCHS"].should == "armv6 armv7"
@project.build_configuration("Release").buildSettings["ARCHS"].should == "armv6 armv7" @project.build_configuration("Release").build_settings["ARCHS"].should == "armv6 armv7"
end end
it "uses standard ARCHs if deployment target is 4.3 or above" do it "uses standard ARCHs if deployment target is 4.3 or above" do
@project = Pod::Project.for_platform(Pod::Platform.new(:ios, :deployment_target => "4.3")) @project = Pod::Project.for_platform(Pod::Platform.new(:ios, :deployment_target => "4.3"))
@project.build_configuration("Debug").buildSettings["ARCHS"].should == "$(ARCHS_STANDARD_32_BIT)" @project.build_configuration("Debug").build_settings["ARCHS"].should == "$(ARCHS_STANDARD_32_BIT)"
@project.build_configuration("Release").buildSettings["ARCHS"].should == "$(ARCHS_STANDARD_32_BIT)" @project.build_configuration("Release").build_settings["ARCHS"].should == "$(ARCHS_STANDARD_32_BIT)"
@project = Pod::Project.for_platform(Pod::Platform.new(:ios, :deployment_target => "4.4")) @project = Pod::Project.for_platform(Pod::Platform.new(:ios, :deployment_target => "4.4"))
@project.build_configuration("Debug").buildSettings["ARCHS"].should == "$(ARCHS_STANDARD_32_BIT)" @project.build_configuration("Debug").build_settings["ARCHS"].should == "$(ARCHS_STANDARD_32_BIT)"
@project.build_configuration("Release").buildSettings["ARCHS"].should == "$(ARCHS_STANDARD_32_BIT)" @project.build_configuration("Release").build_settings["ARCHS"].should == "$(ARCHS_STANDARD_32_BIT)"
end end
it "sets IPHONEOS_DEPLOYMENT_TARGET for both configurations" do it "sets IPHONEOS_DEPLOYMENT_TARGET for both configurations" do
@project = Pod::Project.for_platform(Pod::Platform.new(:ios)) @project = Pod::Project.for_platform(Pod::Platform.new(:ios))
@project.build_configuration("Debug").buildSettings["IPHONEOS_DEPLOYMENT_TARGET"].should == "4.3" @project.build_configuration("Debug").build_settings["IPHONEOS_DEPLOYMENT_TARGET"].should == "4.3"
@project.build_configuration("Release").buildSettings["IPHONEOS_DEPLOYMENT_TARGET"].should == "4.3" @project.build_configuration("Release").build_settings["IPHONEOS_DEPLOYMENT_TARGET"].should == "4.3"
@project = Pod::Project.for_platform(Pod::Platform.new(:ios, :deployment_target => "4.0")) @project = Pod::Project.for_platform(Pod::Platform.new(:ios, :deployment_target => "4.0"))
@project.build_configuration("Debug").buildSettings["IPHONEOS_DEPLOYMENT_TARGET"].should == "4.0" @project.build_configuration("Debug").build_settings["IPHONEOS_DEPLOYMENT_TARGET"].should == "4.0"
@project.build_configuration("Release").buildSettings["IPHONEOS_DEPLOYMENT_TARGET"].should == "4.0" @project.build_configuration("Release").build_settings["IPHONEOS_DEPLOYMENT_TARGET"].should == "4.0"
end end
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