fastlane-plugin-branch 0.5.1 → 0.6.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 +45 -45
- data/lib/fastlane/plugin/branch/actions/setup_branch_action.rb +15 -206
- data/lib/fastlane/plugin/branch/actions/validate_universal_links_action.rb +3 -43
- data/lib/fastlane/plugin/branch/helper/branch_options.rb +16 -0
- data/lib/fastlane/plugin/branch/version.rb +1 -1
- metadata +15 -32
- data/lib/fastlane/plugin/branch/helper/android_helper.rb +0 -86
- data/lib/fastlane/plugin/branch/helper/branch_helper.rb +0 -25
- data/lib/fastlane/plugin/branch/helper/configuration_helper.rb +0 -132
- data/lib/fastlane/plugin/branch/helper/ios_helper.rb +0 -505
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: deb9d71578884158d8ac26de9f51633067221bdf
|
4
|
+
data.tar.gz: 4011ed386f10314697c333a0d194480780e13281
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d8a42857ea57a3d76301a3f308acda6ffc49a8579ff0cfb571461e4c8afd1231d9467b6a33196d414649fe65544715dc61fa594425763124bb2d30adb9eed60f
|
7
|
+
data.tar.gz: 828cfc8821fb821a6dfdcb4ece5e97b4754aceb1beead4a590cc1948b5f28f7e22f08c499b48e9238bafad11d400778a42052b58083411653b45a901d068d27d
|
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# Branch plugin
|
2
2
|
|
3
|
-
Use this Fastlane plugin to set up your
|
3
|
+
Use this Fastlane plugin to set up your Xcode project configuration correctly to
|
4
4
|
use the Branch SDK. It can also validate the Universal Link configuration in any Xcode
|
5
5
|
project, for Branch domains as well as non-Branch domains. Unlike web-based Universal
|
6
6
|
Link validators, the `validate_universal_links` action
|
@@ -8,6 +8,9 @@ operates directly on your project. There is no need to look up your team identif
|
|
8
8
|
any other information. The validator requires no input at all for simple projects. It
|
9
9
|
supports both signed and unsigned apple-app-site-association files.
|
10
10
|
|
11
|
+
Also see the [Branch CLI](https://github.com/BranchMetrics/branch_io_cli), which
|
12
|
+
supports the same operations without Fastlane.
|
13
|
+
|
11
14
|
[](https://rubygems.org/gems/fastlane-plugin-branch)
|
12
15
|
[](https://rubygems.org/gems/fastlane-plugin-branch)
|
13
16
|
[](https://rubygems.org/gems/fastlane-plugin-branch)
|
@@ -26,57 +29,58 @@ This project is a [_fastlane_](https://github.com/fastlane/fastlane) plugin. To
|
|
26
29
|
fastlane add_plugin branch
|
27
30
|
```
|
28
31
|
|
29
|
-
### New to Fastlane or Ruby?
|
30
|
-
|
31
|
-
See [Simple Fastlane setup with plugins](https://github.com/BranchMetrics/fastlane-plugin-branch/wiki/Simple-Fastlane-setup-with-plugins)
|
32
|
-
and the [RVM Cheat Sheet](https://github.com/BranchMetrics/fastlane-plugin-branch/wiki/RVM-Cheat-Sheet) in this repo's wiki
|
33
|
-
for help getting started.
|
34
|
-
|
35
32
|
## setup_branch action
|
36
33
|
|
37
|
-
|
34
|
+
Integrates the Branch SDK into a native app project. This currently supports iOS only.
|
35
|
+
It will infer the project location if there is exactly one .xcodeproj anywhere under
|
36
|
+
the current directory, excluding any in a Pods or Carthage folder. Otherwise, specify
|
37
|
+
the project location using the `--xcodeproj` option, or the CLI will prompt you for the
|
38
|
+
location.
|
38
39
|
|
39
|
-
|
40
|
+
If a Podfile or Cartfile is detected, the Branch SDK will be added to the relevant
|
41
|
+
configuration file and the dependencies updated to include the Branch framework.
|
42
|
+
This behavior may be suppressed using `--no-add-sdk`. If no Podfile or Cartfile
|
43
|
+
is found, and Branch.framework is not already among the project's dependencies,
|
44
|
+
you will be prompted for a number of choices, including setting up CocoaPods or
|
45
|
+
Carthage for the project or directly installing the Branch.framework.
|
40
46
|
|
41
|
-
|
47
|
+
By default, all supplied Universal Link domains are validated. If validation passes,
|
48
|
+
the setup continues. If validation fails, no further action is taken. Suppress
|
49
|
+
validation using `--no-validate` or force changes when validation fails using
|
50
|
+
`--force`.
|
42
51
|
|
43
|
-
|
44
|
-
|
45
|
-
- The custom URI scheme for your app, if any (Android only)
|
46
|
-
- Location(s) of your Android and/or iOS project(s)
|
52
|
+
By default, this command will look for the first app target in the project. Test
|
53
|
+
targets are not supported. To set up an extension target, supply the `--target` option.
|
47
54
|
|
48
|
-
|
55
|
+
All relevant target settings are modified. The Branch keys are added to the Info.plist,
|
56
|
+
along with the `branch_universal_link_domains` key for custom domains (when `--domains`
|
57
|
+
is used). For app targets, all domains are added to the project's Associated Domains
|
58
|
+
entitlement. An entitlements file is also added for app targets if none is found.
|
59
|
+
Optionally, if `--frameworks` is specified, this command can add a list of system
|
60
|
+
frameworks to the target's dependencies (e.g., AdSupport, CoreSpotlight, SafariServices).
|
49
61
|
|
50
|
-
|
51
|
-
|
62
|
+
A language-specific patch is applied to the AppDelegate (Swift or Objective-C).
|
63
|
+
This can be suppressed using `--no-patch-source`.
|
52
64
|
|
53
|
-
|
54
|
-
the Branch pod, the pod will be added and `pod install` run to add the Branch SDK
|
55
|
-
dependency to the project. If no Podfile is present, and a Cartfile is detected without
|
56
|
-
the Branch framework, the framework will be added and `carthage update` run to add
|
57
|
-
the Branch SDK dependency to the project. If no Podfile or Cartfile is detected, or
|
58
|
-
if one exists with the Branch SDK already included, no changes to the project's
|
59
|
-
dependencies will be made.
|
65
|
+
#### Prerequisites
|
60
66
|
|
61
|
-
|
62
|
-
Branch import is not found:
|
67
|
+
Before using this command, make sure to set up your app in the [Branch Dashboard](https://dashboard.branch.io). See https://docs.branch.io/pages/dashboard/integrate/ for details. To use the `setup` command, you need:
|
63
68
|
|
64
|
-
-
|
65
|
-
-
|
66
|
-
-
|
67
|
-
exist.
|
69
|
+
- Branch key(s), either live, test or both
|
70
|
+
- Domain name(s) used for Branch links
|
71
|
+
- Location of your Xcode project (may be inferred in simple projects)
|
68
72
|
|
69
|
-
|
70
|
-
the
|
71
|
-
|
73
|
+
If using the `--commit` option, `git` is required. If not using `--no-add-sdk`,
|
74
|
+
the `pod` or `carthage` command may be required. If not found, the CLI will
|
75
|
+
offer to install and set up these command-line tools for you. Alternately, you can arrange
|
76
|
+
that the relevant commands are available in your `PATH`.
|
72
77
|
|
73
78
|
```ruby
|
74
79
|
setup_branch(
|
75
80
|
live_key: "key_live_xxxx",
|
76
81
|
test_key: "key_test_yyyy",
|
77
82
|
app_link_subdomain: "myapp",
|
78
|
-
uri_scheme: "myscheme",
|
79
|
-
android_project_path: "MyAndroidApp", # MyAndroidApp/src/main/AndroidManifest.xml
|
83
|
+
uri_scheme: "myscheme",
|
80
84
|
xcodeproj: "MyIOSApp.xcodeproj"
|
81
85
|
)
|
82
86
|
```
|
@@ -98,14 +102,9 @@ Available options:
|
|
98
102
|
|:test_key|The Branch test key to use (:live_key or :test_key is required)|BRANCH_TEST_KEY|string||
|
99
103
|
|:app_link_subdomain|An app.link subdomain to use (:app_link_subdomain or :domains is required. The union of the two sets of domains will be used.)|BRANCH_APP_LINK_SUBDOMAIN|string||
|
100
104
|
|:domains|A list of domains (custom domains or Branch domains) to use (:app_link_subdomain or :domains is required. The union of the two sets of domains will be used.)|BRANCH_DOMAINS|array of strings or comma-separated string||
|
101
|
-
|:uri_scheme|A URI scheme to add to the manifest
|
102
|
-
|:android_project_path|Path to an Android project to use. Equivalent to 'android_manifest_path: "app/src/main/AndroidManifest.xml"`. Overridden by :android_manifest_path (:xcodeproj, :android_project_path or :android_manifest_path is required.)|BRANCH_ANDROID_PROJECT_PATH|string||
|
103
|
-
|:android_manifest_path|Path to an Android manifest to modify. Overrides :android_project_path. (:xcodeproj, :android_project_path or :android_manifest_path is required.)|BRANCH_ANDROID_MANIFEST_PATH|string||
|
105
|
+
|:uri_scheme|A URI scheme to add to the manifest|BRANCH_URI_SCHEME|string||
|
104
106
|
|:xcodeproj|Path to a .xcodeproj directory to use. (:xcodeproj, :android_project_path or :android_manifest_path is required.)|BRANCH_XCODEPROJ|string||
|
105
|
-
|:activity_name|Name of the Activity to use (Android only; optional)|BRANCH_ACTIVITY_NAME|string||
|
106
107
|
|:target|Name of the target to use in the Xcode project (iOS only; optional)|BRANCH_TARGET|string||
|
107
|
-
|:update_bundle_and_team_ids|If true, changes the bundle and team identifiers in the Xcode project to match the AASA file. Mainly useful for sample apps. (iOS only)|BRANCH_UPDATE_BUNDLE_AND_TEAM_IDS|boolean|false|
|
108
|
-
|:remove_existing_domains|If true, any domains currently configured in the Xcode project or Android manifest will be removed before adding the domains specified by the arguments. Mainly useful for sample apps.|BRANCH_REMOVE_EXISTING_DOMAINS|boolean|false|
|
109
108
|
|:validate|Determines whether to validate the resulting Universal Link configuration before modifying the project|BRANCH_VALIDATE|boolean|true|
|
110
109
|
|:force|Update project(s) even if Universal Link validation fails|BRANCH_FORCE_UPDATE|boolean|false|
|
111
110
|
|:commit|Set to true to commit changes to Git; set to a string to commit with a custom message|BRANCH_COMMIT_CHANGES|boolean or string|false|
|
@@ -115,14 +114,15 @@ Available options:
|
|
115
114
|
|:patch_source|Set to false to disable automatic source-code patching|BRANCH_PATCH_SOURCE|boolean|true|
|
116
115
|
|:pod_repo_update|Set to false to disable update of local podspec repo before pod install|BRANCH_POD_REPO_UPDATE|boolean|true|
|
117
116
|
|:cartfile|Path to a Cartfile to update (iOS only)|BRANCH_CARTFILE|string||
|
118
|
-
|:
|
117
|
+
|:carthage_command|Command to use when installing with Carthage|BRANCH_CARTHAGE_COMMAND|string|update --platform ios|
|
119
118
|
|
120
119
|
Individually, all parameters are optional, but the following conditions apply:
|
121
120
|
|
122
|
-
- :android_manifest_path, :android_project_path or :xcodeproj must be specified.
|
123
121
|
- :live_key or :test_key must be specified.
|
124
122
|
- :app_link_subdomain or :domains must be specified.
|
125
123
|
|
124
|
+
If these parameters are not specified, you will be prompted for them.
|
125
|
+
|
126
126
|
This action also supports an optional Branchfile to specify configuration options.
|
127
127
|
See the sample [Branchfile](./fastlane/Branchfile) in the fastlane subdirectory of this repo.
|
128
128
|
|
@@ -174,8 +174,8 @@ example lanes. Be sure to run `bundle install` before trying any of the examples
|
|
174
174
|
|
175
175
|
### setup
|
176
176
|
|
177
|
-
This lane sets up the BranchPluginExample
|
178
|
-
in
|
177
|
+
This lane sets up the BranchPluginExample project
|
178
|
+
in
|
179
179
|
[examples/ios/BranchPluginExample](./examples/ios/BranchPluginExample).
|
180
180
|
The Xcode project uses CocoaPods and Swift.
|
181
181
|
|
@@ -1,102 +1,15 @@
|
|
1
|
-
require "
|
2
|
-
require "xcodeproj"
|
1
|
+
require "branch_io_cli"
|
3
2
|
|
4
3
|
module Fastlane
|
5
4
|
module Actions
|
6
5
|
class SetupBranchAction < Action
|
7
|
-
# rubocop: disable Metrics/PerceivedComplexity
|
8
6
|
def self.run(params)
|
9
|
-
|
10
|
-
params
|
11
|
-
|
12
|
-
keys = helper.keys_from_params params
|
13
|
-
raise "Must specify :live_key or :test_key." if keys.empty?
|
14
|
-
|
15
|
-
domains = helper.domains_from_params params
|
16
|
-
raise "Cannot determine domains to add to project. Specify :app_link_subdomain or :domains." if domains.empty?
|
17
|
-
|
18
|
-
if params[:xcodeproj].nil? and params[:android_project_path].nil? and params[:android_manifest_path].nil?
|
19
|
-
raise ":xcodeproj, :android_manifest_path or :android_project_path is required"
|
20
|
-
end
|
21
|
-
|
22
|
-
UI.message "live key: #{keys[:live]}" unless keys[:live].nil?
|
23
|
-
UI.message "test key: #{keys[:test]}" unless keys[:test].nil?
|
24
|
-
UI.message "domains: #{domains}"
|
25
|
-
|
26
|
-
if params[:xcodeproj]
|
27
|
-
# raises
|
28
|
-
xcodeproj = Xcodeproj::Project.open params[:xcodeproj]
|
29
|
-
|
30
|
-
update_podfile(params) || update_cartfile(params, xcodeproj)
|
31
|
-
|
32
|
-
target = params[:target] # may be nil
|
33
|
-
|
34
|
-
if params[:update_bundle_and_team_ids]
|
35
|
-
helper.update_team_and_bundle_ids_from_aasa_file xcodeproj, target, domains.first
|
36
|
-
elsif params[:validate] &&
|
37
|
-
helper.validate_team_and_bundle_ids_from_aasa_files(xcodeproj, target, domains, params[:remove_existing_domains])
|
38
|
-
UI.message "Universal Link configuration passed validation. ✅"
|
39
|
-
elsif params[:validate]
|
40
|
-
UI.error "Universal Link configuration failed validation."
|
41
|
-
helper.errors.each { |error| UI.error " #{error}" }
|
42
|
-
return unless params[:force]
|
43
|
-
end
|
44
|
-
|
45
|
-
# the following calls can all raise IOError
|
46
|
-
helper.add_keys_to_info_plist xcodeproj, target, keys
|
47
|
-
helper.add_branch_universal_link_domains_to_info_plist xcodeproj, target, domains
|
48
|
-
new_path = helper.add_universal_links_to_project xcodeproj, target, domains, params[:remove_existing_domains]
|
49
|
-
other_action.git_add path: new_path if params[:commit] && new_path
|
50
|
-
|
51
|
-
helper.add_system_frameworks xcodeproj, target, params[:frameworks] unless params[:frameworks].empty?
|
52
|
-
|
53
|
-
xcodeproj.save
|
54
|
-
|
55
|
-
patch_source xcodeproj if params[:patch_source]
|
56
|
-
end
|
57
|
-
|
58
|
-
if params[:android_project_path] || params[:android_manifest_path]
|
59
|
-
# :android_manifest_path overrides :android_project_path
|
60
|
-
manifest_path = params[:android_manifest_path] || "#{params[:android_project_path]}/app/src/main/AndroidManifest.xml"
|
61
|
-
manifest = File.open(manifest_path) { |f| REXML::Document.new f }
|
62
|
-
|
63
|
-
helper.add_keys_to_android_manifest manifest, keys
|
64
|
-
# :activity_name and :uri_scheme may be nil. :remove_existing_domains defaults to false
|
65
|
-
helper.add_intent_filters_to_android_manifest manifest,
|
66
|
-
domains,
|
67
|
-
params[:uri_scheme],
|
68
|
-
params[:activity_name],
|
69
|
-
params[:remove_existing_domains]
|
70
|
-
|
71
|
-
File.open(manifest_path, "w") do |f|
|
72
|
-
manifest.write f, 4
|
73
|
-
end
|
74
|
-
|
75
|
-
# Work around a REXML issue for now.
|
76
|
-
# Replace single quotes with double quotes in all XML attributes.
|
77
|
-
# Disable this using double_quotes: false.
|
78
|
-
if params[:double_quotes]
|
79
|
-
Actions::PatchAction.run(
|
80
|
-
files: manifest_path,
|
81
|
-
regexp: /(=\s*)'([^']*)'/,
|
82
|
-
text: '\1"\2"',
|
83
|
-
mode: :replace,
|
84
|
-
global: true,
|
85
|
-
offset: 0
|
86
|
-
)
|
87
|
-
end
|
88
|
-
|
89
|
-
helper.add_change File.expand_path(manifest_path, Bundler.root)
|
90
|
-
end
|
91
|
-
|
92
|
-
if params[:commit]
|
93
|
-
message = params[:commit].kind_of?(String) ? params[:commit] : "[Fastlane] Branch SDK integration"
|
94
|
-
other_action.git_commit path: helper.changes.to_a, message: message
|
95
|
-
end
|
7
|
+
params.load_configuration_file "Branchfile"
|
8
|
+
options = Helper::BranchOptions.new params
|
9
|
+
BranchIOCLI::Commands::SetupCommand.new(options).run!
|
96
10
|
rescue StandardError => e
|
97
11
|
UI.user_error! "Error in SetupBranchAction: #{e.message}\n#{e.backtrace}"
|
98
12
|
end
|
99
|
-
# rubocop: enable Metrics/PerceivedComplexity
|
100
13
|
|
101
14
|
def self.description
|
102
15
|
"Adds Branch keys, custom URI schemes and domains to iOS and Android projects."
|
@@ -110,9 +23,9 @@ module Fastlane
|
|
110
23
|
end
|
111
24
|
|
112
25
|
def self.details
|
113
|
-
"This action automatically configures Xcode
|
114
|
-
"for Universal Links
|
115
|
-
"entitlements as well as Info.plist
|
26
|
+
"This action automatically configures Xcode projects that use the Branch SDK " \
|
27
|
+
"for Universal Links and custom URI handling. It modifies Xcode project settings and " \
|
28
|
+
"entitlements as well as Info.plist files. It also validates the Universal Link " \
|
116
29
|
"configuration for Xcode projects."
|
117
30
|
end
|
118
31
|
|
@@ -123,8 +36,7 @@ module Fastlane
|
|
123
36
|
live_key: "key_live_xxxx",
|
124
37
|
test_key: "key_test_yyyy",
|
125
38
|
app_link_subdomain: "myapp",
|
126
|
-
uri_scheme: "myscheme",
|
127
|
-
android_project_path: "MyAndroidApp", # MyAndroidApp/src/main/AndroidManifest.xml
|
39
|
+
uri_scheme: "myscheme",
|
128
40
|
xcodeproj: "MyIOSApp.xcodeproj"
|
129
41
|
)
|
130
42
|
EOF
|
@@ -138,16 +50,6 @@ module Fastlane
|
|
138
50
|
description: "Path to an Xcode project to modify",
|
139
51
|
optional: true,
|
140
52
|
type: String),
|
141
|
-
FastlaneCore::ConfigItem.new(key: :android_project_path,
|
142
|
-
env_name: "BRANCH_ANDROID_PROJECT_PATH",
|
143
|
-
description: "Path to an Android project to modify",
|
144
|
-
optional: true,
|
145
|
-
type: String),
|
146
|
-
FastlaneCore::ConfigItem.new(key: :android_manifest_path,
|
147
|
-
env_name: "BRANCH_ANDROID_MANIFEST_PATH",
|
148
|
-
description: "Path to and Android manifest to modify",
|
149
|
-
optional: true,
|
150
|
-
type: String),
|
151
53
|
FastlaneCore::ConfigItem.new(key: :live_key,
|
152
54
|
env_name: "BRANCH_LIVE_KEY",
|
153
55
|
description: "The Branch live key for your app",
|
@@ -170,12 +72,7 @@ module Fastlane
|
|
170
72
|
type: String),
|
171
73
|
FastlaneCore::ConfigItem.new(key: :uri_scheme,
|
172
74
|
env_name: "BRANCH_URI_SCHEME",
|
173
|
-
description: "Custom URI scheme used with Branch
|
174
|
-
optional: true,
|
175
|
-
type: String),
|
176
|
-
FastlaneCore::ConfigItem.new(key: :activity_name,
|
177
|
-
env_name: "BRANCH_ACTIVITY_NAME",
|
178
|
-
description: "Name of the Activity in the manifest containing Branch intent-filers (Android only)",
|
75
|
+
description: "Custom URI scheme used with Branch",
|
179
76
|
optional: true,
|
180
77
|
type: String),
|
181
78
|
FastlaneCore::ConfigItem.new(key: :target,
|
@@ -183,18 +80,6 @@ module Fastlane
|
|
183
80
|
description: "Name of the target in the Xcode project to modify (iOS only)",
|
184
81
|
optional: true,
|
185
82
|
type: String),
|
186
|
-
FastlaneCore::ConfigItem.new(key: :update_bundle_and_team_ids,
|
187
|
-
env_name: "BRANCH_UPDATE_BUNDLE_AND_TEAM_IDS",
|
188
|
-
description: "If set to true, updates the bundle and team identifiers to match the AASA file (iOS only)",
|
189
|
-
optional: true,
|
190
|
-
default_value: false,
|
191
|
-
is_string: false),
|
192
|
-
FastlaneCore::ConfigItem.new(key: :remove_existing_domains,
|
193
|
-
env_name: "BRANCH_REMOVE_EXISTING_DOMAINS",
|
194
|
-
description: "If set to true, removes any existing domains before adding Branch domains",
|
195
|
-
optional: true,
|
196
|
-
default_value: false,
|
197
|
-
is_string: false),
|
198
83
|
FastlaneCore::ConfigItem.new(key: :validate,
|
199
84
|
env_name: "BRANCH_VALIDATE",
|
200
85
|
description: "Determines whether to validate the resulting Universal Link configuration before modifying the project",
|
@@ -246,98 +131,22 @@ module Fastlane
|
|
246
131
|
description: "Path to a Cartfile to update (iOS only)",
|
247
132
|
optional: true,
|
248
133
|
type: String),
|
249
|
-
FastlaneCore::ConfigItem.new(key: :
|
250
|
-
env_name: "
|
251
|
-
description: "
|
134
|
+
FastlaneCore::ConfigItem.new(key: :carthage_command,
|
135
|
+
env_name: "BRANCH_CARTHAGE_COMMAND",
|
136
|
+
description: "Command to use when installing with Carthage",
|
252
137
|
optional: true,
|
253
|
-
default_value:
|
254
|
-
|
138
|
+
default_value: "update --platform ios",
|
139
|
+
type: String)
|
255
140
|
]
|
256
141
|
end
|
257
142
|
|
258
143
|
def self.is_supported?(platform)
|
259
|
-
|
144
|
+
platform == :ios
|
260
145
|
end
|
261
146
|
|
262
147
|
def self.category
|
263
148
|
:project
|
264
149
|
end
|
265
|
-
|
266
|
-
class << self
|
267
|
-
def update_podfile(params)
|
268
|
-
podfile_path = helper.podfile_path_from_params params
|
269
|
-
return false if podfile_path.nil?
|
270
|
-
|
271
|
-
# 1. Patch Podfile. Return if no change (Branch pod already present).
|
272
|
-
return false unless helper.patch_podfile podfile_path
|
273
|
-
|
274
|
-
# 2. pod install
|
275
|
-
other_action.cocoapods podfile: podfile_path, repo_update: params[:pod_repo_update]
|
276
|
-
|
277
|
-
# 3. Add Podfile and Podfile.lock to commit (in case :commit param specified)
|
278
|
-
helper.add_change podfile_path
|
279
|
-
helper.add_change "#{podfile_path}.lock"
|
280
|
-
|
281
|
-
# 4. Check if Pods folder is under SCM
|
282
|
-
pods_folder_path = File.expand_path "../Pods", podfile_path
|
283
|
-
`git ls-files #{pods_folder_path} --error-unmatch > /dev/null 2>&1`
|
284
|
-
return true unless $?.exitstatus == 0
|
285
|
-
|
286
|
-
# 5. If so, add the Pods folder to the commit (in case :commit param specified)
|
287
|
-
helper.add_change pods_folder_path
|
288
|
-
other_action.git_add path: pods_folder_path if params[:commit]
|
289
|
-
true
|
290
|
-
end
|
291
|
-
|
292
|
-
def update_cartfile(params, project)
|
293
|
-
cartfile_path = helper.cartfile_path_from_params params
|
294
|
-
return false if cartfile_path.nil?
|
295
|
-
|
296
|
-
# 1. Patch Cartfile. Return if no change (Branch already present).
|
297
|
-
return false unless helper.patch_cartfile cartfile_path
|
298
|
-
|
299
|
-
# 2. carthage update
|
300
|
-
other_action.carthage command: "update", project_directory: File.dirname(cartfile_path)
|
301
|
-
|
302
|
-
# 3. Add Cartfile and Cartfile.resolved to commit (in case :commit param specified)
|
303
|
-
helper.add_change cartfile_path
|
304
|
-
helper.add_change "#{cartfile_path}.resolved"
|
305
|
-
|
306
|
-
# 4. Add to target depependencies
|
307
|
-
frameworks_group = project['Frameworks']
|
308
|
-
branch_framework = frameworks_group.new_file "Carthage/Build/iOS/Branch.framework"
|
309
|
-
target = helper.target_from_project project, params[:target]
|
310
|
-
target.frameworks_build_phase.add_file_reference branch_framework
|
311
|
-
|
312
|
-
# 5. Add to copy-frameworks build phase
|
313
|
-
carthage_build_phase = target.build_phases.find do |phase|
|
314
|
-
phase.respond_to?(:shell_script) && phase.shell_script =~ /carthage\s+copy-frameworks/
|
315
|
-
end
|
316
|
-
|
317
|
-
if carthage_build_phase
|
318
|
-
carthage_build_phase.input_paths << "$(SRCROOT)/Carthage/Build/iOS/Branch.framework"
|
319
|
-
carthage_build_phase.output_paths << "$(BUILT_PRODUCTS_DIR)/$(FRAMEWORKS_FOLDER_PATH)/Branch.framework"
|
320
|
-
end
|
321
|
-
|
322
|
-
# 6. Check if Carthage folder is under SCM
|
323
|
-
carthage_folder_path = File.expand_path "../Carthage", cartfile_path
|
324
|
-
`git ls-files #{carthage_folder_path} --error-unmatch > /dev/null 2>&1`
|
325
|
-
return true unless $?.exitstatus == 0
|
326
|
-
|
327
|
-
# 7. If so, add the Pods folder to the commit (in case :commit param specified)
|
328
|
-
helper.add_change carthage_folder_path
|
329
|
-
other_action.git_add path: carthage_folder_path if params[:commit]
|
330
|
-
true
|
331
|
-
end
|
332
|
-
|
333
|
-
def patch_source(xcodeproj)
|
334
|
-
helper.patch_app_delegate_swift(xcodeproj) || helper.patch_app_delegate_objc(xcodeproj)
|
335
|
-
end
|
336
|
-
|
337
|
-
def helper
|
338
|
-
Helper::BranchHelper
|
339
|
-
end
|
340
|
-
end
|
341
150
|
end
|
342
151
|
end
|
343
152
|
end
|
@@ -1,51 +1,11 @@
|
|
1
|
-
require "
|
1
|
+
require "branch_io_cli"
|
2
2
|
|
3
3
|
module Fastlane
|
4
4
|
module Actions
|
5
5
|
class ValidateUniversalLinksAction < Action
|
6
6
|
def self.run(params)
|
7
|
-
|
8
|
-
|
9
|
-
xcodeproj_path = helper.xcodeproj_path_from_params params
|
10
|
-
# Error reporting is done in the helper.
|
11
|
-
return false if xcodeproj_path.nil?
|
12
|
-
|
13
|
-
# raises
|
14
|
-
xcodeproj = Xcodeproj::Project.open xcodeproj_path
|
15
|
-
|
16
|
-
target = params[:target] # may be nil
|
17
|
-
domains = params[:domains] # may be nil
|
18
|
-
|
19
|
-
valid = true
|
20
|
-
|
21
|
-
unless domains.nil?
|
22
|
-
domains_valid = helper.validate_project_domains(
|
23
|
-
helper.custom_domains_from_params(params),
|
24
|
-
xcodeproj,
|
25
|
-
target
|
26
|
-
)
|
27
|
-
|
28
|
-
if domains_valid
|
29
|
-
UI.message "Project domains match :domains parameter: ✅"
|
30
|
-
else
|
31
|
-
UI.error "Project domains do not match specified :domains"
|
32
|
-
helper.errors.each { |error| UI.error " #{error}" }
|
33
|
-
end
|
34
|
-
|
35
|
-
valid &&= domains_valid
|
36
|
-
end
|
37
|
-
|
38
|
-
configuration_valid = helper.validate_team_and_bundle_ids_from_aasa_files xcodeproj, target
|
39
|
-
unless configuration_valid
|
40
|
-
UI.error "Universal Link configuration failed validation."
|
41
|
-
helper.errors.each { |error| UI.error " #{error}" }
|
42
|
-
end
|
43
|
-
|
44
|
-
valid &&= configuration_valid
|
45
|
-
|
46
|
-
UI.message "Universal Link configuration passed validation. ✅" if valid
|
47
|
-
|
48
|
-
valid
|
7
|
+
options = Helper::BranchOptions.new params
|
8
|
+
BranchIOCLI::Commands::ValidateCommand.new(options).run!
|
49
9
|
rescue StandardError => e
|
50
10
|
UI.user_error! "Error in ValidateUniversalLinksAction: #{e.message}\n#{e.backtrace}"
|
51
11
|
false
|