@Override
    public SoyFileSet run() throws Exception {
      Builder builder = SoyFileSet.builder();

      for (TemplateResource templateResource : _templateResources) {
        String templateContent = getTemplateContent(templateResource);

        builder.add(templateContent, templateResource.getTemplateId());
      }

      return builder.build();
    }
  protected SoyFileSet getSoyFileSet(List<TemplateResource> templateResources) throws Exception {

    SoyFileSet soyFileSet = null;

    if (_privileged) {
      soyFileSet =
          AccessController.doPrivileged(new TemplatePrivilegedExceptionAction(templateResources));
    } else {
      Builder builder = SoyFileSet.builder();

      for (TemplateResource templateResource : templateResources) {
        String templateContent = getTemplateContent(templateResource);

        builder.add(templateContent, templateResource.getTemplateId());
      }

      soyFileSet = builder.build();
    }

    return soyFileSet;
  }
Пример #3
0
 static {
   SoyFileSet.Builder builder = SoyFileSet.builder();
   builder.add(Resources.getResource(ModulesHandler.class, "modules.soy"));
   SoyFileSet fileSet = builder.build();
   TOFU = fileSet.compileToTofu();
 }