use of com.facebook.buck.step.fs.StringTemplateStep in project buck by facebook.
the class WriteStringTemplateRule method getBuildSteps.
@Override
public ImmutableList<Step> getBuildSteps(BuildContext context, BuildableContext buildableContext) {
buildableContext.recordArtifact(output);
ImmutableList.Builder<Step> steps = ImmutableList.builder();
steps.add(new MkdirStep(getProjectFilesystem(), output.getParent()));
steps.add(new StringTemplateStep(context.getSourcePathResolver().getAbsolutePath(template), getProjectFilesystem(), output, st -> {
for (Map.Entry<String, String> ent : values.entrySet()) {
st = st.add(ent.getKey(), ent.getValue());
}
return st;
}));
if (executable) {
steps.add(new AbstractExecutionStep("chmod +x") {
@Override
public StepExecutionResult execute(ExecutionContext context) throws IOException {
MoreFiles.makeExecutable(getProjectFilesystem().resolve(output));
return StepExecutionResult.of(0, Optional.empty());
}
});
}
return steps.build();
}
Aggregations