Skip to content

Commit 97459db

Browse files
authored
Merge branch 'bazelbuild:main' into debuggable_manifest
2 parents 1c26e2b + 6c69e9b commit 97459db

File tree

653 files changed

+62318
-2409
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

653 files changed

+62318
-2409
lines changed

.bazelci/presubmit.yml

Lines changed: 41 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,17 @@
1-
---
2-
3-
bazel: last_green
1+
matrix:
2+
bazel: [
3+
7.4.1,
4+
# last_green, # Enable this once WORKSPACE builds with Bazel 8 work.
5+
]
46

57
tools_flags: &tools_flags
68
? "--enable_bzlmod=false"
9+
? "--enable_workspace=true"
710
# Sandboxed SDK tools depend on libraries that require Java runtime 17 or higher.
811
? "--java_runtime_version=17"
912
rules_flags: &rules_flags
1013
? "--enable_bzlmod=false"
14+
? "--enable_workspace=true"
1115

1216
tools: &tools
1317
name: "Tools"
@@ -34,9 +38,11 @@ tools_bzlmod: &tools_bzlmod
3438
build_flags:
3539
<<: *tools_flags
3640
? "--enable_bzlmod"
41+
? "--enable_workspace=false"
3742
test_flags:
3843
<<: *tools_flags
3944
? "--enable_bzlmod"
45+
? "--enable_workspace=false"
4046
<<: *tools
4147
rules: &rules
4248
name: "Rules"
@@ -53,52 +59,66 @@ rules_bzlmod: &rules_bzlmod
5359
build_flags:
5460
<<: *rules_flags
5561
? "--enable_bzlmod"
62+
? "--enable_workspace=false"
5663
test_flags:
5764
<<: *rules_flags
5865
? "--enable_bzlmod"
66+
? "--enable_workspace=false"
5967
<<: *rules
6068

6169
tasks:
6270
ubuntu2004_tools:
6371
platform: ubuntu2004
72+
bazel: ${{ bazel }}
6473
<<: *tools
6574
ubuntu2004_rules:
6675
platform: ubuntu2004
76+
bazel: ${{ bazel }}
6777
<<: *rules
6878
macos_tools:
6979
platform: macos
80+
bazel: ${{ bazel }}
7081
<<: *tools
7182
macos_rules:
7283
platform: macos
84+
bazel: ${{ bazel }}
7385
<<: *rules
7486
macos_arm64_tools:
7587
platform: macos_arm64
88+
bazel: ${{ bazel }}
7689
<<: *tools
7790
macos_arm64_rules:
7891
platform: macos_arm64
92+
bazel: ${{ bazel }}
7993
<<: *rules
8094
ubuntu2004_tools_bzlmod:
8195
platform: ubuntu2004
96+
bazel: ${{ bazel }}
8297
<<: *tools_bzlmod
8398
ubuntu2004_rules_bzlmod:
8499
platform: ubuntu2004
100+
bazel: ${{ bazel }}
85101
<<: *rules_bzlmod
86102
macos_bzlmods_tools:
87103
platform: macos
104+
bazel: ${{ bazel }}
88105
<<: *tools_bzlmod
89106
macos_bzlmods_rules:
90107
platform: macos
108+
bazel: ${{ bazel }}
91109
<<: *rules_bzlmod
92110
macos_arm64_tools_bzlmod:
93111
platform: macos_arm64
112+
bazel: ${{ bazel }}
94113
<<: *tools_bzlmod
95114
macos_arm64_rules_bzlmod:
96115
platform: macos_arm64
116+
bazel: ${{ bazel }}
97117
<<: *rules_bzlmod
98118
ubuntu2004_basicapp:
99119
name: "Basic app ubuntu"
100120
platform: ubuntu2004
101-
name: basicapp
121+
bazel: ${{ bazel }}
102122
working_directory: examples/basicapp
103123
build_flags:
104124
<<: *rules_flags
@@ -107,17 +127,18 @@ tasks:
107127
ubuntu2004_basicapp_bzlmod:
108128
name: "Basic app ubuntu bzlmod"
109129
platform: ubuntu2004
110-
name: basicapp
130+
bazel: ${{ bazel }}
111131
working_directory: examples/basicapp
112132
build_flags:
113133
<<: *rules_flags
114134
? "--enable_bzlmod"
135+
? "--enable_workspace=false"
115136
build_targets:
116137
- "//java/com/basicapp:basic_app"
117138
macos_arm64_basicapp:
118139
name: "Basic app mac arm64"
119140
platform: macos_arm64
120-
name: basicapp
141+
bazel: ${{ bazel }}
121142
working_directory: examples/basicapp
122143
build_flags:
123144
<<: *rules_flags
@@ -126,20 +147,31 @@ tasks:
126147
macos_arm64_basicapp_bzlmod:
127148
name: "Basic app mac arm64 bzlmod"
128149
platform: macos_arm64
129-
name: basicapp
150+
bazel: ${{ bazel }}
130151
working_directory: examples/basicapp
131152
build_flags:
132153
<<: *rules_flags
133154
? "--enable_bzlmod"
155+
? "--enable_workspace=false"
134156
build_targets:
135157
- "//java/com/basicapp:basic_app"
136158
windows_basicapp_bzlmod:
137159
name: "Windows Basicapp Bzlmod"
138160
platform: windows
139-
name: basicapp
161+
bazel: ${{ bazel }}
140162
working_directory: examples/basicapp
141163
build_flags:
142164
<<: *rules_flags
143165
? "--enable_bzlmod"
166+
? "--enable_workspace=false"
167+
build_targets:
168+
- "//java/com/basicapp:basic_app"
169+
windows_basicapp:
170+
name: "Windows Basicapp"
171+
platform: windows
172+
bazel: ${{ bazel }}
173+
working_directory: examples/basicapp
174+
build_flags:
175+
<<: *rules_flags
144176
build_targets:
145-
- "//java/com/basicapp:basic_app"
177+
- "//java/com/basicapp:basic_app"

.bazelrc

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
11
common --experimental_google_legacy_api
22
common --experimental_enable_android_migration_apis
33
common --java_runtime_version=17
4+
common --android_sdk=@androidsdk//:sdk
5+
6+
# Autoloads are disabled for rule repositories (and their deps).
7+
# These autoloads are still helpful for rules_android to load rules in
8+
# non-rule repositories such as gazelle, though.
9+
# See https://github.com/bazelbuild/bazel/blob/14538435c8e96d1ed8cb9557209a35ebd2683356/src/main/java/com/google/devtools/build/lib/packages/AutoloadSymbols.java#L598
10+
common --incompatible_autoload_externally=+@rules_shell,+@rules_java,+@rules_cc,+@rules_python,+@protobuf

.bazelversion

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
7.4.0

.bcr/config.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
fixedReleaser:
2+
login: ahumesky
3+

.bcr/metadata.template.json

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{
2+
"homepage": "https://github.com/bazelbuild/rules_android",
3+
"maintainers": [
4+
{
5+
"email": "[email protected]",
6+
"github": "ahumesky",
7+
"name": "ahumesky"
8+
},
9+
{
10+
"email": "[email protected]",
11+
"github": "ted-xie",
12+
"name": "tedx"
13+
}
14+
],
15+
"repository": [
16+
"github:bazelbuild/rules_android"
17+
],
18+
"versions": [],
19+
"yanked_versions": {}
20+
}

.bcr/presubmit.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
bcr_test_module:
2+
module_path: examples/basicapp
3+
matrix:
4+
platform: ["ubuntu2004", "macos", "windows"]
5+
bazel: ["7.2.1", "7.4.0", "8.x", "rolling"]
6+
tasks:
7+
run_test_module:
8+
name: "Verify build targets with bzlmod"
9+
platform: ${{ platform }}
10+
bazel: ${{ bazel }}
11+
build_targets:
12+
- "//java/com/basicapp:basic_app"

.bcr/source.template.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"integrity": "",
3+
"strip_prefix": "rules_android-{TAG}",
4+
"url": "https://github.com/bazelbuild/rules_android/archive/refs/tags/{TAG}.tar.gz"
5+
}

.github/workflows/ci.bazelrc

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# This file contains Bazel settings to apply on CI only.
2+
# It is referenced with a --bazelrc option in the call to bazel in ci.yaml
3+
4+
# Debug where options came from
5+
build --announce_rc
6+
# This directory is configured in GitHub actions to be persisted between runs.
7+
# We do not enable the repository cache to cache downloaded external artifacts
8+
# as these are generally faster to download again than to fetch them from the
9+
# GitHub actions cache.
10+
build --disk_cache=~/.cache/bazel
11+
# Don't rely on test logs being easily accessible from the test runner,
12+
# though it makes the log noisier.
13+
test --test_output=errors
14+
# Allows tests to run bazelisk-in-bazel, since this is the cache folder used
15+
test --test_env=XDG_CACHE_HOME

.github/workflows/release.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Cut a release whenever a new tag is pushed to the repo.
2+
# You should use an annotated tag, like `git tag -a v1.2.3`
3+
# and put the release notes into the commit message for the tag.
4+
name: Release
5+
6+
on:
7+
push:
8+
tags:
9+
- "v*.*.*"
10+
11+
permissions:
12+
contents: write
13+
14+
jobs:
15+
release:
16+
uses: bazel-contrib/.github/.github/workflows/release_ruleset.yaml@v6
17+
with:
18+
release_files: rules_android-*.tar.gz
19+
bazel_test_command: "cd examples/basicapp && bazel build java/com/basicapp:basic_app"

.github/workflows/release_prep.sh

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
#!/usr/bin/env bash
2+
# Copyright 2024 The Bazel Authors. All rights reserved.
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
16+
set -o errexit -o nounset -o pipefail
17+
18+
# Set by GH actions, see
19+
# https://docs.github.com/en/actions/learn-github-actions/environment-variables#default-environment-variables
20+
TAG=${GITHUB_REF_NAME}
21+
# The prefix is chosen to match what GitHub generates for source archives
22+
# This guarantees that users can easily switch from a released artifact to a source archive
23+
# with minimal differences in their code (e.g. strip_prefix remains the same)
24+
PREFIX="rules_android-${TAG:1}"
25+
ARCHIVE="rules_android-$TAG.tar.gz"
26+
27+
# NB: configuration for 'git archive' is in /.gitattributes
28+
git archive --format=tar --prefix=${PREFIX}/ ${TAG} | gzip > $ARCHIVE
29+
SHA=$(shasum -a 256 $ARCHIVE | awk '{print $1}')
30+
31+
cat << EOF
32+
## Using Bzlmod with Bazel 6 or greater
33+
34+
1. (Bazel 6 only) Enable with \`common --enable_bzlmod\` in \`.bazelrc\`.
35+
2. Add to your \`MODULE.bazel\` file:
36+
37+
\`\`\`starlark
38+
bazel_dep(name = "rules_android", version = "${TAG:1}")
39+
\`\`\`
40+
41+
## Using WORKSPACE
42+
43+
Paste this snippet into your \`WORKSPACE.bazel\` file:
44+
45+
\`\`\`starlark
46+
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
47+
http_archive(
48+
name = "rules_android",
49+
sha256 = "${SHA}",
50+
strip_prefix = "${PREFIX}",
51+
url = "https://github.com/bazelbuild/rules_android/releases/download/${TAG}/${ARCHIVE}",
52+
)
53+
EOF
54+
55+
awk 'f;/--SNIP--/{f=1}' examples/basicapp/WORKSPACE
56+
echo "\`\`\`"
57+
58+
cat << EOF
59+
60+
## In BUILD
61+
62+
Load the rules from \`rules_android\`:
63+
64+
\`\`\`starlark
65+
load("@rules_android//rules:rules.bzl", "android_binary", "android_library")
66+
android_binary(
67+
...
68+
)
69+
70+
android_library(
71+
...
72+
)
73+
\`\`\`
74+
EOF
75+

0 commit comments

Comments
 (0)