fastlane 2.163.0 → 2.168.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 +80 -80
- data/cert/lib/cert/options.rb +1 -1
- data/cert/lib/cert/runner.rb +2 -2
- data/deliver/lib/deliver/app_screenshot.rb +6 -2
- data/deliver/lib/deliver/queue_worker.rb +14 -29
- data/deliver/lib/deliver/upload_metadata.rb +7 -2
- data/deliver/lib/deliver/upload_screenshots.rb +3 -5
- data/fastlane/lib/fastlane/actions/.download_dsyms.rb.swp +0 -0
- data/fastlane/lib/fastlane/actions/actions_helper.rb +1 -1
- data/fastlane/lib/fastlane/actions/add_git_tag.rb +9 -2
- data/fastlane/lib/fastlane/actions/appledoc.rb +1 -1
- data/fastlane/lib/fastlane/actions/docs/capture_ios_screenshots.md +5 -1
- data/fastlane/lib/fastlane/actions/docs/sync_code_signing.md +9 -0
- data/fastlane/lib/fastlane/actions/import_from_git.rb +9 -1
- data/fastlane/lib/fastlane/actions/is_ci.rb +1 -1
- data/fastlane/lib/fastlane/actions/register_devices.rb +4 -1
- data/fastlane/lib/fastlane/actions/set_changelog.rb +31 -3
- data/fastlane/lib/fastlane/actions/slather.rb +2 -2
- data/fastlane/lib/fastlane/actions/spm.rb +6 -0
- data/fastlane/lib/fastlane/actions/update_fastlane.rb +29 -8
- data/fastlane/lib/fastlane/actions/upload_to_app_store.rb +3 -3
- data/fastlane/lib/fastlane/cli_tools_distributor.rb +2 -2
- data/fastlane/lib/fastlane/fast_file.rb +74 -23
- data/fastlane/lib/fastlane/features.rb +1 -1
- data/fastlane/lib/fastlane/plugins/template/.rubocop.yml +2 -0
- data/fastlane/lib/fastlane/swift_fastlane_function.rb +1 -1
- data/fastlane/lib/fastlane/version.rb +1 -1
- data/fastlane/swift/Deliverfile.swift +1 -1
- data/fastlane/swift/DeliverfileProtocol.swift +1 -1
- data/fastlane/swift/Fastfile.swift +1 -1
- data/fastlane/swift/Fastlane.swift +37 -16
- data/fastlane/swift/Gymfile.swift +1 -1
- data/fastlane/swift/GymfileProtocol.swift +1 -1
- data/fastlane/swift/LaneFileProtocol.swift +2 -2
- data/fastlane/swift/MainProcess.swift +2 -0
- data/fastlane/swift/Matchfile.swift +1 -1
- data/fastlane/swift/MatchfileProtocol.swift +8 -4
- data/fastlane/swift/Precheckfile.swift +1 -1
- data/fastlane/swift/PrecheckfileProtocol.swift +1 -1
- data/fastlane/swift/Runner.swift +1 -1
- data/fastlane/swift/Scanfile.swift +1 -1
- data/fastlane/swift/ScanfileProtocol.swift +5 -1
- data/fastlane/swift/Screengrabfile.swift +1 -1
- data/fastlane/swift/ScreengrabfileProtocol.swift +1 -1
- data/fastlane/swift/Snapshotfile.swift +1 -1
- data/fastlane/swift/SnapshotfileProtocol.swift +1 -1
- data/fastlane/swift/SocketClient.swift +1 -1
- data/fastlane_core/lib/fastlane_core/cert_checker.rb +12 -7
- data/fastlane_core/lib/fastlane_core/device_manager.rb +8 -4
- data/fastlane_core/lib/fastlane_core/helper.rb +11 -3
- data/fastlane_core/lib/fastlane_core/itunes_transporter.rb +3 -3
- data/fastlane_core/lib/fastlane_core/keychain_importer.rb +1 -1
- data/fastlane_core/lib/fastlane_core/provisioning_profile.rb +3 -1
- data/fastlane_core/lib/fastlane_core/ui/disable_colors.rb +8 -0
- data/gym/lib/gym/code_signing_mapping.rb +1 -1
- data/match/lib/match/importer.rb +33 -21
- data/match/lib/match/module.rb +1 -1
- data/match/lib/match/nuke.rb +9 -5
- data/match/lib/match/options.rb +8 -2
- data/pilot/lib/pilot/build_manager.rb +9 -3
- data/scan/lib/scan/detect_values.rb +8 -9
- data/scan/lib/scan/module.rb +4 -0
- data/scan/lib/scan/options.rb +9 -0
- data/scan/lib/scan/runner.rb +4 -3
- data/sigh/lib/assets/resign.sh +1 -1
- data/sigh/lib/sigh/runner.rb +4 -4
- data/snapshot/lib/snapshot/simulator_launchers/simulator_launcher_base.rb +2 -1
- data/snapshot/lib/snapshot/test_command_generator.rb +1 -1
- data/snapshot/lib/snapshot/test_command_generator_base.rb +3 -1
- data/snapshot/lib/snapshot/test_command_generator_xcode_8.rb +1 -1
- data/spaceship/lib/spaceship/connect_api.rb +2 -0
- data/spaceship/lib/spaceship/connect_api/client.rb +7 -4
- data/spaceship/lib/spaceship/connect_api/models/.app.rb.swp +0 -0
- data/spaceship/lib/spaceship/connect_api/models/.app_screenshot.rb.swp +0 -0
- data/spaceship/lib/spaceship/connect_api/models/.build.rb.swp +0 -0
- data/spaceship/lib/spaceship/connect_api/models/age_rating_declaration.rb +3 -2
- data/spaceship/lib/spaceship/connect_api/models/app.rb +127 -51
- data/spaceship/lib/spaceship/connect_api/models/app_info.rb +15 -10
- data/spaceship/lib/spaceship/connect_api/models/app_info_localization.rb +6 -4
- data/spaceship/lib/spaceship/connect_api/models/app_preview.rb +15 -11
- data/spaceship/lib/spaceship/connect_api/models/app_preview_set.rb +13 -9
- data/spaceship/lib/spaceship/connect_api/models/app_screenshot.rb +9 -7
- data/spaceship/lib/spaceship/connect_api/models/app_screenshot_set.rb +15 -11
- data/spaceship/lib/spaceship/connect_api/models/app_store_review_attachment.rb +7 -5
- data/spaceship/lib/spaceship/connect_api/models/app_store_review_detail.rb +6 -4
- data/spaceship/lib/spaceship/connect_api/models/app_store_version.rb +54 -36
- data/spaceship/lib/spaceship/connect_api/models/app_store_version_localization.rb +21 -14
- data/spaceship/lib/spaceship/connect_api/models/app_store_version_submission.rb +3 -2
- data/spaceship/lib/spaceship/connect_api/models/beta_app_review_submission.rb +3 -2
- data/spaceship/lib/spaceship/connect_api/models/beta_feedback.rb +6 -4
- data/spaceship/lib/spaceship/connect_api/models/beta_group.rb +12 -2
- data/spaceship/lib/spaceship/connect_api/models/beta_tester.rb +12 -8
- data/spaceship/lib/spaceship/connect_api/models/build.rb +24 -16
- data/spaceship/lib/spaceship/connect_api/models/build_delivery.rb +3 -2
- data/spaceship/lib/spaceship/connect_api/models/bundle_id.rb +9 -6
- data/spaceship/lib/spaceship/connect_api/models/bundle_id_capability.rb +6 -4
- data/spaceship/lib/spaceship/connect_api/models/certificate.rb +12 -8
- data/spaceship/lib/spaceship/connect_api/models/custom_app_organization.rb +43 -0
- data/spaceship/lib/spaceship/connect_api/models/custom_app_user.rb +41 -0
- data/spaceship/lib/spaceship/connect_api/models/device.rb +6 -4
- data/spaceship/lib/spaceship/connect_api/models/idfa_declaration.rb +6 -4
- data/spaceship/lib/spaceship/connect_api/models/profile.rb +12 -8
- data/spaceship/lib/spaceship/connect_api/models/reset_ratings_request.rb +3 -2
- data/spaceship/lib/spaceship/connect_api/models/sandbox_tester.rb +9 -6
- data/spaceship/lib/spaceship/connect_api/models/territory.rb +3 -2
- data/spaceship/lib/spaceship/connect_api/models/user.rb +6 -4
- data/spaceship/lib/spaceship/connect_api/models/user_invitation.rb +9 -6
- data/spaceship/lib/spaceship/connect_api/spaceship.rb +7 -4
- data/spaceship/lib/spaceship/connect_api/testflight/testflight.rb +12 -0
- data/spaceship/lib/spaceship/connect_api/tunes/tunes.rb +71 -0
- data/spaceship/lib/spaceship/tunes/iap_detail.rb +1 -1
- data/spaceship/lib/spaceship/tunes/tunes_client.rb +2 -2
- data/supply/lib/supply.rb +1 -1
- data/supply/lib/supply/options.rb +1 -1
- data/supply/lib/supply/uploader.rb +4 -3
- metadata +24 -20
- data/fastlane/lib/fastlane/actions/.register_device.rb.swp +0 -0
- data/fastlane/lib/fastlane/actions/.register_devices.rb.swp +0 -0
@@ -55,7 +55,7 @@ module Fastlane
|
|
55
55
|
|
56
56
|
def self.run(params)
|
57
57
|
unless Helper.test?
|
58
|
-
UI.message("Install using `brew install
|
58
|
+
UI.message("Install using `brew install appledoc`")
|
59
59
|
UI.user_error!("appledoc not installed") if `which appledoc`.length == 0
|
60
60
|
end
|
61
61
|
|
@@ -106,7 +106,7 @@ app.launch()
|
|
106
106
|
|
107
107
|
```objective-c
|
108
108
|
XCUIApplication *app = [[XCUIApplication alloc] init];
|
109
|
-
[Snapshot setupSnapshot:app];
|
109
|
+
[Snapshot setupSnapshot:app waitForAnimations:NO];
|
110
110
|
[app launch];
|
111
111
|
```
|
112
112
|
|
@@ -282,6 +282,10 @@ launch_arguments([
|
|
282
282
|
])
|
283
283
|
```
|
284
284
|
|
285
|
+
## Xcode Environment Variables
|
286
|
+
|
287
|
+
_snapshot_ includes `FASTLANE_SNAPSHOT=YES` and `FASTLANE_LANGUAGE=<language>` as arguments when executing `xcodebuild`. This means you may use these environment variables in a custom build phase run script to do any additional configuration.
|
288
|
+
|
285
289
|
# How does it work?
|
286
290
|
|
287
291
|
The easiest solution would be to just render the UIWindow into a file. That's not possible because UI Tests don't run on a main thread. So _snapshot_ uses a different approach:
|
@@ -492,6 +492,15 @@ fastlane match import
|
|
492
492
|
|
493
493
|
You'll be prompted for the certificate (`.cer`), the private key (`.p12`) and the provisioning profiles (`.mobileprovision` or `.provisionprofile`) paths. _match_ will first validate the certificate (`.cer`) against the Developer Portal before importing the certificate, the private key and the provisioning profiles into the specified _match_ repository.
|
494
494
|
|
495
|
+
However if there is no access to the developer portal but there are certificates, private keys and profiles provided, you can use the `skip_certificate_matching` option to tell _match_ not to verify the certificates. Like this:
|
496
|
+
|
497
|
+
```no-highlight
|
498
|
+
fastlane match import --skip_certificate_matching true
|
499
|
+
```
|
500
|
+
This will skip login to Apple Developer Portal and will import the provided certificate, private key and profile directly to the certificates repo.
|
501
|
+
|
502
|
+
Please be careful when using this option and ensure the certificates and profiles match the type (development, adhoc, appstore, enterprise, developer_id) and are not revoked or expired.
|
503
|
+
|
495
504
|
### Manual Decrypt
|
496
505
|
|
497
506
|
If you want to manually decrypt a file you can.
|
@@ -19,6 +19,9 @@ module Fastlane
|
|
19
19
|
|
20
20
|
def self.available_options
|
21
21
|
[
|
22
|
+
# Because the `run` method is actually implemented in `fast_file.rb`,
|
23
|
+
# and because magic, some of the parameters on `ConfigItem`s (e.g.
|
24
|
+
# `conflicting_options`, `verify_block`) are completely ignored.
|
22
25
|
FastlaneCore::ConfigItem.new(key: :url,
|
23
26
|
description: "The URL of the repository to import the Fastfile from",
|
24
27
|
default_value: nil),
|
@@ -38,6 +41,10 @@ module Fastlane
|
|
38
41
|
description: "The version to checkout on the repository. Optimistic match operator or multiple conditions can be used to select the latest version within constraints",
|
39
42
|
default_value: nil,
|
40
43
|
is_string: false,
|
44
|
+
optional: true),
|
45
|
+
FastlaneCore::ConfigItem.new(key: :cache_path,
|
46
|
+
description: "The path to a directory where the repository should be cloned into. This is ignored if `version` is not specified. Defaults to `nil`, which causes the repository to be cloned on every call, to a temporary directory",
|
47
|
+
default_value: nil,
|
41
48
|
optional: true)
|
42
49
|
]
|
43
50
|
end
|
@@ -62,7 +69,8 @@ module Fastlane
|
|
62
69
|
url: "git@github.com:fastlane/fastlane.git", # The URL of the repository to import the Fastfile from.
|
63
70
|
branch: "HEAD", # The branch to checkout on the repository
|
64
71
|
path: "fastlane/Fastfile", # The path of the Fastfile in the repository
|
65
|
-
version: [">= 1.1.0", "< 2.0.0"] # The version to checkout on the repository. Multiple conditions can be used to select the latest version within constraints.
|
72
|
+
version: [">= 1.1.0", "< 2.0.0"], # The version to checkout on the repository. Multiple conditions can be used to select the latest version within constraints.
|
73
|
+
cache_path: "~/.cache/fastlane/imported" # A directory in which the repository will be added, which means that it will not be cloned again on subsequent calls.
|
66
74
|
)'
|
67
75
|
]
|
68
76
|
end
|
@@ -53,7 +53,10 @@ module Fastlane
|
|
53
53
|
existing_devices = Spaceship::ConnectAPI::Device.all
|
54
54
|
|
55
55
|
device_objs = new_devices.map do |device|
|
56
|
-
|
56
|
+
if existing_devices.map(&:udid).map(&:downcase).include?(device[0].downcase)
|
57
|
+
UI.verbose("UDID #{device[0]} already exists - Skipping...")
|
58
|
+
next
|
59
|
+
end
|
57
60
|
|
58
61
|
device_platform = platform
|
59
62
|
|
@@ -6,9 +6,14 @@ module Fastlane
|
|
6
6
|
|
7
7
|
# Team selection passed though FASTLANE_ITC_TEAM_ID and FASTLANE_ITC_TEAM_NAME environment variables
|
8
8
|
# Prompts select team if multiple teams and none specified
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
if (token = self.api_token(params))
|
10
|
+
UI.message("Using App Store Connect API token...")
|
11
|
+
Spaceship::ConnectAPI.token = token
|
12
|
+
else
|
13
|
+
UI.message("Login to App Store Connect (#{params[:username]})")
|
14
|
+
Spaceship::ConnectAPI.login(params[:username], use_portal: false, use_tunes: true, tunes_team_id: params[:team_id], team_name: params[:team_name])
|
15
|
+
UI.message("Login successful")
|
16
|
+
end
|
12
17
|
|
13
18
|
app = Spaceship::ConnectAPI::App.find(params[:app_identifier])
|
14
19
|
UI.user_error!("Couldn't find app with identifier #{params[:app_identifier]}") if app.nil?
|
@@ -73,6 +78,13 @@ module Fastlane
|
|
73
78
|
UI.success("👼 Successfully pushed the new changelog to for #{edit_version.version_string}")
|
74
79
|
end
|
75
80
|
|
81
|
+
def self.api_token(params)
|
82
|
+
params[:api_key] ||= Actions.lane_context[SharedValues::APP_STORE_CONNECT_API_KEY]
|
83
|
+
api_token ||= Spaceship::ConnectAPI::Token.create(params[:api_key]) if params[:api_key]
|
84
|
+
api_token ||= Spaceship::ConnectAPI::Token.from_json_file(params[:api_key_path]) if params[:api_key_path]
|
85
|
+
return api_token
|
86
|
+
end
|
87
|
+
|
76
88
|
def self.default_changelog_path
|
77
89
|
File.join(FastlaneCore::FastlaneFolder.path.to_s, 'changelog.txt')
|
78
90
|
end
|
@@ -98,6 +110,21 @@ module Fastlane
|
|
98
110
|
user ||= CredentialsManager::AppfileConfig.try_fetch_value(:apple_id)
|
99
111
|
|
100
112
|
[
|
113
|
+
FastlaneCore::ConfigItem.new(key: :api_key_path,
|
114
|
+
env_name: "FL_SET_CHANGELOG_API_KEY_PATH",
|
115
|
+
description: "Path to your App Store Connect API Key JSON file (https://docs.fastlane.tools/app-store-connect-api/#using-fastlane-api-key-json-file)",
|
116
|
+
optional: true,
|
117
|
+
conflicting_options: [:api_key],
|
118
|
+
verify_block: proc do |value|
|
119
|
+
UI.user_error!("Couldn't find API key JSON file at path '#{value}'") unless File.exist?(value)
|
120
|
+
end),
|
121
|
+
FastlaneCore::ConfigItem.new(key: :api_key,
|
122
|
+
env_name: "FL_SET_CHANGELOG_API_KEY",
|
123
|
+
description: "Your App Store Connect API Key information (https://docs.fastlane.tools/app-store-connect-api/#use-return-value-and-pass-in-as-an-option)",
|
124
|
+
type: Hash,
|
125
|
+
optional: true,
|
126
|
+
sensitive: true,
|
127
|
+
conflicting_options: [:api_key_path]),
|
101
128
|
FastlaneCore::ConfigItem.new(key: :app_identifier,
|
102
129
|
short_option: "-a",
|
103
130
|
env_name: "FASTLANE_APP_IDENTIFIER",
|
@@ -109,6 +136,7 @@ module Fastlane
|
|
109
136
|
short_option: "-u",
|
110
137
|
env_name: "FASTLANE_USERNAME",
|
111
138
|
description: "Your Apple ID Username",
|
139
|
+
optional: true,
|
112
140
|
default_value: user,
|
113
141
|
default_value_dynamic: true),
|
114
142
|
FastlaneCore::ConfigItem.new(key: :version,
|
@@ -272,8 +272,8 @@ module Fastlane
|
|
272
272
|
FastlaneCore::ConfigItem.new(key: :binary_basename,
|
273
273
|
env_name: "FL_SLATHER_BINARY_BASENAME",
|
274
274
|
description: "Basename of the binary file, this should match the name of your bundle excluding its extension (i.e. YourApp [for YourApp.app bundle])",
|
275
|
-
|
276
|
-
|
275
|
+
type: Array,
|
276
|
+
optional: true),
|
277
277
|
FastlaneCore::ConfigItem.new(key: :binary_file,
|
278
278
|
env_name: "FL_SLATHER_BINARY_FILE",
|
279
279
|
description: "Binary file name to be used for code coverage",
|
@@ -11,6 +11,7 @@ module Fastlane
|
|
11
11
|
cmd << "--disable-sandbox" if params[:disable_sandbox]
|
12
12
|
cmd << "--verbose" if params[:verbose]
|
13
13
|
cmd << params[:command] if package_commands.include?(params[:command])
|
14
|
+
cmd << "--enable-code-coverage" if params[:enable_code_coverage] && params[:command] == 'generate-xcodeproj'
|
14
15
|
if params[:xcconfig]
|
15
16
|
cmd << "--xcconfig-overrides #{params[:xcconfig]}"
|
16
17
|
end
|
@@ -44,6 +45,11 @@ module Fastlane
|
|
44
45
|
verify_block: proc do |value|
|
45
46
|
UI.user_error!("Please pass a valid command. Use one of the following: #{available_commands.join(', ')}") unless available_commands.include?(value)
|
46
47
|
end),
|
48
|
+
FastlaneCore::ConfigItem.new(key: :enable_code_coverage,
|
49
|
+
env_name: "FL_SPM_ENABLE_CODE_COVERAGE",
|
50
|
+
description: "Enables code coverage for the generated Xcode project when using the generate-xcodeproj command",
|
51
|
+
is_string: false,
|
52
|
+
optional: true),
|
47
53
|
FastlaneCore::ConfigItem.new(key: :build_path,
|
48
54
|
env_name: "FL_SPM_BUILD_PATH",
|
49
55
|
description: "Specify build/cache directory [default: ./.build]",
|
@@ -45,25 +45,36 @@ module Fastlane
|
|
45
45
|
end
|
46
46
|
|
47
47
|
# suppress updater output - very noisy
|
48
|
-
Gem::DefaultUserInteraction.ui = Gem::SilentUI.new
|
48
|
+
Gem::DefaultUserInteraction.ui = Gem::SilentUI.new unless FastlaneCore::Globals.verbose?
|
49
49
|
|
50
50
|
update_needed.each do |tool_info|
|
51
|
-
tool = tool_info
|
51
|
+
tool = self.get_gem_name(tool_info)
|
52
52
|
local_version = Gem::Version.new(highest_versions[tool].version)
|
53
53
|
latest_official_version = FastlaneCore::UpdateChecker.fetch_latest(tool)
|
54
54
|
|
55
55
|
UI.message("Updating #{tool} from #{local_version.to_s.yellow} to #{latest_official_version.to_s.yellow}... 🚀")
|
56
56
|
|
57
|
-
|
58
|
-
|
59
|
-
|
57
|
+
if Helper.homebrew?
|
58
|
+
Helper.backticks('brew upgrade fastlane')
|
59
|
+
else
|
60
|
+
# Approximate_recommendation will create a string like "~> 0.10" from a version 0.10.0, e.g. one that is valid for versions >= 0.10 and <1.0
|
61
|
+
requirement_version = local_version.approximate_recommendation
|
62
|
+
updater.update_gem(tool, Gem::Requirement.new(requirement_version))
|
63
|
+
end
|
60
64
|
|
61
65
|
UI.success("Finished updating #{tool}")
|
62
66
|
end
|
63
67
|
|
64
|
-
|
65
|
-
|
66
|
-
|
68
|
+
unless Helper.homebrew?
|
69
|
+
UI.message("Cleaning up old versions...")
|
70
|
+
cleaner.options[:args] = tools_to_update
|
71
|
+
cleaner.execute
|
72
|
+
end
|
73
|
+
|
74
|
+
if FastlaneCore::FastlaneFolder.swift?
|
75
|
+
upgrader = SwiftRunnerUpgrader.new
|
76
|
+
upgrader.upgrade_if_needed!
|
77
|
+
end
|
67
78
|
|
68
79
|
UI.message("fastlane.tools successfully updated! I will now restart myself... 😴")
|
69
80
|
|
@@ -71,6 +82,16 @@ module Fastlane
|
|
71
82
|
exec("FL_NO_UPDATE=true #{$PROGRAM_NAME} #{ARGV.join(' ')}")
|
72
83
|
end
|
73
84
|
|
85
|
+
def self.get_gem_name(tool_info)
|
86
|
+
if tool_info.kind_of?(Array)
|
87
|
+
return tool_info[0]
|
88
|
+
elsif tool_info.respond_to?(:name) # Gem::NameTuple in RubyGems >= 3.1.0
|
89
|
+
return tool_info.name
|
90
|
+
else
|
91
|
+
UI.crash!("Unknown gem update information returned from RubyGems. Please file a new issue for this... 🤷")
|
92
|
+
end
|
93
|
+
end
|
94
|
+
|
74
95
|
def self.description
|
75
96
|
"Makes sure fastlane-tools are up-to-date when running fastlane"
|
76
97
|
end
|
@@ -9,9 +9,9 @@ module Fastlane
|
|
9
9
|
|
10
10
|
begin
|
11
11
|
config.load_configuration_file("Deliverfile")
|
12
|
-
config[:screenshots_path]
|
13
|
-
config[:ipa]
|
14
|
-
config[:pkg]
|
12
|
+
config[:screenshots_path] ||= Actions.lane_context[SharedValues::SNAPSHOT_SCREENSHOTS_PATH] if Actions.lane_context[SharedValues::SNAPSHOT_SCREENSHOTS_PATH]
|
13
|
+
config[:ipa] ||= Actions.lane_context[SharedValues::IPA_OUTPUT_PATH] if Actions.lane_context[SharedValues::IPA_OUTPUT_PATH]
|
14
|
+
config[:pkg] ||= Actions.lane_context[SharedValues::PKG_OUTPUT_PATH] if Actions.lane_context[SharedValues::PKG_OUTPUT_PATH]
|
15
15
|
config[:api_key] ||= Actions.lane_context[SharedValues::APP_STORE_CONNECT_API_KEY]
|
16
16
|
|
17
17
|
return config if Helper.test?
|
@@ -123,9 +123,9 @@ module Fastlane
|
|
123
123
|
end
|
124
124
|
|
125
125
|
# Since loading dotenv should respect additional environments passed using
|
126
|
-
# --env, we must
|
126
|
+
# --env, we must extract the arguments out of ARGV and process them before
|
127
127
|
# calling into commander. This is required since the ENV must be configured
|
128
|
-
# before running any other commands in order to
|
128
|
+
# before running any other commands in order to correctly respect variables
|
129
129
|
# like FASTLANE_HIDE_CHANGELOG and FASTLANE_DISABLE_COLORS
|
130
130
|
def load_dot_env
|
131
131
|
env_cl_param = lambda do
|
@@ -259,11 +259,20 @@ module Fastlane
|
|
259
259
|
return return_value
|
260
260
|
end
|
261
261
|
|
262
|
+
def find_tag(folder: nil, version: nil, remote: false)
|
263
|
+
req = Gem::Requirement.new(version)
|
264
|
+
all_tags = get_tags(folder: folder, remote: remote)
|
265
|
+
|
266
|
+
return all_tags.select { |t| req =~ FastlaneCore::TagVersion.new(t) }.last
|
267
|
+
end
|
268
|
+
|
262
269
|
# @param url [String] The git URL to clone the repository from
|
263
270
|
# @param branch [String] The branch to checkout in the repository
|
264
271
|
# @param path [String] The path to the Fastfile
|
265
272
|
# @param version [String, Array] Version requirement for repo tags
|
266
|
-
|
273
|
+
# @param dependencies [Array] An optional array of additional Fastfiles in the repository
|
274
|
+
# @param cache_path [String] An optional path to a directory where the repository should be cloned into
|
275
|
+
def import_from_git(url: nil, branch: 'HEAD', path: 'fastlane/Fastfile', version: nil, dependencies: [], cache_path: nil) # rubocop:disable Metrics/PerceivedComplexity
|
267
276
|
UI.user_error!("Please pass a path to the `import_from_git` action") if url.to_s.length == 0
|
268
277
|
|
269
278
|
Actions.execute_action('import_from_git') do
|
@@ -271,41 +280,75 @@ module Fastlane
|
|
271
280
|
|
272
281
|
action_launched('import_from_git')
|
273
282
|
|
283
|
+
is_eligible_for_caching = !version.nil? && !cache_path.nil?
|
284
|
+
|
285
|
+
UI.message("Eligible for caching") if is_eligible_for_caching
|
286
|
+
|
274
287
|
# Checkout the repo
|
275
288
|
repo_name = url.split("/").last
|
276
289
|
checkout_param = branch
|
277
290
|
|
278
|
-
|
279
|
-
clone_folder = File.join(
|
291
|
+
import_block = proc do |target_path|
|
292
|
+
clone_folder = File.join(target_path, repo_name)
|
280
293
|
|
281
294
|
branch_option = "--branch #{branch}" if branch != 'HEAD'
|
282
295
|
|
283
296
|
checkout_dependencies = dependencies.map(&:shellescape).join(" ")
|
284
297
|
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
|
298
|
+
# If the current call is eligible for caching, we check out all the
|
299
|
+
# files and directories. If not, we only check out the specified
|
300
|
+
# `path` and `dependencies`.
|
301
|
+
checkout_path = is_eligible_for_caching ? "" : "#{path.shellescape} #{checkout_dependencies}"
|
302
|
+
|
303
|
+
if Dir[clone_folder].empty?
|
304
|
+
UI.message("Cloning remote git repo...")
|
305
|
+
Helper.with_env_values('GIT_TERMINAL_PROMPT' => '0') do
|
306
|
+
# When using cached clones, we need the entire repository history
|
307
|
+
# so we can switch between tags or branches instantly, or else,
|
308
|
+
# it would defeat the caching's purpose.
|
309
|
+
depth = is_eligible_for_caching ? "" : "--depth 1"
|
310
|
+
|
311
|
+
Actions.sh("git clone #{url.shellescape} #{clone_folder.shellescape} #{depth} --no-checkout #{branch_option}")
|
312
|
+
end
|
290
313
|
end
|
291
314
|
|
292
315
|
unless version.nil?
|
293
|
-
|
294
|
-
|
295
|
-
|
316
|
+
if is_eligible_for_caching
|
317
|
+
checkout_param = find_tag(folder: clone_folder, version: version, remote: false)
|
318
|
+
|
319
|
+
if checkout_param.nil?
|
320
|
+
# Update the repo and try again before failing
|
321
|
+
UI.message("Updating git repo...")
|
322
|
+
Helper.with_env_values('GIT_TERMINAL_PROMPT' => '0') do
|
323
|
+
Actions.sh("cd #{clone_folder.shellescape} && git checkout #{branch} && git reset --hard && git pull --all")
|
324
|
+
end
|
325
|
+
|
326
|
+
checkout_param = find_tag(folder: clone_folder, version: version, remote: false)
|
327
|
+
else
|
328
|
+
UI.message("Found tag #{checkout_param}. No git repo update needed.")
|
329
|
+
end
|
330
|
+
else
|
331
|
+
checkout_param = find_tag(folder: clone_folder, version: version, remote: true)
|
332
|
+
end
|
333
|
+
|
296
334
|
UI.user_error!("No tag found matching #{version.inspect}") if checkout_param.nil?
|
297
335
|
end
|
298
336
|
|
299
337
|
Actions.sh("cd #{clone_folder.shellescape} && git checkout #{checkout_param.shellescape} #{checkout_path}")
|
300
338
|
|
301
|
-
#
|
302
|
-
|
303
|
-
|
304
|
-
|
305
|
-
|
306
|
-
|
307
|
-
|
308
|
-
|
339
|
+
# Knowing that we check out all the files and directories when the
|
340
|
+
# current call is eligible for caching, we don't need to also
|
341
|
+
# explicitly check out the "actions" directory.
|
342
|
+
unless is_eligible_for_caching
|
343
|
+
# We also want to check out all the local actions of this fastlane setup
|
344
|
+
containing = path.split(File::SEPARATOR)[0..-2]
|
345
|
+
containing = "." if containing.count == 0
|
346
|
+
actions_folder = File.join(containing, "actions")
|
347
|
+
begin
|
348
|
+
Actions.sh("cd #{clone_folder.shellescape} && git checkout #{checkout_param.shellescape} #{actions_folder.shellescape}")
|
349
|
+
rescue
|
350
|
+
# We don't care about a failure here, as local actions are optional
|
351
|
+
end
|
309
352
|
end
|
310
353
|
|
311
354
|
return_value = nil
|
@@ -320,6 +363,12 @@ module Fastlane
|
|
320
363
|
|
321
364
|
return return_value
|
322
365
|
end
|
366
|
+
|
367
|
+
if is_eligible_for_caching
|
368
|
+
import_block.call(File.expand_path(cache_path))
|
369
|
+
else
|
370
|
+
Dir.mktmpdir("fl_clone", &import_block)
|
371
|
+
end
|
323
372
|
end
|
324
373
|
end
|
325
374
|
|
@@ -327,10 +376,12 @@ module Fastlane
|
|
327
376
|
# @!group Versioning helpers
|
328
377
|
#####################################################
|
329
378
|
|
330
|
-
def
|
331
|
-
|
332
|
-
|
333
|
-
|
379
|
+
def get_tags(folder: nil, remote: false)
|
380
|
+
if remote
|
381
|
+
UI.message("Fetching remote git tags...")
|
382
|
+
Helper.with_env_values('GIT_TERMINAL_PROMPT' => '0') do
|
383
|
+
Actions.sh("cd #{folder.shellescape} && git fetch --all --tags -q")
|
384
|
+
end
|
334
385
|
end
|
335
386
|
|
336
387
|
# Fetch all possible tags
|
@@ -1,4 +1,4 @@
|
|
1
|
-
# Use this file as the place to register Feature switches for the
|
1
|
+
# Use this file as the place to register Feature switches for the fastlane_core project
|
2
2
|
|
3
3
|
# FastlaneCore::Feature.register(env_var: 'YOUR_FEATURE_SWITCH_ENV_VAR',
|
4
4
|
# description: 'Describe what this feature switch controls')
|
@@ -41,6 +41,7 @@ Require/MissingRequireStatement:
|
|
41
41
|
- "**/spec/**/*.rb"
|
42
42
|
- "**/spec_helper.rb"
|
43
43
|
- spaceship/lib/spaceship/babosa_fix.rb
|
44
|
+
- fastlane_core/lib/fastlane_core/ui/disable_colors.rb
|
44
45
|
- "**/Fastfile"
|
45
46
|
- "**/*.gemspec"
|
46
47
|
- rakelib/**/*
|
@@ -179,6 +180,7 @@ Style/MethodCallWithArgsParentheses:
|
|
179
180
|
- private_lane
|
180
181
|
- platform
|
181
182
|
- to
|
183
|
+
- not_to
|
182
184
|
- describe
|
183
185
|
- it
|
184
186
|
- be
|