Commit 5ae5ef8d authored by Marius Rackwitz's avatar Marius Rackwitz

Merge pull request #5352 from CocoaPods/mr-fix-5313

Symlink header folders by script build phase
parents 5496974a 3dc666eb
......@@ -12,6 +12,12 @@ To install release candidates run `[sudo] gem install cocoapods --pre`
##### Bug Fixes
* Symlink the header folders in the framework bundle's root directory
by a new shell script build phase if `header_mappings_dir` is used
with frameworks.
[Marius Rackwitz](https://github.com/mrackwitz)
[#5313](https://github.com/CocoaPods/CocoaPods/issues/5313)
* Ensure `Set` is defined before using it.
[Samuel Giddins](https://github.com/segiddins)
[#5287](https://github.com/CocoaPods/CocoaPods/issues/5287)
......
<?xml version="1.0" encoding="UTF-8"?>
<Workspace
version = "1.0">
<FileRef
location = "group:HeaderMappingsDir Example.xcodeproj">
</FileRef>
<FileRef
location = "group:Pods/Pods.xcodeproj">
</FileRef>
</Workspace>
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0730"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "295BB55D1CEA95DE00E79F82"
BuildableName = "App.app"
BlueprintName = "App"
ReferencedContainer = "container:HeaderMappingsDir Example.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
</Testables>
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "295BB55D1CEA95DE00E79F82"
BuildableName = "App.app"
BlueprintName = "App"
ReferencedContainer = "container:HeaderMappingsDir Example.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "295BB55D1CEA95DE00E79F82"
BuildableName = "App.app"
BlueprintName = "App"
ReferencedContainer = "container:HeaderMappingsDir Example.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "295BB55D1CEA95DE00E79F82"
BuildableName = "App.app"
BlueprintName = "App"
ReferencedContainer = "container:HeaderMappingsDir Example.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>
import Cocoa
import HeaderMappingsDirPod
import HeaderMappingsDirPod.Private
@NSApplicationMain
class AppDelegate: NSObject, NSApplicationDelegate {
@IBOutlet weak var window: NSWindow!
}
{
"images" : [
{
"idiom" : "mac",
"size" : "16x16",
"scale" : "1x"
},
{
"idiom" : "mac",
"size" : "16x16",
"scale" : "2x"
},
{
"idiom" : "mac",
"size" : "32x32",
"scale" : "1x"
},
{
"idiom" : "mac",
"size" : "32x32",
"scale" : "2x"
},
{
"idiom" : "mac",
"size" : "128x128",
"scale" : "1x"
},
{
"idiom" : "mac",
"size" : "128x128",
"scale" : "2x"
},
{
"idiom" : "mac",
"size" : "256x256",
"scale" : "1x"
},
{
"idiom" : "mac",
"size" : "256x256",
"scale" : "2x"
},
{
"idiom" : "mac",
"size" : "512x512",
"scale" : "1x"
},
{
"idiom" : "mac",
"size" : "512x512",
"scale" : "2x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIconFile</key>
<string></string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>$(PRODUCT_NAME)</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1</string>
<key>LSMinimumSystemVersion</key>
<string>$(MACOSX_DEPLOYMENT_TARGET)</string>
<key>NSHumanReadableCopyright</key>
<string>Copyright © 2016 CocoaPods. All rights reserved.</string>
<key>NSPrincipalClass</key>
<string>NSApplication</string>
</dict>
</plist>
Pod::Spec.new do |s|
s.name = 'HeaderMappingsDirPod'
s.version = '0.1.0'
s.summary = 'Demonstrates using a set of advanced options all together.'
s.description = <<-DESC
* has private headers
* has a `header_mappings_dir`
* has a `module_map`
* explictly declare at least one of the private
headers in the module map
DESC
s.source = { :git => 'https://github.com/CocoaPods/CocoaPods.git', :tag => "v#{s.version}" }
s.homepage = "https://github.com/CocoaPods/CocoaPods"
s.author = { 'Example' => 'help@example.org' }
s.license = { :type => 'MIT', :file => '../../../LICENSE' }
s.public_header_files = 'include/Foo.h', 'include/Bar/Bar.h'
s.private_header_files = 'include/Bar/Bar_Private.h'
s.source_files = '*.m', 'include/*.h', 'include/Bar/*.h'
s.module_map = 'module.modulemap'
s.header_mappings_dir = 'include'
s.preserve_paths = %w(include)
s.osx.deployment_target = '10.9'
end
framework module HeaderMappingsDirPod {
umbrella header "Foo.h"
export *
module * { export * }
explicit module Private {
header "Bar/Bar_Private.h"
}
}
platform :osx, '10.9'
use_frameworks!
workspace 'Examples.xcworkspace'
project 'HeaderMappingsDir Example.xcodeproj'
target 'App' do
pod 'HeaderMappingsDirPod', :path => 'HeaderMappingsDirPod'
end
......@@ -32,6 +32,7 @@ module Pod
target.file_accessors.flat_map(&:public_headers).map(&:basename)
end
end
create_build_phase_to_symlink_header_folders
end
create_prefix_header
create_dummy_source
......@@ -216,6 +217,26 @@ module Pod
end
end
# Creates a build phase which links the versioned header folders
# of the OS X into the framework bundle's root root directory.
# This is only necessary because the way how headers are copied
# via custom copy file build phases in combination with
# header_mappings_dir interferes with xcodebuild's expectations
# about the existence of private or public headers.
#
# @return [void]
#
def create_build_phase_to_symlink_header_folders
return unless target.platform.name == :osx && header_mappings_dir
build_phase = native_target.new_shell_script_build_phase('Create Symlinks to Header Folders')
build_phase.shell_script = <<-eos.strip_heredoc
cd "$CONFIGURATION_BUILD_DIR/$WRAPPER_NAME"
ln -fs ${PUBLIC_HEADERS_FOLDER_PATH\#$WRAPPER_NAME/} ${PUBLIC_HEADERS_FOLDER_PATH\#\$CONTENTS_FOLDER_PATH/}
ln -fs ${PRIVATE_HEADERS_FOLDER_PATH\#\$WRAPPER_NAME/} ${PRIVATE_HEADERS_FOLDER_PATH\#\$CONTENTS_FOLDER_PATH/}
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.
......
......@@ -300,10 +300,11 @@ module Pod
@project.add_file_reference(file, group)
end
@installer.stubs(:target).returns(@pod_target)
@installer.install!
end
it 'creates custom copy files phases for framework pods' do
@installer.install!
target = @project.native_targets.first
target.name.should == 'snake'
......@@ -340,12 +341,34 @@ module Pod
end
it 'uses relative file paths to generate umbrella header' do
content = @pod_target.umbrella_header_path.read
@installer.install!
content = @pod_target.umbrella_header_path.read
content.should =~ %r{"A/Boa.h"}
content.should =~ %r{"A/Garden.h"}
content.should =~ %r{"A/Rattle.h"}
end
it 'creates a build phase to symlink header folders on OS X' do
@pod_target.stubs(:platform).returns(Platform.osx)
@installer.install!
target = @project.native_targets.first
build_phase = target.shell_script_build_phases.find do |bp|
bp.name == 'Create Symlinks to Header Folders'
end
build_phase.should.not.be.nil
end
end
it "doesn't create a build phase to symlink header folders by default on OS X" do
@pod_target.stubs(:platform).returns(Platform.osx)
@installer.install!
target = @project.native_targets.first
target.shell_script_build_phases.should == []
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