Skip to content

Commit 2e644da

Browse files
committed
Update Bazel to 7.1.1 and rules_jvm_external to 5.3 (#171)
Fixes #171
1 parent 013103d commit 2e644da

File tree

9 files changed

+5881
-10259
lines changed

9 files changed

+5881
-10259
lines changed

.bazelrc

+46-40
Original file line numberDiff line numberDiff line change
@@ -1,54 +1,60 @@
1-
# Disk cache
2-
build --disk_cache=bazel-cache
1+
# Cache
2+
common --disk_cache=bazel-cache
3+
common --remote_cache_compression=true
34

4-
build --verbose_failures
5+
# Errors
6+
common --verbose_failures
57

68
# Action Env
7-
build --incompatible_strict_action_env
8-
build --repo_env=RJE_VERBOSE=true
9+
common --incompatible_strict_action_env
10+
common --reuse_sandbox_directories
11+
common --repo_env=RJE_VERBOSE=true
912

10-
common --experimental_google_legacy_api
13+
common --enable_bzlmod=false
1114

1215
# Workers
13-
build --experimental_worker_multiplex
16+
common --worker_verbose
17+
common --experimental_worker_multiplex
18+
common --experimental_shrink_worker_pool
1419

1520
# JAVA - START
16-
build --experimental_strict_java_deps=off # Turn off strict java deps
17-
build --java_runtime_version=remotejdk_11 # Use inbuilt Java 11 for hermeticity
18-
build --jvmopt="-Djava.locale.providers=COMPAT,SPI" # Use Java 8 default locale provider
21+
common --experimental_java_classpath=bazel
22+
common --experimental_strict_java_deps=off # Turn off strict java deps
23+
common --java_runtime_version=remotejdk_11 # Use inbuilt Java 11 for hermeticity
24+
common --jvmopt="-Djava.locale.providers=COMPAT,SPI" # Use Java 8 default locale provider
1925
# JAVA - END
2026

21-
# Android
22-
# Databinding flags
23-
common --experimental_android_databinding_v2
24-
common --android_databinding_use_v3_4_args
25-
common --android_databinding_use_androidx
27+
# Android
28+
common --experimental_google_legacy_api
29+
2630
# D8 and Dexing flags
27-
build --define=android_incremental_dexing_tool=d8_dexbuilder
28-
build --define=android_standalone_dexing_tool=d8_compat_dx
29-
build --define=android_dexmerger_tool=d8_dexmerger
30-
31-
build --persistent_multiplex_android_tools
32-
build --strategy=DatabindingStubs=worker
33-
build --worker_max_instances=Javac=1
34-
build --worker_max_instances=KotlinCompile=1
35-
build --worker_max_instances=KotlinKapt=1
36-
build --worker_max_instances=AaptPackage=1
37-
build --worker_max_instances=AndroidResourceParser=1
38-
build --worker_max_instances=AndroidResourceCompiler=1
39-
build --worker_max_instances=AndroidResourceValidator=1
40-
build --worker_max_instances=AndroidLintAnalyze=1
41-
build --worker_max_instances=AndroidLint=1
42-
build --worker_max_instances=RClassGenerator=1
43-
build --worker_max_instances=AndroidAapt2=1
44-
build --worker_max_instances=AndroidAssetMerger=1
45-
build --worker_max_instances=AndroidResourceMerger=1
46-
build --worker_max_instances=AndroidCompiledResourceMerger=1
47-
build --worker_max_instances=Aapt2Optimize=1
48-
build --worker_max_instances=DatabindingStubs=1
49-
build --worker_max_instances=GenerateDataBindingBaseClasses=1
50-
build --worker_max_instances=DexBuilder=1
51-
build --worker_max_instances=Desugar=1
31+
common --define=android_incremental_dexing_tool=d8_dexbuilder
32+
common --define=android_standalone_dexing_tool=d8_compat_dx
33+
common --define=android_dexmerger_tool=d8_dexmerger
34+
35+
common --experimental_persistent_aar_extractor
36+
common --persistent_multiplex_android_tools
37+
common --persistent_android_dex_desugar
38+
common --strategy=DatabindingStubs=worker
39+
common --worker_max_instances=Javac=1
40+
common --worker_max_instances=KotlinCompile=1
41+
common --worker_max_instances=KotlinKapt=1
42+
common --worker_max_instances=AaptPackage=1
43+
common --worker_max_instances=AndroidResourceParser=1
44+
common --worker_max_instances=AndroidResourceCompiler=1
45+
common --worker_max_instances=AndroidResourceValidator=1
46+
common --worker_max_instances=AndroidLintAnalyze=1
47+
common --worker_max_instances=AndroidLint=1
48+
common --worker_max_instances=RClassGenerator=1
49+
common --worker_max_instances=AndroidAapt2=1
50+
common --worker_max_instances=AndroidAssetMerger=1
51+
common --worker_max_instances=AndroidResourceMerger=1
52+
common --worker_max_instances=AndroidCompiledResourceMerger=1
53+
common --worker_max_instances=Aapt2Optimize=1
54+
common --worker_max_instances=DatabindingStubs=1
55+
common --worker_max_instances=GenerateDataBindingBaseClasses=1
56+
common --worker_max_instances=DexBuilder=1
57+
common --worker_max_instances=Desugar=1
5258

5359
test --test_output=errors # Print test logs for failed tests
5460
test --build_tests_only

.bazelversion

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
6.3.2
1+
7.1.1

WORKSPACE

-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
workspace(name = "grab_bazel_common")
22

3-
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
43
load("@grab_bazel_common//rules:repositories.bzl", "bazel_common_dependencies")
54

65
bazel_common_dependencies()

bazel_common_maven_install.json

+5,824-10,205
Large diffs are not rendered by default.

rules/android/lint/lint_aspect.bzl

+1-1
Original file line numberDiff line numberDiff line change
@@ -468,7 +468,7 @@ def _lint_aspect_impl(target, ctx):
468468
project_xml_file = ctx.actions.declare_file("lint/" + target.label.name + "_project.xml")
469469

470470
# Models
471-
lint_models_dir = ctx.actions.declare_file("lint/" + target.label.name + "_models_dir")
471+
lint_models_dir = ctx.actions.declare_directory("lint/" + target.label.name + "_models_dir")
472472
# Output - End
473473

474474
sources = _collect_sources(target, ctx, library)

rules/repositories.bzl

+3-3
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,14 @@ def http_archive(name, **kwargs):
55
maybe(_http_archive, name = name, **kwargs)
66

77
def _maven():
8-
RULES_JVM_EXTERNAL_TAG = "4.4.2"
9-
RULES_JVM_EXTERNAL_SHA = "735602f50813eb2ea93ca3f5e43b1959bd80b213b836a07a62a29d757670b77b"
8+
RULES_JVM_EXTERNAL_TAG = "5.3"
9+
RULES_JVM_EXTERNAL_SHA = "d31e369b854322ca5098ea12c69d7175ded971435e55c18dd9dd5f29cc5249ac"
1010

1111
http_archive(
1212
name = "rules_jvm_external",
1313
sha256 = RULES_JVM_EXTERNAL_SHA,
1414
strip_prefix = "rules_jvm_external-%s" % RULES_JVM_EXTERNAL_TAG,
15-
url = "https://github.com/bazelbuild/rules_jvm_external/archive/%s.zip" % RULES_JVM_EXTERNAL_TAG,
15+
url = "https://github.com/bazelbuild/rules_jvm_external/releases/download/%s/rules_jvm_external-%s.tar.gz" % (RULES_JVM_EXTERNAL_TAG, RULES_JVM_EXTERNAL_TAG),
1616
)
1717

1818
DAGGER_TAG = "2.46.1"

rules/setup.bzl

+1-1
Original file line numberDiff line numberDiff line change
@@ -87,11 +87,11 @@ def bazel_common_setup(
8787
"org.json:json:20210307",
8888
],
8989
repositories = DAGGER_REPOSITORIES + [
90-
"https://jcenter.bintray.com/",
9190
"https://maven.google.com",
9291
"https://repo1.maven.org/maven2",
9392
],
9493
strict_visibility = True,
94+
resolve_timeout = 3500,
9595
maven_install_json = maven_install_json,
9696
fetch_sources = True,
9797
)

tools/maven/src/main/kotlin/com/grab/maven/MavenInstallPin.kt

+3-4
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,16 @@ import java.io.File
1111
class MavenInstallPin : CliktCommand() {
1212

1313
private val mavenRepoName by option(
14-
"-M",
14+
"-m",
1515
"--maven_repo",
1616
help = "Name of the maven_install repo to run pinning"
1717
).required()
1818

19-
private val workingDir = System.getenv("BUILD_WORKSPACE_DIRECTORY")
20-
?: error("Missing BUILD_WORKSPACE_DIRECTORY environment")
19+
private val workingDir = System.getenv("BUILD_WORKSPACE_DIRECTORY") ?: error("Missing BUILD_WORKSPACE_DIRECTORY environment")
2120

2221
private val bazelInvoker = BazelInvokerFactory.create(workingDir = workingDir)
2322

24-
23+
@Suppress("SameParameterValue")
2524
private fun file(name: String) = File(workingDir, name)
2625

2726
override fun run() {

tools/maven/src/main/kotlin/com/grab/maven/WorkspaceUpdater.kt

+2-3
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,8 @@ import java.io.File
55
class WorkspaceUpdater(
66
private val workspace: File
77
) {
8-
98
private val pinnedMavenInstallAttr = "pinned_maven_install ="
10-
private val pinBazelCommonArtifacts = "pin_bazel_common_artifacts()"
9+
private val pinBazelCommonArtifacts = "pin_bazel_common_dependencies()"
1110

1211
fun pin() {
1312
with(workspace) {
@@ -16,7 +15,7 @@ class WorkspaceUpdater(
1615
"$pinnedMavenInstallAttr False",
1716
"$pinnedMavenInstallAttr True"
1817
).replace(
19-
"#+pin_bazel_common_artifacts\\(\\)".toRegex(),
18+
"#+pin_bazel_common_dependencies\\(\\)".toRegex(),
2019
pinBazelCommonArtifacts
2120
)
2221
)

0 commit comments

Comments
 (0)