Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Diff against a dedicated exec version of the baseline configuration #18002

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -611,7 +611,7 @@ public OutputDirectoryNamingSchemeConverter() {
defaultValue = "false",
documentationCategory = OptionDocumentationCategory.UNDOCUMENTED,
effectTags = {OptionEffectTag.BAZEL_INTERNAL_CONFIGURATION},
metadataTags = {OptionMetadataTag.INTERNAL},
metadataTags = {OptionMetadataTag.INTERNAL, OptionMetadataTag.EXPLICIT_IN_OUTPUT_PATH},
help = "Shows whether these options are set for an execution configuration.")
public boolean isExec;

Expand Down Expand Up @@ -984,7 +984,7 @@ public FragmentOptions getExec() {
exec.affectedByStarlarkTransition = affectedByStarlarkTransition;
exec.outputDirectoryNamingScheme = outputDirectoryNamingScheme;
exec.compilationMode = hostCompilationMode;
exec.isExec = false;
gregestren marked this conversation as resolved.
Show resolved Hide resolved
exec.isExec = true;
exec.execConfigurationDistinguisherScheme = execConfigurationDistinguisherScheme;
exec.outputPathsMode = outputPathsMode;
exec.enableRunfiles = enableRunfiles;
Expand Down Expand Up @@ -1048,6 +1048,9 @@ public FragmentOptions getExec() {
exec.allowUnresolvedSymlinks = allowUnresolvedSymlinks;

exec.usePlatformsRepoForConstraints = usePlatformsRepoForConstraints;

// Disable extra actions
exec.actionListeners = ImmutableList.of();
return exec;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,11 +124,6 @@ private static BuildOptions transitionImpl(BuildOptionsView options, Label execu
BuildOptionsView execOptions =
new BuildOptionsView(options.underlying().createExecOptions(), FRAGMENTS);

CoreOptions coreOptions = checkNotNull(execOptions.get(CoreOptions.class));
coreOptions.isExec = true;
// Disable extra actions
coreOptions.actionListeners = ImmutableList.of();

// Then set the target to the saved execution platform if there is one.
PlatformOptions platformOptions = execOptions.get(PlatformOptions.class);
if (platformOptions != null) {
Expand All @@ -154,10 +149,14 @@ private static BuildOptions transitionImpl(BuildOptionsView options, Label execu

// The conditional use of a Builder above may have replaced result and underlying options
// with a clone so must refresh it.
coreOptions = result.get(CoreOptions.class);
CoreOptions coreOptions = result.get(CoreOptions.class);
// TODO(blaze-configurability-team): These updates probably requires a bit too much knowledge
// of exactly how the immutable state and mutable state of BuildOptions is interacting.
// Might be good to have an option to wipeout that state rather than cloning so much.
// Note: It is important for correctness that the platformSuffix encodes whether the current
// configuration is an exec configuration or not as this determines which baseline config
// is used when computing the diff-based output directory suffix with
// --experimental_output_directory_naming_scheme=diff_against_baseline.
switch (coreOptions.execConfigurationDistinguisherScheme) {
case LEGACY:
coreOptions.platformSuffix =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,9 @@ public SkyValue compute(SkyKey skyKey, Environment env)
if (platformMappingValue == null) {
return null;
}
BuildOptions baselineOptions = PrecomputedValue.BASELINE_CONFIGURATION.get(env);
BuildOptions baselineOptions = targetOptions.get(CoreOptions.class).isExec
? PrecomputedValue.EXEC_BASELINE_CONFIGURATION.get(env)
: PrecomputedValue.BASELINE_CONFIGURATION.get(env);
try {
BuildOptions mappedBaselineOptions =
BuildConfigurationKey.withPlatformMapping(platformMappingValue, baselineOptions)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,8 @@ public static <T> Injected injected(Precomputed<T> precomputed, T value) {
// Unsharable because of complications in deserializing BuildOptions on startup due to caching.
public static final Precomputed<BuildOptions> BASELINE_CONFIGURATION =
new Precomputed<>("baseline_configuration", /*shareable=*/ false);
public static final Precomputed<BuildOptions> EXEC_BASELINE_CONFIGURATION =
new Precomputed<>("exec_baseline_configuration", /*shareable=*/ false);

private final Object value;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1271,6 +1271,8 @@ private void setStarlarkSemantics(StarlarkSemantics starlarkSemantics) {

public void setBaselineConfiguration(BuildOptions buildOptions) {
PrecomputedValue.BASELINE_CONFIGURATION.set(injectable(), buildOptions);
PrecomputedValue.EXEC_BASELINE_CONFIGURATION.set(injectable(),
buildOptions.createExecOptions());
}

public void injectExtraPrecomputedValues(List<PrecomputedValue.Injected> extraPrecomputedValues) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,10 @@ public final void initializeSkyframeExecutor() throws Exception {
PrecomputedValue.BASELINE_CONFIGURATION,
BuildOptions.getDefaultBuildOptionsForFragments(
ImmutableList.of(CoreOptions.class))),
PrecomputedValue.injected(
PrecomputedValue.EXEC_BASELINE_CONFIGURATION,
BuildOptions.getDefaultBuildOptionsForFragments(
ImmutableList.of(CoreOptions.class)).createExecOptions()),
PrecomputedValue.injected(
RepositoryDelegatorFunction.RESOLVED_FILE_INSTEAD_OF_WORKSPACE, Optional.empty()),
PrecomputedValue.injected(
Expand Down