Search in sources :

Example 6 with SoyJsSrcOptions

use of com.google.template.soy.jssrc.SoyJsSrcOptions in project closure-templates by google.

the class SoyToJsSrcCompiler method compile.

@Override
void compile(SoyFileSet.Builder sfsBuilder) throws IOException {
    if (!syntaxVersion.isEmpty()) {
        sfsBuilder.setDeclaredSyntaxVersionName(syntaxVersion);
    }
    sfsBuilder.setAllowExternalCalls(allowExternalCalls);
    SoyFileSet sfs = sfsBuilder.build();
    // Create SoyJsSrcOptions.
    SoyJsSrcOptions jsSrcOptions = new SoyJsSrcOptions();
    jsSrcOptions.setShouldProvideRequireSoyNamespaces(shouldProvideRequireSoyNamespaces);
    jsSrcOptions.setShouldGenerateGoogMsgDefs(shouldGenerateGoogMsgDefs);
    jsSrcOptions.setGoogMsgsAreExternal(googMsgsAreExternal);
    jsSrcOptions.setBidiGlobalDir(bidiGlobalDir);
    jsSrcOptions.setUseGoogIsRtlForBidiGlobalDir(useGoogIsRtlForBidiGlobalDir);
    // Compile.
    boolean generateLocalizedJs = !locales.isEmpty();
    if (generateLocalizedJs) {
        sfs.compileToJsSrcFiles(outputPathFormat, inputPrefix, jsSrcOptions, locales, messagePlugin, messageFilePathFormat);
    } else {
        sfs.compileToJsSrcFiles(outputPathFormat, inputPrefix, jsSrcOptions, locales, null, null);
    }
}
Also used : SoyJsSrcOptions(com.google.template.soy.jssrc.SoyJsSrcOptions)

Aggregations

SoyJsSrcOptions (com.google.template.soy.jssrc.SoyJsSrcOptions)6 Test (org.junit.Test)2 Injector (com.google.inject.Injector)1 ParseResult (com.google.template.soy.SoyFileSetParser.ParseResult)1 SoyModule (com.google.template.soy.SoyModule)1 BidiGlobalDir (com.google.template.soy.internal.i18n.BidiGlobalDir)1 CombineConsecutiveRawTextNodesPass (com.google.template.soy.passes.CombineConsecutiveRawTextNodesPass)1 GuiceSimpleScope (com.google.template.soy.shared.internal.GuiceSimpleScope)1 SoyTypeRegistry (com.google.template.soy.types.SoyTypeRegistry)1 Before (org.junit.Before)1