• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright (C) 2020 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# Description:
16#   Defines the Bazel workspace rules for the Dagger examples.
17
18########################
19# Load Dagger repository
20########################
21
22# TODO(bcorso): Replace with `http_archive` pointing to tagged released.
23local_repository(
24    name = "dagger",
25    path = "../../",
26)
27
28load(
29    "@dagger//:workspace_defs.bzl",
30    "DAGGER_ARTIFACTS",
31    "DAGGER_REPOSITORIES",
32    "HILT_ANDROID_ARTIFACTS",
33    "HILT_ANDROID_REPOSITORIES",
34)
35
36#########################
37# Load Android repository
38#########################
39
40android_sdk_repository(
41    name = "androidsdk",
42    api_level = 30,
43    build_tools_version = "30.0.2",
44)
45
46#############################
47# Load Robolectric repository
48#############################
49
50load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
51
52http_archive(
53    name = "robolectric",
54    strip_prefix = "robolectric-bazel-4.1",
55    urls = ["https://github.com/robolectric/robolectric-bazel/archive/4.1.tar.gz"],
56)
57
58load("@robolectric//bazel:robolectric.bzl", "robolectric_repositories")
59
60robolectric_repositories()
61
62#########################
63# Load Maven repositories
64#########################
65
66RULES_JVM_EXTERNAL_TAG = "2.7"
67
68RULES_JVM_EXTERNAL_SHA = "f04b1466a00a2845106801e0c5cec96841f49ea4e7d1df88dc8e4bf31523df74"
69
70http_archive(
71    name = "rules_jvm_external",
72    sha256 = RULES_JVM_EXTERNAL_SHA,
73    strip_prefix = "rules_jvm_external-%s" % RULES_JVM_EXTERNAL_TAG,
74    url = "https://github.com/bazelbuild/rules_jvm_external/archive/%s.zip" % RULES_JVM_EXTERNAL_TAG,
75)
76
77load("@rules_jvm_external//:defs.bzl", "maven_install")
78
79maven_install(
80    artifacts = DAGGER_ARTIFACTS + HILT_ANDROID_ARTIFACTS + [
81        "androidx.test.ext:junit:1.1.1",
82        "androidx.test:runner:1.1.1",
83        "com.google.truth:truth:1.0.1",
84        "junit:junit:4.13",
85        "org.robolectric:robolectric:4.1",
86        "org.robolectric:annotations:4.1",
87    ],
88    repositories = DAGGER_REPOSITORIES + HILT_ANDROID_REPOSITORIES,
89)
90