Commit 9cee0a2a authored by Paul Beusterien's avatar Paul Beusterien

Mixed language static frameworks

parent 6680e71f
......@@ -8,11 +8,14 @@ To install release candidates run `[sudo] gem install cocoapods --pre`
##### Enhancements
* Add `--exclude-pods` option to `pod update` to allow excluding specific pods from update
[Oleksandr Kruk](https://github.com/0mega)
[#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
[Muhammed Yavuz Nuzumlalı](https://github.com/manuyavuz)
[#7473](https://github.com/CocoaPods/CocoaPods/pull/7473)
......
......@@ -50,9 +50,6 @@ module Pod
create_info_plist_file(target.info_plist_path, native_target, target.version, target.platform)
end
create_build_phase_to_symlink_header_folders
if target.static_framework?
create_build_phase_to_move_static_framework_archive
end
elsif target.uses_swift?
add_swift_static_library_compatibility_header_phase
end
......@@ -484,28 +481,6 @@ module Pod
eos
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
# to the platform of the target. This file also include any prefix header
# content reported by the specification of the pods.
......
......@@ -81,10 +81,8 @@ module Pod
end
if target.requires_frameworks?
framework_name = target.product_module_name
if target.static_framework?
settings['PUBLIC_HEADERS_FOLDER_PATH'] = framework_name + '.framework' + '/Headers'
settings['PRIVATE_HEADERS_FOLDER_PATH'] = framework_name + '.framework' + '/PrivateHeaders'
settings['MACH_O_TYPE'] = 'staticlib'
end
else
settings.merge!('OTHER_LDFLAGS' => '', 'OTHER_LIBTOOLFLAGS' => '')
......
......@@ -74,7 +74,7 @@ module Pod
# #requires_frameworks?.
#
def product_type
requires_frameworks? && !static_framework? ? :framework : :static_library
requires_frameworks? ? :framework : :static_library
end
# @return [String] A string suitable for debugging.
......
......@@ -818,20 +818,6 @@ module Pod
build_phase.should.not.be.nil
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
@pod_target.stubs(:requires_frameworks?).returns(false)
......
......@@ -61,27 +61,15 @@ module Pod
}
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(:static_framework?).returns(true)
@installer.send(:add_target)
@installer.send(:native_target).resolved_build_setting('PUBLIC_HEADERS_FOLDER_PATH').should == {
'Release' => 'BananaLib.framework/Headers',
'Debug' => 'BananaLib.framework/Headers',
'Test' => 'BananaLib.framework/Headers',
'AppStore' => 'BananaLib.framework/Headers',
}
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',
@installer.send(:native_target).resolved_build_setting('MACH_O_TYPE').should == {
'Release' => 'staticlib',
'Debug' => 'staticlib',
'Test' => 'staticlib',
'AppStore' => 'staticlib',
}
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