xref: /aosp_15_r20/external/dagger2/WORKSPACE (revision f585d8a307d0621d6060bd7e80091fdcbf94fe27)
1# Copyright (C) 2017 The Dagger Authors.
2#
3# Licensed under the Apache License, Version 2.0 (the "License");
4# you may not use this file except in compliance with the License.
5# You may obtain a copy of the License at
6#
7# http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS,
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12# See the License for the specific language governing permissions and
13# limitations under the License.
14
15load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
16
17#############################
18# Load nested repository
19#############################
20
21# Declare the nested workspace so that the top-level workspace doesn't try to
22# traverse it when calling `bazel build //...`
23local_repository(
24    name = "examples_bazel",
25    path = "examples/bazel",
26)
27
28#############################
29# Load Bazel Skylib rules
30#############################
31
32BAZEL_SKYLIB_VERSION = "1.5.0"
33
34BAZEL_SKYLIB_SHA = "cd55a062e763b9349921f0f5db8c3933288dc8ba4f76dd9416aac68acee3cb94"
35
36http_archive(
37    name = "bazel_skylib",
38    sha256 = BAZEL_SKYLIB_SHA,
39    urls = [
40        "https://mirror.bazel.build/github.com/bazelbuild/bazel-skylib/releases/download/%s/bazel-skylib-%s.tar.gz" % (BAZEL_SKYLIB_VERSION, BAZEL_SKYLIB_VERSION),
41        "https://github.com/bazelbuild/bazel-skylib/releases/download/%s/bazel-skylib-%s.tar.gz" % (BAZEL_SKYLIB_VERSION, BAZEL_SKYLIB_VERSION),
42    ],
43)
44
45load("@bazel_skylib//:workspace.bzl", "bazel_skylib_workspace")
46
47bazel_skylib_workspace()
48
49####################################################
50# Load Protobuf repository (needed by bazel-common)
51####################################################
52
53http_archive(
54    name = "rules_proto",
55    # output from `sha256sum` on the downloaded tar.gz file
56    sha256 = "66bfdf8782796239d3875d37e7de19b1d94301e8972b3cbd2446b332429b4df1",
57    strip_prefix = "rules_proto-4.0.0",
58    urls = [
59        "https://mirror.bazel.build/github.com/bazelbuild/rules_proto/archive/refs/tags/4.0.0.tar.gz",
60        "https://github.com/bazelbuild/rules_proto/archive/refs/tags/4.0.0.tar.gz",
61    ],
62)
63
64load("@rules_proto//proto:repositories.bzl", "rules_proto_dependencies", "rules_proto_toolchains")
65
66rules_proto_dependencies()
67
68rules_proto_toolchains()
69
70#############################
71# Load Bazel-Common repository
72#############################
73
74http_archive(
75    name = "google_bazel_common",
76    sha256 = "82a49fb27c01ad184db948747733159022f9464fc2e62da996fa700594d9ea42",
77    strip_prefix = "bazel-common-2a6b6406e12208e02b2060df0631fb30919080f3",
78    urls = ["https://github.com/google/bazel-common/archive/2a6b6406e12208e02b2060df0631fb30919080f3.zip"],
79)
80
81load("@google_bazel_common//:workspace_defs.bzl", "google_common_workspace_rules")
82
83google_common_workspace_rules()
84
85#############################
86# Load Protobuf dependencies
87#############################
88
89# rules_python and zlib are required by protobuf.
90# TODO(ronshapiro): Figure out if zlib is in fact necessary, or if proto can depend on the
91# @bazel_tools library directly. See discussion in
92# https://github.com/protocolbuffers/protobuf/pull/5389#issuecomment-481785716
93# TODO(cpovirk): Should we eventually get rules_python from "Bazel Federation?"
94# https://github.com/bazelbuild/rules_python#getting-started
95
96http_archive(
97    name = "rules_python",
98    sha256 = "e5470e92a18aa51830db99a4d9c492cc613761d5bdb7131c04bd92b9834380f6",
99    strip_prefix = "rules_python-4b84ad270387a7c439ebdccfd530e2339601ef27",
100    urls = ["https://github.com/bazelbuild/rules_python/archive/4b84ad270387a7c439ebdccfd530e2339601ef27.tar.gz"],
101)
102
103http_archive(
104    name = "zlib",
105    build_file = "@com_google_protobuf//:third_party/zlib.BUILD",
106    sha256 = "629380c90a77b964d896ed37163f5c3a34f6e6d897311f1df2a7016355c45eff",
107    strip_prefix = "zlib-1.2.11",
108    urls = ["https://github.com/madler/zlib/archive/v1.2.11.tar.gz"],
109)
110
111#############################
112# Load Robolectric repository
113#############################
114
115ROBOLECTRIC_VERSION = "4.4"
116
117http_archive(
118    name = "robolectric",
119    sha256 = "d4f2eb078a51f4e534ebf5e18b6cd4646d05eae9b362ac40b93831bdf46112c7",
120    strip_prefix = "robolectric-bazel-%s" % ROBOLECTRIC_VERSION,
121    urls = ["https://github.com/robolectric/robolectric-bazel/archive/%s.tar.gz" % ROBOLECTRIC_VERSION],
122)
123
124load("@robolectric//bazel:robolectric.bzl", "robolectric_repositories")
125
126robolectric_repositories()
127
128#############################
129# Load Kotlin repository
130#############################
131
132RULES_KOTLIN_TAG = "v1.8"
133
134RULES_KOTLIN_SHA = "01293740a16e474669aba5b5a1fe3d368de5832442f164e4fbfc566815a8bc3a"
135
136http_archive(
137    name = "io_bazel_rules_kotlin",
138    sha256 = RULES_KOTLIN_SHA,
139    urls = ["https://github.com/bazelbuild/rules_kotlin/releases/download/%s/rules_kotlin_release.tgz" % RULES_KOTLIN_TAG],
140)
141
142load("@io_bazel_rules_kotlin//kotlin:repositories.bzl", "kotlin_repositories", "kotlinc_version")
143
144KOTLIN_VERSION = "1.9.20"
145
146# Get from https://github.com/JetBrains/kotlin/releases/
147KOTLINC_RELEASE_SHA = "15a8a2825b74ccf6c44e04e97672db802d2df75ce2fbb63ef0539bf3ae5006f0"
148
149kotlin_repositories(
150    compiler_release = kotlinc_version(
151        release = KOTLIN_VERSION,
152        sha256 = KOTLINC_RELEASE_SHA,
153    ),
154)
155
156load("@io_bazel_rules_kotlin//kotlin:core.bzl", "kt_register_toolchains")
157
158kt_register_toolchains()
159
160#############################
161# Load Maven dependencies
162#############################
163
164RULES_JVM_EXTERNAL_TAG = "4.5"
165
166RULES_JVM_EXTERNAL_SHA = "b17d7388feb9bfa7f2fa09031b32707df529f26c91ab9e5d909eb1676badd9a6"
167
168http_archive(
169    name = "rules_jvm_external",
170    sha256 = RULES_JVM_EXTERNAL_SHA,
171    strip_prefix = "rules_jvm_external-%s" % RULES_JVM_EXTERNAL_TAG,
172    url = "https://github.com/bazelbuild/rules_jvm_external/archive/%s.zip" % RULES_JVM_EXTERNAL_TAG,
173)
174
175load("@rules_jvm_external//:defs.bzl", "maven_install")
176
177ANDROID_LINT_VERSION = "30.1.0"
178
179AUTO_COMMON_VERSION = "1.2.1"
180
181# NOTE(bcorso): Even though we set the version here, our Guava version in
182#  processor code will use whatever version is built into JavaBuilder, which is
183#  tied to the version of Bazel we're using.
184GUAVA_VERSION = "33.0.0"
185
186GRPC_VERSION = "1.2.0"
187
188INCAP_VERSION = "0.2"
189
190BYTE_BUDDY_VERSION = "1.9.10"
191
192CHECKER_FRAMEWORK_VERSION = "2.5.3"
193
194ERROR_PRONE_VERSION = "2.14.0"
195
196KSP_VERSION = KOTLIN_VERSION + "-1.0.14"
197
198maven_install(
199    artifacts = [
200        "androidx.annotation:annotation:1.1.0",
201        "androidx.annotation:annotation-experimental:1.3.1",
202        "androidx.appcompat:appcompat:1.3.1",
203        "androidx.activity:activity:1.5.1",
204        "androidx.fragment:fragment:1.5.1",
205        "androidx.lifecycle:lifecycle-common:2.5.1",
206        "androidx.lifecycle:lifecycle-viewmodel:2.5.1",
207        "androidx.lifecycle:lifecycle-viewmodel-savedstate:2.5.1",
208        "androidx.multidex:multidex:2.0.1",
209        "androidx.navigation:navigation-common:2.5.1",
210        "androidx.navigation:navigation-fragment:2.5.1",
211        "androidx.navigation:navigation-runtime:2.5.1",
212        "androidx.savedstate:savedstate:1.2.0",
213        "androidx.test:monitor:1.4.0",
214        "androidx.test:core:1.4.0",
215        "androidx.test.ext:junit:1.1.3",
216        "com.android.support:appcompat-v7:25.0.0",
217        "com.android.support:support-annotations:25.0.0",
218        "com.android.support:support-fragment:25.0.0",
219        "com.android.tools.external.org-jetbrains:uast:%s" % ANDROID_LINT_VERSION,
220        "com.android.tools.external.com-intellij:intellij-core:%s" % ANDROID_LINT_VERSION,
221        "com.android.tools.external.com-intellij:kotlin-compiler:%s" % ANDROID_LINT_VERSION,
222        "com.android.tools.lint:lint:%s" % ANDROID_LINT_VERSION,
223        "com.android.tools.lint:lint-api:%s" % ANDROID_LINT_VERSION,
224        "com.android.tools.lint:lint-checks:%s" % ANDROID_LINT_VERSION,
225        "com.android.tools.lint:lint-tests:%s" % ANDROID_LINT_VERSION,
226        "com.android.tools:testutils:%s" % ANDROID_LINT_VERSION,
227        "com.google.auto:auto-common:%s" % AUTO_COMMON_VERSION,
228        "com.google.auto.factory:auto-factory:1.0",
229        "com.google.auto.service:auto-service:1.0",
230        "com.google.auto.service:auto-service-annotations:1.0",
231        "com.google.auto.value:auto-value:1.9",
232        "com.google.auto.value:auto-value-annotations:1.9",
233        "com.google.code.findbugs:jsr305:3.0.1",
234        "com.google.devtools.ksp:symbol-processing:%s" % KSP_VERSION,
235        "com.google.devtools.ksp:symbol-processing-api:%s" % KSP_VERSION,
236        "com.google.errorprone:error_prone_annotation:%s" % ERROR_PRONE_VERSION,
237        "com.google.errorprone:error_prone_annotations:%s" % ERROR_PRONE_VERSION,
238        "com.google.errorprone:error_prone_check_api:%s" % ERROR_PRONE_VERSION,
239        "com.google.googlejavaformat:google-java-format:1.5",
240        "com.google.guava:guava:%s-jre" % GUAVA_VERSION,
241        "com.google.guava:guava-testlib:%s-jre" % GUAVA_VERSION,
242        "com.google.guava:failureaccess:1.0.1",
243        "com.google.guava:guava-beta-checker:1.0",
244        "com.google.protobuf:protobuf-java:3.7.0",
245        "com.google.testing.compile:compile-testing:0.18",
246        "com.google.truth:truth:1.4.0",
247        "com.squareup:javapoet:1.13.0",
248        "com.squareup:kotlinpoet:1.11.0",
249        "io.github.java-diff-utils:java-diff-utils:4.11",
250        "io.grpc:grpc-context:%s" % GRPC_VERSION,
251        "io.grpc:grpc-core:%s" % GRPC_VERSION,
252        "io.grpc:grpc-netty:%s" % GRPC_VERSION,
253        "io.grpc:grpc-protobuf:%s" % GRPC_VERSION,
254        "jakarta.inject:jakarta.inject-api:2.0.1",
255        "javax.annotation:javax.annotation-api:1.3.2",
256        "javax.inject:javax.inject:1",
257        "javax.inject:javax.inject-tck:1",
258        "junit:junit:4.13",
259        "net.bytebuddy:byte-buddy:%s" % BYTE_BUDDY_VERSION,
260        "net.bytebuddy:byte-buddy-agent:%s" % BYTE_BUDDY_VERSION,
261        "net.ltgt.gradle.incap:incap:%s" % INCAP_VERSION,
262        "net.ltgt.gradle.incap:incap-processor:%s" % INCAP_VERSION,
263        "org.checkerframework:checker-compat-qual:%s" % CHECKER_FRAMEWORK_VERSION,
264        "org.checkerframework:dataflow:%s" % CHECKER_FRAMEWORK_VERSION,
265        "org.checkerframework:javacutil:%s" % CHECKER_FRAMEWORK_VERSION,
266        "org.hamcrest:hamcrest-core:1.3",
267        "org.jetbrains.kotlin:kotlin-annotation-processing-embeddable:%s" % KOTLIN_VERSION,
268        "org.jetbrains.kotlin:kotlin-compiler-embeddable:%s" % KOTLIN_VERSION,
269        "org.jetbrains.kotlin:kotlin-daemon-embeddable:%s" % KOTLIN_VERSION,
270        "org.jetbrains.kotlin:kotlin-stdlib:%s" % KOTLIN_VERSION,
271        "org.jetbrains.kotlinx:kotlinx-metadata-jvm:0.6.2",
272        "org.jspecify:jspecify:0.3.0",
273        "org.mockito:mockito-core:2.28.2",
274        "org.objenesis:objenesis:1.0",
275        "org.robolectric:robolectric:4.4",
276        "org.robolectric:shadows-framework:4.4",  # For ActivityController
277    ],
278    repositories = [
279        "https://repo1.maven.org/maven2",
280        "https://maven.google.com",
281    ],
282)
283