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

bazelrc: set java_runtime_version for builds too #5836

Merged
merged 1 commit into from Dec 19, 2023
Merged

bazelrc: set java_runtime_version for builds too #5836

merged 1 commit into from Dec 19, 2023

Conversation

ghost
Copy link

@ghost ghost commented Dec 12, 2023

If the default Java version on the host is "lower" (in my case, 11), the following happens on master:

$ java -version
openjdk version "11.0.21" 2023-10-17
OpenJDK Runtime Environment (build 11.0.21+9-post-Ubuntu-0ubuntu122.04)
OpenJDK 64-Bit Server VM (build 11.0.21+9-post-Ubuntu-0ubuntu122.04, mixed mode, sharing)
$ 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<String>
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<String>
Use --verbose_failures to see the command lines of failed build steps.

The current behaviour is "technically" correct, because bazel test succeeds. However, it is very confusing: we should be able to build our tests, not only run them.

Fixes #5835

Checklist

  • I have filed an issue about this change and discussed potential changes with the maintainers.
  • I have received the approval from the maintainers to make this change.
  • This is not a stylistic, refactoring, or cleanup change.

Discussion thread for this change

Issue number: #5835

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<String>
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<String>
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
Copy link

google-cla bot commented Dec 12, 2023

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@sgowroji sgowroji added product: IntelliJ IntelliJ plugin awaiting-review Awaiting review from Bazel team on PRs labels Dec 12, 2023
@mai93 mai93 merged commit 38e355a into bazelbuild:master Dec 19, 2023
8 checks passed
@github-actions github-actions bot removed the awaiting-review Awaiting review from Bazel team on PRs label Dec 19, 2023
@ghost ghost deleted the motiejusja-javaversion-upstream branch December 19, 2023 06:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
product: IntelliJ IntelliJ plugin
Projects
Development

Successfully merging this pull request may close these issues.

unable to build //base:integration_tests with older jdk
2 participants