| # 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 |
| ######################## |
| |
| # TODO(bcorso): Replace with `http_archive` pointing to tagged released. |
| 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 = 30, |
| build_tools_version = "30.0.2", |
| ) |
| |
| ############################# |
| # 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 = "2.7" |
| |
| RULES_JVM_EXTERNAL_SHA = "f04b1466a00a2845106801e0c5cec96841f49ea4e7d1df88dc8e4bf31523df74" |
| |
| 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, |
| ) |