use of com.google.template.soy.pysrc.SoyPySrcOptions in project closure-templates by google.
the class SoyToPySrcCompiler method compile.
@Override
void compile(SoyFileSet.Builder sfsBuilder) throws IOException {
if (syntaxVersion.length() > 0) {
SyntaxVersion parsedVersion = SyntaxVersion.forName(syntaxVersion);
if (parsedVersion.num < SyntaxVersion.V2_0.num) {
exitWithError("Declared syntax version must be 2.0 or greater.");
}
sfsBuilder.setDeclaredSyntaxVersionName(syntaxVersion);
}
// Disallow external call entirely in Python.
sfsBuilder.setAllowExternalCalls(false);
// Require strict templates in Python.
sfsBuilder.setStrictAutoescapingRequired(true);
SoyFileSet sfs = sfsBuilder.build();
// Load the manifest if available.
ImmutableMap<String, String> manifest = loadNamespaceManifest(namespaceManifestPaths);
if (!manifest.isEmpty() && outputNamespaceManifest == null) {
exitWithError("Namespace manifests provided without outputting a new manifest.");
}
// Create SoyPySrcOptions.
SoyPySrcOptions pySrcOptions = new SoyPySrcOptions(runtimePath, environmentModulePath, bidiIsRtlFn, translationClass, manifest, outputNamespaceManifest);
// Compile.
sfs.compileToPySrcFiles(outputPathFormat, inputPrefix, pySrcOptions);
}
Aggregations