Commit b55dadbb authored by Ben Asher's avatar Ben Asher

run codesigning in parallel if PARALLEL_CODE_SIGN is set to true

parent 849935d6
......@@ -34,6 +34,11 @@ module Pod
# @return [String] The contents of the embed frameworks script.
#
def script
codesign_bg = ''
parallel_codesign = ENV['PARALLEL_CODE_SIGN'] == 'true'
if parallel_codesign
codesign_bg = ' &'
end
script = <<-SH.strip_heredoc
#!/bin/sh
set -e
......@@ -96,8 +101,8 @@ module Pod
if [ -n "${EXPANDED_CODE_SIGN_IDENTITY}" -a "${CODE_SIGNING_REQUIRED}" != "NO" -a "${CODE_SIGNING_ALLOWED}" != "NO" ]; then
# Use the current code_sign_identitiy
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\\""
/usr/bin/codesign --force --sign ${EXPANDED_CODE_SIGN_IDENTITY} ${OTHER_CODE_SIGN_FLAGS} --preserve-metadata=identifier,entitlements "$1"
echo "/usr/bin/codesign --force --sign ${EXPANDED_CODE_SIGN_IDENTITY} ${OTHER_CODE_SIGN_FLAGS} --preserve-metadata=identifier,entitlements \\"$1\\"#{codesign_bg}"
/usr/bin/codesign --force --sign ${EXPANDED_CODE_SIGN_IDENTITY} ${OTHER_CODE_SIGN_FLAGS} --preserve-metadata=identifier,entitlements "$1"#{codesign_bg}
fi
}
......@@ -130,6 +135,7 @@ module Pod
script << "fi\n"
end
end
script << "wait\n" unless frameworks_by_config.values.all?(&:empty?) || !parallel_codesign
script
end
end
......
......@@ -2,23 +2,45 @@ require File.expand_path('../../../spec_helper', __FILE__)
module Pod
describe Generator::EmbedFrameworksScript do
it 'returns the embed frameworks script' do
before do
ENV.delete('PARALLEL_CODE_SIGN')
frameworks = {
'Debug' => %w(Pods/Loopback.framework Reveal.framework),
'Release' => %w(CrashlyticsFramework.framework),
}
generator = Pod::Generator::EmbedFrameworksScript.new(frameworks)
generator.send(:script).should.include <<-SH.strip_heredoc
@generator = Pod::Generator::EmbedFrameworksScript.new(frameworks)
end
it 'returns the embed frameworks script' do
@generator.send(:script).should.include <<-SH.strip_heredoc
if [[ "$CONFIGURATION" == "Debug" ]]; then
install_framework "Pods/Loopback.framework"
install_framework "Reveal.framework"
fi
SH
generator.send(:script).should.include <<-SH.strip_heredoc
@generator.send(:script).should.include <<-SH.strip_heredoc
if [[ "$CONFIGURATION" == "Release" ]]; then
install_framework "CrashlyticsFramework.framework"
fi
SH
end
it 'runs codesigning in the background when PARALLEL_CODE_SIGN is set to true' do
ENV['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 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
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