Add a conversionContext parameter to option converters
We need to pass flag values through the repo mapping of the main repo, which means that at flag parsing time, we need access to the main repo mapping. To that end, we add a nullable untyped `conversionContext` parameter to the `Converter#convert` method, which is unused in this CL but will be used in a follow-up.
Note that we can't directly add a `RepositoryMapping` parameter because the c.g.devtools.common.options package is a transitive dependency of c.g.devtools.build.lib.cmdline (which RepositoryMapping lives in). So this `conversionContext` will unfortunately need to be an Object.
Reviewers: Please focus on reviewing changes in the c.g.devtools.common.options package. All the other changes in this CL are simply adding a `conversionContext` parameter to implementors of `Converter`, or passing this parameter to delegates, or superclasses.
Work towards https://github.com/bazelbuild/bazel/issues/14852
PiperOrigin-RevId: 459278433
Change-Id: I98b3842305c34d2d0c33e7411c1024897fb0170a
diff --git a/src/main/java/com/google/devtools/build/lib/runtime/CommonCommandOptions.java b/src/main/java/com/google/devtools/build/lib/runtime/CommonCommandOptions.java
index 20f98d9..fd60652 100644
--- a/src/main/java/com/google/devtools/build/lib/runtime/CommonCommandOptions.java
+++ b/src/main/java/com/google/devtools/build/lib/runtime/CommonCommandOptions.java
@@ -118,7 +118,7 @@
public boolean alwaysProfileSlowOperations;
/** Converter for UUID. Accepts values as specified by {@link UUID#fromString(String)}. */
- public static class UUIDConverter implements Converter<UUID> {
+ public static class UUIDConverter extends Converter.Contextless<UUID> {
@Override
@Nullable
@@ -144,7 +144,7 @@
* Converter for options (--build_request_id) that accept prefixed UUIDs. Since we do not care
* about the structure of this value after validation, we store it as a string.
*/
- public static class PrefixedUUIDConverter implements Converter<String> {
+ public static class PrefixedUUIDConverter extends Converter.Contextless<String> {
@Override
@Nullable