From a8cef5331d6a3ab91036fb59f1217073ca8a0fb6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Motiejus=20Jak=C5=A1tys?= Date: Tue, 12 Dec 2023 14:29:35 +0200 Subject: [PATCH] bazelrc: set java_runtime_version for builds too Otherwse, if the default Java version on the host is "lower" (in my case, 11), the following happens: ``` $ bazel build //base:integration_tests --define=ij_product=intellij-2023.3 ERROR: /home/motiejus/code/intellij/base/BUILD:535:32: Building base/integration_tests.jar (72 source files) failed: (Exit 1): java failed: error executing Javac command (from target //base:integration_tests) external/remotejdk17_linux/bin/java '--add-exports=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED' '--add-exports=jdk.compiler/com.sun.tools.javac.main=ALL-UNNAMED' ... (remaining 19 arguments skipped) base/tests/integrationtests/com/google/idea/blaze/base/lang/buildfile/search/GlobalWordIndexTest.java:81: warning: [removal] SERVICE in CacheManager has been deprecated and marked for removal CacheManager.SERVICE ^ base/tests/integrationtests/com/google/idea/blaze/base/lang/buildfile/references/BuildReferenceManagerTest.java:47: error: cannot find symbol .toList(); ^ symbol: method toList() location: interface Stream base/tests/integrationtests/com/google/idea/blaze/base/lang/buildfile/references/BuildReferenceManagerTest.java:68: error: cannot find symbol .toList(); ^ symbol: method toList() location: interface Stream Use --verbose_failures to see the command lines of failed build steps. ``` However, `bazel test` with the same arguments succeeds. The current behaviour is "technically" correct, but is a confusing: we should be able to build our tests, not only run them. Fixes #5835 --- .bazelrc | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.bazelrc b/.bazelrc index 161c41c47b6..fecbf806166 100644 --- a/.bazelrc +++ b/.bazelrc @@ -1,5 +1,4 @@ -build --java_language_version=17 -test --java_language_version=17 --java_runtime_version=17 +build --java_language_version=17 --java_runtime_version=17 # delete testdata package needed for bazel integration tests build --deleted_packages=//aspect/testing/tests/src/com/google/idea/blaze/aspect/integration/testdata