Skip to content
This repository was archived by the owner on Jan 31, 2023. It is now read-only.

Commit b91ad67

Browse files
authored
Merge pull request #25 from BranchMetrics/system-frameworks
Added a :frameworks option to add system frameworks to iOS projects
2 parents 54529ab + 9ac6d53 commit b91ad67

File tree

7 files changed

+40
-22
lines changed

7 files changed

+40
-22
lines changed

Branchfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,4 @@ app_link_subdomain "bnctestbed"
88
uri_scheme "branchtest"
99
android_project_path "examples/android/BranchPluginExample"
1010
xcodeproj "examples/ios/BranchPluginExample/BranchPluginExample.xcodeproj"
11+
frameworks %w{AdSupport CoreSpotlight SafariServices}

Gemfile.lock

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
PATH
22
remote: .
33
specs:
4-
fastlane-plugin-branch (0.2.2)
4+
fastlane-plugin-branch (0.3.0)
55
plist
66
xcodeproj
77

@@ -14,15 +14,15 @@ GEM
1414
minitest (~> 5.1)
1515
thread_safe (~> 0.3, >= 0.3.4)
1616
tzinfo (~> 1.1)
17-
addressable (2.5.1)
18-
public_suffix (~> 2.0, >= 2.0.2)
17+
addressable (2.5.2)
18+
public_suffix (>= 2.0.2, < 4.0)
1919
ast (2.3.0)
2020
babosa (1.0.2)
2121
claide (1.0.2)
22-
cocoapods (1.3.0)
22+
cocoapods (1.3.1)
2323
activesupport (>= 4.0.2, < 5)
2424
claide (>= 1.0.2, < 2.0)
25-
cocoapods-core (= 1.3.0)
25+
cocoapods-core (= 1.3.1)
2626
cocoapods-deintegrate (>= 1.0.1, < 2.0)
2727
cocoapods-downloader (>= 1.1.3, < 2.0)
2828
cocoapods-plugins (>= 1.0.0, < 2.0)
@@ -38,7 +38,7 @@ GEM
3838
nap (~> 1.0)
3939
ruby-macho (~> 1.1)
4040
xcodeproj (>= 1.5.1, < 2.0)
41-
cocoapods-core (1.3.0)
41+
cocoapods-core (1.3.1)
4242
activesupport (>= 4.0.2, < 6)
4343
fuzzy_match (~> 2.0.4)
4444
nap (~> 1.0)
@@ -66,15 +66,15 @@ GEM
6666
dotenv (2.2.1)
6767
escape (0.0.4)
6868
excon (0.58.0)
69-
faraday (0.12.2)
69+
faraday (0.13.1)
7070
multipart-post (>= 1.2, < 3)
7171
faraday-cookie_jar (0.0.6)
7272
faraday (>= 0.7.4)
7373
http-cookie (~> 1.0.0)
7474
faraday_middleware (0.12.2)
7575
faraday (>= 0.7.4, < 1.0)
7676
fastimage (2.1.0)
77-
fastlane (2.50.1)
77+
fastlane (2.55.0)
7878
CFPropertyList (>= 2.3, < 3.0.0)
7979
addressable (>= 2.3, < 3.0.0)
8080
babosa (>= 1.0.2, < 2.0.0)
@@ -88,28 +88,29 @@ GEM
8888
faraday_middleware (~> 0.9)
8989
fastimage (>= 2.1.0, < 3.0.0)
9090
gh_inspector (>= 1.0.1, < 2.0.0)
91-
google-api-client (>= 0.12.0, < 0.13.0)
91+
google-api-client (>= 0.13.1, < 0.14.0)
9292
highline (>= 1.7.2, < 2.0.0)
9393
json (< 3.0.0)
9494
mini_magick (~> 4.5.1)
9595
multi_json
9696
multi_xml (~> 0.5)
9797
multipart-post (~> 2.0.0)
9898
plist (>= 3.1.0, < 4.0.0)
99+
public_suffix (~> 2.0.0)
99100
rubyzip (>= 1.1.0, < 2.0.0)
100101
security (= 0.1.3)
101102
slack-notifier (>= 1.3, < 2.0.0)
102103
terminal-notifier (>= 1.6.2, < 2.0.0)
103104
terminal-table (>= 1.4.5, < 2.0.0)
104105
tty-screen (~> 0.5.0)
105106
word_wrap (~> 1.0.0)
106-
xcodeproj (>= 1.4.4, < 2.0.0)
107+
xcodeproj (>= 1.5.0, < 2.0.0)
107108
xcpretty (>= 0.2.4, < 1.0.0)
108109
xcpretty-travis-formatter (>= 0.0.3)
109110
fourflusher (2.0.1)
110111
fuzzy_match (2.0.4)
111112
gh_inspector (1.0.3)
112-
google-api-client (0.12.0)
113+
google-api-client (0.13.4)
113114
addressable (~> 2.5, >= 2.5.1)
114115
googleauth (~> 0.5)
115116
httpclient (>= 2.8.1, < 3.0)
@@ -199,11 +200,11 @@ GEM
199200
faraday (~> 0.9)
200201
jwt (~> 1.5)
201202
multi_json (~> 1.10)
202-
simplecov (0.14.1)
203+
simplecov (0.15.0)
203204
docile (~> 1.1.0)
204205
json (>= 1.8, < 3)
205206
simplecov-html (~> 0.10.0)
206-
simplecov-html (0.10.1)
207+
simplecov-html (0.10.2)
207208
slack-notifier (1.5.1)
208209
slop (3.6.0)
209210
terminal-notifier (1.8.0)

README.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,8 @@ Available options:
8686
|: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|
8787
|:validate|Determines whether to validate the resulting Universal Link configuration before modifying the project|BRANCH_VALIDATE|boolean|true|
8888
|:force|Update project(s) even if Universal Link validation fails|BRANCH_FORCE_UPDATE|boolean|false|
89-
|:commit|Set to true to commit changes to Git; set to a string to commit with a custom message|boolean or string|BRANCH_COMMIT_CHANGES|false|
89+
|: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|
90+
|:frameworks|A list of system frameworks to add to the target that uses the Branch SDK (iOS only)|BRANCH_FRAMEWORKS|array|[]|
9091

9192
Individually, all parameters are optional, but the following conditions apply:
9293

@@ -143,10 +144,10 @@ This action does not use the Branchfile.
143144
Check out the [example `Fastfile`](fastlane/Fastfile) to see how to use this plugin. To try it:
144145

145146
```bash
146-
bundle exec fastlane validate # The example project needs to be set up. This will fail.
147-
bundle exec fastlane update # Also validates the UL configuration.
148-
bundle exec fastlane update_and_commit # Also commit changes to Git. (git reset --hard HEAD^ to erase the last commit)
149-
bundle exec fastlane validate # Now validation will pass.
147+
bundle exec fastlane validate # The example project needs to be set up. This will fail.
148+
bundle exec fastlane setup # Also validates the UL configuration.
149+
bundle exec fastlane setup_and_commit # Also commit changes to Git. (git reset --hard HEAD^ to erase the last commit)
150+
bundle exec fastlane validate # Now validation will pass.
150151
```
151152

152153
## Run tests for this plugin

fastlane/Fastfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
desc "Add Branch keys and Universal Link domains to BranchPluginExample"
2-
lane :update do
2+
lane :setup do
33
setup_branch
44
end
55

66
desc "Add Branch keys and Universal Link domains to BranchPluginExample and commit to Git"
7-
lane :update_and_commit do
7+
lane :setup_and_commit do
88
setup_branch commit: true # Use a string here for a custom commit message
99
end
1010

lib/fastlane/plugin/branch/actions/setup_branch_action.rb

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,9 @@ def self.run(params)
4747
helper.add_branch_universal_link_domains_to_info_plist xcodeproj, target, domains
4848
new_path = helper.add_universal_links_to_project xcodeproj, target, domains, params[:remove_existing_domains]
4949
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+
5053
xcodeproj.save
5154
end
5255

@@ -192,7 +195,13 @@ def self.available_options
192195
description: "Set to true to commit changes to Git; set to a string to commit with a custom message",
193196
optional: true,
194197
default_value: false,
195-
is_string: false)
198+
is_string: false),
199+
FastlaneCore::ConfigItem.new(key: :frameworks,
200+
env_name: "BRANCH_FRAMEWORKS",
201+
description: "A list of system frameworks to add to the target that uses the Branch SDK (iOS only)",
202+
optional: true,
203+
default_value: [],
204+
type: Array)
196205
]
197206
end
198207

lib/fastlane/plugin/branch/helper/ios_helper.rb

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -329,6 +329,12 @@ def expanded_build_setting(target, setting_name, configuration)
329329
end
330330
setting_value
331331
end
332+
333+
def add_system_frameworks(project, target_name, frameworks)
334+
target = target_from_project project, target_name
335+
336+
target.add_system_framework frameworks
337+
end
332338
end
333339
end
334340
end

lib/fastlane/plugin/branch/version.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
module Fastlane
22
module Branch
3-
VERSION = "0.2.2"
3+
VERSION = "0.3.0"
44
end
55
end

0 commit comments

Comments
 (0)