fastlane 2.107.0 → 2.108.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +72 -72
- data/deliver/lib/deliver/.app_screenshot.rb.swp +0 -0
- data/deliver/lib/deliver/options.rb +1 -1
- data/fastlane/lib/fastlane/actions/create_app_on_managed_play_store.rb +174 -0
- data/fastlane/lib/fastlane/actions/download_dsyms.rb +11 -2
- data/fastlane/lib/fastlane/actions/get_managed_play_store_publishing_rights.rb +120 -0
- data/fastlane/lib/fastlane/actions/get_provisioning_profile.rb +2 -1
- data/fastlane/lib/fastlane/actions/slather.rb +5 -0
- data/fastlane/lib/fastlane/version.rb +1 -1
- data/fastlane/swift/Deliverfile.swift +1 -1
- data/fastlane/swift/Fastlane.swift +32 -2
- 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/provisioning_profile.rb +14 -2
- data/sigh/lib/sigh/options.rb +15 -6
- data/sigh/lib/sigh/runner.rb +6 -1
- data/snapshot/lib/assets/SnapshotHelper.swift +6 -2
- data/spaceship/lib/spaceship/portal/certificate.rb +5 -5
- data/spaceship/lib/spaceship/portal/provisioning_profile.rb +1 -1
- data/supply/lib/supply.rb +1 -0
- data/supply/lib/supply/client.rb +101 -66
- data/supply/lib/supply/languages.rb +88 -0
- data/supply/lib/supply/options.rb +1 -1
- metadata +19 -16
- data/match/lib/match/.nuke.rb.swp +0 -0
@@ -36,6 +36,7 @@ module Fastlane
|
|
36
36
|
profile_type = "app-store"
|
37
37
|
profile_type = "ad-hoc" if values[:adhoc]
|
38
38
|
profile_type = "development" if values[:development]
|
39
|
+
profile_type = "developer-id" if values[:developer_id]
|
39
40
|
profile_type = "enterprise" if enterprise
|
40
41
|
|
41
42
|
UI.message("Setting Provisioning Profile type to '#{profile_type}'")
|
@@ -65,7 +66,7 @@ module Fastlane
|
|
65
66
|
end
|
66
67
|
|
67
68
|
def self.is_supported?(platform)
|
68
|
-
|
69
|
+
[:ios, :mac].include?(platform)
|
69
70
|
end
|
70
71
|
|
71
72
|
def self.example_code
|
@@ -34,6 +34,7 @@ module Fastlane
|
|
34
34
|
workspace: '--workspace',
|
35
35
|
binary_file: '--binary-file',
|
36
36
|
binary_basename: '--binary-basename',
|
37
|
+
arch: '--arch',
|
37
38
|
source_files: '--source-files',
|
38
39
|
decimals: '--decimals'
|
39
40
|
}.freeze
|
@@ -257,6 +258,10 @@ module Fastlane
|
|
257
258
|
description: "Binary file name to be used for code coverage",
|
258
259
|
is_string: false,
|
259
260
|
default_value: false),
|
261
|
+
FastlaneCore::ConfigItem.new(key: :arch,
|
262
|
+
env_name: "FL_SLATHER_ARCH",
|
263
|
+
description: "Specify which architecture the binary file is in. Needed for universal binaries",
|
264
|
+
optional: true),
|
260
265
|
FastlaneCore::ConfigItem.new(key: :source_files,
|
261
266
|
env_name: "FL_SLATHER_SOURCE_FILES",
|
262
267
|
description: "A Dir.glob compatible pattern used to limit the lookup to specific source files. Ignored in gcov mode",
|
@@ -1079,6 +1079,24 @@ func crashlytics(ipaPath: String? = nil,
|
|
1079
1079
|
RubyCommand.Argument(name: "debug", value: debug)])
|
1080
1080
|
_ = runner.executeCommand(command)
|
1081
1081
|
}
|
1082
|
+
func createAppOnManagedPlayStore(jsonKey: String? = nil,
|
1083
|
+
jsonKeyData: String? = nil,
|
1084
|
+
developerAccountId: String,
|
1085
|
+
apk: String,
|
1086
|
+
appTitle: String,
|
1087
|
+
language: String = "en_US",
|
1088
|
+
rootUrl: String? = nil,
|
1089
|
+
timeout: Int = 300) {
|
1090
|
+
let command = RubyCommand(commandID: "", methodName: "create_app_on_managed_play_store", className: nil, args: [RubyCommand.Argument(name: "json_key", value: jsonKey),
|
1091
|
+
RubyCommand.Argument(name: "json_key_data", value: jsonKeyData),
|
1092
|
+
RubyCommand.Argument(name: "developer_account_id", value: developerAccountId),
|
1093
|
+
RubyCommand.Argument(name: "apk", value: apk),
|
1094
|
+
RubyCommand.Argument(name: "app_title", value: appTitle),
|
1095
|
+
RubyCommand.Argument(name: "language", value: language),
|
1096
|
+
RubyCommand.Argument(name: "root_url", value: rootUrl),
|
1097
|
+
RubyCommand.Argument(name: "timeout", value: timeout)])
|
1098
|
+
_ = runner.executeCommand(command)
|
1099
|
+
}
|
1082
1100
|
func createAppOnline(username: String,
|
1083
1101
|
appIdentifier: String,
|
1084
1102
|
bundleIdentifierSuffix: String? = nil,
|
@@ -1533,7 +1551,14 @@ func getGithubRelease(url: String,
|
|
1533
1551
|
RubyCommand.Argument(name: "ipa", value: ipa)])
|
1534
1552
|
return runner.executeCommand(command)
|
1535
1553
|
}
|
1554
|
+
func getManagedPlayStorePublishingRights(jsonKey: String? = nil,
|
1555
|
+
jsonKeyData: String? = nil) {
|
1556
|
+
let command = RubyCommand(commandID: "", methodName: "get_managed_play_store_publishing_rights", className: nil, args: [RubyCommand.Argument(name: "json_key", value: jsonKey),
|
1557
|
+
RubyCommand.Argument(name: "json_key_data", value: jsonKeyData)])
|
1558
|
+
_ = runner.executeCommand(command)
|
1559
|
+
}
|
1536
1560
|
func getProvisioningProfile(adhoc: Bool = false,
|
1561
|
+
developerId: Bool = false,
|
1537
1562
|
development: Bool = false,
|
1538
1563
|
skipInstall: Bool = false,
|
1539
1564
|
force: Bool = false,
|
@@ -1553,6 +1578,7 @@ func getProvisioningProfile(adhoc: Bool = false,
|
|
1553
1578
|
readonly: Bool = false,
|
1554
1579
|
templateName: String? = nil) {
|
1555
1580
|
let command = RubyCommand(commandID: "", methodName: "get_provisioning_profile", className: nil, args: [RubyCommand.Argument(name: "adhoc", value: adhoc),
|
1581
|
+
RubyCommand.Argument(name: "developer_id", value: developerId),
|
1556
1582
|
RubyCommand.Argument(name: "development", value: development),
|
1557
1583
|
RubyCommand.Argument(name: "skip_install", value: skipInstall),
|
1558
1584
|
RubyCommand.Argument(name: "force", value: force),
|
@@ -3012,6 +3038,7 @@ func setupTravis(force: Bool = false) {
|
|
3012
3038
|
return runner.executeCommand(command)
|
3013
3039
|
}
|
3014
3040
|
func sigh(adhoc: Bool = false,
|
3041
|
+
developerId: Bool = false,
|
3015
3042
|
development: Bool = false,
|
3016
3043
|
skipInstall: Bool = false,
|
3017
3044
|
force: Bool = false,
|
@@ -3031,6 +3058,7 @@ func sigh(adhoc: Bool = false,
|
|
3031
3058
|
readonly: Bool = false,
|
3032
3059
|
templateName: String? = nil) {
|
3033
3060
|
let command = RubyCommand(commandID: "", methodName: "sigh", className: nil, args: [RubyCommand.Argument(name: "adhoc", value: adhoc),
|
3061
|
+
RubyCommand.Argument(name: "developer_id", value: developerId),
|
3034
3062
|
RubyCommand.Argument(name: "development", value: development),
|
3035
3063
|
RubyCommand.Argument(name: "skip_install", value: skipInstall),
|
3036
3064
|
RubyCommand.Argument(name: "force", value: force),
|
@@ -3127,6 +3155,7 @@ func slather(buildDirectory: String? = nil,
|
|
3127
3155
|
useBundleExec: Bool = false,
|
3128
3156
|
binaryBasename: Bool = false,
|
3129
3157
|
binaryFile: Bool = false,
|
3158
|
+
arch: String? = nil,
|
3130
3159
|
sourceFiles: Bool = false,
|
3131
3160
|
decimals: Bool = false) {
|
3132
3161
|
let command = RubyCommand(commandID: "", methodName: "slather", className: nil, args: [RubyCommand.Argument(name: "build_directory", value: buildDirectory),
|
@@ -3155,6 +3184,7 @@ func slather(buildDirectory: String? = nil,
|
|
3155
3184
|
RubyCommand.Argument(name: "use_bundle_exec", value: useBundleExec),
|
3156
3185
|
RubyCommand.Argument(name: "binary_basename", value: binaryBasename),
|
3157
3186
|
RubyCommand.Argument(name: "binary_file", value: binaryFile),
|
3187
|
+
RubyCommand.Argument(name: "arch", value: arch),
|
3158
3188
|
RubyCommand.Argument(name: "source_files", value: sourceFiles),
|
3159
3189
|
RubyCommand.Argument(name: "decimals", value: decimals)])
|
3160
3190
|
_ = runner.executeCommand(command)
|
@@ -4013,7 +4043,7 @@ func xcov(workspace: String? = nil,
|
|
4013
4043
|
coverallsServiceJobId: String? = nil,
|
4014
4044
|
coverallsRepoToken: String? = nil,
|
4015
4045
|
xcconfig: String? = nil,
|
4016
|
-
ideFoundationPath: String = "/Applications/Xcode
|
4046
|
+
ideFoundationPath: String = "/Applications/Xcode.app/Contents/Developer/../Frameworks/IDEFoundation.framework/Versions/A/IDEFoundation",
|
4017
4047
|
legacySupport: Bool = false) {
|
4018
4048
|
let command = RubyCommand(commandID: "", methodName: "xcov", className: nil, args: [RubyCommand.Argument(name: "workspace", value: workspace),
|
4019
4049
|
RubyCommand.Argument(name: "project", value: project),
|
@@ -4121,4 +4151,4 @@ let screengrabfile: Screengrabfile = Screengrabfile()
|
|
4121
4151
|
let snapshotfile: Snapshotfile = Snapshotfile()
|
4122
4152
|
// Please don't remove the lines below
|
4123
4153
|
// They are used to detect outdated files
|
4124
|
-
// FastlaneRunnerAPIVersion [0.9.
|
4154
|
+
// FastlaneRunnerAPIVersion [0.9.33]
|
@@ -44,6 +44,19 @@ module FastlaneCore
|
|
44
44
|
parse(path, keychain_path).fetch("Name")
|
45
45
|
end
|
46
46
|
|
47
|
+
def mac?(path, keychain_path = nil)
|
48
|
+
parse(path, keychain_path).fetch("Platform", []).include?('OSX')
|
49
|
+
end
|
50
|
+
|
51
|
+
def profile_filename(path, keychain_path = nil)
|
52
|
+
basename = uuid(path, keychain_path)
|
53
|
+
if mac?(path, keychain_path)
|
54
|
+
basename + ".provisionprofile"
|
55
|
+
else
|
56
|
+
basename + ".mobileprovision"
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
47
60
|
def profiles_path
|
48
61
|
path = File.expand_path("~") + "/Library/MobileDevice/Provisioning Profiles/"
|
49
62
|
# If the directory doesn't exist, create it first
|
@@ -57,8 +70,7 @@ module FastlaneCore
|
|
57
70
|
# Installs a provisioning profile for Xcode to use
|
58
71
|
def install(path, keychain_path = nil)
|
59
72
|
UI.message("Installing provisioning profile...")
|
60
|
-
|
61
|
-
destination = File.join(profiles_path, profile_filename)
|
73
|
+
destination = File.join(profiles_path, profile_filename(path, keychain_path))
|
62
74
|
|
63
75
|
if path != destination
|
64
76
|
# copy to Xcode provisioning profile directory
|
data/sigh/lib/sigh/options.rb
CHANGED
@@ -14,18 +14,27 @@ module Sigh
|
|
14
14
|
description: "Setting this flag will generate AdHoc profiles instead of App Store Profiles",
|
15
15
|
is_string: false,
|
16
16
|
default_value: false,
|
17
|
-
conflicting_options: [:development],
|
18
|
-
conflict_block: proc do |
|
19
|
-
UI.user_error!("You can't enable both
|
17
|
+
conflicting_options: [:developer_id, :development],
|
18
|
+
conflict_block: proc do |option|
|
19
|
+
UI.user_error!("You can't enable both :#{option.key} and :adhoc")
|
20
|
+
end),
|
21
|
+
FastlaneCore::ConfigItem.new(key: :developer_id,
|
22
|
+
env_name: "SIGH_DEVELOPER_ID",
|
23
|
+
description: "Setting his flag will generate Developer ID profiles instead of App Store Profiles",
|
24
|
+
is_string: false,
|
25
|
+
default_value: false,
|
26
|
+
conflicting_options: [:adhoc, :development],
|
27
|
+
conflict_block: proc do |option|
|
28
|
+
UI.user_error!("You can't enable both :#{option.key} and :developer_id")
|
20
29
|
end),
|
21
30
|
FastlaneCore::ConfigItem.new(key: :development,
|
22
31
|
env_name: "SIGH_DEVELOPMENT",
|
23
32
|
description: "Renew the development certificate instead of the production one",
|
24
33
|
is_string: false,
|
25
34
|
default_value: false,
|
26
|
-
conflicting_options: [:adhoc],
|
27
|
-
conflict_block: proc do |
|
28
|
-
UI.user_error!("You can't enable both
|
35
|
+
conflicting_options: [:adhoc, :developer_id],
|
36
|
+
conflict_block: proc do |option|
|
37
|
+
UI.user_error!("You can't enable both :#{option.key} and :development")
|
29
38
|
end),
|
30
39
|
FastlaneCore::ConfigItem.new(key: :skip_install,
|
31
40
|
env_name: "SIGH_SKIP_INSTALL",
|
data/sigh/lib/sigh/runner.rb
CHANGED
@@ -58,6 +58,7 @@ module Sigh
|
|
58
58
|
@profile_type = Spaceship.provisioning_profile.app_store
|
59
59
|
@profile_type = Spaceship.provisioning_profile.in_house if Spaceship.client.in_house?
|
60
60
|
@profile_type = Spaceship.provisioning_profile.ad_hoc if Sigh.config[:adhoc]
|
61
|
+
@profile_type = Spaceship.provisioning_profile.direct if Sigh.config[:developer_id]
|
61
62
|
@profile_type = Spaceship.provisioning_profile.development if Sigh.config[:development]
|
62
63
|
|
63
64
|
@profile_type
|
@@ -260,7 +261,11 @@ module Sigh
|
|
260
261
|
profile_name += "_tvos"
|
261
262
|
end
|
262
263
|
|
263
|
-
|
264
|
+
if Sigh.config[:platform].to_s == 'macos'
|
265
|
+
profile_name += '.provisionprofile'
|
266
|
+
else
|
267
|
+
profile_name += '.mobileprovision'
|
268
|
+
end
|
264
269
|
|
265
270
|
tmp_path = Dir.mktmpdir("profile_download")
|
266
271
|
output_path = File.join(tmp_path, profile_name)
|
@@ -114,10 +114,14 @@ open class Snapshot: NSObject {
|
|
114
114
|
} catch {
|
115
115
|
print("Couldn't detect/set locale...")
|
116
116
|
}
|
117
|
+
|
117
118
|
if locale.isEmpty {
|
118
119
|
locale = Locale(identifier: deviceLanguage).identifier
|
119
120
|
}
|
120
|
-
|
121
|
+
|
122
|
+
if !locale.isEmpty {
|
123
|
+
app.launchArguments += ["-AppleLocale", "\"\(locale)\""]
|
124
|
+
}
|
121
125
|
}
|
122
126
|
|
123
127
|
class func setLaunchArguments(_ app: XCUIApplication) {
|
@@ -273,4 +277,4 @@ private extension CGFloat {
|
|
273
277
|
|
274
278
|
// Please don't remove the lines below
|
275
279
|
// They are used to detect outdated configuration files
|
276
|
-
// SnapshotHelperVersion [1.
|
280
|
+
// SnapshotHelperVersion [1.13]
|
@@ -107,10 +107,10 @@ module Spaceship
|
|
107
107
|
class MacInstallerDistribution < Certificate; end
|
108
108
|
|
109
109
|
# A Mac Developer ID signing certificate for building .app bundles
|
110
|
-
class
|
110
|
+
class DeveloperIdApplication < Certificate; end
|
111
111
|
|
112
112
|
# A Mac Developer ID signing certificate for building .pkg installers
|
113
|
-
class
|
113
|
+
class DeveloperIdInstaller < Certificate; end
|
114
114
|
|
115
115
|
#####################################################
|
116
116
|
# Certs that are specific for one app
|
@@ -175,11 +175,11 @@ module Spaceship
|
|
175
175
|
"749Y1QAGU7" => MacDevelopment,
|
176
176
|
"HXZEUKP0FP" => MacAppDistribution,
|
177
177
|
"2PQI8IDXNH" => MacInstallerDistribution,
|
178
|
-
"OYVN2GW35E" =>
|
179
|
-
"W0EURJRMC5" =>
|
178
|
+
"OYVN2GW35E" => DeveloperIdInstaller,
|
179
|
+
"W0EURJRMC5" => DeveloperIdApplication,
|
180
180
|
"CDZ7EMXIZ1" => MacProductionPush,
|
181
181
|
"HQ4KP3I34R" => MacDevelopmentPush,
|
182
|
-
"DIVN2GW3XT" =>
|
182
|
+
"DIVN2GW3XT" => DeveloperIdApplication
|
183
183
|
}
|
184
184
|
|
185
185
|
CERTIFICATE_TYPE_IDS = IOS_CERTIFICATE_TYPE_IDS.merge(MAC_CERTIFICATE_TYPE_IDS)
|
@@ -445,7 +445,7 @@ module Spaceship
|
|
445
445
|
if self.kind_of?(Development)
|
446
446
|
self.certificates = [Spaceship::Portal::Certificate::MacDevelopment.all.first]
|
447
447
|
elsif self.kind_of?(Direct)
|
448
|
-
self.certificates = [Spaceship::Portal::Certificate::
|
448
|
+
self.certificates = [Spaceship::Portal::Certificate::DeveloperIdApplication.all.first]
|
449
449
|
else
|
450
450
|
self.certificates = [Spaceship::Portal::Certificate::MacAppDistribution.all.first]
|
451
451
|
end
|
data/supply/lib/supply.rb
CHANGED
data/supply/lib/supply/client.rb
CHANGED
@@ -5,9 +5,76 @@ Androidpublisher = Google::Apis::AndroidpublisherV2
|
|
5
5
|
require 'net/http'
|
6
6
|
|
7
7
|
module Supply
|
8
|
-
class
|
8
|
+
class AbstractGoogleServiceClient
|
9
|
+
SCOPE = nil
|
10
|
+
SERVICE = nil
|
11
|
+
|
9
12
|
# Connecting with Google
|
10
|
-
attr_accessor :
|
13
|
+
attr_accessor :client
|
14
|
+
|
15
|
+
def self.make_from_config(params: nil)
|
16
|
+
unless params[:json_key] || params[:json_key_data]
|
17
|
+
UI.important("To not be asked about this value, you can specify it using 'json_key'")
|
18
|
+
json_key_path = UI.input("The service account json file used to authenticate with Google: ")
|
19
|
+
json_key_path = File.expand_path(json_key_path)
|
20
|
+
|
21
|
+
UI.user_error!("Could not find service account json file at path '#{json_key_path}'") unless File.exist?(json_key_path)
|
22
|
+
params[:json_key] = json_key_path
|
23
|
+
end
|
24
|
+
|
25
|
+
if params[:json_key]
|
26
|
+
service_account_json = File.open(File.expand_path(params[:json_key]))
|
27
|
+
elsif params[:json_key_data]
|
28
|
+
service_account_json = StringIO.new(params[:json_key_data])
|
29
|
+
end
|
30
|
+
|
31
|
+
return self.new(service_account_json: service_account_json, params: params)
|
32
|
+
end
|
33
|
+
|
34
|
+
# Initializes the service and its auth_client using the specified information
|
35
|
+
# @param service_account_json: The raw service account Json data
|
36
|
+
def initialize(service_account_json: nil, params: nil)
|
37
|
+
auth_client = Google::Auth::ServiceAccountCredentials.make_creds(json_key_io: service_account_json, scope: self.class::SCOPE)
|
38
|
+
|
39
|
+
UI.verbose("Fetching a new access token from Google...")
|
40
|
+
|
41
|
+
auth_client.fetch_access_token!
|
42
|
+
|
43
|
+
if FastlaneCore::Env.truthy?("DEBUG")
|
44
|
+
Google::Apis.logger.level = Logger::DEBUG
|
45
|
+
end
|
46
|
+
|
47
|
+
Google::Apis::ClientOptions.default.application_name = "fastlane (supply client)"
|
48
|
+
Google::Apis::ClientOptions.default.application_version = Fastlane::VERSION
|
49
|
+
Google::Apis::ClientOptions.default.read_timeout_sec = params[:timeout]
|
50
|
+
Google::Apis::ClientOptions.default.open_timeout_sec = params[:timeout]
|
51
|
+
Google::Apis::ClientOptions.default.send_timeout_sec = params[:timeout]
|
52
|
+
Google::Apis::RequestOptions.default.retries = 5
|
53
|
+
|
54
|
+
service = self.class::SERVICE.new
|
55
|
+
service.authorization = auth_client
|
56
|
+
|
57
|
+
if params[:root_url]
|
58
|
+
# Google's client expects the root_url string to end with "/".
|
59
|
+
params[:root_url] << '/' unless params[:root_url].end_with?('/')
|
60
|
+
service.root_url = params[:root_url]
|
61
|
+
end
|
62
|
+
|
63
|
+
self.client = service
|
64
|
+
end
|
65
|
+
|
66
|
+
private
|
67
|
+
|
68
|
+
def call_google_api
|
69
|
+
yield if block_given?
|
70
|
+
rescue Google::Apis::ClientError => e
|
71
|
+
UI.user_error!("Google Api Error: #{e.message}")
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
class Client < AbstractGoogleServiceClient
|
76
|
+
SERVICE = Androidpublisher::AndroidPublisherService
|
77
|
+
SCOPE = Androidpublisher::AUTH_ANDROIDPUBLISHER
|
11
78
|
|
12
79
|
# Editing something
|
13
80
|
# Reference to the entry we're currently editing. Might be nil if don't have one open
|
@@ -20,32 +87,29 @@ module Supply
|
|
20
87
|
#####################################################
|
21
88
|
|
22
89
|
# instantiate a client given the supplied configuration
|
23
|
-
def self.make_from_config
|
24
|
-
|
25
|
-
|
26
|
-
Supply.config[:json_key] = UI.input("The service account json file used to authenticate with Google: ")
|
90
|
+
def self.make_from_config(params: nil)
|
91
|
+
if params.nil?
|
92
|
+
params = Supply.config
|
27
93
|
end
|
28
94
|
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
95
|
+
# first consider deprecated params
|
96
|
+
unless params[:json_key] || params[:json_key_data] || (params[:key] && params[:issuer])
|
97
|
+
UI.important("To not be asked about this value, you can specify it using 'json_key'")
|
98
|
+
params[:json_key] = UI.input("The service account json file used to authenticate with Google: ")
|
33
99
|
end
|
34
100
|
|
35
|
-
|
36
|
-
issuer: Supply.config[:issuer], service_account_json: service_account_json)
|
101
|
+
super(params: params)
|
37
102
|
end
|
38
103
|
|
39
|
-
# Initializes the
|
104
|
+
# Initializes the client and its auth_client using the specified information
|
40
105
|
# @param service_account_json: The raw service account Json data
|
41
106
|
# @param path_to_key: The path to your p12 file (@deprecated)
|
42
107
|
# @param issuer: Email address for oauth (@deprecated)
|
43
|
-
def initialize(path_to_key: nil, issuer: nil, service_account_json: nil)
|
44
|
-
scope = Androidpublisher::AUTH_ANDROIDPUBLISHER
|
45
|
-
|
108
|
+
def initialize(path_to_key: nil, issuer: nil, service_account_json: nil, params: nil)
|
46
109
|
if service_account_json
|
47
110
|
key_io = service_account_json
|
48
111
|
else
|
112
|
+
# deprecated
|
49
113
|
require 'google/api_client/auth/key_utils'
|
50
114
|
key = Google::APIClient::KeyUtils.load_from_pkcs12(File.expand_path(path_to_key), 'notasecret')
|
51
115
|
cred_json = {
|
@@ -55,30 +119,7 @@ module Supply
|
|
55
119
|
key_io = StringIO.new(MultiJson.dump(cred_json))
|
56
120
|
end
|
57
121
|
|
58
|
-
|
59
|
-
|
60
|
-
UI.verbose("Fetching a new access token from Google...")
|
61
|
-
|
62
|
-
auth_client.fetch_access_token!
|
63
|
-
|
64
|
-
if FastlaneCore::Env.truthy?("DEBUG")
|
65
|
-
Google::Apis.logger.level = Logger::DEBUG
|
66
|
-
end
|
67
|
-
|
68
|
-
Google::Apis::ClientOptions.default.application_name = "fastlane - supply"
|
69
|
-
Google::Apis::ClientOptions.default.application_version = Fastlane::VERSION
|
70
|
-
Google::Apis::ClientOptions.default.read_timeout_sec = Supply.config[:timeout]
|
71
|
-
Google::Apis::ClientOptions.default.open_timeout_sec = Supply.config[:timeout]
|
72
|
-
Google::Apis::ClientOptions.default.send_timeout_sec = Supply.config[:timeout]
|
73
|
-
Google::Apis::RequestOptions.default.retries = 5
|
74
|
-
|
75
|
-
self.android_publisher = Androidpublisher::AndroidPublisherService.new
|
76
|
-
self.android_publisher.authorization = auth_client
|
77
|
-
if Supply.config[:root_url]
|
78
|
-
# Google's client expects the root_url string to end with "/".
|
79
|
-
Supply.config[:root_url] << '/' unless Supply.config[:root_url].end_with?('/')
|
80
|
-
self.android_publisher.root_url = Supply.config[:root_url]
|
81
|
-
end
|
122
|
+
super(service_account_json: key_io, params: params)
|
82
123
|
end
|
83
124
|
|
84
125
|
#####################################################
|
@@ -89,7 +130,7 @@ module Supply
|
|
89
130
|
def begin_edit(package_name: nil)
|
90
131
|
UI.user_error!("You currently have an active edit") if @current_edit
|
91
132
|
|
92
|
-
self.current_edit = call_google_api {
|
133
|
+
self.current_edit = call_google_api { client.insert_edit(package_name) }
|
93
134
|
|
94
135
|
self.current_package_name = package_name
|
95
136
|
end
|
@@ -98,7 +139,7 @@ module Supply
|
|
98
139
|
def abort_current_edit
|
99
140
|
ensure_active_edit!
|
100
141
|
|
101
|
-
call_google_api {
|
142
|
+
call_google_api { client.delete_edit(current_package_name, current_edit.id) }
|
102
143
|
|
103
144
|
self.current_edit = nil
|
104
145
|
self.current_package_name = nil
|
@@ -108,14 +149,14 @@ module Supply
|
|
108
149
|
def validate_current_edit!
|
109
150
|
ensure_active_edit!
|
110
151
|
|
111
|
-
call_google_api {
|
152
|
+
call_google_api { client.validate_edit(current_package_name, current_edit.id) }
|
112
153
|
end
|
113
154
|
|
114
155
|
# Commits the current edit saving all pending changes on Google Play
|
115
156
|
def commit_current_edit!
|
116
157
|
ensure_active_edit!
|
117
158
|
|
118
|
-
call_google_api {
|
159
|
+
call_google_api { client.commit_edit(current_package_name, current_edit.id) }
|
119
160
|
|
120
161
|
self.current_edit = nil
|
121
162
|
self.current_package_name = nil
|
@@ -130,7 +171,7 @@ module Supply
|
|
130
171
|
def listings
|
131
172
|
ensure_active_edit!
|
132
173
|
|
133
|
-
result = call_google_api {
|
174
|
+
result = call_google_api { client.list_listings(current_package_name, current_edit.id) }
|
134
175
|
|
135
176
|
return result.listings.map do |row|
|
136
177
|
Listing.new(self, row.language, row)
|
@@ -142,7 +183,7 @@ module Supply
|
|
142
183
|
ensure_active_edit!
|
143
184
|
|
144
185
|
begin
|
145
|
-
result =
|
186
|
+
result = client.get_listing(
|
146
187
|
current_package_name,
|
147
188
|
current_edit.id,
|
148
189
|
language
|
@@ -159,7 +200,7 @@ module Supply
|
|
159
200
|
def apks_version_codes
|
160
201
|
ensure_active_edit!
|
161
202
|
|
162
|
-
result = call_google_api {
|
203
|
+
result = call_google_api { client.list_apks(current_package_name, current_edit.id) }
|
163
204
|
|
164
205
|
return Array(result.apks).map(&:version_code)
|
165
206
|
end
|
@@ -168,7 +209,7 @@ module Supply
|
|
168
209
|
def aab_version_codes
|
169
210
|
ensure_active_edit!
|
170
211
|
|
171
|
-
result = call_google_api {
|
212
|
+
result = call_google_api { client.list_edit_bundles(current_package_name, current_edit.id) }
|
172
213
|
|
173
214
|
return Array(result.bundles).map(&:version_code)
|
174
215
|
end
|
@@ -178,7 +219,7 @@ module Supply
|
|
178
219
|
ensure_active_edit!
|
179
220
|
|
180
221
|
result = call_google_api do
|
181
|
-
|
222
|
+
client.list_apk_listings(
|
182
223
|
current_package_name,
|
183
224
|
current_edit.id,
|
184
225
|
apk_version_code
|
@@ -207,7 +248,7 @@ module Supply
|
|
207
248
|
})
|
208
249
|
|
209
250
|
call_google_api do
|
210
|
-
|
251
|
+
client.update_listing(
|
211
252
|
current_package_name,
|
212
253
|
current_edit.id,
|
213
254
|
language,
|
@@ -220,7 +261,7 @@ module Supply
|
|
220
261
|
ensure_active_edit!
|
221
262
|
|
222
263
|
result_upload = call_google_api do
|
223
|
-
|
264
|
+
client.upload_apk(
|
224
265
|
current_package_name,
|
225
266
|
current_edit.id,
|
226
267
|
upload_source: path_to_apk
|
@@ -234,7 +275,7 @@ module Supply
|
|
234
275
|
ensure_active_edit!
|
235
276
|
|
236
277
|
call_google_api do
|
237
|
-
|
278
|
+
client.upload_edit_deobfuscationfile(
|
238
279
|
current_package_name,
|
239
280
|
current_edit.id,
|
240
281
|
apk_version_code,
|
@@ -249,7 +290,7 @@ module Supply
|
|
249
290
|
ensure_active_edit!
|
250
291
|
|
251
292
|
result_upload = call_google_api do
|
252
|
-
|
293
|
+
client.upload_edit_bundle(
|
253
294
|
current_package_name,
|
254
295
|
self.current_edit.id,
|
255
296
|
upload_source: path_to_aab,
|
@@ -278,7 +319,7 @@ module Supply
|
|
278
319
|
})
|
279
320
|
|
280
321
|
call_google_api do
|
281
|
-
|
322
|
+
client.update_track(
|
282
323
|
current_package_name,
|
283
324
|
current_edit.id,
|
284
325
|
track,
|
@@ -292,7 +333,7 @@ module Supply
|
|
292
333
|
ensure_active_edit!
|
293
334
|
|
294
335
|
begin
|
295
|
-
result =
|
336
|
+
result = client.get_track(
|
296
337
|
current_package_name,
|
297
338
|
current_edit.id,
|
298
339
|
track
|
@@ -313,7 +354,7 @@ module Supply
|
|
313
354
|
})
|
314
355
|
|
315
356
|
call_google_api do
|
316
|
-
|
357
|
+
client.update_apk_listing(
|
317
358
|
current_package_name,
|
318
359
|
current_edit.id,
|
319
360
|
apk_listing.apk_version_code,
|
@@ -331,7 +372,7 @@ module Supply
|
|
331
372
|
ensure_active_edit!
|
332
373
|
|
333
374
|
result = call_google_api do
|
334
|
-
|
375
|
+
client.list_images(
|
335
376
|
current_package_name,
|
336
377
|
current_edit.id,
|
337
378
|
language,
|
@@ -347,7 +388,7 @@ module Supply
|
|
347
388
|
ensure_active_edit!
|
348
389
|
|
349
390
|
call_google_api do
|
350
|
-
|
391
|
+
client.upload_image(
|
351
392
|
current_package_name,
|
352
393
|
current_edit.id,
|
353
394
|
language,
|
@@ -362,7 +403,7 @@ module Supply
|
|
362
403
|
ensure_active_edit!
|
363
404
|
|
364
405
|
call_google_api do
|
365
|
-
|
406
|
+
client.delete_all_images(
|
366
407
|
current_package_name,
|
367
408
|
current_edit.id,
|
368
409
|
language,
|
@@ -375,7 +416,7 @@ module Supply
|
|
375
416
|
ensure_active_edit!
|
376
417
|
|
377
418
|
call_google_api do
|
378
|
-
|
419
|
+
client.upload_expansion_file(
|
379
420
|
current_package_name,
|
380
421
|
current_edit.id,
|
381
422
|
apk_version_code,
|
@@ -391,11 +432,5 @@ module Supply
|
|
391
432
|
def ensure_active_edit!
|
392
433
|
UI.user_error!("You need to have an active edit, make sure to call `begin_edit`") unless @current_edit
|
393
434
|
end
|
394
|
-
|
395
|
-
def call_google_api
|
396
|
-
yield if block_given?
|
397
|
-
rescue Google::Apis::ClientError => e
|
398
|
-
UI.user_error!("Google Api Error: #{e.message}")
|
399
|
-
end
|
400
435
|
end
|
401
436
|
end
|