Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[7.0.1] Fix bootstrapped Bazel binary #20612

Merged
merged 3 commits into from
Dec 19, 2023
Merged
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
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
load("@rules_java//java:defs.bzl", "java_binary", "java_library")
load("//tools/build_rules:java_rules_skylark.bzl", "bootstrap_java_binary", "bootstrap_java_library")
load("@rules_java//java:defs.bzl", "java_binary", "java_library")

# Description:
# The Java library builders, which are used by Bazel to compile Java
Expand Down Expand Up @@ -174,14 +174,14 @@ bootstrap_java_library(
name = "starlark-deps",
srcs = ["//:bootstrap-derived-java-srcs"],
jars = [
"//third_party:auto_value-jars",
"//:bootstrap-derived-java-jars",
"//third_party:bootstrap_guava_and_error_prone-jars",
"//third_party:jsr305-jars",
"//third_party/java/jacoco:core-jars",
"//third_party/grpc-java:bootstrap-grpc-jars",
"//third_party:tomcat_annotations_api-jars",
],
neverlink_jars = ["//third_party:auto_value-jars"],
tags = ["manual"],
)

Expand Down Expand Up @@ -213,6 +213,7 @@ bootstrap_java_binary(
"javac/WerrorCustomOption.java",
],
main_class = "com.google.devtools.build.buildjar.VanillaJavaBuilder",
neverlink_jars = ["//third_party:auto_value-jars"],
tags = ["manual"],
deps = [
":starlark-deps",
Expand Down
11 changes: 11 additions & 0 deletions src/test/shell/bazel/bazel_bootstrap_distfile_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -104,11 +104,22 @@ function test_bootstrap() {

env EXTRA_BAZEL_ARGS="--tool_java_runtime_version=local_jdk" ./compile.sh \
|| fail "Expected to be able to bootstrap bazel. If you updated MODULE.bazel, see the NOTE in that file."

./output/bazel \
--server_javabase=$JAVABASE --host_jvm_args=--add-opens=java.base/java.nio=ALL-UNNAMED \
version --nognu_format &> "${TEST_log}" \
|| fail "Generated bazel not working"
expect_log "${SOURCE_DATE_EPOCH}"

# TODO: make the build work without network and check for success
# the repo cache is currently missing:
# 1) canonical IDs
# 2) remote jdks & java_tools (if not using a custom java_toolchain)
./output/bazel \
--server_javabase=$JAVABASE --host_jvm_args=--add-opens=java.base/java.nio=ALL-UNNAMED \
build --nobuild --repository_cache=derived/repository_cache \
//src:bazel_nojdk &> "${TEST_log}" || true
expect_not_log "FATAL: bazel crashed due to an internal error"
}

run_suite "bootstrap test"
Loading