fastlane 2.108.0 → 2.109.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +76 -76
- data/deliver/lib/deliver/app_screenshot.rb +22 -1
- data/fastlane/lib/fastlane/action_collector.rb +1 -22
- data/fastlane/lib/fastlane/actions/appetize.rb +20 -3
- data/fastlane/lib/fastlane/actions/docs/build_ios_app.md +12 -9
- data/fastlane/lib/fastlane/actions/pod_lib_lint.rb +25 -16
- data/fastlane/lib/fastlane/actions/pod_push.rb +1 -1
- data/fastlane/lib/fastlane/actions/puts.rb +1 -1
- data/fastlane/lib/fastlane/actions/set_github_release.rb +1 -0
- data/fastlane/lib/fastlane/actions/testfairy.rb +11 -5
- data/fastlane/lib/fastlane/fast_file.rb +9 -6
- data/fastlane/lib/fastlane/helper/adb_helper.rb +3 -3
- data/fastlane/lib/fastlane/helper/crashlytics_helper.rb +5 -5
- data/fastlane/lib/fastlane/version.rb +1 -1
- data/fastlane/swift/Deliverfile.swift +1 -1
- data/fastlane/swift/Fastlane.swift +16 -6
- data/fastlane/swift/Gymfile.swift +1 -1
- data/fastlane/swift/Matchfile.swift +1 -1
- data/fastlane/swift/Precheckfile.swift +1 -1
- data/fastlane/swift/Scanfile.swift +1 -1
- data/fastlane/swift/Screengrabfile.swift +1 -1
- data/fastlane/swift/Snapshotfile.swift +1 -1
- data/fastlane_core/lib/fastlane_core.rb +0 -1
- data/fastlane_core/lib/fastlane_core/configuration/configuration.rb +2 -2
- data/fastlane_core/lib/fastlane_core/project.rb +9 -11
- data/match/lib/match/encryption.rb +33 -9
- data/match/lib/match/runner.rb +15 -3
- data/match/lib/match/spaceship_ensure.rb +2 -5
- data/match/lib/match/storage.rb +29 -7
- data/match/lib/match/storage/git_storage.rb +30 -48
- data/match/lib/match/storage/interface.rb +39 -1
- data/precheck/lib/precheck/rules/other_platforms_rule.rb +4 -1
- data/scan/lib/scan/error_handler.rb +8 -1
- data/sigh/lib/assets/resign.sh +39 -63
- data/snapshot/lib/snapshot/reports_generator.rb +1 -0
- data/spaceship/lib/spaceship/client.rb +174 -58
- data/spaceship/lib/spaceship/commands_generator.rb +1 -0
- data/spaceship/lib/spaceship/du/du_client.rb +18 -12
- data/spaceship/lib/spaceship/spaceauth_runner.rb +1 -1
- data/spaceship/lib/spaceship/tunes/app_submission.rb +2 -1
- data/spaceship/lib/spaceship/tunes/device_type.rb +1 -1
- data/spaceship/lib/spaceship/tunes/tunes_client.rb +5 -2
- data/spaceship/lib/spaceship/{two_step_client.rb → two_step_or_factor_client.rb} +65 -96
- data/supply/lib/supply/options.rb +17 -3
- data/supply/lib/supply/uploader.rb +12 -5
- metadata +17 -19
- data/deliver/lib/deliver/.app_screenshot.rb.swp +0 -0
- data/fastlane_core/lib/fastlane_core/tool_collector.rb +0 -304
data/match/lib/match/runner.rb
CHANGED
@@ -166,7 +166,7 @@ module Match
|
|
166
166
|
|
167
167
|
if params[:force_for_new_devices] && !params[:readonly]
|
168
168
|
if prov_type != :appstore
|
169
|
-
params[:force] = device_count_different?(profile: profile, keychain_path: keychain_path) unless params[:force]
|
169
|
+
params[:force] = device_count_different?(profile: profile, keychain_path: keychain_path, platform: params[:platform].to_sym) unless params[:force]
|
170
170
|
else
|
171
171
|
# App Store provisioning profiles don't contain device identifiers and
|
172
172
|
# thus shouldn't be renewed if the device count has changed.
|
@@ -229,7 +229,7 @@ module Match
|
|
229
229
|
return uuid
|
230
230
|
end
|
231
231
|
|
232
|
-
def device_count_different?(profile: nil, keychain_path: nil)
|
232
|
+
def device_count_different?(profile: nil, keychain_path: nil, platform: nil)
|
233
233
|
return false unless profile
|
234
234
|
|
235
235
|
parsed = FastlaneCore::ProvisioningProfile.parse(profile, keychain_path)
|
@@ -238,7 +238,19 @@ module Match
|
|
238
238
|
|
239
239
|
if portal_profile
|
240
240
|
profile_device_count = portal_profile.devices.count
|
241
|
-
|
241
|
+
|
242
|
+
portal_device_count =
|
243
|
+
case platform
|
244
|
+
when :ios
|
245
|
+
Spaceship.device.all_ios_profile_devices.count
|
246
|
+
when :tvos
|
247
|
+
Spaceship.device.all_apple_tvs.count
|
248
|
+
when :mac
|
249
|
+
Spaceship.device.all_macs.count
|
250
|
+
else
|
251
|
+
Spaceship.device.all.count
|
252
|
+
end
|
253
|
+
|
242
254
|
return portal_device_count != profile_device_count
|
243
255
|
end
|
244
256
|
return false
|
@@ -59,11 +59,8 @@ module Match
|
|
59
59
|
end
|
60
60
|
|
61
61
|
unless found
|
62
|
-
UI.error("Provisioning profile '#{uuid}' is not available on the Developer Portal")
|
63
|
-
|
64
|
-
UI.error("Make sure to use the same user and team every time you run 'match' for this")
|
65
|
-
UI.error("Git repository. This might be caused by deleting the provisioning profile on the Dev Portal")
|
66
|
-
UI.user_error!("To reset the provisioning profiles of your Apple account, you can use the `fastlane match nuke` feature, more information on https://docs.fastlane.tools/actions/match/")
|
62
|
+
UI.error("Provisioning profile '#{uuid}' is not available on the Developer Portal for the user #{username}, fixing this now for you 🔨")
|
63
|
+
return false
|
67
64
|
end
|
68
65
|
|
69
66
|
if found.valid?
|
data/match/lib/match/storage.rb
CHANGED
@@ -3,13 +3,35 @@ require_relative 'storage/git_storage'
|
|
3
3
|
|
4
4
|
module Match
|
5
5
|
module Storage
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
6
|
+
class << self
|
7
|
+
def backends
|
8
|
+
@backends ||= {
|
9
|
+
"git" => lambda { |params|
|
10
|
+
return Storage::GitStorage.configure(params)
|
11
|
+
}
|
12
|
+
}
|
13
|
+
end
|
14
|
+
|
15
|
+
def register_backend(type: nil, storage_class: nil, &configurator)
|
16
|
+
UI.user_error!("No type specified for storage backend") if type.nil?
|
17
|
+
|
18
|
+
normalized_name = type.to_s
|
19
|
+
UI.message("Replacing Match::Encryption backend for type '#{normalized_name}'") if backends.include?(normalized_name)
|
20
|
+
|
21
|
+
if configurator
|
22
|
+
@backends[normalized_name] = configurator
|
23
|
+
elsif storage_class
|
24
|
+
@backends[normalized_name] = ->(params) { return storage_class.configure(params) }
|
25
|
+
else
|
26
|
+
UI.user_error!("Specify either a `storage_class` or a configuration block when registering a storage backend")
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
def for_mode(storage_mode, params)
|
31
|
+
configurator = backends[storage_mode.to_s]
|
32
|
+
return configurator.call(params) if configurator
|
33
|
+
|
34
|
+
UI.user_error!("No storage backend for storage mode '#{storage_mode}'")
|
13
35
|
end
|
14
36
|
end
|
15
37
|
end
|
@@ -7,8 +7,6 @@ module Match
|
|
7
7
|
module Storage
|
8
8
|
# Store the code signing identities in a git repo
|
9
9
|
class GitStorage < Interface
|
10
|
-
MATCH_VERSION_FILE_NAME = "match_version.txt"
|
11
|
-
|
12
10
|
# User provided values
|
13
11
|
attr_accessor :git_url
|
14
12
|
attr_accessor :shallow_clone
|
@@ -98,54 +96,18 @@ module Match
|
|
98
96
|
checkout_branch unless self.branch == "master"
|
99
97
|
end
|
100
98
|
|
101
|
-
def
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
if !File.exist?(MATCH_VERSION_FILE_NAME) || File.read(MATCH_VERSION_FILE_NAME) != Fastlane::VERSION.to_s
|
107
|
-
files_to_commit << MATCH_VERSION_FILE_NAME
|
108
|
-
File.write(MATCH_VERSION_FILE_NAME, Fastlane::VERSION) # stored unencrypted
|
109
|
-
end
|
110
|
-
|
111
|
-
template = File.read("#{Match::ROOT}/lib/assets/READMETemplate.md")
|
112
|
-
readme_path = "README.md"
|
113
|
-
if (!File.exist?(readme_path) || File.read(readme_path) != template) && !self.skip_docs
|
114
|
-
files_to_commit << readme_path
|
115
|
-
File.write(readme_path, template)
|
116
|
-
end
|
117
|
-
|
118
|
-
# `git add` each file we want to commit
|
119
|
-
# - Fixes https://github.com/fastlane/fastlane/issues/8917
|
120
|
-
# - Fixes https://github.com/fastlane/fastlane/issues/8793
|
121
|
-
# - Replaces, closes and fixes https://github.com/fastlane/fastlane/pull/8919
|
122
|
-
commands += files_to_commit.map do |current_file|
|
123
|
-
"git add #{current_file.shellescape}"
|
124
|
-
end
|
125
|
-
else
|
126
|
-
# No specific list given, e.g. this happens on `fastlane match nuke`
|
127
|
-
# We just want to run `git add -A` to commit everything
|
128
|
-
commands << "git add -A"
|
129
|
-
end
|
130
|
-
commit_message = custom_message || generate_commit_message
|
131
|
-
commands << "git commit -m #{commit_message.shellescape}"
|
132
|
-
commands << "GIT_TERMINAL_PROMPT=0 git push origin #{self.branch.shellescape}"
|
133
|
-
|
134
|
-
UI.message("Pushing changes to remote git repo...")
|
135
|
-
|
136
|
-
begin
|
137
|
-
commands.each do |command|
|
138
|
-
FastlaneCore::CommandExecutor.execute(command: command,
|
139
|
-
print_all: FastlaneCore::Globals.verbose?,
|
140
|
-
print_command: FastlaneCore::Globals.verbose?)
|
141
|
-
end
|
99
|
+
def delete_files(files_to_delete: [], custom_message: nil)
|
100
|
+
# No specific list given, e.g. this happens on `fastlane match nuke`
|
101
|
+
# We just want to run `git add -A` to commit everything
|
102
|
+
git_push(commands: ["git add -A"], commit_message: custom_message)
|
103
|
+
end
|
142
104
|
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
UI.error(ex)
|
147
|
-
end
|
105
|
+
def upload_files(files_to_upload: [], custom_message: nil)
|
106
|
+
commands = files_to_upload.map do |current_file|
|
107
|
+
"git add #{current_file.shellescape}"
|
148
108
|
end
|
109
|
+
|
110
|
+
git_push(commands: commands, commit_message: custom_message)
|
149
111
|
end
|
150
112
|
|
151
113
|
def clear_changes
|
@@ -223,6 +185,26 @@ module Match
|
|
223
185
|
end
|
224
186
|
end
|
225
187
|
end
|
188
|
+
|
189
|
+
private # rubocop:disable Lint/UselessAccessModifier
|
190
|
+
|
191
|
+
def git_push(commands: [], commit_message: nil)
|
192
|
+
commit_message ||= generate_commit_message
|
193
|
+
commands << "git commit -m #{commit_message.shellescape}"
|
194
|
+
commands << "GIT_TERMINAL_PROMPT=0 git push origin #{self.branch.shellescape}"
|
195
|
+
|
196
|
+
UI.message("Pushing changes to remote git repo...")
|
197
|
+
commands.each do |command|
|
198
|
+
FastlaneCore::CommandExecutor.execute(command: command,
|
199
|
+
print_all: FastlaneCore::Globals.verbose?,
|
200
|
+
print_command: FastlaneCore::Globals.verbose?)
|
201
|
+
end
|
202
|
+
|
203
|
+
self.clear_changes
|
204
|
+
rescue => ex
|
205
|
+
UI.error("Couldn't commit or push changes back to git...")
|
206
|
+
UI.error(ex)
|
207
|
+
end
|
226
208
|
end
|
227
209
|
end
|
228
210
|
end
|
@@ -1,6 +1,10 @@
|
|
1
|
+
require_relative '../module'
|
2
|
+
|
1
3
|
module Match
|
2
4
|
module Storage
|
3
5
|
class Interface
|
6
|
+
MATCH_VERSION_FILE_NAME = "match_version.txt"
|
7
|
+
|
4
8
|
# The working directory in which we download all the profiles
|
5
9
|
# and decrypt/encrypt them
|
6
10
|
attr_accessor :working_directory
|
@@ -37,7 +41,41 @@ module Match
|
|
37
41
|
# that should be committed to the storage provider
|
38
42
|
# @parameter custom_message: [String] Custom change message
|
39
43
|
# that's optional, is used for commit title
|
40
|
-
def save_changes!(files_to_commit: [], custom_message: nil)
|
44
|
+
def save_changes!(files_to_commit: [], files_to_delete: [], custom_message: nil)
|
45
|
+
Dir.chdir(File.expand_path(self.working_directory)) do
|
46
|
+
if files_to_commit.count > 0 # everything that isn't `match nuke`
|
47
|
+
UI.user_error!("You can't provide both `files_to_delete` and `files_to_commit` right now") if files_to_delete.count > 0
|
48
|
+
|
49
|
+
if !File.exist?(MATCH_VERSION_FILE_NAME) || File.read(MATCH_VERSION_FILE_NAME) != Fastlane::VERSION.to_s
|
50
|
+
files_to_commit << MATCH_VERSION_FILE_NAME
|
51
|
+
File.write(MATCH_VERSION_FILE_NAME, Fastlane::VERSION) # stored unencrypted
|
52
|
+
end
|
53
|
+
|
54
|
+
template = File.read("#{Match::ROOT}/lib/assets/READMETemplate.md")
|
55
|
+
readme_path = "README.md"
|
56
|
+
if (!File.exist?(readme_path) || File.read(readme_path) != template) && !self.skip_docs
|
57
|
+
files_to_commit << readme_path
|
58
|
+
File.write(readme_path, template)
|
59
|
+
end
|
60
|
+
|
61
|
+
self.upload_files(files_to_upload: files_to_commit, custom_message: custom_message)
|
62
|
+
elsif files_to_delete.count > 0
|
63
|
+
self.delete_files(files_to_delete: files_to_delete, custom_message: custom_message)
|
64
|
+
else
|
65
|
+
UI.user_error!("Neither `files_to_commit` nor `files_to_delete` were provided to the `save_changes!` method call")
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
def upload_files(files_to_upload: [], custom_message: nil)
|
71
|
+
not_implemented(__method__)
|
72
|
+
end
|
73
|
+
|
74
|
+
def delete_files(files_to_delete: [], custom_message: nil)
|
75
|
+
not_implemented(__method__)
|
76
|
+
end
|
77
|
+
|
78
|
+
def skip_docs
|
41
79
|
not_implemented(__method__)
|
42
80
|
end
|
43
81
|
|
@@ -24,11 +24,18 @@ module Scan
|
|
24
24
|
print("https://stackoverflow.com/a/17031697/445598")
|
25
25
|
when /Testing failed/
|
26
26
|
UI.build_failure!("Error building the application - see the log above")
|
27
|
-
when /Executed/
|
27
|
+
when /Executed/, /Failing tests:/
|
28
28
|
# this is *really* important:
|
29
29
|
# we don't want to raise an exception here
|
30
30
|
# as we handle this in runner.rb at a later point
|
31
31
|
# after parsing the actual test results
|
32
|
+
# ------------------------------------------------
|
33
|
+
# For the "Failing tests:" case, this covers Xcode
|
34
|
+
# 10 parallel testing failure, which doesn't
|
35
|
+
# print out the "Executed" line that would show
|
36
|
+
# test summary (number of tests passed, etc.).
|
37
|
+
# Instead, it just prints "Failing tests:"
|
38
|
+
# followed by a list of tests that failed.
|
32
39
|
return
|
33
40
|
end
|
34
41
|
UI.build_failure!("Error building/testing the application - see the log above")
|
data/sigh/lib/assets/resign.sh
CHANGED
@@ -60,6 +60,9 @@
|
|
60
60
|
# 4. extracts the entitlements from the provisioning profile
|
61
61
|
# 5. copy the entitlements as archived-expanded-entitlements.xcent inside the app bundle (because Xcode does too)
|
62
62
|
#
|
63
|
+
# new features November 2018
|
64
|
+
# 1. only create the archived-expanded-entitlements.xcent file if the version of Xcode < 9.3 as Xcode 10 does not create it.
|
65
|
+
#
|
63
66
|
|
64
67
|
# Logging functions
|
65
68
|
|
@@ -81,8 +84,7 @@ warning() {
|
|
81
84
|
function checkStatus {
|
82
85
|
|
83
86
|
# shellcheck disable=SC2181
|
84
|
-
if [ $? -ne 0 ];
|
85
|
-
then
|
87
|
+
if [ $? -ne 0 ]; then
|
86
88
|
error "Encountered an error, aborting!"
|
87
89
|
fi
|
88
90
|
}
|
@@ -154,6 +156,7 @@ PROVISIONS_BY_ID=()
|
|
154
156
|
DEFAULT_PROVISION=""
|
155
157
|
TEMP_DIR="_floatsignTemp"
|
156
158
|
USE_APP_ENTITLEMENTS=""
|
159
|
+
XCODE_VERSION="$(xcodebuild -version | grep "Xcode" | /usr/bin/cut -f 2 -d ' ')"
|
157
160
|
|
158
161
|
# List of plist keys used for reference to and from nested apps and extensions
|
159
162
|
NESTED_APP_REFERENCE_KEYS=(":WKCompanionAppBundleIdentifier" ":NSExtension:NSExtensionAttributes:WKAppBundleIdentifier")
|
@@ -220,8 +223,7 @@ while [ "$1" != "" ]; do
|
|
220
223
|
done
|
221
224
|
|
222
225
|
KEYCHAIN_FLAG=
|
223
|
-
if [ -n "$KEYCHAIN_PATH" ]
|
224
|
-
then
|
226
|
+
if [ -n "$KEYCHAIN_PATH" ]; then
|
225
227
|
KEYCHAIN_FLAG="--keychain $KEYCHAIN_PATH"
|
226
228
|
fi
|
227
229
|
|
@@ -254,8 +256,7 @@ log "Certificate: '$CERTIFICATE'"
|
|
254
256
|
[[ -n "${USE_APP_ENTITLEMENTS}" && -n ${ENTITLEMENTS} ]] && error "--use-app-entitlements option cannot be used in combination with -e, --entitlements option."
|
255
257
|
|
256
258
|
# Check output file name
|
257
|
-
if [ -z "$NEW_FILE" ];
|
258
|
-
then
|
259
|
+
if [ -z "$NEW_FILE" ]; then
|
259
260
|
error "Output file name required"
|
260
261
|
fi
|
261
262
|
|
@@ -264,8 +265,7 @@ if [[ "${#RAW_PROVISIONS[*]}" == "0" ]]; then
|
|
264
265
|
fi
|
265
266
|
|
266
267
|
# Check for and remove the temporary directory if it already exists
|
267
|
-
if [ -d "$TEMP_DIR" ];
|
268
|
-
then
|
268
|
+
if [ -d "$TEMP_DIR" ]; then
|
269
269
|
log "Removing previous temporary directory: '$TEMP_DIR'"
|
270
270
|
rm -Rf "$TEMP_DIR"
|
271
271
|
fi
|
@@ -275,13 +275,11 @@ extension="${filename##*.}"
|
|
275
275
|
filename="${filename%.*}"
|
276
276
|
|
277
277
|
# Check if the supplied file is an ipa or an app file
|
278
|
-
if [ "${extension}" = "ipa" ]
|
279
|
-
then
|
278
|
+
if [ "${extension}" = "ipa" ]; then
|
280
279
|
# Unzip the old ipa quietly
|
281
280
|
unzip -q "$ORIGINAL_FILE" -d $TEMP_DIR
|
282
281
|
checkStatus
|
283
|
-
elif [ "${extension}" = "app" ]
|
284
|
-
then
|
282
|
+
elif [ "${extension}" = "app" ]; then
|
285
283
|
# Copy the app file into an ipa-like structure
|
286
284
|
mkdir -p "$TEMP_DIR/Payload"
|
287
285
|
cp -Rf "${ORIGINAL_FILE}" "$TEMP_DIR/Payload/${filename}.app"
|
@@ -291,8 +289,7 @@ else
|
|
291
289
|
fi
|
292
290
|
|
293
291
|
# check the keychain
|
294
|
-
if [ "${KEYCHAIN}" != "" ];
|
295
|
-
then
|
292
|
+
if [ "${KEYCHAIN}" != "" ]; then
|
296
293
|
security list-keychains -s "$KEYCHAIN"
|
297
294
|
security unlock "$KEYCHAIN"
|
298
295
|
security default-keychain -s "$KEYCHAIN"
|
@@ -400,8 +397,7 @@ function resign {
|
|
400
397
|
fi
|
401
398
|
|
402
399
|
# Make sure that the Info.plist file is where we expect it
|
403
|
-
if [ ! -e "$APP_PATH/Info.plist" ];
|
404
|
-
then
|
400
|
+
if [ ! -e "$APP_PATH/Info.plist" ]; then
|
405
401
|
error "Expected file does not exist: '$APP_PATH/Info.plist'"
|
406
402
|
fi
|
407
403
|
|
@@ -447,10 +443,8 @@ function resign {
|
|
447
443
|
log "New bundle identifier will be: '$BUNDLE_IDENTIFIER'"
|
448
444
|
|
449
445
|
# Update the CFBundleDisplayName property in the Info.plist if a new name has been provided
|
450
|
-
if [ "${DISPLAY_NAME}" != "" ];
|
451
|
-
|
452
|
-
if [ "${DISPLAY_NAME}" != "${CURRENT_NAME}" ];
|
453
|
-
then
|
446
|
+
if [ "${DISPLAY_NAME}" != "" ]; then
|
447
|
+
if [ "${DISPLAY_NAME}" != "${CURRENT_NAME}" ]; then
|
454
448
|
log "Changing display name from '$CURRENT_NAME' to '$DISPLAY_NAME'"
|
455
449
|
PlistBuddy -c "Set :CFBundleDisplayName $DISPLAY_NAME" "$APP_PATH/Info.plist"
|
456
450
|
fi
|
@@ -465,8 +459,7 @@ function resign {
|
|
465
459
|
if [ "$APP_IDENTIFIER_PREFIX" == "" ];
|
466
460
|
then
|
467
461
|
APP_IDENTIFIER_PREFIX=$(PlistBuddy -c "Print :ApplicationIdentifierPrefix:0" "$TEMP_DIR/profile.plist")
|
468
|
-
if [ "$APP_IDENTIFIER_PREFIX" == "" ];
|
469
|
-
then
|
462
|
+
if [ "$APP_IDENTIFIER_PREFIX" == "" ]; then
|
470
463
|
error "Failed to extract any app identifier prefix from '$NEW_PROVISION'"
|
471
464
|
else
|
472
465
|
warning "WARNING: extracted an app identifier prefix '$APP_IDENTIFIER_PREFIX' from '$NEW_PROVISION', but it was not found in the profile's entitlements"
|
@@ -479,11 +472,9 @@ function resign {
|
|
479
472
|
PlistBuddy -c "Set :AppIdentifierPrefix $APP_IDENTIFIER_PREFIX." "$APP_PATH/Info.plist" 2>/dev/null
|
480
473
|
|
481
474
|
TEAM_IDENTIFIER=$(PlistBuddy -c "Print :Entitlements:com.apple.developer.team-identifier" "$TEMP_DIR/profile.plist" | tr -d '\n')
|
482
|
-
if [ "$TEAM_IDENTIFIER" == "" ];
|
483
|
-
then
|
475
|
+
if [ "$TEAM_IDENTIFIER" == "" ]; then
|
484
476
|
TEAM_IDENTIFIER=$(PlistBuddy -c "Print :TeamIdentifier:0" "$TEMP_DIR/profile.plist")
|
485
|
-
if [ "$TEAM_IDENTIFIER" == "" ];
|
486
|
-
then
|
477
|
+
if [ "$TEAM_IDENTIFIER" == "" ]; then
|
487
478
|
warning "Failed to extract team identifier from '$NEW_PROVISION', resigned ipa may fail on iOS 8 and higher"
|
488
479
|
else
|
489
480
|
warning "WARNING: extracted a team identifier '$TEAM_IDENTIFIER' from '$NEW_PROVISION', but it was not found in the profile's entitlements, resigned ipa may fail on iOS 8 and higher"
|
@@ -499,19 +490,16 @@ function resign {
|
|
499
490
|
cp -f "$NEW_PROVISION" "$APP_PATH/embedded.mobileprovision"
|
500
491
|
|
501
492
|
#if the current bundle identifier is different from the new one in the provisioning profile, then change it.
|
502
|
-
if [ "$CURRENT_BUNDLE_IDENTIFIER" != "$BUNDLE_IDENTIFIER" ];
|
503
|
-
then
|
493
|
+
if [ "$CURRENT_BUNDLE_IDENTIFIER" != "$BUNDLE_IDENTIFIER" ]; then
|
504
494
|
log "Updating the bundle identifier from '$CURRENT_BUNDLE_IDENTIFIER' to '$BUNDLE_IDENTIFIER'"
|
505
495
|
PlistBuddy -c "Set :CFBundleIdentifier $BUNDLE_IDENTIFIER" "$APP_PATH/Info.plist"
|
506
496
|
checkStatus
|
507
497
|
fi
|
508
498
|
|
509
499
|
# Update the version number properties in the Info.plist if a version number has been provided
|
510
|
-
if [ "$VERSION_NUMBER" != "" ];
|
511
|
-
then
|
500
|
+
if [ "$VERSION_NUMBER" != "" ]; then
|
512
501
|
CURRENT_VERSION_NUMBER=$(PlistBuddy -c "Print :CFBundleVersion" "$APP_PATH/Info.plist")
|
513
|
-
if [ "$VERSION_NUMBER" != "$CURRENT_VERSION_NUMBER" ];
|
514
|
-
then
|
502
|
+
if [ "$VERSION_NUMBER" != "$CURRENT_VERSION_NUMBER" ]; then
|
515
503
|
log "Updating the version from '$CURRENT_VERSION_NUMBER' to '$VERSION_NUMBER'"
|
516
504
|
PlistBuddy -c "Set :CFBundleVersion $VERSION_NUMBER" "$APP_PATH/Info.plist"
|
517
505
|
PlistBuddy -c "Set :CFBundleShortVersionString $VERSION_NUMBER" "$APP_PATH/Info.plist"
|
@@ -519,8 +507,7 @@ function resign {
|
|
519
507
|
fi
|
520
508
|
|
521
509
|
# Update short version string in the Info.plist if provided
|
522
|
-
if [[ -n "$SHORT_VERSION" ]];
|
523
|
-
then
|
510
|
+
if [[ -n "$SHORT_VERSION" ]]; then
|
524
511
|
CURRENT_VALUE="$(PlistBuddy -c "Print :CFBundleShortVersionString" "$APP_PATH/Info.plist")"
|
525
512
|
# Even if the old value is same - just update, less code, less debugging
|
526
513
|
log "Updating the short version string (CFBundleShortVersionString) from '$CURRENT_VALUE' to '$SHORT_VERSION'"
|
@@ -528,8 +515,7 @@ function resign {
|
|
528
515
|
fi
|
529
516
|
|
530
517
|
# Update bundle version in the Info.plist if provided
|
531
|
-
if [[ -n "$BUNDLE_VERSION" ]];
|
532
|
-
then
|
518
|
+
if [[ -n "$BUNDLE_VERSION" ]]; then
|
533
519
|
CURRENT_VALUE="$(PlistBuddy -c "Print :CFBundleVersion" "$APP_PATH/Info.plist")"
|
534
520
|
# Even if the old value is same - just update, less code, less debugging
|
535
521
|
log "Updating the bundle version (CFBundleVersion) from '$CURRENT_VALUE' to '$BUNDLE_VERSION'"
|
@@ -538,18 +524,15 @@ function resign {
|
|
538
524
|
|
539
525
|
# Check for and resign any embedded frameworks (new feature for iOS 8 and above apps)
|
540
526
|
FRAMEWORKS_DIR="$APP_PATH/Frameworks"
|
541
|
-
if [ -d "$FRAMEWORKS_DIR" ];
|
542
|
-
|
543
|
-
if [ "$TEAM_IDENTIFIER" == "" ];
|
544
|
-
then
|
527
|
+
if [ -d "$FRAMEWORKS_DIR" ]; then
|
528
|
+
if [ "$TEAM_IDENTIFIER" == "" ]; then
|
545
529
|
error "ERROR: embedded frameworks detected, re-signing iOS 8 (or higher) applications wihout a team identifier in the certificate/profile does not work"
|
546
530
|
fi
|
547
531
|
|
548
532
|
log "Resigning embedded frameworks using certificate: '$CERTIFICATE'"
|
549
533
|
for framework in "$FRAMEWORKS_DIR"/*
|
550
534
|
do
|
551
|
-
if [[ "$framework" == *.framework || "$framework" == *.dylib ]]
|
552
|
-
then
|
535
|
+
if [[ "$framework" == *.framework || "$framework" == *.dylib ]]; then
|
553
536
|
log "Resigning '$framework'"
|
554
537
|
# Must not qote KEYCHAIN_FLAG because it needs to be unwrapped and passed to codesign with spaces
|
555
538
|
# shellcheck disable=SC2086
|
@@ -566,46 +549,37 @@ function resign {
|
|
566
549
|
for key in "${NESTED_APP_REFERENCE_KEYS[@]}"; do
|
567
550
|
# Check if Info.plist has a reference to another app or extension
|
568
551
|
REF_BUNDLE_ID=$(PlistBuddy -c "Print ${key}" "$APP_PATH/Info.plist" 2>/dev/null)
|
569
|
-
if [ -n "$REF_BUNDLE_ID" ];
|
570
|
-
then
|
552
|
+
if [ -n "$REF_BUNDLE_ID" ]; then
|
571
553
|
# Found a reference bundle id, now get the corresponding provisioning profile for this bundle id
|
572
554
|
REF_PROVISION=$(provision_for_bundle_id "$REF_BUNDLE_ID")
|
573
555
|
# Map to the new bundle id
|
574
556
|
NEW_REF_BUNDLE_ID=$(bundle_id_for_provison "$REF_PROVISION")
|
575
557
|
# Change if not the same and if doesn't contain wildcard
|
576
558
|
# shellcheck disable=SC2049
|
577
|
-
if [[ "$REF_BUNDLE_ID" != "$NEW_REF_BUNDLE_ID" ]] && ! [[ "$NEW_REF_BUNDLE_ID" =~ \* ]];
|
578
|
-
then
|
559
|
+
if [[ "$REF_BUNDLE_ID" != "$NEW_REF_BUNDLE_ID" ]] && ! [[ "$NEW_REF_BUNDLE_ID" =~ \* ]]; then
|
579
560
|
log "Updating nested app or extension reference for ${key} key from ${REF_BUNDLE_ID} to ${NEW_REF_BUNDLE_ID}"
|
580
561
|
PlistBuddy -c "Set ${key} $NEW_REF_BUNDLE_ID" "$APP_PATH/Info.plist"
|
581
562
|
fi
|
582
563
|
fi
|
583
564
|
done
|
584
565
|
|
585
|
-
if [ "$ENTITLEMENTS" != "" ];
|
586
|
-
|
587
|
-
if [ -n "$APP_IDENTIFIER_PREFIX" ];
|
588
|
-
then
|
566
|
+
if [ "$ENTITLEMENTS" != "" ]; then
|
567
|
+
if [ -n "$APP_IDENTIFIER_PREFIX" ]; then
|
589
568
|
# sanity check the 'application-identifier' is present in the provided entitlements and matches the provisioning profile value
|
590
569
|
ENTITLEMENTS_APP_ID_PREFIX=$(PlistBuddy -c "Print :application-identifier" "$ENTITLEMENTS" | grep -E '^[A-Z0-9]*' -o | tr -d '\n')
|
591
|
-
if [ "$ENTITLEMENTS_APP_ID_PREFIX" == "" ];
|
592
|
-
then
|
570
|
+
if [ "$ENTITLEMENTS_APP_ID_PREFIX" == "" ]; then
|
593
571
|
error "Provided entitlements file is missing a value for the required 'application-identifier' key"
|
594
|
-
elif [ "$ENTITLEMENTS_APP_ID_PREFIX" != "$APP_IDENTIFIER_PREFIX" ];
|
595
|
-
then
|
572
|
+
elif [ "$ENTITLEMENTS_APP_ID_PREFIX" != "$APP_IDENTIFIER_PREFIX" ]; then
|
596
573
|
error "Provided entitlements file's app identifier prefix value '$ENTITLEMENTS_APP_ID_PREFIX' does not match the provided provisioning profile's value '$APP_IDENTIFIER_PREFIX'"
|
597
574
|
fi
|
598
575
|
fi
|
599
576
|
|
600
|
-
if [ -n "$TEAM_IDENTIFIER" ];
|
601
|
-
then
|
577
|
+
if [ -n "$TEAM_IDENTIFIER" ]; then
|
602
578
|
# sanity check the 'com.apple.developer.team-identifier' is present in the provided entitlements and matches the provisioning profile value
|
603
579
|
ENTITLEMENTS_TEAM_IDENTIFIER=$(PlistBuddy -c "Print :com.apple.developer.team-identifier" "$ENTITLEMENTS" | tr -d '\n')
|
604
|
-
if [ "$ENTITLEMENTS_TEAM_IDENTIFIER" == "" ];
|
605
|
-
then
|
580
|
+
if [ "$ENTITLEMENTS_TEAM_IDENTIFIER" == "" ]; then
|
606
581
|
error "Provided entitlements file is missing a value for the required 'com.apple.developer.team-identifier' key"
|
607
|
-
elif [ "$ENTITLEMENTS_TEAM_IDENTIFIER" != "$TEAM_IDENTIFIER" ];
|
608
|
-
then
|
582
|
+
elif [ "$ENTITLEMENTS_TEAM_IDENTIFIER" != "$TEAM_IDENTIFIER" ]; then
|
609
583
|
error "Provided entitlements file's 'com.apple.developer.team-identifier' '$ENTITLEMENTS_TEAM_IDENTIFIER' does not match the provided provisioning profile's value '$TEAM_IDENTIFIER'"
|
610
584
|
fi
|
611
585
|
fi
|
@@ -615,8 +589,7 @@ function resign {
|
|
615
589
|
cp -f "$ENTITLEMENTS" "$APP_PATH/archived-expanded-entitlements.xcent"
|
616
590
|
/usr/bin/codesign ${VERBOSE} -f -s "$CERTIFICATE" --entitlements "$ENTITLEMENTS" "$APP_PATH"
|
617
591
|
checkStatus
|
618
|
-
elif [[ -n "${USE_APP_ENTITLEMENTS}" ]];
|
619
|
-
then
|
592
|
+
elif [[ -n "${USE_APP_ENTITLEMENTS}" ]]; then
|
620
593
|
# Extract entitlements from provisioning profile and from the app binary
|
621
594
|
# then combine them together
|
622
595
|
|
@@ -828,7 +801,10 @@ function resign {
|
|
828
801
|
checkStatus
|
829
802
|
log "Resigning application using certificate: '$CERTIFICATE'"
|
830
803
|
log "and entitlements from provisioning profile: $NEW_PROVISION"
|
831
|
-
|
804
|
+
if [[ "${XCODE_VERSION/.*/}" -lt 10 ]]; then
|
805
|
+
log "Creating an archived-expanded-entitlements.xcent file for Xcode 9 builds or earlier"
|
806
|
+
cp -- "$TEMP_DIR/newEntitlements" "$APP_PATH/archived-expanded-entitlements.xcent"
|
807
|
+
fi
|
832
808
|
# Must not qote KEYCHAIN_FLAG because it needs to be unwrapped and passed to codesign with spaces
|
833
809
|
# shellcheck disable=SC2086
|
834
810
|
/usr/bin/codesign ${VERBOSE} ${KEYCHAIN_FLAG} -f -s "$CERTIFICATE" --entitlements "$TEMP_DIR/newEntitlements" "$APP_PATH"
|