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 15 16load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") 17 18############################# 19# Load nested repository 20############################# 21 22# Declare the nested workspace so that the top-level workspace doesn't try to 23# traverse it when calling `bazel build //...` 24local_repository( 25 name = "examples_bazel", 26 path = "examples/bazel", 27) 28 29############################# 30# Load Bazel Skylib rules 31############################# 32 33BAZEL_SKYLIB_VERSION = "1.5.0" 34 35BAZEL_SKYLIB_SHA = "cd55a062e763b9349921f0f5db8c3933288dc8ba4f76dd9416aac68acee3cb94" 36 37http_archive( 38 name = "bazel_skylib", 39 sha256 = BAZEL_SKYLIB_SHA, 40 urls = [ 41 "https://mirror.bazel.build/github.com/bazelbuild/bazel-skylib/releases/download/%s/bazel-skylib-%s.tar.gz" % (BAZEL_SKYLIB_VERSION, BAZEL_SKYLIB_VERSION), 42 "https://github.com/bazelbuild/bazel-skylib/releases/download/%s/bazel-skylib-%s.tar.gz" % (BAZEL_SKYLIB_VERSION, BAZEL_SKYLIB_VERSION), 43 ], 44) 45 46load("@bazel_skylib//:workspace.bzl", "bazel_skylib_workspace") 47 48bazel_skylib_workspace() 49 50############################# 51# Load rules_java repository 52############################# 53 54http_archive( 55 name = "rules_java", 56 sha256 = "c73336802d0b4882e40770666ad055212df4ea62cfa6edf9cb0f9d29828a0934", 57 url = "https://github.com/bazelbuild/rules_java/releases/download/5.3.5/rules_java-5.3.5.tar.gz", 58) 59 60############################# 61# Load Android Sdk 62############################# 63 64android_sdk_repository( 65 name = "androidsdk", 66 api_level = 34, 67 build_tools_version = "34.0.0", 68) 69 70#################################################### 71# Load Protobuf repository (needed by bazel-common) 72#################################################### 73 74http_archive( 75 name = "rules_proto", 76 # output from `sha256sum` on the downloaded tar.gz file 77 sha256 = "66bfdf8782796239d3875d37e7de19b1d94301e8972b3cbd2446b332429b4df1", 78 strip_prefix = "rules_proto-4.0.0", 79 urls = [ 80 "https://mirror.bazel.build/github.com/bazelbuild/rules_proto/archive/refs/tags/4.0.0.tar.gz", 81 "https://github.com/bazelbuild/rules_proto/archive/refs/tags/4.0.0.tar.gz", 82 ], 83) 84 85load("@rules_proto//proto:repositories.bzl", "rules_proto_dependencies", "rules_proto_toolchains") 86 87rules_proto_dependencies() 88 89rules_proto_toolchains() 90 91############################# 92# Load Protobuf dependencies 93############################# 94 95# rules_python and zlib are required by protobuf. 96# TODO(ronshapiro): Figure out if zlib is in fact necessary, or if proto can depend on the 97# @bazel_tools library directly. See discussion in 98# https://github.com/protocolbuffers/protobuf/pull/5389#issuecomment-481785716 99# TODO(cpovirk): Should we eventually get rules_python from "Bazel Federation?" 100# https://github.com/bazelbuild/rules_python#getting-started 101 102http_archive( 103 name = "rules_python", 104 sha256 = "e5470e92a18aa51830db99a4d9c492cc613761d5bdb7131c04bd92b9834380f6", 105 strip_prefix = "rules_python-4b84ad270387a7c439ebdccfd530e2339601ef27", 106 urls = ["https://github.com/bazelbuild/rules_python/archive/4b84ad270387a7c439ebdccfd530e2339601ef27.tar.gz"], 107) 108 109http_archive( 110 name = "zlib", 111 build_file = "@com_google_protobuf//:third_party/zlib.BUILD", 112 sha256 = "629380c90a77b964d896ed37163f5c3a34f6e6d897311f1df2a7016355c45eff", 113 strip_prefix = "zlib-1.2.11", 114 urls = ["https://github.com/madler/zlib/archive/v1.2.11.tar.gz"], 115) 116 117############################# 118# Load Robolectric repository 119############################# 120 121ROBOLECTRIC_VERSION = "4.11.1" 122 123http_archive( 124 name = "robolectric", 125 sha256 = "1ea1cfe67848decf959316e80dd69af2bbaa359ae2195efe1366cbdf3e968356", 126 strip_prefix = "robolectric-bazel-%s" % ROBOLECTRIC_VERSION, 127 urls = ["https://github.com/robolectric/robolectric-bazel/releases/download/%s/robolectric-bazel-%s.tar.gz" % (ROBOLECTRIC_VERSION, ROBOLECTRIC_VERSION)], 128) 129 130load("@robolectric//bazel:robolectric.bzl", "robolectric_repositories") 131 132robolectric_repositories() 133 134############################# 135# Load Kotlin repository 136############################# 137 138RULES_KOTLIN_TAG = "1.9.6" 139 140RULES_KOTLIN_SHA = "3b772976fec7bdcda1d84b9d39b176589424c047eb2175bed09aac630e50af43" 141 142http_archive( 143 name = "io_bazel_rules_kotlin", 144 sha256 = RULES_KOTLIN_SHA, 145 urls = ["https://github.com/bazelbuild/rules_kotlin/releases/download/v%s/rules_kotlin-v%s.tar.gz" % (RULES_KOTLIN_TAG, RULES_KOTLIN_TAG)], 146) 147 148load("@io_bazel_rules_kotlin//kotlin:repositories.bzl", "kotlin_repositories", "kotlinc_version") 149 150# TODO: update to Kotlin 2 once rules_kotlin support it. 151# See https://github.com/bazelbuild/rules_kotlin/issues/1176 152KOTLINC_VERSION = "1.9.24" 153 154# Get from https://github.com/JetBrains/kotlin/releases/ 155KOTLINC_RELEASE_SHA = "eb7b68e01029fa67bc8d060ee54c12018f2c60ddc438cf21db14517229aa693b" 156 157kotlin_repositories( 158 compiler_release = kotlinc_version( 159 release = KOTLINC_VERSION, 160 # Get from https://github.com/JetBrains/kotlin/releases/ 161 sha256 = KOTLINC_RELEASE_SHA, 162 ), 163) 164 165register_toolchains("//:kotlin_toolchain") 166 167############################# 168# Load Maven dependencies 169############################# 170 171RULES_JVM_EXTERNAL_TAG = "4.5" 172 173RULES_JVM_EXTERNAL_SHA = "b17d7388feb9bfa7f2fa09031b32707df529f26c91ab9e5d909eb1676badd9a6" 174 175http_archive( 176 name = "rules_jvm_external", 177 sha256 = RULES_JVM_EXTERNAL_SHA, 178 strip_prefix = "rules_jvm_external-%s" % RULES_JVM_EXTERNAL_TAG, 179 url = "https://github.com/bazelbuild/rules_jvm_external/archive/%s.zip" % RULES_JVM_EXTERNAL_TAG, 180) 181 182load("@rules_jvm_external//:defs.bzl", "maven_install") 183 184ANDROID_LINT_VERSION = "30.1.0" 185 186ANT_VERSION = "1.9.6" 187 188ASM_VERSION = "9.6" 189 190AUTO_COMMON_VERSION = "1.2.1" 191 192BYTE_BUDDY_VERSION = "1.9.10" 193 194CHECKER_FRAMEWORK_VERSION = "2.5.3" 195 196ECLIPSE_SISU_VERSION = "0.3.0" 197 198ERROR_PRONE_VERSION = "2.14.0" 199 200# NOTE(bcorso): Even though we set the version here, our Guava version in 201# processor code will use whatever version is built into JavaBuilder, which is 202# tied to the version of Bazel we're using. 203GUAVA_VERSION = "33.0.0" 204 205GRPC_VERSION = "1.2.0" 206 207INCAP_VERSION = "0.2" 208 209KOTLIN_VERSION = "2.0.21" 210 211KSP_VERSION = KOTLIN_VERSION + "-1.0.28" 212 213MAVEN_VERSION = "3.3.3" 214 215maven_install( 216 artifacts = [ 217 "androidx.annotation:annotation:1.1.0", 218 "androidx.annotation:annotation-experimental:1.3.1", 219 "androidx.appcompat:appcompat:1.3.1", 220 "androidx.activity:activity:1.5.1", 221 "androidx.fragment:fragment:1.5.1", 222 "androidx.lifecycle:lifecycle-common:2.5.1", 223 "androidx.lifecycle:lifecycle-viewmodel:2.5.1", 224 "androidx.lifecycle:lifecycle-viewmodel-savedstate:2.5.1", 225 "androidx.multidex:multidex:2.0.1", 226 "androidx.navigation:navigation-common:2.5.1", 227 "androidx.navigation:navigation-fragment:2.5.1", 228 "androidx.navigation:navigation-runtime:2.5.1", 229 "androidx.savedstate:savedstate:1.2.0", 230 "androidx.test:monitor:1.4.0", 231 "androidx.test:core:1.4.0", 232 "androidx.test.ext:junit:1.1.3", 233 "com.android.support:appcompat-v7:25.0.0", 234 "com.android.support:support-annotations:25.0.0", 235 "com.android.support:support-fragment:25.0.0", 236 "com.android.tools.external.org-jetbrains:uast:%s" % ANDROID_LINT_VERSION, 237 "com.android.tools.external.com-intellij:intellij-core:%s" % ANDROID_LINT_VERSION, 238 "com.android.tools.external.com-intellij:kotlin-compiler:%s" % ANDROID_LINT_VERSION, 239 "com.android.tools.lint:lint:%s" % ANDROID_LINT_VERSION, 240 "com.android.tools.lint:lint-api:%s" % ANDROID_LINT_VERSION, 241 "com.android.tools.lint:lint-checks:%s" % ANDROID_LINT_VERSION, 242 "com.android.tools.lint:lint-tests:%s" % ANDROID_LINT_VERSION, 243 "com.android.tools:testutils:%s" % ANDROID_LINT_VERSION, 244 "com.google.auto:auto-common:%s" % AUTO_COMMON_VERSION, 245 "com.google.auto.factory:auto-factory:1.0", 246 "com.google.auto.service:auto-service:1.0", 247 "com.google.auto.service:auto-service-annotations:1.0", 248 "com.google.auto.value:auto-value:1.9", 249 "com.google.auto.value:auto-value-annotations:1.9", 250 "com.google.code.findbugs:jsr305:3.0.1", 251 "com.google.devtools.ksp:symbol-processing:%s" % KSP_VERSION, 252 "com.google.devtools.ksp:symbol-processing-api:%s" % KSP_VERSION, 253 "com.google.devtools.ksp:symbol-processing-common-deps:%s" % KSP_VERSION, 254 "com.google.devtools.ksp:symbol-processing-aa-embeddable:%s" % KSP_VERSION, 255 "com.google.errorprone:error_prone_annotation:%s" % ERROR_PRONE_VERSION, 256 "com.google.errorprone:error_prone_annotations:%s" % ERROR_PRONE_VERSION, 257 "com.google.errorprone:error_prone_check_api:%s" % ERROR_PRONE_VERSION, 258 "com.google.googlejavaformat:google-java-format:1.5", 259 "com.google.guava:guava:%s-jre" % GUAVA_VERSION, 260 "com.google.guava:guava-testlib:%s-jre" % GUAVA_VERSION, 261 "com.google.guava:failureaccess:1.0.1", 262 "com.google.guava:guava-beta-checker:1.0", 263 "com.google.protobuf:protobuf-java:3.7.0", 264 "com.google.testing.compile:compile-testing:0.18", 265 "com.google.truth:truth:1.4.0", 266 "com.squareup:javapoet:1.13.0", 267 "com.squareup:kotlinpoet:1.11.0", 268 "io.github.java-diff-utils:java-diff-utils:4.11", 269 "io.grpc:grpc-context:%s" % GRPC_VERSION, 270 "io.grpc:grpc-core:%s" % GRPC_VERSION, 271 "io.grpc:grpc-netty:%s" % GRPC_VERSION, 272 "io.grpc:grpc-protobuf:%s" % GRPC_VERSION, 273 "jakarta.inject:jakarta.inject-api:2.0.1", 274 "javax.annotation:javax.annotation-api:1.3.2", 275 "javax.enterprise:cdi-api:1.0", 276 "javax.inject:javax.inject:1", 277 "javax.inject:javax.inject-tck:1", 278 "junit:junit:4.13", 279 "net.bytebuddy:byte-buddy:%s" % BYTE_BUDDY_VERSION, 280 "net.bytebuddy:byte-buddy-agent:%s" % BYTE_BUDDY_VERSION, 281 "net.ltgt.gradle.incap:incap:%s" % INCAP_VERSION, 282 "net.ltgt.gradle.incap:incap-processor:%s" % INCAP_VERSION, 283 "org.apache.ant:ant:%s" % ANT_VERSION, 284 "org.apache.ant:ant-launcher:%s" % ANT_VERSION, 285 "org.apache.maven:maven-artifact:%s" % MAVEN_VERSION, 286 "org.apache.maven:maven-model:%s" % MAVEN_VERSION, 287 "org.apache.maven:maven-plugin-api:%s" % MAVEN_VERSION, 288 "org.checkerframework:checker-compat-qual:%s" % CHECKER_FRAMEWORK_VERSION, 289 "org.checkerframework:dataflow:%s" % CHECKER_FRAMEWORK_VERSION, 290 "org.checkerframework:javacutil:%s" % CHECKER_FRAMEWORK_VERSION, 291 "org.codehaus.plexus:plexus-utils:3.0.20", 292 "org.codehaus.plexus:plexus-classworlds:2.5.2", 293 "org.codehaus.plexus:plexus-component-annotations:1.5.5", 294 "org.eclipse.sisu:org.eclipse.sisu.plexus:%s" % ECLIPSE_SISU_VERSION, 295 "org.eclipse.sisu:org.eclipse.sisu.inject:%s" % ECLIPSE_SISU_VERSION, 296 "org.hamcrest:hamcrest-core:1.3", 297 "org.jetbrains.kotlin:kotlin-annotation-processing-embeddable:%s" % KOTLIN_VERSION, 298 "org.jetbrains.kotlin:kotlin-compiler-embeddable:%s" % KOTLIN_VERSION, 299 "org.jetbrains.kotlin:kotlin-daemon-embeddable:%s" % KOTLIN_VERSION, 300 "org.jetbrains.kotlin:kotlin-metadata-jvm:%s" % KOTLIN_VERSION, 301 "org.jetbrains.kotlin:kotlin-stdlib:%s" % KOTLIN_VERSION, 302 "org.jspecify:jspecify:1.0.0", 303 "org.mockito:mockito-core:2.28.2", 304 "org.pantsbuild:jarjar:1.7.2", 305 "org.objenesis:objenesis:1.0", 306 "org.ow2.asm:asm:%s" % ASM_VERSION, 307 "org.ow2.asm:asm-tree:%s" % ASM_VERSION, 308 "org.ow2.asm:asm-commons:%s" % ASM_VERSION, 309 "org.robolectric:robolectric:%s" % ROBOLECTRIC_VERSION, 310 "org.robolectric:shadows-framework:%s" % ROBOLECTRIC_VERSION, # For ActivityController 311 ], 312 repositories = [ 313 "https://repo1.maven.org/maven2", 314 "https://maven.google.com", 315 ], 316) 317