forked from square/dagger
-
Notifications
You must be signed in to change notification settings - Fork 2k
/
Copy pathMODULE.bazel
197 lines (174 loc) · 8.51 KB
/
MODULE.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
bazel_dep(name = "bazel_skylib", version = "1.7.1")
bazel_dep(name = "rules_java", version = "8.6.0")
bazel_dep(name = "rules_jvm_external", version = "6.6")
bazel_dep(name = "rules_android", version = "0.6.0")
bazel_dep(name = "rules_kotlin", version = "1.9.6", repo_name = "io_bazel_rules_kotlin")
bazel_dep(name = "rules_robolectric", version = "4.14.1.2", repo_name = "robolectric")
bazel_dep(name = "protobuf", version = "29.0", repo_name = "com_google_protobuf")
# Pin the version of rules_robolectric so that it matches the robolectric version we get from maven.
single_version_override(
module_name = "rules_robolectric",
version = "4.14.1.2",
)
# Setup the Android SDK repository
android_sdk_repository_extension = use_extension(
"@rules_android//rules/android_sdk_repository:rule.bzl",
"android_sdk_repository_extension",
)
android_sdk_repository_extension.configure(api_level = 34)
use_repo(android_sdk_repository_extension, "androidsdk")
register_toolchains("@androidsdk//:sdk-toolchain", "@androidsdk//:all")
# Define the versions of the maven dependencies we use.
ANT_VERSION = "1.9.6"
ASM_VERSION = "9.6"
AUTO_COMMON_VERSION = "1.2.1"
BYTE_BUDDY_VERSION = "1.9.10"
CHECKER_FRAMEWORK_VERSION = "2.5.3"
ECLIPSE_SISU_VERSION = "0.3.0"
ERROR_PRONE_VERSION = "2.23.0"
# NOTE(bcorso): Even though we set the version here, our Guava version in
# processor code will use whatever version is built into JavaBuilder, which is
# tied to the version of Bazel we're using.
GUAVA_VERSION = "33.0.0"
GRPC_VERSION = "1.2.0"
INCAP_VERSION = "0.2"
KOTLIN_VERSION = "2.0.21"
KSP_VERSION = KOTLIN_VERSION + "-1.0.28"
MAVEN_VERSION = "3.3.3"
ROBOLECTRIC_VERSION = "4.14.1"
maven = use_extension("@rules_jvm_external//:extensions.bzl", "maven")
# Test only maven dependencies
[
maven.artifact(
testonly = True,
artifact = artifact,
group = group,
version = version,
)
for group, artifact, version in [coord.split(":") for coord in [
"androidx.test:monitor:1.4.0",
"androidx.test:core:1.4.0",
"androidx.test.ext:junit:1.1.3",
"com.google.guava:guava-testlib:%s-jre" % GUAVA_VERSION,
"com.google.testing.compile:compile-testing:0.18",
"com.google.truth.extensions:truth-java8-extension:1.4.0",
"com.google.truth:truth:1.4.0",
"javax.inject:javax.inject-tck:1",
"org.hamcrest:hamcrest-core:1.3",
"org.mockito:mockito-core:5.4.0",
"org.robolectric:robolectric:%s" % ROBOLECTRIC_VERSION,
"org.robolectric:shadows-framework:%s" % ROBOLECTRIC_VERSION, # For ActivityController
]]
]
maven.install(
artifacts = [
"androidx.annotation:annotation:1.1.0",
"androidx.annotation:annotation-experimental:1.3.1",
"androidx.appcompat:appcompat:1.3.1",
"androidx.activity:activity:1.5.1",
"androidx.fragment:fragment:1.5.1",
"androidx.lifecycle:lifecycle-common:2.5.1",
"androidx.lifecycle:lifecycle-viewmodel:2.5.1",
"androidx.lifecycle:lifecycle-viewmodel-savedstate:2.5.1",
"androidx.multidex:multidex:2.0.1",
"androidx.navigation:navigation-common:2.5.1",
"androidx.navigation:navigation-fragment:2.5.1",
"androidx.navigation:navigation-runtime:2.5.1",
"androidx.savedstate:savedstate:1.2.0",
"com.android.support:appcompat-v7:25.0.0",
"com.android.support:support-annotations:25.0.0",
"com.android.support:support-fragment:25.0.0",
"com.google.auto:auto-common:%s" % AUTO_COMMON_VERSION,
"com.google.auto.factory:auto-factory:1.0",
"com.google.auto.service:auto-service:1.0",
"com.google.auto.service:auto-service-annotations:1.0",
"com.google.auto.value:auto-value:1.9",
"com.google.auto.value:auto-value-annotations:1.9",
"com.google.code.findbugs:jsr305:3.0.1",
"com.google.devtools.ksp:symbol-processing:%s" % KSP_VERSION,
"com.google.devtools.ksp:symbol-processing-api:%s" % KSP_VERSION,
"com.google.devtools.ksp:symbol-processing-common-deps:%s" % KSP_VERSION,
"com.google.devtools.ksp:symbol-processing-aa-embeddable:%s" % KSP_VERSION,
"com.google.errorprone:error_prone_annotation:%s" % ERROR_PRONE_VERSION,
"com.google.errorprone:error_prone_annotations:%s" % ERROR_PRONE_VERSION,
"com.google.errorprone:error_prone_check_api:%s" % ERROR_PRONE_VERSION,
"com.google.googlejavaformat:google-java-format:1.5",
"com.google.guava:guava:%s-jre" % GUAVA_VERSION,
"com.google.guava:failureaccess:1.0.1",
"com.google.guava:guava-beta-checker:1.0",
"com.google.protobuf:protobuf-java:4.29.3",
"com.squareup:javapoet:1.13.0",
"com.squareup:kotlinpoet:1.11.0",
"io.github.java-diff-utils:java-diff-utils:4.11",
"io.grpc:grpc-context:%s" % GRPC_VERSION,
"io.grpc:grpc-core:%s" % GRPC_VERSION,
"io.grpc:grpc-netty:%s" % GRPC_VERSION,
"io.grpc:grpc-protobuf:%s" % GRPC_VERSION,
"jakarta.inject:jakarta.inject-api:2.0.1",
"javax.annotation:javax.annotation-api:1.3.2",
"javax.enterprise:cdi-api:1.0",
"javax.inject:javax.inject:1",
"junit:junit:4.13.2",
"net.bytebuddy:byte-buddy:%s" % BYTE_BUDDY_VERSION,
"net.bytebuddy:byte-buddy-agent:%s" % BYTE_BUDDY_VERSION,
"net.ltgt.gradle.incap:incap:%s" % INCAP_VERSION,
"net.ltgt.gradle.incap:incap-processor:%s" % INCAP_VERSION,
"org.apache.ant:ant:%s" % ANT_VERSION,
"org.apache.ant:ant-launcher:%s" % ANT_VERSION,
"org.apache.maven:maven-artifact:%s" % MAVEN_VERSION,
"org.apache.maven:maven-model:%s" % MAVEN_VERSION,
"org.apache.maven:maven-plugin-api:%s" % MAVEN_VERSION,
"org.checkerframework:checker-compat-qual:%s" % CHECKER_FRAMEWORK_VERSION,
"org.checkerframework:dataflow:%s" % CHECKER_FRAMEWORK_VERSION,
"org.checkerframework:javacutil:%s" % CHECKER_FRAMEWORK_VERSION,
"org.codehaus.plexus:plexus-utils:3.0.20",
"org.codehaus.plexus:plexus-classworlds:2.5.2",
"org.codehaus.plexus:plexus-component-annotations:1.5.5",
"org.eclipse.sisu:org.eclipse.sisu.plexus:%s" % ECLIPSE_SISU_VERSION,
"org.eclipse.sisu:org.eclipse.sisu.inject:%s" % ECLIPSE_SISU_VERSION,
"org.jetbrains.kotlin:kotlin-annotation-processing-embeddable:%s" % KOTLIN_VERSION,
"org.jetbrains.kotlin:kotlin-compiler-embeddable:%s" % KOTLIN_VERSION,
"org.jetbrains.kotlin:kotlin-daemon-embeddable:%s" % KOTLIN_VERSION,
"org.jetbrains.kotlin:kotlin-metadata-jvm:%s" % KOTLIN_VERSION,
"org.jetbrains.kotlin:kotlin-stdlib:%s" % KOTLIN_VERSION,
"org.jspecify:jspecify:1.0.0",
"org.pantsbuild:jarjar:1.7.2",
"org.objenesis:objenesis:1.0",
"org.ow2.asm:asm:%s" % ASM_VERSION,
"org.ow2.asm:asm-tree:%s" % ASM_VERSION,
"org.ow2.asm:asm-commons:%s" % ASM_VERSION,
],
repositories = [
"https://repo1.maven.org/maven2",
"https://maven.google.com",
],
)
use_repo(maven, "maven")
# TODO(b/394123765): Merge these dependencies back into the "maven" repo and remove "maven_lint".
# For now, we isolate "com.android.tools.lint:lint" from the rest of the maven dependencies because
# one of its dependencies, "org.codehaus.groovy:groovy-all", depends on some testonly targets, e.g.
# "org.codehaus.groovy:groovy-test", but isn't marked as testonly itself. To work around this issue,
# we define a separate "maven_lint" repository that doesn't mark anything as testonly.
ANDROID_LINT_VERSION = "30.1.0"
maven.install(
name = "maven_lint",
artifacts = [
"com.android.tools.external.org-jetbrains:uast:%s" % ANDROID_LINT_VERSION,
"com.android.tools.external.com-intellij:intellij-core:%s" % ANDROID_LINT_VERSION,
"com.android.tools.external.com-intellij:kotlin-compiler:%s" % ANDROID_LINT_VERSION,
"com.android.tools.lint:lint:%s" % ANDROID_LINT_VERSION,
"com.android.tools.lint:lint-api:%s" % ANDROID_LINT_VERSION,
"com.android.tools.lint:lint-checks:%s" % ANDROID_LINT_VERSION,
"com.android.tools.lint:lint-tests:%s" % ANDROID_LINT_VERSION,
"com.android.tools:testutils:%s" % ANDROID_LINT_VERSION,
"com.google.auto:auto-common:%s" % AUTO_COMMON_VERSION,
"com.google.auto.service:auto-service:1.0",
"com.google.auto.service:auto-service-annotations:1.0",
"junit:junit:4.13.2",
],
repositories = [
"https://repo1.maven.org/maven2",
"https://maven.google.com",
],
)
use_repo(maven, "maven_lint")