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# Upgrade java_tools version 19############################# 20 21# These targets added per instructions at 22# https://github.com/bazelbuild/java_tools/releases/tag/javac11_v10.7 23http_archive( 24 name = "remote_java_tools_linux", 25 sha256 = "cf57fc238ed5c24c718436ab4178ade5eb838fe56e7c32c4fafe0b6fbdaec51f", 26 urls = [ 27 "https://mirror.bazel.build/bazel_java_tools/releases/javac11/v10.7/java_tools_javac11_linux-v10.7.zip", 28 "https://github.com/bazelbuild/java_tools/releases/download/javac11_v10.7/java_tools_javac11_linux-v10.7.zip", 29 ], 30) 31 32http_archive( 33 name = "remote_java_tools_windows", 34 sha256 = "a0fc3a3be3ea01a4858d12f56892dd663c02f218104e8c1dc9f3e90d5e583bcb", 35 urls = [ 36 "https://mirror.bazel.build/bazel_java_tools/releases/javac11/v10.7/java_tools_javac11_windows-v10.7.zip", 37 "https://github.com/bazelbuild/java_tools/releases/download/javac11_v10.7/java_tools_javac11_windows-v10.7.zip", 38 ], 39) 40 41http_archive( 42 name = "remote_java_tools_darwin", 43 sha256 = "51a4cf424d3b26d6c42703cf2d80002f1489ba0d28c939519c3bb9c3d6ee3720", 44 urls = [ 45 "https://mirror.bazel.build/bazel_java_tools/releases/javac11/v10.7/java_tools_javac11_darwin-v10.7.zip", 46 "https://github.com/bazelbuild/java_tools/releases/download/javac11_v10.7/java_tools_javac11_darwin-v10.7.zip", 47 ], 48) 49 50############################# 51# Load nested repository 52############################# 53 54# Declare the nested workspace so that the top-level workspace doesn't try to 55# traverse it when calling `bazel build //...` 56local_repository( 57 name = "examples_bazel", 58 path = "examples/bazel", 59) 60 61############################# 62# Load Bazel-Common repository 63############################# 64 65http_archive( 66 name = "google_bazel_common", 67 sha256 = "8b6aebdc095c8448b2f6a72bb8eae4a563891467e2d20c943f21940b1c444e38", 68 strip_prefix = "bazel-common-3d0e5005cfcbee836e31695d4ab91b5328ccc506", 69 urls = ["https://github.com/google/bazel-common/archive/3d0e5005cfcbee836e31695d4ab91b5328ccc506.zip"], 70) 71 72load("@google_bazel_common//:workspace_defs.bzl", "google_common_workspace_rules") 73 74google_common_workspace_rules() 75 76############################# 77# Load Protobuf dependencies 78############################# 79 80# rules_python and zlib are required by protobuf. 81# TODO(ronshapiro): Figure out if zlib is in fact necessary, or if proto can depend on the 82# @bazel_tools library directly. See discussion in 83# https://github.com/protocolbuffers/protobuf/pull/5389#issuecomment-481785716 84# TODO(cpovirk): Should we eventually get rules_python from "Bazel Federation?" 85# https://github.com/bazelbuild/rules_python#getting-started 86 87http_archive( 88 name = "rules_python", 89 sha256 = "e5470e92a18aa51830db99a4d9c492cc613761d5bdb7131c04bd92b9834380f6", 90 strip_prefix = "rules_python-4b84ad270387a7c439ebdccfd530e2339601ef27", 91 urls = ["https://github.com/bazelbuild/rules_python/archive/4b84ad270387a7c439ebdccfd530e2339601ef27.tar.gz"], 92) 93 94http_archive( 95 name = "zlib", 96 build_file = "@com_google_protobuf//:third_party/zlib.BUILD", 97 sha256 = "629380c90a77b964d896ed37163f5c3a34f6e6d897311f1df2a7016355c45eff", 98 strip_prefix = "zlib-1.2.11", 99 urls = ["https://github.com/madler/zlib/archive/v1.2.11.tar.gz"], 100) 101 102############################# 103# Load Robolectric repository 104############################# 105 106ROBOLECTRIC_VERSION = "4.4" 107 108http_archive( 109 name = "robolectric", 110 sha256 = "d4f2eb078a51f4e534ebf5e18b6cd4646d05eae9b362ac40b93831bdf46112c7", 111 strip_prefix = "robolectric-bazel-%s" % ROBOLECTRIC_VERSION, 112 urls = ["https://github.com/robolectric/robolectric-bazel/archive/%s.tar.gz" % ROBOLECTRIC_VERSION], 113) 114 115load("@robolectric//bazel:robolectric.bzl", "robolectric_repositories") 116 117robolectric_repositories() 118 119############################# 120# Load Kotlin repository 121############################# 122 123RULES_KOTLIN_COMMIT = "686f0f1cf3e1cc8c750688bb082316b3eadb3cb6" 124 125RULES_KOTLIN_SHA = "1d8758bbf27400a5f9d40f01e4337f6834d2b7864df34e9aa5cf0a9ab6cc9241" 126 127http_archive( 128 name = "io_bazel_rules_kotlin_head", 129 sha256 = RULES_KOTLIN_SHA, 130 strip_prefix = "rules_kotlin-%s" % RULES_KOTLIN_COMMIT, 131 type = "zip", 132 urls = ["https://github.com/bazelbuild/rules_kotlin/archive/%s.zip" % RULES_KOTLIN_COMMIT], 133) 134 135load("@io_bazel_rules_kotlin_head//src/main/starlark/release_archive:repository.bzl", "archive_repository") 136 137archive_repository( 138 name = "io_bazel_rules_kotlin", 139 source_repository_name = "io_bazel_rules_kotlin_head", 140) 141 142load("@io_bazel_rules_kotlin//kotlin:repositories.bzl", "kotlin_repositories", "kotlinc_version") 143 144KOTLIN_VERSION = "1.5.32" 145 146KOTLINC_RELEASE_SHA = "2e728c43ee0bf819eae06630a4cbbc28ba2ed5b19a55ee0af96d2c0ab6b6c2a5" 147 148kotlin_repositories( 149 compiler_release = kotlinc_version( 150 release = KOTLIN_VERSION, 151 sha256 = KOTLINC_RELEASE_SHA, 152 ), 153) 154 155load("@io_bazel_rules_kotlin//kotlin:core.bzl", "kt_register_toolchains") 156 157kt_register_toolchains() 158 159############################# 160# Load Maven dependencies 161############################# 162 163RULES_JVM_EXTERNAL_TAG = "2.7" 164 165RULES_JVM_EXTERNAL_SHA = "f04b1466a00a2845106801e0c5cec96841f49ea4e7d1df88dc8e4bf31523df74" 166 167http_archive( 168 name = "rules_jvm_external", 169 sha256 = RULES_JVM_EXTERNAL_SHA, 170 strip_prefix = "rules_jvm_external-%s" % RULES_JVM_EXTERNAL_TAG, 171 url = "https://github.com/bazelbuild/rules_jvm_external/archive/%s.zip" % RULES_JVM_EXTERNAL_TAG, 172) 173 174load("@rules_jvm_external//:defs.bzl", "maven_install") 175 176ANDROID_LINT_VERSION = "30.1.0" 177 178AUTO_COMMON_VERSION = "1.2.1" 179 180# NOTE(bcorso): Even though we set the version here, our Guava version in 181# processor code will use whatever version is built into JavaBuilder, which is 182# tied to the version of Bazel we're using. 183GUAVA_VERSION = "27.1" 184 185GRPC_VERSION = "1.2.0" 186 187INCAP_VERSION = "0.2" 188 189BYTE_BUDDY_VERSION = "1.9.10" 190 191CHECKER_FRAMEWORK_VERSION = "2.5.3" 192 193ERROR_PRONE_VERSION = "2.3.2" 194 195maven_install( 196 artifacts = [ 197 "androidx.annotation:annotation:1.1.0", 198 "androidx.appcompat:appcompat:1.3.1", 199 "androidx.activity:activity:1.3.1", 200 "androidx.fragment:fragment:1.3.6", 201 "androidx.lifecycle:lifecycle-common:2.3.1", 202 "androidx.lifecycle:lifecycle-viewmodel:2.3.1", 203 "androidx.lifecycle:lifecycle-viewmodel-savedstate:2.3.1", 204 "androidx.multidex:multidex:2.0.1", 205 "androidx.savedstate:savedstate:1.0.0", 206 "androidx.test:monitor:1.4.0", 207 "androidx.test:core:1.4.0", 208 "androidx.test.ext:junit:1.1.3", 209 "com.android.support:appcompat-v7:25.0.0", 210 "com.android.support:support-annotations:25.0.0", 211 "com.android.support:support-fragment:25.0.0", 212 "com.android.tools.external.org-jetbrains:uast:%s" % ANDROID_LINT_VERSION, 213 "com.android.tools.external.com-intellij:intellij-core:%s" % ANDROID_LINT_VERSION, 214 "com.android.tools.external.com-intellij:kotlin-compiler:%s" % ANDROID_LINT_VERSION, 215 "com.android.tools.lint:lint:%s" % ANDROID_LINT_VERSION, 216 "com.android.tools.lint:lint-api:%s" % ANDROID_LINT_VERSION, 217 "com.android.tools.lint:lint-checks:%s" % ANDROID_LINT_VERSION, 218 "com.android.tools.lint:lint-tests:%s" % ANDROID_LINT_VERSION, 219 "com.android.tools:testutils:%s" % ANDROID_LINT_VERSION, 220 "com.github.tschuchortdev:kotlin-compile-testing:1.2.8", 221 "com.google.auto:auto-common:%s" % AUTO_COMMON_VERSION, 222 "com.google.auto.factory:auto-factory:1.0", 223 "com.google.auto.service:auto-service:1.0", 224 "com.google.auto.service:auto-service-annotations:1.0", 225 "com.google.auto.value:auto-value:1.6", 226 "com.google.auto.value:auto-value-annotations:1.6", 227 "com.google.code.findbugs:jsr305:3.0.1", 228 "com.google.devtools.ksp:symbol-processing-api:1.5.30-1.0.0", 229 "com.google.errorprone:error_prone_annotation:%s" % ERROR_PRONE_VERSION, 230 "com.google.errorprone:error_prone_annotations:%s" % ERROR_PRONE_VERSION, 231 "com.google.errorprone:error_prone_check_api:%s" % ERROR_PRONE_VERSION, 232 "com.google.googlejavaformat:google-java-format:1.5", 233 "com.google.guava:guava:%s-jre" % GUAVA_VERSION, 234 "com.google.guava:guava-testlib:%s-jre" % GUAVA_VERSION, 235 "com.google.guava:failureaccess:1.0.1", 236 "com.google.guava:guava-beta-checker:1.0", 237 "com.google.protobuf:protobuf-java:3.7.0", 238 "com.google.testing.compile:compile-testing:0.18", 239 "com.google.truth:truth:1.1", 240 "com.squareup:javapoet:1.13.0", 241 "io.grpc:grpc-context:%s" % GRPC_VERSION, 242 "io.grpc:grpc-core:%s" % GRPC_VERSION, 243 "io.grpc:grpc-netty:%s" % GRPC_VERSION, 244 "io.grpc:grpc-protobuf:%s" % GRPC_VERSION, 245 "jakarta.inject:jakarta.inject-api:2.0.1", 246 "javax.annotation:jsr250-api:1.0", 247 "javax.inject:javax.inject:1", 248 "javax.inject:javax.inject-tck:1", 249 "junit:junit:4.13", 250 "net.bytebuddy:byte-buddy:%s" % BYTE_BUDDY_VERSION, 251 "net.bytebuddy:byte-buddy-agent:%s" % BYTE_BUDDY_VERSION, 252 "net.ltgt.gradle.incap:incap:%s" % INCAP_VERSION, 253 "net.ltgt.gradle.incap:incap-processor:%s" % INCAP_VERSION, 254 "org.checkerframework:checker-compat-qual:%s" % CHECKER_FRAMEWORK_VERSION, 255 "org.checkerframework:dataflow:%s" % CHECKER_FRAMEWORK_VERSION, 256 "org.checkerframework:javacutil:%s" % CHECKER_FRAMEWORK_VERSION, 257 "org.hamcrest:hamcrest-core:1.3", 258 "org.jetbrains.kotlin:kotlin-stdlib:%s" % KOTLIN_VERSION, 259 "org.jetbrains.kotlin:kotlin-stdlib-jdk8:%s" % KOTLIN_VERSION, 260 "org.jetbrains.kotlinx:kotlinx-metadata-jvm:0.3.0", 261 "org.mockito:mockito-core:2.28.2", 262 "org.objenesis:objenesis:1.0", 263 "org.robolectric:robolectric:4.4", 264 "org.robolectric:shadows-framework:4.4", # For ActivityController 265 ], 266 repositories = [ 267 "https://repo1.maven.org/maven2", 268 "https://maven.google.com", 269 ], 270) 271 272############################# 273# Load Bazel Skylib rules 274############################# 275 276BAZEL_SKYLIB_VERSION = "1.0.2" 277 278BAZEL_SKYLIB_SHA = "97e70364e9249702246c0e9444bccdc4b847bed1eb03c5a3ece4f83dfe6abc44" 279 280http_archive( 281 name = "bazel_skylib", 282 sha256 = BAZEL_SKYLIB_SHA, 283 urls = [ 284 "https://github.com/bazelbuild/bazel-skylib/releases/download/{version}/bazel-skylib-{version}.tar.gz".format(version = BAZEL_SKYLIB_VERSION), 285 ], 286) 287 288load("@bazel_skylib//:workspace.bzl", "bazel_skylib_workspace") 289 290bazel_skylib_workspace() 291