# Copyright (C) 2020 The Dagger Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # # Description: # Defines the Bazel workspace rules for the Dagger examples. ######################## # Load Dagger repository ######################## # In a real project, this repository would use `http_archive` to link to a # tagged, released version of the Dagger, but we use `local_repository` so that # CI testing can test local changes to workspace_defs.bzl. local_repository( name = "dagger", path = "../../", ) load( "@dagger//:workspace_defs.bzl", "DAGGER_ARTIFACTS", "DAGGER_REPOSITORIES", "HILT_ANDROID_ARTIFACTS", "HILT_ANDROID_REPOSITORIES", ) ######################### # Load Android repository ######################### android_sdk_repository( name = "androidsdk", api_level = 34, build_tools_version = "34.0.0", ) ############################# # Load Robolectric repository ############################# load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") ROBOLECTRIC_VERSION = "4.11.1" http_archive( name = "robolectric", sha256 = "1ea1cfe67848decf959316e80dd69af2bbaa359ae2195efe1366cbdf3e968356", strip_prefix = "robolectric-bazel-%s" % ROBOLECTRIC_VERSION, urls = ["https://github.com/robolectric/robolectric-bazel/releases/download/%s/robolectric-bazel-%s.tar.gz" % (ROBOLECTRIC_VERSION, ROBOLECTRIC_VERSION)], ) load("@robolectric//bazel:robolectric.bzl", "robolectric_repositories") robolectric_repositories() ######################### # Load Maven repositories ######################### RULES_JVM_EXTERNAL_TAG = "4.2" RULES_JVM_EXTERNAL_SHA = "cd1a77b7b02e8e008439ca76fd34f5b07aecb8c752961f9640dea15e9e5ba1ca" http_archive( name = "rules_jvm_external", sha256 = RULES_JVM_EXTERNAL_SHA, strip_prefix = "rules_jvm_external-%s" % RULES_JVM_EXTERNAL_TAG, url = "https://github.com/bazelbuild/rules_jvm_external/archive/%s.zip" % RULES_JVM_EXTERNAL_TAG, ) load("@rules_jvm_external//:defs.bzl", "maven_install") maven_install( artifacts = DAGGER_ARTIFACTS + HILT_ANDROID_ARTIFACTS + [ "androidx.test.ext:junit:1.1.1", "androidx.test:runner:1.1.1", "com.google.truth:truth:1.0.1", "junit:junit:4.13", "org.robolectric:robolectric:%s" % ROBOLECTRIC_VERSION, "org.robolectric:annotations:%s" % ROBOLECTRIC_VERSION, ], repositories = DAGGER_REPOSITORIES + HILT_ANDROID_REPOSITORIES, )