• Home
Name Date Size #Lines LOC

..--

.bazelci/03-May-2024-2314

android/03-May-2024-8464

examples/basicapp/03-May-2024-191143

kokoro/presubmit/03-May-2024-16874

mobile_install/adapters/03-May-2024-981868

rules/03-May-2024-12,22410,799

src/03-May-2024-13,07710,213

test/rules/resources/03-May-2024-54

toolchains/03-May-2024-422372

tools/03-May-2024-13299

.bazelrcD03-May-202492 32

.gitignoreD03-May-20248 21

AUTHORSD03-May-2024298 107

BUILDD03-May-20241.2 KiB5647

CONTRIBUTING.mdD03-May-20242 KiB4034

CONTRIBUTORSD03-May-2024643 1716

LICENSED03-May-202411.1 KiB203169

METADATAD03-May-2024471 1917

MODULE.bazelD03-May-20241.6 KiB4943

MODULE_LICENSE_APACHE2D03-May-20240

README.mdD03-May-20242.2 KiB6145

WORKSPACED03-May-2024597 2618

WORKSPACE.bzlmodD03-May-2024305 1511

defs.bzlD03-May-20242.2 KiB6955

go.modD03-May-2024188 107

go.sumD03-May-2024931 1110

groupsD03-May-2024146 54

prereqs.bzlD03-May-20243.8 KiB9884

project.configD03-May-2024174 87

README.md

1# Android support in Bazel
2
3## Disclaimer
4
5NOTE: This branch contains a development preview of the Starlark implementation of Android rules for Bazel. This code is incomplete and may not function as-is.
6
7A version of Bazel built at or near head or a recent pre-release and the following flags are necessary to use these rules:
8
9```
10--experimental_enable_android_migration_apis
11--experimental_google_legacy_api
12--incompatible_java_common_parameters
13--android_databinding_use_v3_4_args
14--experimental_android_databinding_v2
15```
16
17## Overview
18
19This repository contains the Starlark implementation of Android rules in Bazel.
20
21The rules are being incrementally converted from their native implementations
22in the [Bazel source
23tree](https://source.bazel.build/bazel/+/master:src/main/java/com/google/devtools/build/lib/rules/android/).
24
25For the list of Android rules, see the Bazel [documentation](https://docs.bazel.build/versions/master/be/android.html).
26
27## Getting Started
28To use the Starlark Bazel Android rules, add the following to your WORKSPACE file:
29
30    load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
31
32    # Or a later commit
33    RULES_ANDROID_COMMIT= "0bf3093bd011acd35de3c479c8990dd630d552aa"
34    RULES_ANDROID_SHA = "b75a673a66c157138ab53f4d8612a6e655d38b69bb14207c1a6675f0e10afa61"
35    http_archive(
36        name = "build_bazel_rules_android",
37        url = "https://github.com/bazelbuild/rules_android/archive/%s.zip" % RULES_ANDROID_COMMIT,
38        sha256 = RULES_ANDROID_SHA,
39        strip_prefix = "rules_android-%s" % RULES_ANDROID_COMMIT,
40    )
41    load("@build_bazel_rules_android//:prereqs.bzl", "rules_android_prereqs")
42    rules_android_prereqs()
43    load("@build_bazel_rules_android//:defs.bzl", "rules_android_workspace")
44    rules_android_workspace()
45
46    register_toolchains(
47    "@build_bazel_rules_android//toolchains/android:android_default_toolchain",
48    "@build_bazel_rules_android//toolchains/android_sdk:android_sdk_tools",
49    )
50
51Then, in your BUILD files, import and use the rules:
52
53    load("@build_bazel_rules_android//rules:rules.bzl", "android_binary", "android_library")
54    android_binary(
55        ...
56    )
57
58    android_library(
59        ...
60    )
61