Skip to content

Commit

Permalink
Inline and remove BuildConfigurationKey.withPlatformMapping.
Browse files Browse the repository at this point in the history
Next will be to rename `withoutPlatformMapping`.

Work towards platform-based flags: #19409.

PiperOrigin-RevId: 571363118
Change-Id: I170d83c8cc6550f33abeaa6b11cb58447104b134
  • Loading branch information
katre authored and copybara-github committed Oct 6, 2023
1 parent ba436cc commit 860612c
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,9 @@ private StateMachine applyMappings(Tasks tasks) {
String transitionKey = entry.getKey();
BuildConfigurationKey newConfigurationKey;
try {
newConfigurationKey =
BuildConfigurationKey.withPlatformMapping(
platformMappingValues.get(transitionKey), entry.getValue());
PlatformMappingValue mappingValue = platformMappingValues.get(transitionKey);
BuildOptions mappedOptions = mappingValue.map(entry.getValue());
newConfigurationKey = BuildConfigurationKey.withoutPlatformMapping(mappedOptions);
} catch (OptionsParsingException e) {
sink.acceptTransitionError(e);
return runAfter;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1807,7 +1807,8 @@ private BuildConfigurationKey createBuildConfigurationKey(

// Create the build configuration key.
try {
return BuildConfigurationKey.withPlatformMapping(platformMappingValue, buildOptions);
BuildOptions mappedOptions = platformMappingValue.map(buildOptions);
return BuildConfigurationKey.withoutPlatformMapping(mappedOptions);
} catch (OptionsParsingException e) {
throw new InvalidConfigurationException(Code.INVALID_BUILD_OPTIONS, e);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
import com.google.devtools.build.lib.skyframe.serialization.autocodec.AutoCodec;
import com.google.devtools.build.skyframe.SkyFunctionName;
import com.google.devtools.build.skyframe.SkyKey;
import com.google.devtools.common.options.OptionsParsingException;

/**
* {@link SkyKey} for {@link com.google.devtools.build.lib.analysis.config.BuildConfigurationValue}.
Expand All @@ -30,22 +29,6 @@ public final class BuildConfigurationKey implements SkyKey {

private static final SkyKeyInterner<BuildConfigurationKey> interner = SkyKey.newInterner();

/**
* Creates a new configuration key based on the given options, after applying a platform mapping
* transformation.
*
* @param platformMappingValue sky value that can transform a configuration key based on a
* platform mapping
* @param options the desired configuration
* @throws OptionsParsingException if the platform mapping cannot be parsed
*/
public static BuildConfigurationKey withPlatformMapping(
PlatformMappingValue platformMappingValue, BuildOptions options)
throws OptionsParsingException {
BuildOptions mappedOptions = platformMappingValue.map(options);
return BuildConfigurationKey.withoutPlatformMapping(mappedOptions);
}

/**
* Returns the key for a requested configuration.
*
Expand Down

0 comments on commit 860612c

Please sign in to comment.