# 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 = 32, build_tools_version = "32.0.0", ) ############################# # Load Robolectric repository ############################# load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") http_archive( name = "robolectric", strip_prefix = "robolectric-bazel-4.1", urls = ["https://github.com/robolectric/robolectric-bazel/archive/4.1.tar.gz"], ) 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:4.1", "org.robolectric:annotations:4.1", ], repositories = DAGGER_REPOSITORIES + HILT_ANDROID_REPOSITORIES, )