Unverified Commit 2fe815c9 authored by Samuel Giddins's avatar Samuel Giddins Committed by GitHub

Merge pull request #7519 from paulb777/mixed-static-frameworks

Mixed language static frameworks
parents 77d34d36 9cee0a2a
...@@ -8,11 +8,14 @@ To install release candidates run `[sudo] gem install cocoapods --pre` ...@@ -8,11 +8,14 @@ To install release candidates run `[sudo] gem install cocoapods --pre`
##### Enhancements ##### Enhancements
* Add `--exclude-pods` option to `pod update` to allow excluding specific pods from update * Add `--exclude-pods` option to `pod update` to allow excluding specific pods from update
[Oleksandr Kruk](https://github.com/0mega) [Oleksandr Kruk](https://github.com/0mega)
[#7334](https://github.com/CocoaPods/CocoaPods/issues/7334) [#7334](https://github.com/CocoaPods/CocoaPods/issues/7334)
* Add support for mixed Objective-C and Swift static frameworks
[Paul Beusterien](https://github.com/paulb777)
[#7213](https://github.com/CocoaPods/CocoaPods/issues/7213)
* Improve `pod install` performance for pods with exact file paths rather than glob patterns * Improve `pod install` performance for pods with exact file paths rather than glob patterns
[Muhammed Yavuz Nuzumlalı](https://github.com/manuyavuz) [Muhammed Yavuz Nuzumlalı](https://github.com/manuyavuz)
[#7473](https://github.com/CocoaPods/CocoaPods/pull/7473) [#7473](https://github.com/CocoaPods/CocoaPods/pull/7473)
......
...@@ -50,9 +50,6 @@ module Pod ...@@ -50,9 +50,6 @@ module Pod
create_info_plist_file(target.info_plist_path, native_target, target.version, target.platform) create_info_plist_file(target.info_plist_path, native_target, target.version, target.platform)
end end
create_build_phase_to_symlink_header_folders create_build_phase_to_symlink_header_folders
if target.static_framework?
create_build_phase_to_move_static_framework_archive
end
elsif target.uses_swift? elsif target.uses_swift?
add_swift_static_library_compatibility_header_phase add_swift_static_library_compatibility_header_phase
end end
...@@ -484,28 +481,6 @@ module Pod ...@@ -484,28 +481,6 @@ module Pod
eos eos
end end
# Creates a build phase to put the static framework in the appropriate framework location
# Since Xcode does not provide template support for static library frameworks, we've built a static library
# of the form lib{LibraryName}.a. We need to move that to the framework location -
# {LibraryName}.framework/{LibraryName}.
#
# @return [void]
#
def create_build_phase_to_move_static_framework_archive
build_phase = native_target.new_shell_script_build_phase('Setup Static Framework')
build_phase.shell_script = <<-eos.strip_heredoc
mkdir -p "${BUILT_PRODUCTS_DIR}/${PRODUCT_NAME}.framework/Modules"
# The fat library archive is at a file symbolic link when archiving, so use -L option
rsync -tL "${BUILT_PRODUCTS_DIR}/lib${PRODUCT_NAME}.a" "${BUILT_PRODUCTS_DIR}/${PRODUCT_NAME}.framework/${PRODUCT_NAME}"
rsync -t "${MODULEMAP_FILE}" "${BUILT_PRODUCTS_DIR}/${PRODUCT_NAME}.framework/Modules/module.modulemap"
# If there's a .swiftmodule, copy it into the framework's Modules folder
rsync -tr "${BUILT_PRODUCTS_DIR}/${PRODUCT_NAME}".swiftmodule "${BUILT_PRODUCTS_DIR}/${PRODUCT_NAME}.framework/Modules/" 2>/dev/null || :
# If archiving, Headers copy is needed
rsync -tr "${TARGET_BUILD_DIR}/${PRODUCT_NAME}.framework/Headers" "${BUILT_PRODUCTS_DIR}/${PRODUCT_NAME}.framework/" 2>/dev/null || :
rsync -tr "${TARGET_BUILD_DIR}/${PRODUCT_NAME}.framework/PrivateHeaders" "${BUILT_PRODUCTS_DIR}/${PRODUCT_NAME}.framework/" 2>/dev/null || :
eos
end
# Creates a prefix header file which imports `UIKit` or `Cocoa` according # Creates a prefix header file which imports `UIKit` or `Cocoa` according
# to the platform of the target. This file also include any prefix header # to the platform of the target. This file also include any prefix header
# content reported by the specification of the pods. # content reported by the specification of the pods.
......
...@@ -81,10 +81,8 @@ module Pod ...@@ -81,10 +81,8 @@ module Pod
end end
if target.requires_frameworks? if target.requires_frameworks?
framework_name = target.product_module_name
if target.static_framework? if target.static_framework?
settings['PUBLIC_HEADERS_FOLDER_PATH'] = framework_name + '.framework' + '/Headers' settings['MACH_O_TYPE'] = 'staticlib'
settings['PRIVATE_HEADERS_FOLDER_PATH'] = framework_name + '.framework' + '/PrivateHeaders'
end end
else else
settings.merge!('OTHER_LDFLAGS' => '', 'OTHER_LIBTOOLFLAGS' => '') settings.merge!('OTHER_LDFLAGS' => '', 'OTHER_LIBTOOLFLAGS' => '')
......
...@@ -74,7 +74,7 @@ module Pod ...@@ -74,7 +74,7 @@ module Pod
# #requires_frameworks?. # #requires_frameworks?.
# #
def product_type def product_type
requires_frameworks? && !static_framework? ? :framework : :static_library requires_frameworks? ? :framework : :static_library
end end
# @return [String] A string suitable for debugging. # @return [String] A string suitable for debugging.
......
...@@ -818,20 +818,6 @@ module Pod ...@@ -818,20 +818,6 @@ module Pod
build_phase.should.not.be.nil build_phase.should.not.be.nil
end end
it 'creates a build phase to set up a static library framework' do
@pod_target.stubs(:static_framework?).returns(true)
@installer.install!
target = @project.native_targets.first
build_phase = target.shell_script_build_phases.find do |bp|
bp.name == 'Setup Static Framework'
end
build_phase.shell_script.should.include?('swiftmodule')
build_phase.shell_script.should.include?('PrivateHeaders')
build_phase.should.not.be.nil
end
it 'verifies that headers in build phase for static libraries are all Project headers' do it 'verifies that headers in build phase for static libraries are all Project headers' do
@pod_target.stubs(:requires_frameworks?).returns(false) @pod_target.stubs(:requires_frameworks?).returns(false)
......
...@@ -61,27 +61,15 @@ module Pod ...@@ -61,27 +61,15 @@ module Pod
} }
end end
it 'verify header path for a static library framework' do it 'verify static framework is building a static library' do
@pod_target.stubs(:requires_frameworks?).returns(true) @pod_target.stubs(:requires_frameworks?).returns(true)
@pod_target.stubs(:static_framework?).returns(true) @pod_target.stubs(:static_framework?).returns(true)
@installer.send(:add_target) @installer.send(:add_target)
@installer.send(:native_target).resolved_build_setting('PUBLIC_HEADERS_FOLDER_PATH').should == { @installer.send(:native_target).resolved_build_setting('MACH_O_TYPE').should == {
'Release' => 'BananaLib.framework/Headers', 'Release' => 'staticlib',
'Debug' => 'BananaLib.framework/Headers', 'Debug' => 'staticlib',
'Test' => 'BananaLib.framework/Headers', 'Test' => 'staticlib',
'AppStore' => 'BananaLib.framework/Headers', 'AppStore' => 'staticlib',
}
end
it 'verify private header path for a static library framework' do
@pod_target.stubs(:requires_frameworks?).returns(true)
@pod_target.stubs(:static_framework?).returns(true)
@installer.send(:add_target)
@installer.send(:native_target).resolved_build_setting('PRIVATE_HEADERS_FOLDER_PATH').should == {
'Release' => 'BananaLib.framework/PrivateHeaders',
'Debug' => 'BananaLib.framework/PrivateHeaders',
'Test' => 'BananaLib.framework/PrivateHeaders',
'AppStore' => 'BananaLib.framework/PrivateHeaders',
} }
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