-
Notifications
You must be signed in to change notification settings - Fork 90
/
Copy pathapp_clip.bzl
80 lines (68 loc) · 2.91 KB
/
app_clip.bzl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
load("@build_bazel_rules_apple//apple:ios.bzl", rules_apple_ios_app_clip = "ios_app_clip")
load("//rules:plists.bzl", "process_infoplists")
load("//rules/internal:framework_middleman.bzl", "dep_middleman", "framework_middleman")
def ios_app_clip(
name,
families = ["iphone", "ipad"],
infoplists = [],
infoplists_by_build_setting = {},
xcconfig = {},
xcconfig_by_build_setting = {},
**kwargs):
"""
Builds and packages an iOS App Clip.
The docs for app_clip are at rules_apple
https://github.com/bazelbuild/rules_apple/blob/master/doc/rules-ios.md#ios_app_clip
Args:
name: The name of the iOS app clip.
families: A list of iOS device families the target supports.
infoplists: A list of Info.plist files to be merged into the app clip.
infoplists_by_build_setting: A dictionary of infoplists grouped by bazel build setting.
Each value is applied if the respective bazel build setting
is resolved during the analysis phase.
If '//conditions:default' is not set the value in 'infoplists'
is set as default.
xcconfig: A dictionary of xcconfigs to be applied to the app clip by default.
xcconfig_by_build_setting: A dictionary of xcconfigs grouped by bazel build setting.
Each value is applied if the respective bazel build setting
is resolved during the analysis phase.
If '//conditions:default' is not set the value in 'xcconfig'
is set as default.
**kwargs: Arguments passed to the ios_app_clip rule as appropriate.
"""
deps = kwargs.pop("deps", [])
frameworks = kwargs.pop("frameworks", [])
testonly = kwargs.pop("testonly", False)
# Setup framework middlemen - need to process deps and libs
fw_name = name + ".framework_middleman"
framework_middleman(
name = fw_name,
framework_deps = deps,
tags = ["manual"],
testonly = testonly,
)
frameworks = [fw_name] + frameworks
dep_name = name + ".dep_middleman"
dep_middleman(
name = dep_name,
deps = deps,
tags = ["manual"],
testonly = testonly,
)
deps = [dep_name] + [force_load_name]
processed_infoplists = process_infoplists(
name = name,
infoplists = infoplists,
infoplists_by_build_setting = infoplists_by_build_setting,
xcconfig = xcconfig,
xcconfig_by_build_setting = xcconfig_by_build_setting,
)
rules_apple_ios_app_clip(
name = name,
deps = deps,
frameworks = frameworks,
families = families,
infoplists = select(processed_infoplists),
testonly = testonly,
**kwargs
)