Skip to content

Commit

Permalink
Change rules_android workspace name
Browse files Browse the repository at this point in the history
...from build_bazel_rules_android to just rules_android
Closes #8

PiperOrigin-RevId: 565772198
Change-Id: I7e113000844b7d6804d8342e43492e9704f42af9
  • Loading branch information
ted-xie authored and copybara-github committed Sep 15, 2023
1 parent 2e2f840 commit ad1727a
Show file tree
Hide file tree
Showing 12 changed files with 22 additions and 22 deletions.
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,24 +33,24 @@ To use the Starlark Bazel Android rules, add the following to your WORKSPACE fil
RULES_ANDROID_COMMIT= "0bf3093bd011acd35de3c479c8990dd630d552aa"
RULES_ANDROID_SHA = "b75a673a66c157138ab53f4d8612a6e655d38b69bb14207c1a6675f0e10afa61"
http_archive(
name = "build_bazel_rules_android",
name = "rules_android",
url = "https://github.com/bazelbuild/rules_android/archive/%s.zip" % RULES_ANDROID_COMMIT,
sha256 = RULES_ANDROID_SHA,
strip_prefix = "rules_android-%s" % RULES_ANDROID_COMMIT,
)
load("@build_bazel_rules_android//:prereqs.bzl", "rules_android_prereqs")
load("@rules_android//:prereqs.bzl", "rules_android_prereqs")
rules_android_prereqs()
load("@build_bazel_rules_android//:defs.bzl", "rules_android_workspace")
load("@rules_android//:defs.bzl", "rules_android_workspace")
rules_android_workspace()

register_toolchains(
"@build_bazel_rules_android//toolchains/android:android_default_toolchain",
"@build_bazel_rules_android//toolchains/android_sdk:android_sdk_tools",
"@rules_android//toolchains/android:android_default_toolchain",
"@rules_android//toolchains/android_sdk:android_sdk_tools",
)

Then, in your BUILD files, import and use the rules:

load("@build_bazel_rules_android//rules:rules.bzl", "android_binary", "android_library")
load("@rules_android//rules:rules.bzl", "android_binary", "android_library")
android_binary(
...
)
Expand Down
2 changes: 1 addition & 1 deletion WORKSPACE
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
workspace(name = "build_bazel_rules_android")
workspace(name = "rules_android")

load("@bazel_tools//tools/build_defs/repo:utils.bzl", "maybe")
load(":android_sdk_supplemental_repository.bzl", "android_sdk_supplemental_repository")
Expand Down
2 changes: 1 addition & 1 deletion WORKSPACE.bzlmod
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
workspace(name = "build_bazel_rules_android")
workspace(name = "rules_android")

load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
load("@bazel_tools//tools/build_defs/repo:utils.bzl", "maybe")
Expand Down
2 changes: 1 addition & 1 deletion rules/flags/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ bzl_library(

string_flag(
name = "runfiles_root_prefix",
build_setting_default = "build_bazel_rules_android/",
build_setting_default = "rules_android/",
visibility = ["//visibility:public"],
)

Expand Down
2 changes: 1 addition & 1 deletion src/tools/ak/rjar/rjar_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ var (

const (
java = "local_jdk/bin/java"
testDataBase = "build_bazel_rules_android/src/tools/ak/rjar/testdata"
testDataBase = "rules_android/src/tools/ak/rjar/testdata"
)

func TestCreateRJar(t *testing.T) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public final class TestData {
public static final Path JAVATESTS_DIR =
Path.of(
System.getenv("TEST_SRCDIR"),
"/build_bazel_rules_android/src/tools/javatests/");
"/rules_android/src/tools/javatests/");

/** Reads the contents of a file, assuming its path is absolute. */
public static String readFromAbsolutePath(Path absolutePath) throws Exception {
Expand Down
2 changes: 1 addition & 1 deletion test/bashunit/unittest_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
echo "Writing XML to ${XML_OUTPUT_FILE}"
source "$(rlocation "build_bazel_rules_android/test/bashunit/unittest.bash")" \
source "$(rlocation "rules_android/test/bashunit/unittest.bash")" \
|| { echo "Could not source unittest.bash" >&2; exit 1; }
"""

Expand Down
6 changes: 3 additions & 3 deletions test/rules/android_sdk_repository/android_helper.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ source "${RUNFILES_DIR:-/dev/null}/$f" 2>/dev/null || \
{ echo>&2 "ERROR: cannot find $f"; exit 1; }; f=; set -e
# --- end runfiles.bash initialization v2 ---

source "$(rlocation build_bazel_rules_android/test/bashunit/unittest.bash)" || \
source "$(rlocation rules_android/test/bashunit/unittest.bash)" || \
(echo >&2 "Failed to locate bashunit.sh" && exit 1)

function set_up() {
Expand All @@ -42,9 +42,9 @@ function set_up() {
}

function set_up_rules() {
local android_revision_rule="$(rlocation build_bazel_rules_android/rules/android_revision.bzl)"
local android_revision_rule="$(rlocation rules_android/rules/android_revision.bzl)"

local repo_rule="$(rlocation build_bazel_rules_android/rules/android_sdk_repository/rule.bzl)"
local repo_rule="$(rlocation rules_android/rules/android_sdk_repository/rule.bzl)"
local repo_rule_dir="$(dirname "${repo_rule}")"
local dest_dir="${TEST_TMPDIR}/android_sdk_repository_src"
mkdir -p "${dest_dir}/rules/android_sdk_repository"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,13 @@ source "${RUNFILES_DIR:-/dev/null}/$f" 2>/dev/null || \
{ echo>&2 "ERROR: cannot find $f"; exit 1; }; f=; set -e
# --- end runfiles.bash initialization v2 ---

source "$(rlocation build_bazel_rules_android/test/bashunit/unittest.bash)" || \
source "$(rlocation rules_android/test/bashunit/unittest.bash)" || \
(echo >&2 "Failed to locate bashunit.sh" && exit 1)

ENABLE_PLATFORMS=true

# Source and run the actual tests from test_lib.sh
source "$(rlocation build_bazel_rules_android/test/rules/android_sdk_repository/test_lib.sh)" || \
source "$(rlocation rules_android/test/rules/android_sdk_repository/test_lib.sh)" || \
(echo >&2 "Failed to locate test_lib.sh" && exit 1)

run_suite "Android integration tests for SDK (with platforms)"
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,13 @@ source "${RUNFILES_DIR:-/dev/null}/$f" 2>/dev/null || \
{ echo>&2 "ERROR: cannot find $f"; exit 1; }; f=; set -e
# --- end runfiles.bash initialization v2 ---

source "$(rlocation build_bazel_rules_android/test/bashunit/unittest.bash)" || \
source "$(rlocation rules_android/test/bashunit/unittest.bash)" || \
(echo >&2 "Failed to locate bashunit.sh" && exit 1)

ENABLE_PLATFORMS=false

# Source and run the actual tests from test_lib.sh
source "$(rlocation build_bazel_rules_android/test/rules/android_sdk_repository/test_lib.sh)" || \
source "$(rlocation rules_android/test/rules/android_sdk_repository/test_lib.sh)" || \
(echo >&2 "Failed to locate test_lib.sh" && exit 1)

run_suite "Android integration tests for SDK"
4 changes: 2 additions & 2 deletions test/rules/android_sdk_repository/test_lib.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ source "${RUNFILES_DIR:-/dev/null}/$f" 2>/dev/null || \
{ echo>&2 "ERROR: cannot find $f"; exit 1; }; f=; set -e
# --- end runfiles.bash initialization v2 ---

source "$(rlocation build_bazel_rules_android/test/bashunit/unittest.bash)" || \
source "$(rlocation rules_android/test/bashunit/unittest.bash)" || \
(echo >&2 "Failed to locate bashunit.sh" && exit 1)

source "$(rlocation build_bazel_rules_android/test/rules/android_sdk_repository/android_helper.sh)" || \
source "$(rlocation rules_android/test/rules/android_sdk_repository/android_helper.sh)" || \
(echo >&2 "Failed to locate android_helper.sh" && exit 1)

# Actual tests for Android Sdk Repository
Expand Down
2 changes: 1 addition & 1 deletion test/utils/integration_demo/demo_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ source "${RUNFILES_DIR:-/dev/null}/$f" 2>/dev/null || \
{ echo>&2 "ERROR: cannot find $f"; exit 1; }; f=; set -e
# --- end runfiles.bash initialization v2 ---

source "$(rlocation build_bazel_rules_android/test/bashunit/unittest.bash)" || \
source "$(rlocation rules_android/test/bashunit/unittest.bash)" || \
(echo >&2 "Failed to locate bashunit.sh" && exit 1)

function test_bazel_exists() {
Expand Down

0 comments on commit ad1727a

Please sign in to comment.