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
0d889c8c
Commit
0d889c8c
authored
Oct 27, 2016
by
Ben Asher
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
check env var in shell script
parent
5070013c
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
34 deletions
+16
-34
embed_frameworks_script.rb
lib/cocoapods/generator/embed_frameworks_script.rb
+12
-8
embed_frameworks_script_spec.rb
spec/unit/generator/embed_frameworks_script_spec.rb
+4
-26
No files found.
lib/cocoapods/generator/embed_frameworks_script.rb
View file @
0d889c8c
...
@@ -34,11 +34,6 @@ module Pod
...
@@ -34,11 +34,6 @@ module Pod
# @return [String] The contents of the embed frameworks script.
# @return [String] The contents of the embed frameworks script.
#
#
def
script
def
script
codesign_bg
=
''
parallel_codesign
=
ENV
[
'COCOAPODS_PARALLEL_CODE_SIGN'
]
==
'true'
if
parallel_codesign
codesign_bg
=
' &'
end
script
=
<<-
SH
.
strip_heredoc
script
=
<<-
SH
.
strip_heredoc
#!/bin/sh
#!/bin/sh
set -e
set -e
...
@@ -101,8 +96,13 @@ module Pod
...
@@ -101,8 +96,13 @@ module Pod
if [ -n "${EXPANDED_CODE_SIGN_IDENTITY}" -a "${CODE_SIGNING_REQUIRED}" != "NO" -a "${CODE_SIGNING_ALLOWED}" != "NO" ]; then
if [ -n "${EXPANDED_CODE_SIGN_IDENTITY}" -a "${CODE_SIGNING_REQUIRED}" != "NO" -a "${CODE_SIGNING_ALLOWED}" != "NO" ]; then
# Use the current code_sign_identitiy
# Use the current code_sign_identitiy
echo "Code Signing $1 with Identity ${EXPANDED_CODE_SIGN_IDENTITY_NAME}"
echo "Code Signing $1 with Identity ${EXPANDED_CODE_SIGN_IDENTITY_NAME}"
echo "/usr/bin/codesign --force --sign ${EXPANDED_CODE_SIGN_IDENTITY} ${OTHER_CODE_SIGN_FLAGS} --preserve-metadata=identifier,entitlements
\\
"$1
\\
"
#{
codesign_bg
}
"
local code_sign_cmd="/usr/bin/codesign --force --sign ${EXPANDED_CODE_SIGN_IDENTITY} ${OTHER_CODE_SIGN_FLAGS} --preserve-metadata=identifier,entitlements
\"
$1
\"
"
/usr/bin/codesign --force --sign ${EXPANDED_CODE_SIGN_IDENTITY} ${OTHER_CODE_SIGN_FLAGS} --preserve-metadata=identifier,entitlements "$1"
#{
codesign_bg
}
if [ "${COCOAPODS_PARALLEL_CODE_SIGN}" == "true" ]; then
code_sign_cmd="$code_sign_cmd &"
fi
echo "$code_sign_cmd"
eval "$code_sign_cmd"
fi
fi
}
}
...
@@ -135,7 +135,11 @@ module Pod
...
@@ -135,7 +135,11 @@ module Pod
script
<<
"fi
\n
"
script
<<
"fi
\n
"
end
end
end
end
script
<<
"wait
\n
"
unless
frameworks_by_config
.
values
.
all?
(
&
:empty?
)
||
!
parallel_codesign
script
<<
<<-
SH
.
strip_heredoc
if [ "${COCOAPODS_PARALLEL_CODE_SIGN}" == "true" ]; then
wait
fi
SH
script
script
end
end
end
end
...
...
spec/unit/generator/embed_frameworks_script_spec.rb
View file @
0d889c8c
...
@@ -2,45 +2,23 @@ require File.expand_path('../../../spec_helper', __FILE__)
...
@@ -2,45 +2,23 @@ require File.expand_path('../../../spec_helper', __FILE__)
module
Pod
module
Pod
describe
Generator
::
EmbedFrameworksScript
do
describe
Generator
::
EmbedFrameworksScript
do
before
do
it
'returns the embed frameworks script'
do
ENV
.
delete
(
'COCOAPODS_PARALLEL_CODE_SIGN'
)
frameworks
=
{
frameworks
=
{
'Debug'
=>
%w(Pods/Loopback.framework Reveal.framework)
,
'Debug'
=>
%w(Pods/Loopback.framework Reveal.framework)
,
'Release'
=>
%w(CrashlyticsFramework.framework)
,
'Release'
=>
%w(CrashlyticsFramework.framework)
,
}
}
@generator
=
Pod
::
Generator
::
EmbedFrameworksScript
.
new
(
frameworks
)
generator
=
Pod
::
Generator
::
EmbedFrameworksScript
.
new
(
frameworks
)
end
generator
.
send
(
:script
).
should
.
include
<<-
SH
.
strip_heredoc
it
'returns the embed frameworks script'
do
@generator
.
send
(
:script
).
should
.
include
<<-
SH
.
strip_heredoc
if [[ "$CONFIGURATION" == "Debug" ]]; then
if [[ "$CONFIGURATION" == "Debug" ]]; then
install_framework "Pods/Loopback.framework"
install_framework "Pods/Loopback.framework"
install_framework "Reveal.framework"
install_framework "Reveal.framework"
fi
fi
SH
SH
@
generator
.
send
(
:script
).
should
.
include
<<-
SH
.
strip_heredoc
generator
.
send
(
:script
).
should
.
include
<<-
SH
.
strip_heredoc
if [[ "$CONFIGURATION" == "Release" ]]; then
if [[ "$CONFIGURATION" == "Release" ]]; then
install_framework "CrashlyticsFramework.framework"
install_framework "CrashlyticsFramework.framework"
fi
fi
SH
SH
end
end
it
'runs codesigning in the background when COCOAPODS_PARALLEL_CODE_SIGN is set to true'
do
ENV
[
'COCOAPODS_PARALLEL_CODE_SIGN'
]
=
'true'
@generator
.
send
(
:script
).
should
.
include
<<-
SH
.
strip_heredoc
/usr/bin/codesign --force --sign ${EXPANDED_CODE_SIGN_IDENTITY} ${OTHER_CODE_SIGN_FLAGS} --preserve-metadata=identifier,entitlements "$1" &
SH
@generator
.
send
(
:script
).
should
.
include
<<-
SH
.
strip_heredoc
wait
SH
end
it
'does not run codesigning in the background when COCOAPODS_PARALLEL_CODE_SIGN is set to true'
do
@generator
.
send
(
:script
).
should
.
include
<<-
SH
.
strip_heredoc
/usr/bin/codesign --force --sign ${EXPANDED_CODE_SIGN_IDENTITY} ${OTHER_CODE_SIGN_FLAGS} --preserve-metadata=identifier,entitlements "$1"
SH
@generator
.
send
(
:script
).
should
.
not
.
include
<<-
SH
.
strip_heredoc
/usr/bin/codesign --force --sign ${EXPANDED_CODE_SIGN_IDENTITY} ${OTHER_CODE_SIGN_FLAGS} --preserve-metadata=identifier,entitlements "$1" &
SH
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