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

[7.3.0] Add basic C++ path mapping support #22876

Merged
merged 2 commits into from
Jul 10, 2024
Merged
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 @@ -42,6 +42,7 @@ public final class SimpleSpawn implements Spawn {
private final ImmutableList<ActionInput> outputs;
// If null, all outputs are mandatory.
@Nullable private final Set<? extends ActionInput> mandatoryOutputs;
private final PathMapper pathMapper;
private final LocalResourcesSupplier localResourcesSupplier;
private ResourceSet localResourcesCached;

Expand All @@ -57,7 +58,8 @@ private SimpleSpawn(
Collection<? extends ActionInput> outputs,
@Nullable final Set<? extends ActionInput> mandatoryOutputs,
@Nullable ResourceSet localResources,
@Nullable LocalResourcesSupplier localResourcesSupplier) {
@Nullable LocalResourcesSupplier localResourcesSupplier,
PathMapper pathMapper) {
this.owner = Preconditions.checkNotNull(owner);
this.arguments = Preconditions.checkNotNull(arguments);
this.environment = Preconditions.checkNotNull(environment);
Expand All @@ -81,6 +83,7 @@ private SimpleSpawn(
this.localResourcesSupplier = localResourcesSupplier;
this.localResourcesCached = null;
}
this.pathMapper = pathMapper;
}

public SimpleSpawn(
Expand All @@ -107,7 +110,8 @@ public SimpleSpawn(
outputs,
mandatoryOutputs,
localResources,
/*localResourcesSupplier=*/ null);
/* localResourcesSupplier= */ null,
PathMapper.NOOP);
}

@SuppressWarnings("TooManyParameters")
Expand All @@ -134,8 +138,67 @@ public SimpleSpawn(
tools,
outputs,
mandatoryOutputs,
/*localResources=*/ null,
localResourcesSupplier);
/* localResources= */ null,
localResourcesSupplier,
PathMapper.NOOP);
}

public SimpleSpawn(
ActionExecutionMetadata owner,
ImmutableList<String> arguments,
ImmutableMap<String, String> environment,
ImmutableMap<String, String> executionInfo,
RunfilesSupplier runfilesSupplier,
ImmutableMap<Artifact, ImmutableList<FilesetOutputSymlink>> filesetMappings,
NestedSet<? extends ActionInput> inputs,
NestedSet<? extends ActionInput> tools,
Collection<? extends ActionInput> outputs,
@Nullable Set<? extends ActionInput> mandatoryOutputs,
LocalResourcesSupplier localResourcesSupplier,
PathMapper pathMapper) {
this(
owner,
arguments,
environment,
executionInfo,
runfilesSupplier,
filesetMappings,
inputs,
tools,
outputs,
mandatoryOutputs,
/* localResources= */ null,
localResourcesSupplier,
pathMapper);
}

public SimpleSpawn(
ActionExecutionMetadata owner,
ImmutableList<String> arguments,
ImmutableMap<String, String> environment,
ImmutableMap<String, String> executionInfo,
RunfilesSupplier runfilesSupplier,
ImmutableMap<Artifact, ImmutableList<FilesetOutputSymlink>> filesetMappings,
NestedSet<? extends ActionInput> inputs,
NestedSet<? extends ActionInput> tools,
Collection<? extends ActionInput> outputs,
@Nullable Set<? extends ActionInput> mandatoryOutputs,
ResourceSet localResources,
PathMapper pathMapper) {
this(
owner,
arguments,
environment,
executionInfo,
runfilesSupplier,
filesetMappings,
inputs,
tools,
outputs,
mandatoryOutputs,
localResources,
/* localResourcesSupplier= */ null,
pathMapper);
}

public SimpleSpawn(
Expand All @@ -159,7 +222,8 @@ public SimpleSpawn(
outputs,
/* mandatoryOutputs= */ null,
localResources,
/* localResourcesSupplier= */ null);
/* localResourcesSupplier= */ null,
PathMapper.NOOP);
}

public SimpleSpawn(
Expand Down Expand Up @@ -265,6 +329,11 @@ public ResourceSet getLocalResources() throws ExecException {
return localResourcesCached;
}

@Override
public PathMapper getPathMapper() {
return pathMapper;
}

@Override
public String getMnemonic() {
return owner.getMnemonic();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.ImmutableSet;
import com.google.devtools.build.lib.actions.Artifact;
import com.google.devtools.build.lib.actions.PathMapper;
import com.google.devtools.build.lib.analysis.AnalysisUtils;
import com.google.devtools.build.lib.analysis.RuleContext;
import com.google.devtools.build.lib.analysis.config.BuildConfigurationValue;
Expand Down Expand Up @@ -305,7 +306,7 @@ public Dict<String, String> getEnvironmentVariable(
return Dict.immutableCopyOf(
featureConfiguration
.getFeatureConfiguration()
.getEnvironmentVariables(actionName, variables));
.getEnvironmentVariables(actionName, variables, PathMapper.NOOP));
}

@Override
Expand Down
Loading
Loading