From 22bc76f08332f9918cff14d564eee6fd62785929 Mon Sep 17 00:00:00 2001 From: Fabian Meumertzheim Date: Thu, 6 Apr 2023 07:24:42 +0200 Subject: [PATCH] Move CoreOptions exec modifiations out of ExecutionTransitionFactory Now that the host configuration is gone, fixed changes to the `CoreOptions` when switching to the exec configuration are better handled in `CoreOptions#getExec`. --- .../devtools/build/lib/analysis/config/CoreOptions.java | 5 ++++- .../lib/analysis/config/ExecutionTransitionFactory.java | 7 +------ 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/src/main/java/com/google/devtools/build/lib/analysis/config/CoreOptions.java b/src/main/java/com/google/devtools/build/lib/analysis/config/CoreOptions.java index dcf0966c2b9106..a0919e97293faf 100644 --- a/src/main/java/com/google/devtools/build/lib/analysis/config/CoreOptions.java +++ b/src/main/java/com/google/devtools/build/lib/analysis/config/CoreOptions.java @@ -984,7 +984,7 @@ public FragmentOptions getExec() { exec.affectedByStarlarkTransition = affectedByStarlarkTransition; exec.outputDirectoryNamingScheme = outputDirectoryNamingScheme; exec.compilationMode = hostCompilationMode; - exec.isExec = false; + exec.isExec = true; exec.execConfigurationDistinguisherScheme = execConfigurationDistinguisherScheme; exec.outputPathsMode = outputPathsMode; exec.enableRunfiles = enableRunfiles; @@ -1048,6 +1048,9 @@ public FragmentOptions getExec() { exec.allowUnresolvedSymlinks = allowUnresolvedSymlinks; exec.usePlatformsRepoForConstraints = usePlatformsRepoForConstraints; + + // Disable extra actions + exec.actionListeners = ImmutableList.of(); return exec; } diff --git a/src/main/java/com/google/devtools/build/lib/analysis/config/ExecutionTransitionFactory.java b/src/main/java/com/google/devtools/build/lib/analysis/config/ExecutionTransitionFactory.java index a613ff3070cbb5..977a058a236bae 100644 --- a/src/main/java/com/google/devtools/build/lib/analysis/config/ExecutionTransitionFactory.java +++ b/src/main/java/com/google/devtools/build/lib/analysis/config/ExecutionTransitionFactory.java @@ -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) { @@ -154,7 +149,7 @@ 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.