From f15124c0c77954ca9af75a2dbc2741599a91da96 Mon Sep 17 00:00:00 2001 From: Googler Date: Mon, 19 Dec 2022 07:20:03 -0800 Subject: [PATCH] Enable Starlark `java_binary` in bazel RELNOTES[inc]: `java_binary` is now implemented in Starlark. The only visible change is that `java_binary` is now a macro, with the `_deploy.jar` target(s) created by a separate rule. This affects the results of `blaze query` and has a (small) memory regression for builds with very many `java_binary` targets. Downstream tests: An earlier build had one windows launcher related failure: https://buildkite.com/bazel/bazel-at-head-plus-downstream/builds/2786 which has now been fixed: https://buildkite.com/bazel/bazel-at-head-plus-downstream/builds/2791 (but other unrelated changes in the meantime have broken many more projects) PiperOrigin-RevId: 496393229 Change-Id: I64eb93f6fd1f4259eece29191828d81d8fe42879 --- src/main/starlark/builtins_bzl/bazel/exports.bzl | 2 ++ src/test/shell/integration/jvm_flags_escaping_test.sh | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main/starlark/builtins_bzl/bazel/exports.bzl b/src/main/starlark/builtins_bzl/bazel/exports.bzl index a4466c8a5bb630..cc56c6235e28fe 100644 --- a/src/main/starlark/builtins_bzl/bazel/exports.bzl +++ b/src/main/starlark/builtins_bzl/bazel/exports.bzl @@ -19,6 +19,7 @@ load("@_builtins//:common/java/java_plugin.bzl", "java_plugin") load("@_builtins//:common/java/java_import.bzl", "java_import") load("@_builtins//:common/java/proto/java_proto_library.bzl", "java_proto_library") load("@_builtins//:common/cc/cc_proto_library.bzl", "cc_proto_library") +load(":bazel/java/bazel_java_binary_wrapper.bzl", "java_binary") exported_toplevels = {} exported_rules = { @@ -27,5 +28,6 @@ exported_rules = { "+java_import": java_import, "java_proto_library": java_proto_library, "+cc_proto_library": cc_proto_library, + "+java_binary": java_binary, } exported_to_java = {} diff --git a/src/test/shell/integration/jvm_flags_escaping_test.sh b/src/test/shell/integration/jvm_flags_escaping_test.sh index 344500881679cb..768b507e5bd2ae 100755 --- a/src/test/shell/integration/jvm_flags_escaping_test.sh +++ b/src/test/shell/integration/jvm_flags_escaping_test.sh @@ -279,7 +279,7 @@ function test_untokenizable_jvm_flag_when_escaping_is_enabled() { # On Windows, Bazel will check the flag. bazel build --verbose_failures "${pkg}:cannot_tokenize" \ 2>"$TEST_log" && fail "expected failure" || true - expect_log "ERROR:.*in jvm_flags attribute of java_binary rule" + expect_log "Error in tokenize: unterminated quotation" else # On other platforms, Bazel will build the target but it fails to run. bazel build --verbose_failures "${pkg}:cannot_tokenize" \