(WIP) Bzlmod: export DEFAULT_SYSTEM_JAVABASE to MODULE.bazel#14253
(WIP) Bzlmod: export DEFAULT_SYSTEM_JAVABASE to MODULE.bazel#14253meteorcloudy wants to merge 2 commits intobazelbuild:masterfrom
Conversation
|
cc @comius I think DEFAULT_SYSTEM_JAVABASE as a symbol in WORKSPACE was an ugly hack, and I would really like to avoid having it in MODULE.bazel too. [Off-topic: In fact it feels weird that we can specify Anyhow, I think my preferred solution would be to make it available under |
|
Hey, I wish you asked about this earlier. I think there are no obstacles to completely remove DEFAULT_SYSTEM_JAVABASE logic and its passing down to the workspace. Proper implementation should leverage repository api in the local_java_repository repo rule. I believe the logic that happens in C++ can be completely reproduced in local_java_repository's implementation. It would perhaps be even better, to simplify it and only resolve to JAVA_HOME environment variable (this is what's advertised in the documentation, but we actually also look in PATH). This was one thing I wanted to do, but there was no proper motivation to do it, that is "tech debt", but not much impact when removing it. Now with bzlmod, it has much bigger impact to remove it, because you can keep the codebase simple. |
|
OK, looks like the java base is detected in the Bazel client, and each platform has its own implementation: |
Can we require user to always set JAVA_HOME manually? That's a breaking change, right? I think I can try to replicate the java base detection logic in module extension. |
You're right, Java compilations on systems without JAVA_HOME set would start failing. JAVA_HOME or PATH it is. |
|
Closing this one as we prefer to get rid of |
DEFAULT_SYSTEM_JAVABASEis an default variable in WORKSPACE file, its value is controlled by--default_system_javabaseflag, we need this information to locate the local JDK path in rules_java.Required by bazelbuild/rules_java#45 (comment)