diff --git a/src/main/java/com/google/devtools/build/lib/analysis/config/BuildOptions.java b/src/main/java/com/google/devtools/build/lib/analysis/config/BuildOptions.java index ad6bf3cac63917..c1b094534490cf 100644 --- a/src/main/java/com/google/devtools/build/lib/analysis/config/BuildOptions.java +++ b/src/main/java/com/google/devtools/build/lib/analysis/config/BuildOptions.java @@ -95,6 +95,15 @@ public BuildOptions createHostOptions() { return builder.addStarlarkOptions(skylarkOptionsMap).build(); } + /** Creates a new BuildOptions instance for exec. */ + public BuildOptions createExecOptions() { + Builder builder = builder(); + for (FragmentOptions options : fragmentOptionsMap.values()) { + builder.addFragmentOptions(options.getExec()); + } + return builder.addStarlarkOptions(skylarkOptionsMap).build(); + } + /** * Returns {@code BuildOptions} that are otherwise identical to this one, but contain only options * from the given {@link FragmentOptions} classes (plus build configuration options). diff --git a/src/main/java/com/google/devtools/build/lib/analysis/config/FragmentOptions.java b/src/main/java/com/google/devtools/build/lib/analysis/config/FragmentOptions.java index 2ff277d31f044e..815effca9e7032 100644 --- a/src/main/java/com/google/devtools/build/lib/analysis/config/FragmentOptions.java +++ b/src/main/java/com/google/devtools/build/lib/analysis/config/FragmentOptions.java @@ -47,11 +47,18 @@ public FragmentOptions getDefault() { * Creates a new instance of this {@code FragmentOptions} with all flags adjusted as needed to * represent the host platform. */ - @SuppressWarnings("unused") public FragmentOptions getHost() { return getDefault(); } + /** + * Creates a new instance of this {@code FragmentOptions} with all flags adjusted as needed to + * represent the execution platform. + */ + public FragmentOptions getExec() { + return clone(); + } + /** * Returns an instance of {@code FragmentOptions} with all flags adjusted to be suitable for * forming configurations.