Skip to content

Commit 6d0716d

Browse files
gregestrencopybara-github
authored andcommitted
Remove native exec transition API.
This is a no-op: Bazel applies the equivalent logic through https://github.com/bazelbuild/bazel/blob/86b157aee418b5c95349060eeabbeb3ac22d8125/src/main/starlark/builtins_bzl/common/builtin_exec_platforms.bzl . PiperOrigin-RevId: 584702620 Change-Id: I50d76400a2a72be76cecc41503c9e59cb6d883c7
1 parent f596485 commit 6d0716d

24 files changed

Lines changed: 5 additions & 534 deletions

src/main/java/com/google/devtools/build/lib/analysis/PlatformOptions.java

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -171,20 +171,6 @@ public static boolean platformIsDefault(Label platform) {
171171
+ " 'test'.")
172172
public List<Map.Entry<RegexFilter, List<Label>>> targetFilterToAdditionalExecConstraints;
173173

174-
@Override
175-
public PlatformOptions getExec() {
176-
PlatformOptions exec = (PlatformOptions) getDefault();
177-
exec.platforms =
178-
this.hostPlatform == null ? ImmutableList.of() : ImmutableList.of(this.hostPlatform);
179-
exec.hostPlatform = this.hostPlatform;
180-
exec.platformMappings = this.platformMappings;
181-
exec.extraExecutionPlatforms = this.extraExecutionPlatforms;
182-
exec.extraToolchains = this.extraToolchains;
183-
exec.toolchainResolutionDebug = this.toolchainResolutionDebug;
184-
exec.useToolchainResolutionForJavaRules = this.useToolchainResolutionForJavaRules;
185-
return exec;
186-
}
187-
188174
@Override
189175
public PlatformOptions getNormalized() {
190176
PlatformOptions result = (PlatformOptions) clone();

src/main/java/com/google/devtools/build/lib/analysis/ShellConfiguration.java

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -91,12 +91,5 @@ public static class Options extends FragmentOptions {
9191
+ "to build failures or runtime failures of the generated binaries."
9292
)
9393
public PathFragment shellExecutable;
94-
95-
@Override
96-
public Options getExec() {
97-
Options exec = (Options) getDefault();
98-
exec.shellExecutable = shellExecutable;
99-
return exec;
100-
}
10194
}
10295
}

src/main/java/com/google/devtools/build/lib/analysis/config/BuildOptions.java

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -79,15 +79,6 @@ public static BuildOptions getDefaultBuildOptionsForFragments(
7979
}
8080
}
8181

82-
/** Creates a new BuildOptions instance for an exec configuration. */
83-
public BuildOptions createExecOptions() {
84-
Builder builder = builder();
85-
for (FragmentOptions options : fragmentOptionsMap.values()) {
86-
builder.addFragmentOptions(options.getExec());
87-
}
88-
return builder.addStarlarkOptions(starlarkOptionsMap).build();
89-
}
90-
9182
/**
9283
* Creates a BuildOptions class by taking the option values from an options provider (eg. an
9384
* OptionsParser).

src/main/java/com/google/devtools/build/lib/analysis/config/CoreOptions.java

Lines changed: 0 additions & 89 deletions
Original file line numberDiff line numberDiff line change
@@ -87,19 +87,6 @@ public class CoreOptions extends FragmentOptions implements Cloneable {
8787
+ "internal logic.")
8888
public String starlarkExecConfig;
8989

90-
@Option(
91-
name = "experimental_exec_config_diff",
92-
defaultValue = "false",
93-
documentationCategory = OptionDocumentationCategory.UNDOCUMENTED,
94-
effectTags = {OptionEffectTag.BAZEL_INTERNAL_CONFIGURATION},
95-
metadataTags = {OptionMetadataTag.EXPERIMENTAL},
96-
help =
97-
"For debugging --experimental_exec_config only: if set and --experimental_exec_config is"
98-
+ " set, Bazel also runs internal logic on `cfg = \"exec\"` transitions and prints "
99-
+ "the diff between that and the Starlark transition to the screen. "
100-
+ "`cfg = \"exec\"` semantics still use the Starlark transition.")
101-
public boolean execConfigDiff;
102-
10390
@Option(
10491
name = "experimental_platform_in_output_dir",
10592
defaultValue = "false",
@@ -951,82 +938,6 @@ public IncludeConfigFragmentsEnumConverter() {
951938
}
952939
}
953940

954-
@Override
955-
public FragmentOptions getExec() {
956-
CoreOptions exec = (CoreOptions) getDefault();
957-
958-
exec.compilationMode = hostCompilationMode;
959-
exec.isExec = false;
960-
exec.outputPathsMode = outputPathsMode;
961-
exec.enableRunfiles = enableRunfiles;
962-
exec.commandLineBuildVariables = commandLineBuildVariables;
963-
exec.enforceConstraints = enforceConstraints;
964-
exec.mergeGenfilesDirectory = mergeGenfilesDirectory;
965-
exec.cpu = hostCpu;
966-
exec.includeRequiredConfigFragmentsProvider = includeRequiredConfigFragmentsProvider;
967-
exec.debugSelectsAlwaysSucceed = debugSelectsAlwaysSucceed;
968-
exec.checkTestonlyForOutputFiles = checkTestonlyForOutputFiles;
969-
exec.useAutoExecGroups = useAutoExecGroups;
970-
exec.experimentalWritableOutputs = experimentalWritableOutputs;
971-
exec.strictConflictChecks = strictConflictChecks;
972-
exec.disallowUnsoundDirectoryOutputs = disallowUnsoundDirectoryOutputs;
973-
974-
// === Output path calculation
975-
exec.outputDirectoryNamingScheme = outputDirectoryNamingScheme;
976-
exec.execConfigurationDistinguisherScheme = execConfigurationDistinguisherScheme;
977-
exec.platformInOutputDir = platformInOutputDir;
978-
exec.usePlatformsInOutputDirLegacyHeuristic = usePlatformsInOutputDirLegacyHeuristic;
979-
exec.overrideNamePlatformInOutputDirEntries = overrideNamePlatformInOutputDirEntries;
980-
981-
// === Runfiles ===
982-
exec.buildRunfileManifests = buildRunfileManifests;
983-
exec.buildRunfileLinks = buildRunfileLinks;
984-
exec.legacyExternalRunfiles = legacyExternalRunfiles;
985-
exec.remotableSourceManifestActions = remotableSourceManifestActions;
986-
exec.alwaysIncludeFilesToBuildInData = alwaysIncludeFilesToBuildInData;
987-
988-
// === Filesets ===
989-
exec.strictFilesetOutput = strictFilesetOutput;
990-
exec.strictFilesets = strictFilesets;
991-
992-
// === Linkstamping ===
993-
// Disable all link stamping for the exec configuration, to improve action
994-
// cache hit rates for tools.
995-
exec.stampBinaries = false;
996-
997-
// === Visibility ===
998-
exec.checkVisibility = checkVisibility;
999-
1000-
// === Licenses ===
1001-
exec.checkLicenses = checkLicenses;
1002-
1003-
// === Pass on C++ compiler features.
1004-
exec.incompatibleUseHostFeatures = incompatibleUseHostFeatures;
1005-
exec.hostFeatures = ImmutableList.copyOf(hostFeatures);
1006-
if (incompatibleUseHostFeatures) {
1007-
exec.defaultFeatures = ImmutableList.copyOf(hostFeatures);
1008-
} else {
1009-
exec.defaultFeatures = ImmutableList.copyOf(defaultFeatures);
1010-
}
1011-
1012-
// Save host options in case of a further exec->host transition.
1013-
exec.hostCpu = hostCpu;
1014-
exec.hostCompilationMode = hostCompilationMode;
1015-
1016-
// Pass exec action environment variables
1017-
exec.actionEnvironment = hostActionEnvironment;
1018-
exec.hostActionEnvironment = hostActionEnvironment;
1019-
1020-
// Pass archived tree artifacts filter.
1021-
exec.archivedArtifactsMnemonicsFilter = archivedArtifactsMnemonicsFilter;
1022-
1023-
exec.allowUnresolvedSymlinks = allowUnresolvedSymlinks;
1024-
1025-
exec.starlarkExecConfig = starlarkExecConfig;
1026-
exec.execConfigDiff = execConfigDiff;
1027-
return exec;
1028-
}
1029-
1030941
/// Normalizes --define flags, preserving the last one to appear in the event of conflicts.
1031942
public ImmutableMap<String, String> getNormalizedCommandLineBuildVariables() {
1032943
return sortEntries(normalizeEntries(commandLineBuildVariables)).stream()

src/main/java/com/google/devtools/build/lib/analysis/config/FragmentOptions.java

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -47,15 +47,6 @@ public FragmentOptions getDefault() {
4747
return Options.getDefaults(getClass());
4848
}
4949

50-
/**
51-
* Creates a new instance of this {@code FragmentOptions} with all flags adjusted as needed to
52-
* represent the execution platform.
53-
*/
54-
@SuppressWarnings("unused")
55-
public FragmentOptions getExec() {
56-
return getDefault();
57-
}
58-
5950
/**
6051
* Returns an instance of {@code FragmentOptions} with all flags adjusted to be suitable for
6152
* forming configurations.
@@ -82,7 +73,7 @@ public FragmentOptions getNormalized() {
8273

8374
/**
8475
* Helper method for subclasses to normalize set valued options. In addition to removing
85-
* duplicates, it picks a deterministic ordering. The fact that the determinisitic ordering is
76+
* duplicates, it picks a deterministic ordering. The fact that the deterministic ordering is
8677
* based on sorting is an accident and should NOT be relied upon.
8778
*/
8879
protected static ImmutableList<String> dedupAndSort(@Nullable List<String> values) {

src/main/java/com/google/devtools/build/lib/analysis/starlark/FunctionTransitionUtil.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ private static BuildOptions maybeGetExecDefaults(
155155
// Propagate Starlark options from the source config:
156156
// TODO(b/288258583) don't automatically propagate Starlark options.
157157
defaultBuilder.addStarlarkOptions(fromOptions.getStarlarkOptions());
158-
// Hard-code TestConfiguration.getExec() for now, which clones the source options.
158+
// Hard-code TestConfiguration for now, which clones the source options.
159159
// TODO(b/295936652): handle this directly in Starlark. This has two complications:
160160
// 1: --trim_test_configuration means the flags may not exist. Starlark logic needs to handle
161161
// that possibility.

src/main/java/com/google/devtools/build/lib/analysis/test/TestConfiguration.java

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -303,18 +303,6 @@ public static class TestOptions extends FragmentOptions {
303303
+ "If false, a test runner that does not support sharding will lead to all tests "
304304
+ "running in each shard.")
305305
public boolean checkShardingSupport;
306-
307-
@Override
308-
public FragmentOptions getExec() {
309-
// Options here are either:
310-
// 1. Applicable only for the test actions, which are relevant only for the top-level targets
311-
// before exec transitions can apply.
312-
// 2. Supposed to be build-universal and thus non-transitionable anyways
313-
// (e.g. trim_test_configuration)
314-
// And thus the options should just be copied and not reset by the exec transition (as
315-
// resetting them has incremental performance drawbacks when these options change).
316-
return clone();
317-
}
318306
}
319307

320308
private final TestOptions options;

src/main/java/com/google/devtools/build/lib/bazel/BazelConfiguration.java

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -39,14 +39,6 @@ public static class Options extends FragmentOptions {
3939
metadataTags = {OptionMetadataTag.INCOMPATIBLE_CHANGE},
4040
help = "If enabled, visibility checking also applies to toolchain implementations.")
4141
public boolean checkVisibilityForToolchains;
42-
43-
@Override
44-
public FragmentOptions getExec() {
45-
Options exec = (Options) getDefault();
46-
exec.checkVisibilityForToolchains = checkVisibilityForToolchains;
47-
48-
return exec;
49-
}
5042
}
5143

5244
private final Options options;

src/main/java/com/google/devtools/build/lib/bazel/rules/BazelRuleClassProvider.java

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -156,13 +156,6 @@ public static class StrictActionEnvOptions extends FragmentOptions {
156156
+ "inherit specific environment variables from the client, but note that doing so "
157157
+ "can prevent cross-user caching if a shared cache is used.")
158158
public boolean useStrictActionEnv;
159-
160-
@Override
161-
public StrictActionEnvOptions getExec() {
162-
StrictActionEnvOptions exec = (StrictActionEnvOptions) getDefault();
163-
exec.useStrictActionEnv = useStrictActionEnv;
164-
return exec;
165-
}
166159
}
167160

168161
private static final PathFragment FALLBACK_SHELL = PathFragment.create("/bin/bash");

src/main/java/com/google/devtools/build/lib/bazel/rules/python/BazelPythonConfiguration.java

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -96,12 +96,6 @@ public static final class Options extends FragmentOptions {
9696
+ "`import myreponame.mytoplevelpackage.package.module` is valid. The latter form "
9797
+ "is less likely to experience import name collisions.")
9898
public boolean experimentalPythonImportAllRepositories;
99-
100-
/** Make Python configuration options available for exec configurations as well */
101-
@Override
102-
public FragmentOptions getExec() {
103-
return clone(); // exec options are the same as target options
104-
}
10599
}
106100

107101
private final Options options;

0 commit comments

Comments
 (0)