-
Notifications
You must be signed in to change notification settings - Fork 0
/
BUILD.bazel
94 lines (84 loc) · 2.95 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
load("@buildifier_prebuilt//:rules.bzl", "buildifier", "buildifier_test")
load("@rules_android//toolchains/android:toolchain.bzl", "android_toolchain")
load("@rules_java//java:defs.bzl", "java_binary", "java_import")
load("@rules_kotlin//kotlin:core.bzl", "define_kt_toolchain", "kt_kotlinc_options")
package(default_visibility = ["//visibility:public"])
_WARNINGS = ["load,load-on-top,out-of-order-load,unsorted-dict-items"]
define_kt_toolchain(
name = "kotlin_toolchain",
api_version = "1.9",
jvm_target = "17",
# Some of these should only be applied to certain modules. Apply all globally during eval.
kotlinc_options = ":slack_opt_ins",
language_version = "1.9",
)
# Autocorrects. Used for local development.
buildifier(
name = "buildifier",
lint_mode = "fix",
lint_warnings = _WARNINGS,
tags = ["manual"],
)
# Will not fix, used on CI.
buildifier_test(
name = "buildifier.validate",
testonly = True,
lint_mode = "warn",
lint_warnings = _WARNINGS,
mode = "check",
no_sandbox = True,
tags = ["manual"],
workspace = "WORKSPACE",
)
kt_kotlinc_options(
name = "slack_opt_ins",
x_assertions = "jvm",
x_emit_jvm_type_annotations = True,
x_jspecify_annotations = "strict",
x_jsr_305 = "strict",
x_jvm_default = "all",
x_optin = [
"kotlin.contracts.ExperimentalContracts",
"kotlin.experimental.ExperimentalTypeInference",
"kotlin.ExperimentalStdlibApi",
"kotlin.time.ExperimentalTime",
],
x_type_enhancement_improvements_strict_mode = True,
)
# # Custom Toolchain
java_import(
name = "all_android_tools",
jars = ["@android_tools//:all_android_tools_deploy.jar"],
)
java_binary(
name = "ResourceProcessorBusyBox",
jvm_flags = [
# quiet warnings from com.google.protobuf.UnsafeUtil,
# see: https://github.com/google/protobuf/issues/3781
"-XX:+IgnoreUnrecognizedVMOptions",
"--add-opens=java.base/java.nio=ALL-UNNAMED",
"--add-opens=java.base/java.lang=ALL-UNNAMED",
],
main_class = "com.google.devtools.build.android.ResourceProcessorBusyBox",
visibility = ["//visibility:public"],
runtime_deps = [
":all_android_tools",
],
)
# # Default Android Toolchain
android_toolchain(
name = "slack_android_default",
# Hacks to force Bazel to resolve our custom android_tools patches
# that we provision in our Bzlmod extensions. Without this
# Bazel ends up using the one that's being downloaded by Bazel which doesn't
# have the correct patches, and will as a result just crash.
# TODO Remove this once rules_android properly supports Bzlmod
android_resources_busybox = ":ResourceProcessorBusyBox_deploy.jar",
visibility = ["//visibility:public"],
)
toolchain(
name = "slack_android_default_toolchain",
toolchain = ":slack_android_default",
toolchain_type = "@rules_android//toolchains/android:toolchain_type",
visibility = ["//visibility:public"],
)