Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
C
cocoapods
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
gengmeiios
cocoapods
Commits
ec2073bf
Unverified
Commit
ec2073bf
authored
Mar 08, 2018
by
Samuel Giddins
Committed by
GitHub
Mar 08, 2018
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #7488 from CocoaPods/segiddins/fix-archiving-swift-static-libs
Fix archiving when using Swift static libraries
parents
11072aee
1014c973
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
37 additions
and
18 deletions
+37
-18
pod_target_installer.rb
...ller/xcode/pods_project_generator/pod_target_installer.rb
+12
-15
target_installer.rb
...nstaller/xcode/pods_project_generator/target_installer.rb
+2
-2
cocoapods-integration-specs
spec/cocoapods-integration-specs
+1
-1
aggregate_target_installer_spec.rb
...pods_project_generator/aggregate_target_installer_spec.rb
+22
-0
No files found.
lib/cocoapods/installer/xcode/pods_project_generator/pod_target_installer.rb
View file @
ec2073bf
...
@@ -596,17 +596,6 @@ module Pod
...
@@ -596,17 +596,6 @@ module Pod
flags
*
' '
flags
*
' '
end
end
# Adds a reference to the given file in the support group of this target.
#
# @param [Pathname] path
# The path of the file to which the reference should be added.
#
# @return [PBXFileReference] the file reference of the added file.
#
def
add_file_to_support_group
(
path
)
support_files_group
.
new_file
(
path
)
end
def
apply_xcconfig_file_ref_to_resource_bundle_targets
(
resource_bundle_targets
,
xcconfig_file_ref
)
def
apply_xcconfig_file_ref_to_resource_bundle_targets
(
resource_bundle_targets
,
xcconfig_file_ref
)
resource_bundle_targets
.
each
do
|
rsrc_target
|
resource_bundle_targets
.
each
do
|
rsrc_target
|
rsrc_target
.
build_configurations
.
each
do
|
rsrc_bc
|
rsrc_target
.
build_configurations
.
each
do
|
rsrc_bc
|
...
@@ -706,26 +695,34 @@ module Pod
...
@@ -706,26 +695,34 @@ module Pod
# Adds a shell script phase, intended only for static library targets that contain swift,
# Adds a shell script phase, intended only for static library targets that contain swift,
# to copy the ObjC compatibility header (the -Swift.h file that the swift compiler generates)
# to copy the ObjC compatibility header (the -Swift.h file that the swift compiler generates)
# to the built products directory. Additionally, the script phase copies the module map, appending a `.Swift`
# to the built products directory. Additionally, the script phase copies the module map, appending a `.Swift`
# submodule that references the (moved) compatibility header.
# submodule that references the (moved) compatibility header. Since the module map has been moved, the umbrella header
# is _also_ copied, so that it is sitting next to the module map. This is necessary for a successful archive build.
#
#
# @return [Void]
# @return [Void]
#
#
def
add_swift_static_library_compatibility_header_phase
def
add_swift_static_library_compatibility_header_phase
build_phase
=
native_target
.
new_shell_script_build_phase
(
'Copy generated compatibility header'
)
build_phase
=
native_target
.
new_shell_script_build_phase
(
'Copy generated compatibility header'
)
relative_module_map_path
=
target
.
module_map_path
.
relative_path_from
(
target
.
sandbox
.
root
)
relative_umbrella_header_path
=
target
.
umbrella_header_path
.
relative_path_from
(
target
.
sandbox
.
root
)
build_phase
.
shell_script
=
<<-
SH
.
strip_heredoc
build_phase
.
shell_script
=
<<-
SH
.
strip_heredoc
COMPATIBILITY_HEADER_PATH="${BUILT_PRODUCTS_DIR}/Swift Compatibility Header/${PRODUCT_MODULE_NAME}-Swift.h"
COMPATIBILITY_HEADER_PATH="${BUILT_PRODUCTS_DIR}/Swift Compatibility Header/${PRODUCT_MODULE_NAME}-Swift.h"
MODULE_MAP_PATH="${BUILT_PRODUCTS_DIR}/${PRODUCT_MODULE_NAME}.modulemap"
MODULE_MAP_PATH="${BUILT_PRODUCTS_DIR}/${PRODUCT_MODULE_NAME}.modulemap"
ditto "${DERIVED_SOURCES_DIR}/${PRODUCT_MODULE_NAME}-Swift.h" "${COMPATIBILITY_HEADER_PATH}"
ditto "${DERIVED_SOURCES_DIR}/${PRODUCT_MODULE_NAME}-Swift.h" "${COMPATIBILITY_HEADER_PATH}"
ditto "${PODS_ROOT}/
#{
target
.
module_map_path
.
relative_path_from
(
target
.
sandbox
.
root
)
}
" "${MODULE_MAP_PATH}"
ditto "${PODS_ROOT}/
#{
relative_module_map_path
}
" "${MODULE_MAP_PATH}"
ditto "${PODS_ROOT}/
#{
relative_umbrella_header_path
}
" "${BUILT_PRODUCTS_DIR}"
printf "
\\
n
\\
nmodule ${PRODUCT_MODULE_NAME}.Swift {
\\
n header
\\
"${COMPATIBILITY_HEADER_PATH}
\\
"
\\
n requires objc
\\
n}
\\
n" >> "${MODULE_MAP_PATH}"
printf "
\\
n
\\
nmodule ${PRODUCT_MODULE_NAME}.Swift {
\\
n header
\\
"${COMPATIBILITY_HEADER_PATH}
\\
"
\\
n requires objc
\\
n}
\\
n" >> "${MODULE_MAP_PATH}"
SH
SH
build_phase
.
input_paths
=
%W(
build_phase
.
input_paths
=
%W(
${DERIVED_SOURCES_DIR}/${PRODUCT_MODULE_NAME}-Swift.h
${DERIVED_SOURCES_DIR}/${PRODUCT_MODULE_NAME}-Swift.h
${PODS_ROOT}/
#{
target
.
module_map_path
.
relative_path_from
(
target
.
sandbox
.
root
)
}
${PODS_ROOT}/
#{
relative_module_map_path
}
${PODS_ROOT}/
#{
relative_umbrella_header_path
}
)
)
build_phase
.
output_paths
=
%
w
(
build_phase
.
output_paths
=
%
W
(
${BUILT_PRODUCTS_DIR}/${PRODUCT_MODULE_NAME}.modulemap
${BUILT_PRODUCTS_DIR}/${PRODUCT_MODULE_NAME}.modulemap
${BUILT_PRODUCTS_DIR}/
#{
relative_umbrella_header_path
.
basename
}
${BUILT_PRODUCTS_DIR}/Swift
\
Compatibility
\
Header/${PRODUCT_MODULE_NAME}-Swift.h
${BUILT_PRODUCTS_DIR}/Swift
\
Compatibility
\
Header/${PRODUCT_MODULE_NAME}-Swift.h
)
)
end
end
...
...
lib/cocoapods/installer/xcode/pods_project_generator/target_installer.rb
View file @
ec2073bf
...
@@ -204,10 +204,10 @@ module Pod
...
@@ -204,10 +204,10 @@ module Pod
file_ref
=
add_file_to_support_group
(
path
)
file_ref
=
add_file_to_support_group
(
path
)
native_target
.
add_file_references
([
file_ref
])
native_target
.
add_file_references
([
file_ref
])
# Make the umbrella header public
acl
=
target
.
requires_frameworks?
?
'Public'
:
'Project'
build_file
=
native_target
.
headers_build_phase
.
build_file
(
file_ref
)
build_file
=
native_target
.
headers_build_phase
.
build_file
(
file_ref
)
build_file
.
settings
||=
{}
build_file
.
settings
||=
{}
build_file
.
settings
[
'ATTRIBUTES'
]
=
[
'Public'
]
build_file
.
settings
[
'ATTRIBUTES'
]
=
[
acl
]
end
end
end
end
...
...
cocoapods-integration-specs
@
6ea6db14
Subproject commit
94fd69236ef1f5c92eca020bd7eb4bd5b34138ce
Subproject commit
6ea6db143cff938564b90b63769bcb40a9aaac8b
spec/unit/installer/xcode/pods_project_generator/aggregate_target_installer_spec.rb
View file @
ec2073bf
...
@@ -255,6 +255,28 @@ module Pod
...
@@ -255,6 +255,28 @@ module Pod
script
=
support_files_dir
+
'Pods-SampleProject-frameworks.sh'
script
=
support_files_dir
+
'Pods-SampleProject-frameworks.sh'
File
.
exist?
(
script
).
should
==
false
File
.
exist?
(
script
).
should
==
false
end
end
it
'installs umbrella headers for swift static libraries'
do
@pod_target
.
stubs
(
:uses_swift?
=>
true
)
@target
.
stubs
(
:uses_swift?
=>
true
)
@installer
.
install!
build_files
=
@installer
.
target
.
native_target
.
headers_build_phase
.
files
build_file
=
build_files
.
find
{
|
bf
|
bf
.
file_ref
.
path
.
include?
(
'Pods-SampleProject-umbrella.h'
)
}
build_file
.
should
.
not
.
be
.
nil
build_file
.
settings
.
should
==
{
'ATTRIBUTES'
=>
[
'Project'
]
}
end
it
'installs umbrella headers for frameworks'
do
@pod_target
.
stubs
(
:requires_frameworks?
=>
true
)
@target
.
stubs
(
:requires_frameworks?
=>
true
)
@installer
.
install!
build_files
=
@installer
.
target
.
native_target
.
headers_build_phase
.
files
build_file
=
build_files
.
find
{
|
bf
|
bf
.
file_ref
.
path
.
include?
(
'Pods-SampleProject-umbrella.h'
)
}
build_file
.
should
.
not
.
be
.
nil
build_file
.
settings
.
should
==
{
'ATTRIBUTES'
=>
[
'Public'
]
}
end
end
end
end
end
end
end
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment