Commit e83f01b0 authored by Fabio Pelosin's avatar Fabio Pelosin

[Generator::Xcconfig] Add developer frameworks search paths if needed

Closes #771
parent b9c37bc7
......@@ -3,6 +3,15 @@
[cocoapods-core](https://github.com/CocoaPods/Core/compare/0.17.2...0.17.3)
[Xcodeproj](https://github.com/CocoaPods/Xcodeproj/compare/0.5.2...0.5.4)
###### Enhancements
* The `pod search` commands now accepts the `--ios` and the `--osx` arguments
to filter the results by platform.
[#625](https://github.com/CocoaPods/CocoaPods/issues/625)
* The developer frameworks are automatically added if `SenTestingKit` is
detected. There is no need to specify them in specifications anymore.
[#771](https://github.com/CocoaPods/CocoaPods/issues/771)
###### Bug fixes
* Improved handling for Xcode projects containing non ASCII characters.
......@@ -16,12 +25,6 @@
[#935](https://github.com/CocoaPods/CocoaPods/issues/935)
###### Ancillary enhancements
* The `pod search` commands now accepts the `--ios` and the `--osx` arguments
to filter the results by platform.
[#625](https://github.com/CocoaPods/CocoaPods/issues/625)
## 0.17.2
[CocoaPods](https://github.com/CocoaPods/CocoaPods/compare/0.17.1...0.17.2)
......
......@@ -61,10 +61,7 @@ module Pod
})
spec_consumers.each do |consumer|
@xcconfig.merge!(consumer.xcconfig);
@xcconfig.libraries.merge(consumer.libraries);
@xcconfig.frameworks.merge(consumer.frameworks);
@xcconfig.weak_frameworks.merge(consumer.weak_frameworks);
add_spec_build_settings_to_xcconfig(consumer, @xcconfig)
end
@xcconfig
......@@ -124,6 +121,63 @@ module Pod
def quote(strings)
strings.sort.map { |s| %W|"#{s}"| }.join(" ")
end
# Configures the given Xcconfig according to the build settings of the
# given Specification.
#
# @param [Specification::Consumer] consumer
# The consumer of the specification.
#
# @param [Xcodeproj::Config] xcconfig
# The xcconfig to edit.
#
# @return [void]
#
def add_spec_build_settings_to_xcconfig(consumer, xcconfig)
xcconfig.merge!(consumer.xcconfig)
xcconfig.libraries.merge(consumer.libraries)
xcconfig.frameworks.merge(consumer.frameworks)
xcconfig.weak_frameworks.merge(consumer.weak_frameworks)
add_developers_frameworks_if_needed(consumer, xcconfig)
end
# @return [Array<String>] The search paths for the developer frameworks.
#
# @todo Inheritance should be properly handled in Xcconfigs.
#
DEVELOPER_FRAMEWORKS_SEARCH_PATHS = [
'$(inherited)',
'"$(SDKROOT)/Developer/Library/Frameworks"',
'"$(DEVELOPER_LIBRARY_DIR)/Frameworks"'
]
# Adds the search paths of the developer frameworks to the specification
# if needed. This is done because the `SenTestingKit` requires them and
# adding them to each specification which requires it is repetitive and
# error prone.
#
# @param [Specification::Consumer] consumer
# The consumer of the specification.
#
# @param [Xcodeproj::Config] xcconfig
# The xcconfig to edit.
#
# @return [void]
#
def add_developers_frameworks_if_needed(consumer, xcconfig)
if xcconfig.frameworks.include?('SenTestingKit')
search_paths = xcconfig.attributes['FRAMEWORK_SEARCH_PATHS'] ||= ''
DEVELOPER_FRAMEWORKS_SEARCH_PATHS.each do |search_path|
unless search_paths.include?(search_path)
search_paths << ' ' unless search_paths.empty?
search_paths << search_path
end
end
end
end
#-----------------------------------------------------------------------#
end
end
end
......
......@@ -91,6 +91,26 @@ module Pod
@xcconfig.to_hash['OTHER_LDFLAGS'].should.include('-weak_framework iAd')
end
it "includes the developer frameworks search paths when SenTestingKit is detected" do
spec = fixture_spec('banana-lib/BananaLib.podspec')
consumer = spec.consumer(:ios)
generator = Generator::XCConfig.new(config.sandbox, [consumer], './Pods')
spec.xcconfig = { 'OTHER_LDFLAGS' => '-no_compact_unwind' }
spec.frameworks = ['SenTestingKit']
xcconfig = generator.generate
xcconfig.to_hash['FRAMEWORK_SEARCH_PATHS'].should == '$(inherited) "$(SDKROOT)/Developer/Library/Frameworks" "$(DEVELOPER_LIBRARY_DIR)/Frameworks"'
end
it "doesn't include the developer frameworks if already present" do
spec = fixture_spec('banana-lib/BananaLib.podspec')
consumer_1 = spec.consumer(:ios)
consumer_2 = spec.consumer(:ios)
generator = Generator::XCConfig.new(config.sandbox, [consumer_1, consumer_2], './Pods')
spec.frameworks = ['SenTestingKit']
xcconfig = generator.generate
xcconfig.to_hash['FRAMEWORK_SEARCH_PATHS'].should == '$(inherited) "$(SDKROOT)/Developer/Library/Frameworks" "$(DEVELOPER_LIBRARY_DIR)/Frameworks"'
end
#-----------------------------------------------------------------------#
it 'returns the settings that the pods project needs to override' do
......
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