use of com.google.devtools.build.lib.skyframe.ActionTemplateExpansionValue.ActionTemplateExpansionKey in project bazel by bazelbuild.
the class ActionTemplateExpansionFunction method compute.
@Override
public SkyValue compute(SkyKey skyKey, Environment env) throws ActionTemplateExpansionFunctionException, InterruptedException {
ActionTemplateExpansionKey key = (ActionTemplateExpansionKey) skyKey.argument();
ActionTemplate actionTemplate = key.getActionTemplate();
// Requests the TreeArtifactValue object for the input TreeArtifact.
SkyKey artifactValueKey = ArtifactSkyKey.key(actionTemplate.getInputTreeArtifact(), true);
TreeArtifactValue treeArtifactValue = (TreeArtifactValue) env.getValue(artifactValueKey);
// Input TreeArtifact is not ready yet.
if (env.valuesMissing()) {
return null;
}
Iterable<TreeFileArtifact> inputTreeFileArtifacts = treeArtifactValue.getChildren();
Iterable<Action> expandedActions;
try {
// Expand the action template using the list of expanded input TreeFileArtifacts.
expandedActions = ImmutableList.<Action>copyOf(actionTemplate.generateActionForInputArtifacts(inputTreeFileArtifacts, key));
// TODO(rduan): Add a check to verify the inputs of expanded actions are subsets of inputs
// of the ActionTemplate.
checkActionAndArtifactConflicts(expandedActions);
} catch (ActionConflictException e) {
e.reportTo(env.getListener());
throw new ActionTemplateExpansionFunctionException(e);
} catch (ArtifactPrefixConflictException e) {
env.getListener().handle(Event.error(e.getMessage()));
throw new ActionTemplateExpansionFunctionException(e);
}
return new ActionTemplateExpansionValue(expandedActions);
}
Aggregations