Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 20 additions & 16 deletions .bazelci/presubmit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,12 @@

matrix:
bazel: [
7.4.1,
8.2.1,
7.7.1,
8.5.0,
last_green,
]
platform: [
ubuntu2004,
macos,
ubuntu2404,
macos_arm64,
# windows # TODO: Windows unit tests don't work yet.
]
Expand Down Expand Up @@ -96,15 +95,20 @@ rules_bzlmod: &rules_bzlmod
<<: *rules
resource_rules_bzlmod: &resource_rules_bzlmod
name: "Resource Rules Bzlmod"
build_targets:
- "//test/rules/resources/..."
test_targets:
- "//test/rules/resources/..."
build_flags:
<<: *rules_flags
? "--enable_bzlmod"
? "--enable_workspace=false"
? "--//rules/flags:manifest_merge_order=legacy"
test_flags:
<<: *rules_flags
? "--enable_bzlmod"
? "--enable_workspace=false"
<<: *resource_rules
? "--//rules/flags:manifest_merge_order=legacy"

tasks:
tools:
Expand All @@ -115,20 +119,20 @@ tasks:
platform: ${{ platform }}
bazel: ${{ bazel }}
<<: *rules
# TODO(#397): Resource tests need some more debugging.
## resource_rules:
## platform: ${{ platform }}
## bazel: ${{ bazel }}
## <<: *resource_rules
resource_rules:
# Resource tests have macOS compatibility issues, run only on Linux
platform: ubuntu2404
bazel: ${{ bazel }}
<<: *resource_rules
tools_bzlmod:
platform: ${{ platform }}
bazel: ${{ bazel }}
<<: *tools_bzlmod
# TODO(#397): Resource tests need some more debugging.
## resource_rules_bzlmod:
## platform: ${{ platform }}
## bazel: ${{ bazel }}
## <<: *resource_rules_bzlmod
resource_rules_bzlmod:
# Resource tests have macOS compatibility issues, run only on Linux
platform: ubuntu2404
bazel: ${{ bazel }}
<<: *resource_rules_bzlmod
rules_bzlmod:
platform: ${{ platform }}
bazel: ${{ bazel }}
Expand All @@ -140,7 +144,7 @@ tasks:
<<: *rules_coverage
macos_a_l_t_coverage:
name: "Macos android_local_test coverage"
platform: macos
platform: macos_arm64
bazel: ${{ bazel }}
<<: *rules_coverage
# TODO: Make windows ALT coverage work
Expand Down
2 changes: 1 addition & 1 deletion .bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ common --tool_java_runtime_version=17
# Workaround for a rules_java + bazel < 8.3.0 issue. It should only be relevant
# for bazel@HEAD and rolling releases.
# https://github.com/bazelbuild/bazel/pull/26119
common --repositories_without_autoloads=bazel_features_version,bazel_features_globals
common --repositories_without_autoloads=bazel_features_version,bazel_features_globals,cc_compatibility_proxy

# Newer versions of protobuf require downstream transitive projects to set C++ language version flags.
common:linux --cxxopt=-std=c++17
Expand Down
2 changes: 1 addition & 1 deletion .bazelversion
Original file line number Diff line number Diff line change
@@ -1 +1 @@
7.4.0
9.0.0rc3
4 changes: 2 additions & 2 deletions .bcr/presubmit.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
bcr_test_module:
module_path: examples/basicapp
matrix:
platform: ["ubuntu2004", "macos", "windows"]
bazel: ["7.4.1", "8.0.0", "rolling"]
platform: ["ubuntu2404", "macos", "windows"]
bazel: ["7.7.1", "8.4.2", "rolling"]
tasks:
run_test_module:
name: "Verify build targets with bzlmod"
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ bazel-*
.aswb
*.swp
MODULE.bazel.lock
.claude
9 changes: 2 additions & 7 deletions BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -76,17 +76,12 @@ alias(
actual = "@androidsdk//:d8_jar_import",
)

alias(
name = "androidsdk_dx_jar_import",
actual = "@androidsdk//:dx_jar_import",
)

alias(
name = "androidsdk_files",
actual = "@androidsdk//:files",
)

alias(
name = "androidsdk_has_android_sdk",
actual = "@androidsdk//:has_android_sdk",
name = "androidsdk_has_androidsdk",
actual = "@androidsdk//:has_androidsdk",
)
45 changes: 22 additions & 23 deletions MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -4,32 +4,32 @@ module(
compatibility_level = 1,
)

bazel_dep(name = "platforms", version = "0.0.5")
bazel_dep(name = "platforms", version = "1.0.0")
bazel_dep(name = "rules_license", version = "1.0.0")
bazel_dep(name = "rules_java", version = "8.13.0")
bazel_dep(name = "rules_cc", version = "0.1.1")
bazel_dep(name = "rules_shell", version = "0.1.2")
bazel_dep(name = "rules_java", version = "9.3.0")
bazel_dep(name = "rules_cc", version = "0.2.14")
bazel_dep(name = "rules_shell", version = "0.6.1")

bazel_dep(name = "stardoc", version = "0.7.2", dev_dependency = True)
bazel_dep(name = "stardoc", version = "0.8.0", dev_dependency = True)

rules_java_toolchains = use_extension("@rules_java//java:extensions.bzl", "toolchains")
use_repo(rules_java_toolchains, "remote_java_tools")

bazel_dep(name = "protobuf", version = "31.1", repo_name = "com_google_protobuf")
bazel_dep(name = "rules_jvm_external", version = "6.6")
bazel_dep(name = "bazel_skylib", version = "1.0.3")
bazel_dep(name = "protobuf", version = "33.1", repo_name = "com_google_protobuf")
bazel_dep(name = "rules_jvm_external", version = "6.9")
bazel_dep(name = "bazel_skylib", version = "1.8.1")
bazel_dep(name = "rules_robolectric", version = "4.14.1.2", repo_name = "robolectric")

register_toolchains("//toolchains/android:all")

register_toolchains("//toolchains/android_sdk:all")

# go-related dependency setup
bazel_dep(name = "rules_go", version = "0.51.0-rc2", repo_name = "io_bazel_rules_go")
bazel_dep(name = "gazelle", version = "0.40.0", repo_name = "bazel_gazelle")
bazel_dep(name = "rules_go", version = "0.59.0", repo_name = "io_bazel_rules_go")
bazel_dep(name = "gazelle", version = "0.47.0", repo_name = "bazel_gazelle")
bazel_dep(name = "abseil-py", version = "2.1.0", repo_name = "py_absl")
bazel_dep(name = "bazel_worker_api", version = "0.0.4")
bazel_dep(name = "bazel_worker_java", version = "0.0.4")
bazel_dep(name = "bazel_worker_api", version = "0.0.8")
bazel_dep(name = "bazel_worker_java", version = "0.0.8")

go_sdk = use_extension("@io_bazel_rules_go//go:extensions.bzl", "go_sdk")
go_sdk.download(version = "1.22.4")
Expand All @@ -46,7 +46,7 @@ use_repo(
)

# python-related dependency setup
bazel_dep(name = "rules_python", version = "0.37.1", repo_name = "rules_python")
bazel_dep(name = "rules_python", version = "1.6.0", repo_name = "rules_python")

python = use_extension("@rules_python//python/extensions:python.bzl", "python")
python.toolchain(
Expand All @@ -55,10 +55,9 @@ python.toolchain(
)

# proto-related dependency setup
bazel_dep(name = "rules_proto", version = "6.0.2", repo_name = "rules_proto")
bazel_dep(name = "rules_proto", version = "7.1.0", repo_name = "rules_proto")

maven = use_extension("@rules_jvm_external//:extensions.bzl", "maven")

# Maven for android_ide_common need to be separated into their own separate maven_install for now
# due to compatibility issues with newer versions.
maven.install(
Expand All @@ -79,8 +78,8 @@ maven.install(
# These technically aren't needed, but the protobuf version pulled
# in by these older deps has compatibility issues with the newer
# protobuf runtimes.
"com.google.protobuf:protobuf-java:4.31.1",
"com.google.protobuf:protobuf-java-util:4.31.1",
"com.google.protobuf:protobuf-java:4.33.1",
"com.google.protobuf:protobuf-java-util:4.33.1",
],
repositories = [
"https://maven.google.com",
Expand All @@ -89,6 +88,7 @@ maven.install(
use_starlark_android_rules = True,
)
use_repo(maven, "android_ide_common_30_1_3")

maven.install(
name = "rules_android_maven",
aar_import_bzl_label = "@rules_android//rules:rules.bzl",
Expand Down Expand Up @@ -117,8 +117,8 @@ maven.install(
"jakarta.inject:jakarta.inject-api:2.0.1",
"junit:junit:4.13.2",
"com.beust:jcommander:1.82",
"com.google.protobuf:protobuf-java:4.31.1",
"com.google.protobuf:protobuf-java-util:4.31.1",
"com.google.protobuf:protobuf-java:4.33.1",
"com.google.protobuf:protobuf-java-util:4.33.1",
"com.google.code.findbugs:jsr305:3.0.2",
"androidx.databinding:databinding-compiler:8.7.0",
"org.ow2.asm:asm:9.6",
Expand Down Expand Up @@ -157,10 +157,9 @@ maven.install(
],
# To generate, run:
# REPIN=1 bazelisk run --enable_bzlmod @rules_android_maven//:pin
# lock_file = "//:rules_android_maven_install.json",
lock_file = "//:rules_android_maven_install.json",
use_starlark_android_rules = True,
)

use_repo(
maven,
"rules_android_maven",
Expand All @@ -177,7 +176,7 @@ bazel_dep(
)
bazel_dep(
name = "cgrindel_bazel_starlib",
version = "0.17.0",
version = "0.18.0",
dev_dependency = True,
)

Expand All @@ -187,7 +186,7 @@ bazel_binaries = use_extension(
dev_dependency = True,
)
bazel_binaries.download(version = "last_green")
use_repo(bazel_binaries, "bazel_binaries")
use_repo(bazel_binaries, "bazel_binaries", "bazel_binaries_bazelisk", "build_bazel_bazel_last_green")

# extension for apksignerextensions
apksig_extension = use_extension("//bzlmod_extensions:apksig.bzl", "apksig_extension")
Expand Down
9 changes: 6 additions & 3 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,15 @@ load("prereqs.bzl", "rules_android_prereqs")

rules_android_prereqs(dev_mode = True)

load("@rules_java//java:rules_java_deps.bzl", "rules_java_dependencies")
rules_java_dependencies()

load("@bazel_features//:deps.bzl", "bazel_features_deps")
bazel_features_deps()

load("@rules_cc//cc:extensions.bzl", "compatibility_proxy_repo")
compatibility_proxy_repo()

load("@rules_java//java:rules_java_deps.bzl", "rules_java_dependencies")
rules_java_dependencies()

# note that the following line is what is minimally required from protobuf for the java rules
# consider using the protobuf_deps() public API from @com_google_protobuf//:protobuf_deps.bzl
load("@com_google_protobuf//bazel/private:proto_bazel_features.bzl", "proto_bazel_features") # buildifier: disable=bzl-visibility
Expand Down
25 changes: 11 additions & 14 deletions defs.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ def rules_android_workspace():
# These technically aren't needed, but the protobuf version pulled
# in by these older deps has compatibility issues with the newer
# protobuf runtimes.
"com.google.protobuf:protobuf-java:4.31.1",
"com.google.protobuf:protobuf-java-util:4.31.1",
"com.google.protobuf:protobuf-java:4.33.1",
"com.google.protobuf:protobuf-java-util:4.33.1",
],
repositories = [
"https://maven.google.com",
Expand Down Expand Up @@ -94,8 +94,8 @@ def rules_android_workspace():
"jakarta.inject:jakarta.inject-api:2.0.1",
"junit:junit:4.13.2",
"com.beust:jcommander:1.82",
"com.google.protobuf:protobuf-java:4.31.1",
"com.google.protobuf:protobuf-java-util:4.31.1",
"com.google.protobuf:protobuf-java:4.33.1",
"com.google.protobuf:protobuf-java-util:4.33.1",
"com.google.code.findbugs:jsr305:3.0.2",
"androidx.databinding:databinding-compiler:8.7.0",
"org.ow2.asm:asm:9.6",
Expand Down Expand Up @@ -141,16 +141,17 @@ def rules_android_workspace():
)

maven_install(
# Specifically named since the worker API lib needs `@maven` to exist.
# Specifically named since the worker API lib needs `@bazel_worker_maven` to exist
# in WORKSPACE mode.
# All lines in the artifacts list must be tagged "bazel worker api" for
# the presubmit maven artifact consistency checker to pass.
name = "maven",
name = "bazel_worker_maven",
artifacts = [ # bazel worker api
"com.google.code.gson:gson:2.10.1", # bazel worker api
"com.google.errorprone:error_prone_annotations:2.23.0", # bazel worker api
"com.google.guava:guava:33.0.0-jre", # bazel worker api
"com.google.protobuf:protobuf-java:4.27.2", # bazel worker api
"com.google.protobuf:protobuf-java-util:4.27.2", # bazel worker api
"com.google.protobuf:protobuf-java:4.33.1", # bazel worker api
"com.google.protobuf:protobuf-java-util:4.33.1", # bazel worker api
"junit:junit:4.13.2", # bazel worker api
"org.mockito:mockito-core:5.4.0", # bazel worker api
"com.google.truth:truth:1.4.0", # bazel worker api
Expand All @@ -170,12 +171,8 @@ def rules_android_workspace():
gazelle_dependencies()
# gazelle:repository go_repository name=org_golang_x_xerrors importpath=golang.org/x/xerrors

go_repository(
name = "org_golang_google_protobuf",
importpath = "google.golang.org/protobuf",
sum = "h1:g0LDEJHgrBl9N9r17Ru3sqWhkIx2NB67okBHPwC7hs8=",
version = "v1.31.0",
)
# Note: org_golang_google_protobuf is now set up by go_rules_dependencies()
# with proper patches for newer protobuf versions.

go_repository(
name = "com_github_google_go_cmp",
Expand Down
2 changes: 1 addition & 1 deletion examples/basicapp/.bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ common --tool_java_runtime_version=17
# Workaround for a rules_java + bazel < 8.3.0 issue. It should only be relevant
# for bazel@HEAD and rolling releases.
# https://github.com/bazelbuild/bazel/pull/26119
common --repositories_without_autoloads=bazel_features_version,bazel_features_globals
common --repositories_without_autoloads=bazel_features_version,bazel_features_globals,cc_compatibility_proxy

# Newer versions of protobuf require downstream transitive projects to set C++ language version flags.
common:linux --cxxopt=-std=c++17
Expand Down
5 changes: 3 additions & 2 deletions examples/basicapp/MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@ module(
name = "basicapp",
)

bazel_dep(name = "rules_java", version = "8.12.0")
bazel_dep(name = "bazel_skylib", version = "1.3.0")
bazel_dep(name = "rules_java", version = "9.0.3")
bazel_dep(name = "bazel_skylib", version = "1.8.1")
bazel_dep(name = "rules_jvm_external", version = "6.7")

bazel_dep(
name = "rules_android",
Expand Down
9 changes: 6 additions & 3 deletions examples/basicapp/WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,16 @@ local_repository(
load("@rules_android//:prereqs.bzl", "rules_android_prereqs")
rules_android_prereqs()

load("@bazel_features//:deps.bzl", "bazel_features_deps")
bazel_features_deps()

load("@rules_cc//cc:extensions.bzl", "compatibility_proxy_repo")
compatibility_proxy_repo()

##### rules_java setup for rules_android #####
load("@rules_java//java:rules_java_deps.bzl", "rules_java_dependencies")
rules_java_dependencies()

load("@bazel_features//:deps.bzl", "bazel_features_deps")
bazel_features_deps()

# note that the following line is what is minimally required from protobuf for the java rules
# consider using the protobuf_deps() public API from @com_google_protobuf//:protobuf_deps.bzl
load("@com_google_protobuf//bazel/private:proto_bazel_features.bzl", "proto_bazel_features") # buildifier: disable=bzl-visibility
Expand Down
Loading