Clone this repo:
  1. 07011f0 Add MIT and Apache 2.0 licenses by Ben Lee · 3 months ago upstream/master
  2. 4930278 Add support for Robolectric 4.16 (#132) by Ben Lee · 4 months ago 4.16
  3. 3708390 Bump actions/checkout from 4 to 5 by dependabot[bot] · 5 months ago
  4. 3e05780 Bump rules_jvm_external to 6.7 (#130) by utzcoz · 7 months ago
  5. 117aabc Support Robolectric 4.15.1 (#129) by Ben Lee · 7 months ago 4.15.1

robolectric-bazel

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

Releases


Installation

Follow instructions in the release notes from the release you use: https://github.com/robolectric/robolectric-bazel/releases

Usage

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",
    ],
)

Publishing Releases

A new release can be published by just pushing a tag.

Once the tag is pushed, GitHub Actions will build, test, and publish a release to both GitHub releases and the BCR.

Example:

git tag 4.11.1
git push origin 4.11.1