bazelbuild / bazel

a fast, scalable, multi-language and extensible build system
https://bazel.build
Apache License 2.0
23.29k stars 4.09k forks source link

Java "11" is not required (especially for Windows) #23882

Open tats-u opened 1 month ago

tats-u commented 1 month ago

Page link:

https://bazel.build/install/windows#install-compilers

Problem description (include actual vs expected text, if applicable):

https://github.com/bazelbuild/bazel/blob/83830c264f135893e1db1a425ea7c008717e1f39/site/en/install/windows.md?plain=1#L108

This line is incorrect and confused me a lot. It should be removed.

https://github.com/google/mozc/issues/932#issuecomment-2395098791

Bazel for Windows these days automatically installs Zulu 21.

image

 tatsu@TATSU-DPC-2ND  ~\..\..\..\..\..\bin  ./java --version
openjdk 21 2023-09-19
OpenJDK Runtime Environment Zulu21.28+85-CA (build 21+35)
OpenJDK 64-Bit Server VM Zulu21.28+85-CA (build 21+35, mixed mode)
 tatsu@TATSU-DPC-2ND  ~\..\..\..\..\..\bin  java --version
openjdk 21.0.3 2024-04-16 LTS
OpenJDK Runtime Environment Temurin-21.0.3+9 (build 21.0.3+9-LTS)
OpenJDK 64-Bit Server VM Temurin-21.0.3+9 (build 21.0.3+9-LTS, mixed mode, sharing)
 tatsu@TATSU-DPC-2ND  ~\..\..\..\..\..\bin  bazel --version
bazel 7.3.2

Where do you see this issue? (include link to specific section of the page, if applicable)

No response

Any other information you'd like to share?

Python "3.6" is a stale information too.

fmeum commented 1 month ago

Would you be interested in sending a PR?

tats-u commented 1 month ago

Not now or in this week. It's a bad idea to expect too much from my contribution. If I were a member, I would remove the JDK entry. Do you agree with it?

yukawa commented 1 month ago

If I were a member, I would remove the JDK entry. Do you agree with it?

Sorry, my comment at https://github.com/google/mozc/issues/932#issuecomment-2395100819_ might have been misleading.

I was trying to explain that running Bazel itself would not require any explicit installation of Java Runtime Environment (JRE) these days, while the installation document looks to be saying that an explicit explicit installation of Java Development Kit (JDK) will be needed to build code written in Java by using Bazel, which I believe is still valid (except for which JDK version should be installed most likely depends on the target project you want to build).

https://github.com/bazelbuild/bazel/blob/83830c264f135893e1db1a425ea7c008717e1f39/site/en/install/windows.md?plain=1#L108-L112

If I were a member, I would remove the JDK entry. Do you agree with it?

In https://github.com/google/mozc/issues/932 the reporter did not need to install JDK because the project that the reporter was trying to build a project (for Windows) did not have any Java build target. This does not mean that JDK is completely unnecessary to build other projects that need to build Java source code. So removing JDK entry may also cause another confusion. Just fyi.

tats-u commented 1 month ago

Thank you for the additional explanation. We might verify whether the installation of JDK is really unnecessary using Sandbox or VM.

tats-u commented 1 month ago

I uninstalled MSYS2, Bazel, and Java 21 (Eclipse Temurin), and reinstalled only MSYS2 and Bazel via Scoop. Then I set up MSYS2 by the msys2 command. After that I ran in the src directory of Mozc:

bazel clean
bazel --bazelrc=windows.bazelrc build --config oss_windows --config release_build package

Bazel is successfully compiling C++ source code files without a local JDK. This shouw we don't need a local JDK in Windows.

yukawa commented 1 month ago

This shouw we don't need a local JDK in Windows.

Right. You don't need JDK as long as Mozc is the only project you want to build with Bazel.

https://bazel.build/install/windows#install-compilers is actually saying that what additional tools are needed depend on what you want to build.

Depending on which languages you want to build, you will need:

In other words, you can use Bazel without installing Visual C++ Build Tools and Windows 10 SDK. Bazel itself can run without them, but the build may or may not fail depending on the target project requirements. And as for Mozc, the build will actually fail on Windows.

If you happened to have to build Java-based project such as Bazel itself, you would still need to install JDK, I guess.

tats-u commented 1 month ago

Right. You don't need JDK as long as Mozc is the only project you want to build with Bazel.

I'll fix docs/build_mozc_in_windows.md in Mozc if possible.

If you happened to have to build Java-based project such as Bazel itself, you would still need to install JDK, I guess.

I see. There's a description "You will need this to build Java code on Windows.". However I think we shouldn't write concrete versions there. "Java SE Development Kit (JDK) for Windows x64 whose version is required by the project" is longer but might be better.