in src/main/java/com/googlesource/gerrit/plugins/its/base/workflow/AddSoyComment.java [54:77]
private String soyTextTemplate(
SoyFileSet.Builder builder, String template, Map<String, String> properties) {
Path templatePath = templateDir.resolve(template + ".soy");
String content;
try (Reader r = Files.newBufferedReader(templatePath, StandardCharsets.UTF_8)) {
content = CharStreams.toString(r);
} catch (IOException err) {
throw new ProvisionException(
"Failed to read template file " + templatePath.toAbsolutePath().toString(), err);
}
builder.add(content, templatePath.toAbsolutePath().toString());
Renderer renderer =
builder
.build()
.compileTemplates()
.renderTemplate("etc.its.templates." + template)
.setData(properties);
String rendered = renderer.renderText().get();
logger.atFinest().log("Rendered template %s to:\n%s", templatePath, rendered);
return rendered;
}