Skip to content

Commit

Permalink
Propagate all experimental options to the exec configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
fmeum committed Sep 16, 2024
1 parent b4af015 commit d66ec86
Show file tree
Hide file tree
Showing 11 changed files with 207 additions and 63 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,7 @@ public class CoreOptions extends FragmentOptions implements Cloneable {
defaultValue = "false",
documentationCategory = OptionDocumentationCategory.EXECUTION_STRATEGY,
effectTags = {OptionEffectTag.EXECUTION},
metadataTags = {OptionMetadataTag.EXPERIMENTAL},
help =
"If this option is enabled, filesets will treat all output artifacts as regular files. "
+ "They will not traverse directories or be sensitive to symlinks.")
Expand Down Expand Up @@ -481,6 +482,7 @@ public ExecConfigurationDistinguisherSchemeConverter() {
name = "experimental_collect_code_coverage_for_generated_files",
defaultValue = "false",
documentationCategory = OptionDocumentationCategory.OUTPUT_PARAMETERS,
metadataTags = {OptionMetadataTag.EXPERIMENTAL},
effectTags = {OptionEffectTag.AFFECTS_OUTPUTS},
help =
"If specified, Bazel will also generate collect coverage information for generated"
Expand Down Expand Up @@ -933,6 +935,7 @@ public OutputPathsConverter() {
defaultValue = "false",
documentationCategory = OptionDocumentationCategory.UNDOCUMENTED,
effectTags = {OptionEffectTag.LOADING_AND_ANALYSIS},
metadataTags = {OptionMetadataTag.EXPERIMENTAL},
help =
"When set, select functions with no matching clause will return an empty value, instead"
+ " of failing. This is to help use cquery diagnose failures in select.")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,15 +108,14 @@ public static class TestOptions extends FragmentOptions {
public List<Pair<String, Map<TestSize, Double>>> testResources;

@Option(
name = "test_filter",
allowMultiple = false,
defaultValue = "null",
documentationCategory = OptionDocumentationCategory.UNCATEGORIZED,
effectTags = {OptionEffectTag.UNKNOWN},
help =
"Specifies a filter to forward to the test framework. Used to limit "
+ "the tests run. Note that this does not affect which targets are built."
)
name = "test_filter",
allowMultiple = false,
defaultValue = "null",
documentationCategory = OptionDocumentationCategory.UNCATEGORIZED,
effectTags = {OptionEffectTag.UNKNOWN},
help =
"Specifies a filter to forward to the test framework. Used to limit "
+ "the tests run. Note that this does not affect which targets are built.")
public String testFilter;

@Option(
Expand All @@ -130,20 +129,19 @@ public static class TestOptions extends FragmentOptions {
public boolean testRunnerFailFast;

@Option(
name = "cache_test_results",
defaultValue = "auto",
abbrev = 't', // it's useful to toggle this on/off quickly
documentationCategory = OptionDocumentationCategory.UNCATEGORIZED,
effectTags = {OptionEffectTag.UNKNOWN},
help =
"If set to 'auto', Bazel reruns a test if and only if: "
+ "(1) Bazel detects changes in the test or its dependencies, "
+ "(2) the test is marked as external, "
+ "(3) multiple test runs were requested with --runs_per_test, or"
+ "(4) the test previously failed. "
+ "If set to 'yes', Bazel caches all test results except for tests marked as "
+ "external. If set to 'no', Bazel does not cache any test results."
)
name = "cache_test_results",
defaultValue = "auto",
abbrev = 't', // it's useful to toggle this on/off quickly
documentationCategory = OptionDocumentationCategory.UNCATEGORIZED,
effectTags = {OptionEffectTag.UNKNOWN},
help =
"If set to 'auto', Bazel reruns a test if and only if: "
+ "(1) Bazel detects changes in the test or its dependencies, "
+ "(2) the test is marked as external, "
+ "(3) multiple test runs were requested with --runs_per_test, or"
+ "(4) the test previously failed. "
+ "If set to 'yes', Bazel caches all test results except for tests marked as "
+ "external. If set to 'no', Bazel does not cache any test results.")
public TriState cacheTestResults;

@Deprecated
Expand Down Expand Up @@ -178,6 +176,7 @@ public static class TestOptions extends FragmentOptions {
OptionEffectTag.LOADING_AND_ANALYSIS,
OptionEffectTag.LOSES_INCREMENTAL_STATE,
},
metadataTags = {OptionMetadataTag.EXPERIMENTAL},
help =
"When enabled, --trim_test_configuration will not trim the test configuration for rules"
+ " marked testonly=1. This is meant to reduce action conflict issues when non-test"
Expand Down Expand Up @@ -246,6 +245,7 @@ public static class TestOptions extends FragmentOptions {
defaultValue = "false",
documentationCategory = OptionDocumentationCategory.UNCATEGORIZED,
effectTags = {OptionEffectTag.AFFECTS_OUTPUTS, OptionEffectTag.LOADING_AND_ANALYSIS},
metadataTags = {OptionMetadataTag.EXPERIMENTAL},
help =
"If true, then Blaze will cancel concurrently running tests on the first successful "
+ "run. This is only useful in combination with --runs_per_test_detects_flakes.")
Expand All @@ -257,21 +257,21 @@ public static class TestOptions extends FragmentOptions {
defaultValue = "@bazel_tools//tools/test:coverage_support",
documentationCategory = OptionDocumentationCategory.TOOLCHAIN,
effectTags = {
OptionEffectTag.CHANGES_INPUTS,
OptionEffectTag.AFFECTS_OUTPUTS,
OptionEffectTag.LOADING_AND_ANALYSIS
OptionEffectTag.CHANGES_INPUTS,
OptionEffectTag.AFFECTS_OUTPUTS,
OptionEffectTag.LOADING_AND_ANALYSIS
},
help =
"Location of support files that are required on the inputs of every test action "
+ "that collects code coverage. Defaults to '//tools/test:coverage_support'."
)
+ "that collects code coverage. Defaults to '//tools/test:coverage_support'.")
public Label coverageSupport;

@Option(
name = "experimental_fetch_all_coverage_outputs",
defaultValue = "false",
documentationCategory = OptionDocumentationCategory.UNCATEGORIZED,
effectTags = {OptionEffectTag.AFFECTS_OUTPUTS, OptionEffectTag.LOADING_AND_ANALYSIS},
metadataTags = {OptionMetadataTag.EXPERIMENTAL},
help =
"If true, then Bazel fetches the entire coverage data directory for each test during a "
+ "coverage run.")
Expand All @@ -293,6 +293,7 @@ public static class TestOptions extends FragmentOptions {
defaultValue = "false",
documentationCategory = OptionDocumentationCategory.EXECUTION_STRATEGY,
effectTags = {OptionEffectTag.EXECUTION},
metadataTags = {OptionMetadataTag.EXPERIMENTAL},
help = "If true, then Bazel will run coverage postprocessing for test in a new spawn.")
public boolean splitCoveragePostProcessing;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
import com.google.devtools.common.options.Option;
import com.google.devtools.common.options.OptionDocumentationCategory;
import com.google.devtools.common.options.OptionEffectTag;
import com.google.devtools.common.options.OptionMetadataTag;
import net.starlark.java.annot.StarlarkBuiltin;
import net.starlark.java.annot.StarlarkMethod;

Expand Down Expand Up @@ -69,6 +70,7 @@ public static final class Options extends FragmentOptions {
defaultValue = "true",
documentationCategory = OptionDocumentationCategory.UNDOCUMENTED,
effectTags = {OptionEffectTag.LOADING_AND_ANALYSIS},
metadataTags = {OptionMetadataTag.EXPERIMENTAL},
help =
"If true, the roots of repositories in the runfiles tree are added to PYTHONPATH, so "
+ "that imports like `import mytoplevelpackage.package.module` are valid."
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -517,6 +517,7 @@ public static class Options extends FragmentOptions {
OptionEffectTag.AFFECTS_OUTPUTS,
OptionEffectTag.LOADING_AND_ANALYSIS,
},
metadataTags = OptionMetadataTag.EXPERIMENTAL,
help = "Enables resource shrinking for android_binary APKs that use ProGuard.")
public boolean useExperimentalAndroidResourceShrinking;

Expand Down Expand Up @@ -677,6 +678,7 @@ public static class Options extends FragmentOptions {
OptionEffectTag.LOADING_AND_ANALYSIS,
OptionEffectTag.LOSES_INCREMENTAL_STATE,
},
metadataTags = OptionMetadataTag.EXPERIMENTAL,
help = "The default value of the exports_manifest attribute on android_library.")
public boolean exportsManifestDefault;

Expand All @@ -685,6 +687,7 @@ public static class Options extends FragmentOptions {
defaultValue = "false",
documentationCategory = OptionDocumentationCategory.UNDOCUMENTED,
effectTags = {OptionEffectTag.AFFECTS_OUTPUTS},
metadataTags = {OptionMetadataTag.EXPERIMENTAL},
help =
"Omit AndroidResourcesInfo provider from android_binary rules."
+ " Propagating resources out to other binaries is usually unintentional.")
Expand Down Expand Up @@ -743,6 +746,7 @@ public static class Options extends FragmentOptions {
effectTags = {
OptionEffectTag.CHANGES_INPUTS,
},
metadataTags = {OptionMetadataTag.EXPERIMENTAL},
help = "If enabled, R Jars will be filtered from the test apk built by android_test.")
public boolean filterRJarsFromAndroidTest;

Expand All @@ -755,6 +759,7 @@ public static class Options extends FragmentOptions {
OptionEffectTag.BAZEL_INTERNAL_CONFIGURATION,
OptionEffectTag.ACTION_COMMAND_LINES
},
metadataTags = {OptionMetadataTag.EXPERIMENTAL},
help =
"If enabled, one version enforcement for android_test uses the binary_under_test's "
+ "transitive classpath, otherwise it uses the deploy jar")
Expand All @@ -767,6 +772,7 @@ public static class Options extends FragmentOptions {
effectTags = {
OptionEffectTag.EXECUTION,
},
metadataTags = {OptionMetadataTag.EXPERIMENTAL},
help = "Enable persistent aar extractor by using workers.")
public boolean persistentAarExtractor;

Expand Down Expand Up @@ -945,6 +951,7 @@ public static class Options extends FragmentOptions {
effectTags = {
OptionEffectTag.CHANGES_INPUTS,
},
metadataTags = {OptionMetadataTag.EXPERIMENTAL},
help =
"If enabled and the test instruments an application, all the R classes from the test's "
+ "deploy jar will be removed.")
Expand All @@ -957,6 +964,7 @@ public static class Options extends FragmentOptions {
effectTags = {
OptionEffectTag.CHANGES_INPUTS,
},
metadataTags = {OptionMetadataTag.EXPERIMENTAL},
help =
"If enabled and the android_test defines a binary_under_test, the class filterering "
+ "applied to the test's deploy jar will always filter duplicate classes based "
Expand All @@ -968,6 +976,7 @@ public static class Options extends FragmentOptions {
defaultValue = "false",
documentationCategory = OptionDocumentationCategory.BUILD_TIME_OPTIMIZATION,
effectTags = {OptionEffectTag.ACTION_COMMAND_LINES},
metadataTags = {OptionMetadataTag.EXPERIMENTAL},
help =
"Filter the ProGuard ProgramJar to remove any classes also present in the LibraryJar.")
public boolean filterLibraryJarWithProgramJar;
Expand All @@ -977,6 +986,7 @@ public static class Options extends FragmentOptions {
defaultValue = "false",
documentationCategory = OptionDocumentationCategory.UNDOCUMENTED,
effectTags = {OptionEffectTag.CHANGES_INPUTS},
metadataTags = {OptionMetadataTag.EXPERIMENTAL},
help = "Use R.txt from the merging action, instead of from the validation action.")
public boolean useRTxtFromMergedResources;

Expand Down Expand Up @@ -1015,6 +1025,7 @@ public static class Options extends FragmentOptions {
defaultValue = "false",
documentationCategory = OptionDocumentationCategory.UNDOCUMENTED,
effectTags = {OptionEffectTag.AFFECTS_OUTPUTS},
metadataTags = {OptionMetadataTag.EXPERIMENTAL},
help =
"Disables manifest merging when an android_binary has instruments set (i.e. is used "
+ "for instrumentation testing).")
Expand All @@ -1025,6 +1036,7 @@ public static class Options extends FragmentOptions {
defaultValue = "false",
documentationCategory = OptionDocumentationCategory.UNDOCUMENTED,
effectTags = {OptionEffectTag.CHANGES_INPUTS},
metadataTags = {OptionMetadataTag.EXPERIMENTAL},
help =
"Get Java resources from _proguard.jar instead of _deploy.jar in android_binary when "
+ "bundling the final APK.")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,21 +39,21 @@ public class AppleCommandLineOptions extends FragmentOptions {
defaultValue = "false",
documentationCategory = OptionDocumentationCategory.UNDOCUMENTED,
effectTags = {OptionEffectTag.NO_OP},
metadataTags = {OptionMetadataTag.EXPERIMENTAL},
help =
"No-op. Kept here for backwards compatibility. This field will be removed in a "
+ "future release.")
// TODO(b/32411441): This flag should be removed.
public boolean objcProviderFromLinked;

@Option(
name = "xcode_version",
defaultValue = "null",
documentationCategory = OptionDocumentationCategory.TOOLCHAIN,
effectTags = {OptionEffectTag.LOSES_INCREMENTAL_STATE},
help =
"If specified, uses Xcode of the given version for relevant build actions. "
+ "If unspecified, uses the executor default version of Xcode."
)
name = "xcode_version",
defaultValue = "null",
documentationCategory = OptionDocumentationCategory.TOOLCHAIN,
effectTags = {OptionEffectTag.LOSES_INCREMENTAL_STATE},
help =
"If specified, uses Xcode of the given version for relevant build actions. "
+ "If unspecified, uses the executor default version of Xcode.")
public String xcodeVersion;

@Option(
Expand Down Expand Up @@ -160,6 +160,7 @@ public class AppleCommandLineOptions extends FragmentOptions {
defaultValue = "true",
documentationCategory = OptionDocumentationCategory.TOOLCHAIN,
effectTags = {OptionEffectTag.LOSES_INCREMENTAL_STATE},
metadataTags = {OptionMetadataTag.EXPERIMENTAL},
help =
"If true, use the most recent Xcode that is available both locally and remotely. If"
+ " false, or if there are no mutual available versions, use the local Xcode version"
Expand Down Expand Up @@ -192,15 +193,14 @@ public class AppleCommandLineOptions extends FragmentOptions {
public static final String DEFAULT_CATALYST_CPU = "x86_64";

@Option(
name = "apple_crosstool_top",
defaultValue = "@bazel_tools//tools/cpp:toolchain",
converter = LabelConverter.class,
documentationCategory = OptionDocumentationCategory.TOOLCHAIN,
effectTags = {OptionEffectTag.LOSES_INCREMENTAL_STATE, OptionEffectTag.CHANGES_INPUTS},
help =
"The label of the crosstool package to be used in Apple and Objc rules and their"
+ " dependencies."
)
name = "apple_crosstool_top",
defaultValue = "@bazel_tools//tools/cpp:toolchain",
converter = LabelConverter.class,
documentationCategory = OptionDocumentationCategory.TOOLCHAIN,
effectTags = {OptionEffectTag.LOSES_INCREMENTAL_STATE, OptionEffectTag.CHANGES_INPUTS},
help =
"The label of the crosstool package to be used in Apple and Objc rules and their"
+ " dependencies.")
public Label appleCrosstoolTop;

@Option(
Expand All @@ -215,14 +215,13 @@ public class AppleCommandLineOptions extends FragmentOptions {
public String applePlatformType;

@Option(
name = "apple_split_cpu",
defaultValue = "",
documentationCategory = OptionDocumentationCategory.UNDOCUMENTED,
effectTags = {OptionEffectTag.BAZEL_INTERNAL_CONFIGURATION},
help =
"Don't set this value from the command line - it is derived from other flags and "
+ "configuration transitions derived from rule attributes"
)
name = "apple_split_cpu",
defaultValue = "",
documentationCategory = OptionDocumentationCategory.UNDOCUMENTED,
effectTags = {OptionEffectTag.BAZEL_INTERNAL_CONFIGURATION},
help =
"Don't set this value from the command line - it is derived from other flags and "
+ "configuration transitions derived from rule attributes")
public String appleSplitCpu;

// This option exists because two configurations are not allowed to have the same cache key
Expand Down Expand Up @@ -323,6 +322,7 @@ public class AppleCommandLineOptions extends FragmentOptions {
OptionEffectTag.LOADING_AND_ANALYSIS,
OptionEffectTag.EXECUTION
},
metadataTags = {OptionMetadataTag.EXPERIMENTAL},
help =
"If set, add a \"requires-xcode:{version}\" execution requirement to every Xcode action."
+ " If the Xcode version has a hyphenated label, also add a"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public List<CompilationMode> convert(String input) throws OptionsParsingExceptio
} else if (!input.equals("no")) { // "no" is another special case that disables all modes.
CompilationMode.Converter modeConverter = new CompilationMode.Converter();
for (String mode : Splitter.on(',').split(input)) {
modes.add(modeConverter.convert(mode, /*conversionContext=*/ null));
modes.add(modeConverter.convert(mode, /* conversionContext= */ null));
}
}
return modes.build().asList();
Expand Down Expand Up @@ -962,6 +962,7 @@ public Label getMemProfProfileLabel() {
defaultValue = "false",
documentationCategory = OptionDocumentationCategory.UNCATEGORIZED,
effectTags = {OptionEffectTag.AFFECTS_OUTPUTS, OptionEffectTag.LOADING_AND_ANALYSIS},
metadataTags = {OptionMetadataTag.EXPERIMENTAL},
help = "If true, coverage for clang will generate an LCOV report.")
public boolean generateLlvmLcov;

Expand Down Expand Up @@ -1005,6 +1006,7 @@ public Label getMemProfProfileLabel() {
OptionEffectTag.EXECUTION,
OptionEffectTag.CHANGES_INPUTS
},
metadataTags = {OptionMetadataTag.EXPERIMENTAL},
help =
"Whether to narrow inputs to C/C++ compilation by parsing #include lines from input"
+ " files. This can improve performance and incrementality by decreasing the size of"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import com.google.devtools.common.options.Option;
import com.google.devtools.common.options.OptionDocumentationCategory;
import com.google.devtools.common.options.OptionEffectTag;
import com.google.devtools.common.options.OptionMetadataTag;

/** {@link Fragment} for {@link GenQuery}. */
@RequiresOptions(options = {GenQueryConfiguration.GenQueryOptions.class})
Expand All @@ -33,6 +34,7 @@ public static class GenQueryOptions extends FragmentOptions {
defaultValue = "true",
documentationCategory = OptionDocumentationCategory.UNDOCUMENTED,
effectTags = {OptionEffectTag.BAZEL_INTERNAL_CONFIGURATION},
metadataTags = {OptionMetadataTag.EXPERIMENTAL},
help =
"If true, genquery loads its scope's transitive closure directly instead of by using "
+ "'TransitiveTargetValue' Skyframe work.")
Expand Down
Loading

0 comments on commit d66ec86

Please sign in to comment.