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
76261935
Commit
76261935
authored
Jul 18, 2015
by
Samuel E. Giddins
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[EmbedFrameworksScript] Strip fat frameworks
parent
2c5ef52b
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
28 additions
and
3 deletions
+28
-3
embed_frameworks_script.rb
lib/cocoapods/generator/embed_frameworks_script.rb
+28
-3
No files found.
lib/cocoapods/generator/embed_frameworks_script.rb
View file @
76261935
...
...
@@ -64,14 +64,21 @@ module Pod
echo "rsync -av --filter
\\
"- CVS/
\\
" --filter
\\
"- .svn/
\\
" --filter
\\
"- .git/
\\
" --filter
\\
"- .hg/
\\
" --filter
\\
"- Headers
\\
" --filter
\\
"- PrivateHeaders
\\
" --filter
\\
"- Modules
\\
"
\\
"${source}
\\
"
\\
"${destination}
\\
""
rsync -av --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${source}" "${destination}"
local basename
basename="$(basename "$1" | sed -E s/
\\\\
..+// && exit ${PIPESTATUS[0]})"
binary="${destination}/${basename}.framework/${basename}"
# Strip invalid architectures so "fat" simulator / device frameworks work on device
if [[ "$(file "$binary")" == *"dynamically linked shared library"* ]]; then
strip_invalid_archs "$binary"
fi
# Resign the code if required by the build settings to avoid unstable apps
code_sign_if_enabled "${destination}/$(basename "$1")"
# Embed linked Swift runtime libraries
local basename
basename="$(basename "$1" | sed -E s/
\\\\
..+// && exit ${PIPESTATUS[0]})"
local swift_runtime_libs
swift_runtime_libs=$(xcrun otool -LX "$
{CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/${basename}.framework/${basename}
" | grep --color=never @rpath/libswift | sed -E s/@rpath
\\\\
/
\\
(.+dylib
\\
).*/
\\\\
1/g | uniq -u && exit ${PIPESTATUS[0]})
swift_runtime_libs=$(xcrun otool -LX "$
binary
" | grep --color=never @rpath/libswift | sed -E s/@rpath
\\\\
/
\\
(.+dylib
\\
).*/
\\\\
1/g | uniq -u && exit ${PIPESTATUS[0]})
for lib in $swift_runtime_libs; do
echo "rsync -auv
\\
"${SWIFT_STDLIB_PATH}/${lib}
\\
"
\\
"${destination}
\\
""
rsync -auv "${SWIFT_STDLIB_PATH}/${lib}" "${destination}"
...
...
@@ -89,6 +96,24 @@ module Pod
fi
}
# Strip invalid architectures
strip_invalid_archs() {
binary="$1"
# Get architectures for current file
archs="$(lipo -info "$binary" | rev | cut -d ':' -f1 | rev)"
stripped=""
for arch in $archs; do
if ! [[ "${VALID_ARCHS}" == *"$arch"* ]]; then
# Strip non-valid architectures in-place
lipo -remove "$arch" -output "$binary" "$binary" || exit 1
stripped="$stripped $arch"
fi
done
if [[ "$stripped" ]]; then
echo "Stripped $binary of architectures:$stripped"
fi
}
eos
script
+=
"
\n
"
unless
frameworks_by_config
.
values
.
all?
(
&
:empty?
)
frameworks_by_config
.
each
do
|
config
,
frameworks
|
...
...
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