-
Notifications
You must be signed in to change notification settings - Fork 49
/
Copy pathBUILD.bazel
350 lines (303 loc) · 11.3 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
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
load("@aspect_rules_js//js:defs.bzl", "js_library")
load("@bazel_gazelle//:def.bzl", "gazelle_binary", "gazelle")
load("@bazel_skylib//rules:common_settings.bzl", "string_flag")
load("@npm//:defs.bzl", "npm_link_all_packages")
load("@rules_player//internal:defs.bzl", "stamp")
load("@rules_player//ios:defs.bzl", "assemble_pod", "ios_publish")
load("@rules_swift_package_manager//swiftpkg:defs.bzl", "swift_update_packages")
package(default_visibility = ["//visibility:public"])
npm_link_all_packages(
name = "node_modules",
)
exports_files([
"VERSION",
"babel.config.js",
"tsconfig.json",
"package.json",
"jest.config.js",
"webpack.config.js",
".editorconfig",
".all-contributorsrc",
"README.md",
])
js_library(
name = "vitest_config",
testonly = True,
srcs = [
"scripts/vitest.setup.ts",
"vitest.config.mts",
],
visibility = ["//visibility:public"],
deps = [
"//:node_modules/@testing-library/jest-dom",
"//:node_modules/@testing-library/react",
"//:node_modules/@testing-library/react-hooks",
"//:node_modules/@testing-library/user-event",
"//:node_modules/@vitest/coverage-v8",
"//:node_modules/happy-dom",
"//:node_modules/vitest",
"//tools:vitest_coverage_mapper",
],
)
js_library(
name = "eslint_config",
testonly = True,
srcs = [
".eslintrc.js",
],
visibility = ["//visibility:public"],
deps = [
":node_modules/@typescript-eslint/eslint-plugin",
":node_modules/@typescript-eslint/parser",
":node_modules/eslint",
":node_modules/eslint-plugin-prettier",
":node_modules/eslint-plugin-react",
],
)
js_library(
name = "tsup_config",
srcs = [
"tsup.config.ts",
],
data = [":typings"],
visibility = ["//visibility:public"],
deps = [
":node_modules/@types/node",
":node_modules/tsup",
":node_modules/typescript",
":node_modules/vitest",
],
)
js_library(
name = "typings",
srcs = [
"tsconfig.build.json",
"tsconfig.json",
] + glob(["typings/*"]),
visibility = ["//visibility:public"],
)
# # Update the version in the podspec
stamp(
name = "PlayerUI_Podspec",
files = ["//:PlayerUI.podspec"],
stable = True,
stamp = -1,
substitutions = {
"0.0.1-placeholder": "{STABLE_VERSION}",
},
)
exports_files([
"PlayerUI.podspec",
])
assemble_pod(
name = "PlayerUI_Pod",
srcs = glob([
"LICENSE",
"Package.swift",
]),
data = {
# Core
"//ios/core:PlayerUI_Sources": "ios/core/",
"//core/player:player_native_bundle": "ios/core/Resources/",
"//plugins/partial-match-fingerprint/core:core_native_bundle": "ios/core/Resources/",
"//core/partial-match-registry:partial-match-registry_native_bundle": "ios/core/Resources/",
# SwiftUI
"//ios/swiftui:PlayerUISwiftUI_Sources": "ios/swiftui/",
# Logger
"//ios/logger:PlayerUILogger_Sources": "ios/logger/",
# Test Utilities
"//ios/test-utils-core:PlayerUITestUtilitiesCore_Sources": "ios/test-utils-core/",
"//ios/test-utils:PlayerUITestUtilities_Sources": "ios/test-utils/",
"//core/make-flow:make-flow_native_bundle": "ios/test-utils-core/Resources/",
# Plugins #
# Beacon
"//plugins/beacon/ios:PlayerUIBaseBeaconPlugin_Sources": "plugins/beacon/ios/",
"//plugins/beacon/swiftui:PlayerUIBeaconPlugin_Sources": "plugins/beacon/swiftui/",
"//plugins/beacon/core:core_native_bundle": "plugins/beacon/ios/Resources/",
# Check Path
"//plugins/check-path/ios:PlayerUICheckPathPlugin_Sources": "plugins/check-path/ios/",
"//plugins/check-path/swiftui:PlayerUISwiftUICheckPathPlugin_Sources": "plugins/check-path/swiftui/",
"//plugins/check-path/core:core_native_bundle": "plugins/check-path/ios/Resources/",
# Common Expressions
"//plugins/common-expressions/ios:PlayerUICommonExpressionsPlugin_Sources": "plugins/common-expressions/ios/",
"//plugins/common-expressions/core:core_native_bundle": "plugins/common-expressions/ios/Resources/",
# Common Types
"//plugins/common-types/ios:PlayerUICommonTypesPlugin_Sources": "plugins/common-types/ios/",
"//plugins/common-types/core:core_native_bundle": "plugins/common-types/ios/Resources/",
# Computed Properties
"//plugins/computed-properties/ios:PlayerUIComputedPropertiesPlugin_Sources": "plugins/computed-properties/ios/",
"//plugins/computed-properties/core:core_native_bundle": "plugins/computed-properties/ios/Resources/",
# Console Logger (PrintLoggerPlugin)
"//plugins/console-logger/ios:PlayerUIPrintLoggerPlugin_Sources": "plugins/console-logger/ios/",
# Expression
"//plugins/expression/ios:PlayerUIExpressionPlugin_Sources": "plugins/expression/ios/",
"//plugins/expression/core:core_native_bundle": "plugins/expression/ios/Resources/",
# External Action
"//plugins/external-action/ios:PlayerUIExternalActionPlugin_Sources": "plugins/external-action/ios/",
"//plugins/external-action/swiftui:PlayerUIExternalActionViewModifierPlugin_Sources": "plugins/external-action/swiftui/",
"//plugins/external-action/core:core_native_bundle": "plugins/external-action/ios/Resources/",
# Metrics
"//plugins/metrics/swiftui:PlayerUIMetricsPlugin_Sources": "plugins/metrics/swiftui/",
"//plugins/metrics/core:core_native_bundle": "plugins/metrics/swiftui/Resources/",
# Pending Transaction
"//plugins/pending-transaction/swiftui:PlayerUISwiftUIPendingTransactionPlugin_Sources": "plugins/pending-transaction/swiftui/",
# PubSub
"//plugins/pubsub/ios:PlayerUIPubSubPlugin_Sources": "plugins/pubsub/ios/",
"//plugins/pubsub/core:core_native_bundle": "plugins/pubsub/ios/Resources/",
# Reference Assets
"//plugins/reference-assets/swiftui:PlayerUIReferenceAssets_Sources": "plugins/reference-assets/swiftui/",
"//plugins/reference-assets/swiftui/Resources:PlayerUIReferenceAssets_Resources": "plugins/reference-assets/swiftui/Resources/",
"//plugins/reference-assets/core:core_native_bundle": "plugins/reference-assets/swiftui/Resources/js/",
# Stage Revert Data
"//plugins/stage-revert-data/ios:PlayerUIStageRevertDataPlugin_Sources": "plugins/stage-revert-data/ios/",
"//plugins/stage-revert-data/core:core_native_bundle": "plugins/stage-revert-data/ios/Resources/",
# Transition
"//plugins/transition/swiftui:PlayerUITransitionPlugin_Sources": "plugins/transition/swiftui",
# Types Provider
"//plugins/types-provider/ios:PlayerUITypesProviderPlugin_Sources": "plugins/types-provider/ios/",
"//plugins/types-provider/core:core_native_bundle": "plugins/types-provider/ios/Resources/",
},
podspec = ":PlayerUI_Podspec",
)
ios_publish(
name = "ios_publish",
zip = ":PlayerUI_Pod",
# SPM Release Repo
repository = "[email protected]:player-ui/playerui-swift-package.git",
# CocoaPods
podspec = ":PlayerUI_Podspec",
executable = "bundle exec pod",
globalFlags = [
# because jenkins runs as root
"--allow-root",
],
pushFlags = [
# skip tests because it never runs them right
# and they're run as part of the build pipeline anyway
"--skip-tests",
],
)
# # Push podspec to specs repo
# # tag must exist in github first
# pod_push(
# name = "PlayerUI_Pod_Push",
# executable = "bundle exec pod",
# globalFlags = [],
# podspec = ":PlayerUI_Podspec",
# pushFlags = [
# # skip tests because it never runs them right
# # and they're run as part of the build pipeline anyway
# "--skip-tests",
# ],
# )
# Ignore the `.build` folder that is created by running Swift package manager
# commands. The Swift Gazelle plugin executes some Swift package manager
# commands to resolve external dependencies. This results in a `.build` file
# being created.
# NOTE: Swift package manager is not used to build any of the external packages.
# The `.build` directory should be ignored. Be sure to configure your source
# control to ignore it (i.e., add it to your `.gitignore`).
# gazelle:exclude .build
# This declaration builds a Gazelle binary that incorporates all of the Gazelle
# plugins for the languages that you use in your workspace. In this example, we
# are only listing the Gazelle plugin for Swift from rules_swift_package_manager.
gazelle_binary(
name = "gazelle_bin",
languages = [
"@rules_swift_package_manager//gazelle",
],
)
# This macro defines two targets: `swift_update_pkgs` and
# `swift_update_pkgs_to_latest`.
#
# The `swift_update_pkgs` target should be run whenever the list of external
# dependencies is updated in the `Package.swift`. Running this target will
# populate the `swift_deps.bzl` with `swift_package` declarations for all of
# the direct and transitive Swift packages that your project uses.
#
# The `swift_update_pkgs_to_latest` target should be run when you want to
# update your Swift dependencies to their latest eligible version.
swift_update_packages(
name = "swift_update_pkgs",
gazelle = ":gazelle_bin",
generate_swift_deps_for_workspace = True,
package_manifest = "./xcode/Package.swift",
swift_deps = "swift_deps.bzl",
swift_deps_index = "swift_deps_index.json",
update_bzlmod_stanzas = False,
)
# This target updates the Bazel build files for your project. Run this target
# whenever you add or remove source files from your project.
gazelle(
name = "update_build_files",
gazelle = ":gazelle_bin",
)
alias(
name = "android_tools",
actual = "@bazel_tools//src/tools/android/java/com/google/devtools/build/android:all_android_tools",
visibility = ["//visibility:public"],
)
java_plugin(
name = "compiler_annotation_processor",
generates_api = False,
processor_class = "android.databinding.annotationprocessor.ProcessDataBinding",
visibility = ["//visibility:public"],
deps = [
":android_tools",
],
)
#SwiftLint
exports_files([".swiftlint.yml"])
# Native platform settings
string_flag(
name = "cmake_build_type",
build_setting_default = "Debug",
make_variable = "CMAKE_BUILD_TYPE",
values = [
"Debug",
"Release",
"MinSizeRel",
"RelWithDebInfo",
],
)
config_setting(
name = "cmake_build_type_debug",
flag_values = {
":cmake_build_type": "Debug",
},
)
config_setting(
name = "cmake_build_type_release",
flag_values = {
":cmake_build_type": "Release",
},
)
config_setting(
name = "cmake_build_type_minsizerel",
flag_values = {
":cmake_build_type": "MinSizeRel",
},
)
config_setting(
name = "cmake_build_type_relwithdebinfo",
flag_values = {
":cmake_build_type": "RelWithDebInfo",
},
)
# TODO: Enable platform support for detecting Android OS as well as cpu
config_setting(
name = "arm64-v8a",
values = {"cpu": "arm64-v8a"},
)
config_setting(
name = "armeabi-v7a",
values = {"cpu": "armeabi-v7a"},
)
config_setting(
name = "x86",
values = {"cpu": "x86"},
)
config_setting(
name = "x86_64",
values = {"cpu": "x86_64"},
)