Skip to content

Commit

Permalink
Update Bazel to 7.1.1 and rules_jvm_external to 5.3 (#171)
Browse files Browse the repository at this point in the history
Fixes #171
  • Loading branch information
arunkumar9t2 committed May 8, 2024
1 parent 013103d commit 2e644da
Show file tree
Hide file tree
Showing 9 changed files with 5,881 additions and 10,259 deletions.
86 changes: 46 additions & 40 deletions .bazelrc
Original file line number Diff line number Diff line change
@@ -1,54 +1,60 @@
# Disk cache
build --disk_cache=bazel-cache
# Cache
common --disk_cache=bazel-cache
common --remote_cache_compression=true

build --verbose_failures
# Errors
common --verbose_failures

# Action Env
build --incompatible_strict_action_env
build --repo_env=RJE_VERBOSE=true
common --incompatible_strict_action_env
common --reuse_sandbox_directories
common --repo_env=RJE_VERBOSE=true

common --experimental_google_legacy_api
common --enable_bzlmod=false

# Workers
build --experimental_worker_multiplex
common --worker_verbose
common --experimental_worker_multiplex
common --experimental_shrink_worker_pool

# JAVA - START
build --experimental_strict_java_deps=off # Turn off strict java deps
build --java_runtime_version=remotejdk_11 # Use inbuilt Java 11 for hermeticity
build --jvmopt="-Djava.locale.providers=COMPAT,SPI" # Use Java 8 default locale provider
common --experimental_java_classpath=bazel
common --experimental_strict_java_deps=off # Turn off strict java deps
common --java_runtime_version=remotejdk_11 # Use inbuilt Java 11 for hermeticity
common --jvmopt="-Djava.locale.providers=COMPAT,SPI" # Use Java 8 default locale provider
# JAVA - END

# Android
# Databinding flags
common --experimental_android_databinding_v2
common --android_databinding_use_v3_4_args
common --android_databinding_use_androidx
# Android
common --experimental_google_legacy_api

# D8 and Dexing flags
build --define=android_incremental_dexing_tool=d8_dexbuilder
build --define=android_standalone_dexing_tool=d8_compat_dx
build --define=android_dexmerger_tool=d8_dexmerger

build --persistent_multiplex_android_tools
build --strategy=DatabindingStubs=worker
build --worker_max_instances=Javac=1
build --worker_max_instances=KotlinCompile=1
build --worker_max_instances=KotlinKapt=1
build --worker_max_instances=AaptPackage=1
build --worker_max_instances=AndroidResourceParser=1
build --worker_max_instances=AndroidResourceCompiler=1
build --worker_max_instances=AndroidResourceValidator=1
build --worker_max_instances=AndroidLintAnalyze=1
build --worker_max_instances=AndroidLint=1
build --worker_max_instances=RClassGenerator=1
build --worker_max_instances=AndroidAapt2=1
build --worker_max_instances=AndroidAssetMerger=1
build --worker_max_instances=AndroidResourceMerger=1
build --worker_max_instances=AndroidCompiledResourceMerger=1
build --worker_max_instances=Aapt2Optimize=1
build --worker_max_instances=DatabindingStubs=1
build --worker_max_instances=GenerateDataBindingBaseClasses=1
build --worker_max_instances=DexBuilder=1
build --worker_max_instances=Desugar=1
common --define=android_incremental_dexing_tool=d8_dexbuilder
common --define=android_standalone_dexing_tool=d8_compat_dx
common --define=android_dexmerger_tool=d8_dexmerger

common --experimental_persistent_aar_extractor
common --persistent_multiplex_android_tools
common --persistent_android_dex_desugar
common --strategy=DatabindingStubs=worker
common --worker_max_instances=Javac=1
common --worker_max_instances=KotlinCompile=1
common --worker_max_instances=KotlinKapt=1
common --worker_max_instances=AaptPackage=1
common --worker_max_instances=AndroidResourceParser=1
common --worker_max_instances=AndroidResourceCompiler=1
common --worker_max_instances=AndroidResourceValidator=1
common --worker_max_instances=AndroidLintAnalyze=1
common --worker_max_instances=AndroidLint=1
common --worker_max_instances=RClassGenerator=1
common --worker_max_instances=AndroidAapt2=1
common --worker_max_instances=AndroidAssetMerger=1
common --worker_max_instances=AndroidResourceMerger=1
common --worker_max_instances=AndroidCompiledResourceMerger=1
common --worker_max_instances=Aapt2Optimize=1
common --worker_max_instances=DatabindingStubs=1
common --worker_max_instances=GenerateDataBindingBaseClasses=1
common --worker_max_instances=DexBuilder=1
common --worker_max_instances=Desugar=1

test --test_output=errors # Print test logs for failed tests
test --build_tests_only
Expand Down
2 changes: 1 addition & 1 deletion .bazelversion
Original file line number Diff line number Diff line change
@@ -1 +1 @@
6.3.2
7.1.1
1 change: 0 additions & 1 deletion WORKSPACE
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
workspace(name = "grab_bazel_common")

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

bazel_common_dependencies()
Expand Down
16,029 changes: 5,824 additions & 10,205 deletions bazel_common_maven_install.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion rules/android/lint/lint_aspect.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -468,7 +468,7 @@ def _lint_aspect_impl(target, ctx):
project_xml_file = ctx.actions.declare_file("lint/" + target.label.name + "_project.xml")

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

sources = _collect_sources(target, ctx, library)
Expand Down
6 changes: 3 additions & 3 deletions rules/repositories.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ def http_archive(name, **kwargs):
maybe(_http_archive, name = name, **kwargs)

def _maven():
RULES_JVM_EXTERNAL_TAG = "4.4.2"
RULES_JVM_EXTERNAL_SHA = "735602f50813eb2ea93ca3f5e43b1959bd80b213b836a07a62a29d757670b77b"
RULES_JVM_EXTERNAL_TAG = "5.3"
RULES_JVM_EXTERNAL_SHA = "d31e369b854322ca5098ea12c69d7175ded971435e55c18dd9dd5f29cc5249ac"

http_archive(
name = "rules_jvm_external",
sha256 = RULES_JVM_EXTERNAL_SHA,
strip_prefix = "rules_jvm_external-%s" % RULES_JVM_EXTERNAL_TAG,
url = "https://github.com/bazelbuild/rules_jvm_external/archive/%s.zip" % RULES_JVM_EXTERNAL_TAG,
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),
)

DAGGER_TAG = "2.46.1"
Expand Down
2 changes: 1 addition & 1 deletion rules/setup.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -87,11 +87,11 @@ def bazel_common_setup(
"org.json:json:20210307",
],
repositories = DAGGER_REPOSITORIES + [
"https://jcenter.bintray.com/",
"https://maven.google.com",
"https://repo1.maven.org/maven2",
],
strict_visibility = True,
resolve_timeout = 3500,
maven_install_json = maven_install_json,
fetch_sources = True,
)
Expand Down
7 changes: 3 additions & 4 deletions tools/maven/src/main/kotlin/com/grab/maven/MavenInstallPin.kt
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,16 @@ import java.io.File
class MavenInstallPin : CliktCommand() {

private val mavenRepoName by option(
"-M",
"-m",
"--maven_repo",
help = "Name of the maven_install repo to run pinning"
).required()

private val workingDir = System.getenv("BUILD_WORKSPACE_DIRECTORY")
?: error("Missing BUILD_WORKSPACE_DIRECTORY environment")
private val workingDir = System.getenv("BUILD_WORKSPACE_DIRECTORY") ?: error("Missing BUILD_WORKSPACE_DIRECTORY environment")

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


@Suppress("SameParameterValue")
private fun file(name: String) = File(workingDir, name)

override fun run() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,8 @@ import java.io.File
class WorkspaceUpdater(
private val workspace: File
) {

private val pinnedMavenInstallAttr = "pinned_maven_install ="
private val pinBazelCommonArtifacts = "pin_bazel_common_artifacts()"
private val pinBazelCommonArtifacts = "pin_bazel_common_dependencies()"

fun pin() {
with(workspace) {
Expand All @@ -16,7 +15,7 @@ class WorkspaceUpdater(
"$pinnedMavenInstallAttr False",
"$pinnedMavenInstallAttr True"
).replace(
"#+pin_bazel_common_artifacts\\(\\)".toRegex(),
"#+pin_bazel_common_dependencies\\(\\)".toRegex(),
pinBazelCommonArtifacts
)
)
Expand Down

0 comments on commit 2e644da

Please sign in to comment.