Skip to content

Commit

Permalink
Use TemplateMetadata in TemplateExpansionAction.execute() instead of …
Browse files Browse the repository at this point in the history
…passing

arguments separately.

PiperOrigin-RevId: 525125577
Change-Id: I952873d29b75175451186615d17e11471a4bf0d1
  • Loading branch information
buildbreaker2021 authored and fweikert committed May 25, 2023
1 parent 12910fe commit 9865ad0
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -172,10 +172,12 @@ public ActionResult execute(ActionExecutionContext ctx)
return TemplateExpansionAction.execute(
/* actionExecutionContext= */ ctx,
/* action= */ this,
Template.forArtifact(template),
getPrimaryOutput(),
substitutionList,
/* makeExecutable= */ false);
TemplateExpansionContext.TemplateMetadata.builder()
.setTemplate(Template.forArtifact(template))
.setPrimaryOutput(getPrimaryOutput())
.setSubstitutions(substitutionList)
.setMakeExecutable(false)
.build());
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,24 +131,13 @@ public TemplateExpansionAction(ActionOwner owner,
static ActionResult execute(
ActionExecutionContext actionExecutionContext,
AbstractAction action,
Template template,
Artifact primaryOutput,
List<Substitution> substitutions,
boolean makeExecutable)
TemplateExpansionContext.TemplateMetadata templateMetadata)
throws ActionExecutionException, InterruptedException {
try {
ImmutableList<SpawnResult> result =
actionExecutionContext
.getContext(TemplateExpansionContext.class)
.expandTemplate(
action,
actionExecutionContext,
TemplateExpansionContext.TemplateMetadata.builder()
.setTemplate(template)
.setPrimaryOutput(primaryOutput)
.setSubstitutions(ImmutableList.copyOf(substitutions))
.setMakeExecutable(makeExecutable)
.build());
.expandTemplate(action, actionExecutionContext, templateMetadata);

return ActionResult.create(result);
} catch (EvalException e) {
Expand All @@ -169,7 +158,14 @@ static ActionResult execute(
public ActionResult execute(ActionExecutionContext actionExecutionContext)
throws ActionExecutionException, InterruptedException {
return TemplateExpansionAction.execute(
actionExecutionContext, this, template, getPrimaryOutput(), substitutions, makeExecutable);
actionExecutionContext,
this,
TemplateExpansionContext.TemplateMetadata.builder()
.setTemplate(template)
.setPrimaryOutput(getPrimaryOutput())
.setSubstitutions(substitutions)
.setMakeExecutable(makeExecutable)
.build());
}

@VisibleForTesting
Expand Down

0 comments on commit 9865ad0

Please sign in to comment.