Reduce platform dependant selects in //tools/jdk/BUILD #12324
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Macro
default_java_toolchain
used to create ajava_toolchain
rule with each attribute set using a platform dependent select. For exampleijar
attribute was set to//tools/jdk:ijar
, which was a macroremote_java_tools_filegroup
. That macro contains aselect
choosing the right@remote_java_tools
repository.With Java toolchainisation this become a fragile mechanism (selects need to match the toolchain...), which would be hard to maintain.
In previous commits
java_toolchain_default
was implemented, which is part of eachjava_tools
repository and does not use anyselects
.For backward compatibility
default_java_toolchain
was reimplemented to invokejava_toolchain_default
. Implementation is not perfect, because it load 3 java_tools repositories (linux,darwin,windows). Not to invoke this misfeature, some macros were moved intoutils.bzl
. The use ofdefault_java_toolchain
should be discouraged.remote_java_tools_filegroup/import
targets in//tools/jdk/BUILD
that were previous used only bydefault_java_toolchain
were removed.default_java_toolchain
targets in//tools/jdk/BUILD
were replaced with select aliases. Those will be removed when Java toolchainsation is complete.legacy_toolchain
was removed as a fall-back - it was an awkard one - going from Java 11 to Java 8 language level.