Bump rules_jvm_external to 4.5 (#39)

Signed-off-by: utzcoz <utzcoz@outlook.com>
1 file changed
tree: 73dd6266b98358c093769c3b5b14e34e992b14e3
  1. .github/
  2. bazel/
  3. .gitignore
  4. README.md
  5. WORKSPACE
README.md

robolectric-bazel

This project provides build rules for integrating Robolectric into Bazel projects.

Releases


Usage

Add the robolectric and rules_jvm_external repositories in your WORKSPACE file:

http_archive(
    name = "robolectric",
    urls = ["https://github.com/robolectric/robolectric-bazel/archive/4.9.tar.gz"],
    strip_prefix = "robolectric-bazel-4.9",
    sha256 = "get the sha256 from github releases",
)
load("@robolectric//bazel:robolectric.bzl", "robolectric_repositories")
robolectric_repositories()


http_archive(
    name = "rules_jvm_external",
    strip_prefix = "rules_jvm_external-4.5",
    sha256 = "b17d7388feb9bfa7f2fa09031b32707df529f26c91ab9e5d909eb1676badd9a6",
    url = "https://github.com/bazelbuild/rules_jvm_external/archive/4.5.zip",
)
load("@rules_jvm_external//:defs.bzl", "maven_install")
maven_install(
    artifacts = [
        "org.robolectric:robolectric:4.9",
    ],
    repositories = [
        "https://maven.google.com",
        "https://repo1.maven.org/maven2",
    ],
)

Then, in your android_local_test targets in the BUILD files, depend on the Robolectric targets @maven//:org_robolectric_robolectric and @robolectric//bazel:android-all:

android_local_test(
    name = "greeter_activity_test",
    srcs = ["GreeterTest.java"],
    manifest = "TestManifest.xml",
    test_class = "com.example.bazel.GreeterTest",
    deps = [
        ":greeter_activity",
        "@maven//:org_robolectric_robolectric",
        "@robolectric//bazel:android-all",
    ],
)