Commit 29697f42 authored by Fabio Pelosin's avatar Fabio Pelosin

[XCConfigHelper] Don't include missing frameworks in OS X

parent 75452ffc
...@@ -19,7 +19,7 @@ To install or update CocoaPods see this [guide](http://docs.cocoapods.org/guides ...@@ -19,7 +19,7 @@ To install or update CocoaPods see this [guide](http://docs.cocoapods.org/guides
###### Bug Fixes ###### Bug Fixes
* The architecture is now set in the build settings of the user build * The architecture is now set in the build settings of the user build
configurations. configurations.
[Fabio Pelosin](https://github.com/irrationalfab) [Fabio Pelosin](https://github.com/irrationalfab)
[#1450](https://github.com/CocoaPods/CocoaPods/issues/1462) [#1450](https://github.com/CocoaPods/CocoaPods/issues/1462)
[#1462](https://github.com/CocoaPods/CocoaPods/issues/1462) [#1462](https://github.com/CocoaPods/CocoaPods/issues/1462)
...@@ -36,6 +36,11 @@ To install or update CocoaPods see this [guide](http://docs.cocoapods.org/guides ...@@ -36,6 +36,11 @@ To install or update CocoaPods see this [guide](http://docs.cocoapods.org/guides
[Noah McCann](https://github.com/nmccann) [Noah McCann](https://github.com/nmccann)
[#29](https://github.com/CocoaPods/Core/pull/29) [#29](https://github.com/CocoaPods/Core/pull/29)
* The developer dir relative to the SDK is not added anymore if testing
frameworks are detected in OS X targets, as it doesn't exists, avoiding the
presentation of the relative warning in Xcode.
[Fabio Pelosin](https://github.com/irrationalfab)
## 0.26.2 ## 0.26.2
[CocoaPods](https://github.com/CocoaPods/CocoaPods/compare/0.26.1...0.26.2) [CocoaPods](https://github.com/CocoaPods/CocoaPods/compare/0.26.1...0.26.2)
......
...@@ -46,7 +46,7 @@ module Pod ...@@ -46,7 +46,7 @@ module Pod
xcconfig.libraries.merge(consumer.libraries) xcconfig.libraries.merge(consumer.libraries)
xcconfig.frameworks.merge(consumer.frameworks) xcconfig.frameworks.merge(consumer.frameworks)
xcconfig.weak_frameworks.merge(consumer.weak_frameworks) xcconfig.weak_frameworks.merge(consumer.weak_frameworks)
add_developers_frameworks_if_needed(xcconfig) add_developers_frameworks_if_needed(xcconfig, consumer.platform_name)
end end
# Configures the given Xcconfig with the the build settings for the given # Configures the given Xcconfig with the the build settings for the given
...@@ -87,14 +87,6 @@ module Pod ...@@ -87,14 +87,6 @@ module Pod
xcconfig.merge!(build_settings) xcconfig.merge!(build_settings)
end end
# @return [Array<String>] The search paths for the developer frameworks.
#
DEVELOPER_FRAMEWORKS_SEARCH_PATHS = [
'$(inherited)',
'"$(SDKROOT)/Developer/Library/Frameworks"',
'"$(DEVELOPER_LIBRARY_DIR)/Frameworks"'
]
# Adds the search paths of the developer frameworks to the specification # Adds the search paths of the developer frameworks to the specification
# if needed. This is done because the `SenTestingKit` requires them and # if needed. This is done because the `SenTestingKit` requires them and
# adding them to each specification which requires it is repetitive and # adding them to each specification which requires it is repetitive and
...@@ -105,16 +97,23 @@ module Pod ...@@ -105,16 +97,23 @@ module Pod
# #
# @return [void] # @return [void]
# #
def self.add_developers_frameworks_if_needed(xcconfig) def self.add_developers_frameworks_if_needed(xcconfig, platform)
matched_frameworks = xcconfig.frameworks & ['XCTest', 'SenTestingKit'] matched_frameworks = xcconfig.frameworks & ['XCTest', 'SenTestingKit']
unless matched_frameworks.empty? unless matched_frameworks.empty?
search_paths = xcconfig.attributes['FRAMEWORK_SEARCH_PATHS'] ||= '' search_paths = xcconfig.attributes['FRAMEWORK_SEARCH_PATHS'] ||= ''
DEVELOPER_FRAMEWORKS_SEARCH_PATHS.each do |search_path| search_paths_to_add = []
search_paths_to_add << '$(inherited)'
search_paths_to_add << '"$(DEVELOPER_LIBRARY_DIR)/Frameworks"'
if platform == :ios
search_paths_to_add << '"$(SDKROOT)/Developer/Library/Frameworks"'
end
search_paths_to_add.each do |search_path|
unless search_paths.include?(search_path) unless search_paths.include?(search_path)
search_paths << ' ' unless search_paths.empty? search_paths << ' ' unless search_paths.empty?
search_paths << search_path search_paths << search_path
end end
end end
search_paths
end end
end end
......
...@@ -49,6 +49,7 @@ module Pod ...@@ -49,6 +49,7 @@ module Pod
:libraries => [], :libraries => [],
:frameworks => [], :frameworks => [],
:weak_frameworks => [], :weak_frameworks => [],
:platform_name => :ios
}) })
@sut.add_spec_build_settings_to_xcconfig(consumer, xcconfig) @sut.add_spec_build_settings_to_xcconfig(consumer, xcconfig)
xcconfig.to_hash['OTHER_LDFLAGS'].should == '-framework SenTestingKit' xcconfig.to_hash['OTHER_LDFLAGS'].should == '-framework SenTestingKit'
...@@ -61,6 +62,7 @@ module Pod ...@@ -61,6 +62,7 @@ module Pod
:libraries => ['xml2'], :libraries => ['xml2'],
:frameworks => [], :frameworks => [],
:weak_frameworks => [], :weak_frameworks => [],
:platform_name => :ios
}) })
@sut.add_spec_build_settings_to_xcconfig(consumer, xcconfig) @sut.add_spec_build_settings_to_xcconfig(consumer, xcconfig)
xcconfig.to_hash['OTHER_LDFLAGS'].should == '-lxml2' xcconfig.to_hash['OTHER_LDFLAGS'].should == '-lxml2'
...@@ -73,6 +75,7 @@ module Pod ...@@ -73,6 +75,7 @@ module Pod
:libraries => [], :libraries => [],
:frameworks => ['CoreAnimation'], :frameworks => ['CoreAnimation'],
:weak_frameworks => [], :weak_frameworks => [],
:platform_name => :ios
}) })
@sut.add_spec_build_settings_to_xcconfig(consumer, xcconfig) @sut.add_spec_build_settings_to_xcconfig(consumer, xcconfig)
xcconfig.to_hash['OTHER_LDFLAGS'].should == '-framework CoreAnimation' xcconfig.to_hash['OTHER_LDFLAGS'].should == '-framework CoreAnimation'
...@@ -85,6 +88,7 @@ module Pod ...@@ -85,6 +88,7 @@ module Pod
:libraries => [], :libraries => [],
:frameworks => [], :frameworks => [],
:weak_frameworks => ['iAd'], :weak_frameworks => ['iAd'],
:platform_name => :ios
}) })
@sut.add_spec_build_settings_to_xcconfig(consumer, xcconfig) @sut.add_spec_build_settings_to_xcconfig(consumer, xcconfig)
xcconfig.to_hash['OTHER_LDFLAGS'].should == '-weak_framework iAd' xcconfig.to_hash['OTHER_LDFLAGS'].should == '-weak_framework iAd'
...@@ -97,6 +101,7 @@ module Pod ...@@ -97,6 +101,7 @@ module Pod
:libraries => [], :libraries => [],
:frameworks => ['SenTestingKit'], :frameworks => ['SenTestingKit'],
:weak_frameworks => [], :weak_frameworks => [],
:platform_name => :ios
}) })
@sut.add_spec_build_settings_to_xcconfig(consumer, xcconfig) @sut.add_spec_build_settings_to_xcconfig(consumer, xcconfig)
xcconfig.to_hash['FRAMEWORK_SEARCH_PATHS'].should.include('DEVELOPER_LIBRARY_DIR') xcconfig.to_hash['FRAMEWORK_SEARCH_PATHS'].should.include('DEVELOPER_LIBRARY_DIR')
...@@ -150,7 +155,7 @@ module Pod ...@@ -150,7 +155,7 @@ module Pod
describe "::add_framework_build_settings" do describe "::add_framework_build_settings" do
it "adds the developer frameworks search paths to the xcconfig if SenTestingKit has been detected" do it "adds the developer frameworks search paths to the xcconfig if SenTestingKit has been detected" do
xcconfig = Xcodeproj::Config.new({'OTHER_LDFLAGS' => '-framework SenTestingKit'}) xcconfig = Xcodeproj::Config.new({'OTHER_LDFLAGS' => '-framework SenTestingKit'})
@sut.add_developers_frameworks_if_needed(xcconfig) @sut.add_developers_frameworks_if_needed(xcconfig, :ios)
frameworks_search_paths = xcconfig.to_hash['FRAMEWORK_SEARCH_PATHS'] frameworks_search_paths = xcconfig.to_hash['FRAMEWORK_SEARCH_PATHS']
frameworks_search_paths.should.include?('$(inherited)') frameworks_search_paths.should.include?('$(inherited)')
frameworks_search_paths.should.include?('"$(SDKROOT)/Developer/Library/Frameworks"') frameworks_search_paths.should.include?('"$(SDKROOT)/Developer/Library/Frameworks"')
...@@ -159,12 +164,25 @@ module Pod ...@@ -159,12 +164,25 @@ module Pod
it "adds the developer frameworks search paths to the xcconfig if XCTest has been detected" do it "adds the developer frameworks search paths to the xcconfig if XCTest has been detected" do
xcconfig = Xcodeproj::Config.new({'OTHER_LDFLAGS' => '-framework XCTest'}) xcconfig = Xcodeproj::Config.new({'OTHER_LDFLAGS' => '-framework XCTest'})
@sut.add_developers_frameworks_if_needed(xcconfig) @sut.add_developers_frameworks_if_needed(xcconfig, :ios)
frameworks_search_paths = xcconfig.to_hash['FRAMEWORK_SEARCH_PATHS'] frameworks_search_paths = xcconfig.to_hash['FRAMEWORK_SEARCH_PATHS']
frameworks_search_paths.should.include?('$(inherited)') frameworks_search_paths.should.include?('$(inherited)')
frameworks_search_paths.should.include?('"$(SDKROOT)/Developer/Library/Frameworks"') frameworks_search_paths.should.include?('"$(SDKROOT)/Developer/Library/Frameworks"')
frameworks_search_paths.should.include?('"$(DEVELOPER_LIBRARY_DIR)/Frameworks"') frameworks_search_paths.should.include?('"$(DEVELOPER_LIBRARY_DIR)/Frameworks"')
end end
it "doesn't adds the developer frameworks relative to the SDK for OS X" do
xcconfig = Xcodeproj::Config.new({'OTHER_LDFLAGS' => '-framework XCTest'})
@sut.add_developers_frameworks_if_needed(xcconfig, :ios)
frameworks_search_paths = xcconfig.to_hash['FRAMEWORK_SEARCH_PATHS']
frameworks_search_paths.should.include?('"$(SDKROOT)/Developer/Library/Frameworks"')
xcconfig = Xcodeproj::Config.new({'OTHER_LDFLAGS' => '-framework XCTest'})
@sut.add_developers_frameworks_if_needed(xcconfig, :osx)
frameworks_search_paths = xcconfig.to_hash['FRAMEWORK_SEARCH_PATHS']
frameworks_search_paths.should.not.include?('"$(SDKROOT)/Developer/Library/Frameworks"')
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