Skip to content

Commit

Permalink
Starlark exec logic: hard-code test configuration logic for now.
Browse files Browse the repository at this point in the history
See change for the challenges of proper Starlark support.

PiperOrigin-RevId: 556946537
Change-Id: Ib155fa07e10f425bd4be81fc6a7cf0497f759d54
  • Loading branch information
gregestren authored and copybara-github committed Aug 14, 2023
1 parent dd3b0ec commit 5806691
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/main/java/com/google/devtools/build/lib/analysis/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -2442,6 +2442,7 @@ java_library(
":config/optioninfo",
":config/starlark_defined_config_transition",
":config/transitions/configuration_transition",
":test/test_configuration",
"//src/main/java/com/google/devtools/build/lib/cmdline",
"//src/main/java/com/google/devtools/build/lib/events",
"//src/main/java/com/google/devtools/build/lib/packages",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
import com.google.devtools.build.lib.analysis.config.OptionInfo;
import com.google.devtools.build.lib.analysis.config.StarlarkDefinedConfigTransition;
import com.google.devtools.build.lib.analysis.config.StarlarkDefinedConfigTransition.ValidationException;
import com.google.devtools.build.lib.analysis.test.TestConfiguration.TestOptions;
import com.google.devtools.build.lib.cmdline.Label;
import com.google.devtools.build.lib.cmdline.LabelSyntaxException;
import com.google.devtools.build.lib.events.Event;
Expand Down Expand Up @@ -156,6 +157,15 @@ private static BuildOptions maybeGetExecDefaults(
// Propagate Starlark options from the source config:
// TODO(b/288258583) don't automatically propagate Starlark options.
defaultBuilder.addStarlarkOptions(fromOptions.getStarlarkOptions());
// Hard-code TestConfiguration.getExec() for now, which clones the source options.
// TODO(b/295936652): handle this directly in Starlark. This has two complications:
// 1: --trim_test_configuration means the flags may not exist. Starlark logic needs to handle
// that possibility.
// 2: --runs_per_test has a non-Starlark readable type.
if (fromOptions.contains(TestOptions.class)) {
defaultBuilder.removeFragmentOptions(TestOptions.class);
defaultBuilder.addFragmentOptions(fromOptions.get(TestOptions.class));
}
// Propagate --define values from the source config:
// TODO(b/288258583) don't automatically propagate --defines.
BuildOptions ans = defaultBuilder.build();
Expand Down

0 comments on commit 5806691

Please sign in to comment.