-
Notifications
You must be signed in to change notification settings - Fork 49
/
BUILD.bazel
177 lines (158 loc) · 4.26 KB
/
BUILD.bazel
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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
package(default_visibility = ["//visibility:public"])
licenses(["notice"])
load(
"@build_bazel_rules_apple//apple:macos.bzl",
"macos_application",
)
load(
"@build_bazel_rules_apple//apple:resources.bzl",
"apple_resource_group",
"apple_resource_bundle",
)
load(
"@build_bazel_rules_swift//swift:swift.bzl",
"swift_library",
)
load(
"@build_bazel_rules_apple//apple:versioning.bzl",
"apple_bundle_version",
)
load(
"@com_github_bazelbuild_buildtools//buildifier:def.bzl",
"buildifier",
)
load(
"//third_party:repositories.bzl",
"namespaced_name",
)
load(
"//BazelExtensions:xchammerconfig.bzl",
"execution_action",
"gen_xchammer_config",
"project_config",
"scheme_action_config",
"target_config",
"xchammer_config",
)
apple_resource_group(
name = "XCHammerAssets",
structured_resources = glob([
"XCHammerAssets/**",
]),
)
# Build system support. Currently, we use the example xcbuildkit
# to simply show the progress bar.
# Stick this into a bundle to group files together
apple_resource_bundle(
name = "XCBuildKit",
resources = [
"@xcbuildkit//:BazelBuildServiceInstaller",
"@xcbuildkit//:BuildInfo",
# We use this to check if it's installed into each Xcode
"@bazel_tools//tools/osx:xcode-locator-genrule"
]
)
load(
"//BazelExtensions:xcode_configuration_provider.bzl",
"declare_target_config",
)
# This is an example of declaring a target config.
declare_target_config(name="XCHammerSourcesXcodeConfig", config=target_config())
swift_library(
name = "XCHammerSources",
srcs = glob(["Sources/**/*.swift"]),
data = [
":XCHammerAssets",
"//BazelExtensions:BazelExtensions",
] + [
":XCBuildKit",
],
deps = ["@" + namespaced_name(x) for x in [
"AEXML//:AEXML",
"Commandant//:Commandant",
"Commander//:Commander",
"JSONUtilities//:JSONUtilities",
"PathKit//:PathKit",
"Rainbow//:Rainbow",
"Result//:Result",
"ShellOut//:ShellOut",
"Tulsi//src/TulsiGenerator:tulsi_generator_lib",
"XcodeGen//:XcodeGenKit",
"XcodeGen//:ProjectSpec",
"XcodeProj//:XcodeProj",
"Yams//:Yams",
]] + [":XCHammerSourcesXcodeConfig" ],
copts = [
"-swift-version",
"4.2"
],
)
apple_bundle_version(
name = "XCHammerVersion",
build_version = "1.0",
)
macos_application(
name = "xchammer",
bundle_id = "com.pinterest.xchammer",
infoplists = ["Info.plist"],
minimum_os_version = "10.14",
version = ":XCHammerVersion",
deps = [":XCHammerSources"],
)
buildifier(
name = "buildifier",
)
script_base = "$SRCROOT/tools/instrumentation_helpers"
scheme_config = {
"Build": scheme_action_config(
post_actions = [
execution_action(
name = "Report build end",
script = "python " + script_base + "/statsd_post_build_action.py",
),
],
pre_actions = [
execution_action(
name = "Track build start",
script = script_base + "/statsd_pre_build_action.sh",
),
],
),
}
xchammer_config = xchammer_config(
projects = {
"xchammer": project_config(paths = ["**"]),
},
target_config = {
"//:xchammer": target_config(
# Metrics are disabled by default
# scheme_config=scheme_config
),
"//tools/XCConfigExporter:xcconfig-exporter": target_config(),
},
targets = ["//:xchammer", "//tools/XCConfigExporter:xcconfig-exporter"],
)
gen_xchammer_config(
name = "xchammer_config",
config = xchammer_config,
)
# Experimental xcode_project rule
load(
"//BazelExtensions:xcodeproject.bzl",
"xcode_project"
)
xcode_project(
name="workspace_v2",
targets=["//:xchammer", "//tools/XCConfigExporter:xcconfig-exporter"],
bazel="tools/bazelwrapper",
xchammer="xchammer.app",
project_config=project_config(
paths = ["**"],
generate_xcode_schemes=False,
xcconfig_overrides = {
"Release": "tools/BazelToolchain.xcconfig",
"Debug": "tools/BazelToolchain.xcconfig",
"Profile": "tools/BazelToolchain.xcconfig",
}
)
)