/** * Builds the new {@code SoyFileSet}. * * @return The new {@code SoyFileSet}. */ public SoyFileSet build() { return new SoyFileSet( coreDependencies.scopedData, typeRegistryBuilder.build(), ImmutableMap.<String, SoyFunction>builder() .putAll(InternalPlugins.internalLegacyFunctionMap()) .putAll(coreDependencies.pluginFunctions) .putAll(InternalPlugins.fromLegacyFunctions(extraSoyFunctions.build())) .build(), ImmutableMap.<String, SoyPrintDirective>builder() .putAll(InternalPlugins.internalDirectiveMap(coreDependencies.scopedData)) .putAll(coreDependencies.pluginDirectives) .putAll(InternalPlugins.fromDirectives(extraSoyPrintDirectives.build())) .build(), ImmutableMap.<String, SoySourceFunction>builder() .putAll(InternalPlugins.internalFunctionMap(coreDependencies.scopedData)) .putAll(InternalPlugins.fromFunctions(extraSourceFunctions.build())) .build(), filesBuilder.build(), getGeneralOptions(), cache, conformanceConfig, loggingConfig, warningSink); }
/** * Sets the user-declared syntax version name for the Soy file bundle. * * @param versionName The syntax version name, e.g. "1.0", "2.0", "2.3". */ public Builder setDeclaredSyntaxVersionName(@Nonnull String versionName) { getGeneralOptions().setDeclaredSyntaxVersionName(versionName); return this; }
/** * Builds the new {@code SoyFileSet}. * * @return The new {@code SoyFileSet}. */ public SoyFileSet build() { return new SoyFileSet( coreDependencies.apiCallScope, typeRegistryBuilder.build(), coreDependencies.soyFunctionMap, coreDependencies.printDirectives, filesBuilder.build(), getGeneralOptions(), cache, conformanceConfig, loggingConfig, warningSink); }
/** * Sets the file containing compile-time globals. * * <p>Each line of the file should have the format * * <pre> * <global_name> = <primitive_data> * </pre> * * where primitive_data is a valid Soy expression literal for a primitive type (null, boolean, * integer, float, or string). Empty lines and lines beginning with "//" are ignored. The file * should be encoded in UTF-8. * * <p>If you need to generate a file in this format from Java, consider using the utility {@code * SoyUtils.generateCompileTimeGlobalsFile()}. * * @param compileTimeGlobalsFile The file containing compile-time globals. * @return This builder. * @throws IOException If there is an error reading the compile-time globals file. */ public Builder setCompileTimeGlobals(File compileTimeGlobalsFile) throws IOException { getGeneralOptions().setCompileTimeGlobals(compileTimeGlobalsFile); return this; }
/** * Sets the resource file containing compile-time globals. * * <p>Each line of the file should have the format * * <pre> * <global_name> = <primitive_data> * </pre> * * where primitive_data is a valid Soy expression literal for a primitive type (null, boolean, * integer, float, or string). Empty lines and lines beginning with "//" are ignored. The file * should be encoded in UTF-8. * * <p>If you need to generate a file in this format from Java, consider using the utility {@code * SoyUtils.generateCompileTimeGlobalsFile()}. * * @param compileTimeGlobalsResource The resource containing compile-time globals. * @return This builder. * @throws IOException If there is an error reading the compile-time globals file. */ public Builder setCompileTimeGlobals(URL compileTimeGlobalsResource) throws IOException { getGeneralOptions().setCompileTimeGlobals(compileTimeGlobalsResource); return this; }
/** * Sets the file containing compile-time globals. * * <p>Each line of the file should have the format * * <pre> * <global_name> = <primitive_data> * </pre> * * where primitive_data is a valid Soy expression literal for a primitive type (null, boolean, * integer, float, or string). Empty lines and lines beginning with "//" are ignored. The file * should be encoded in UTF-8. * * <p>If you need to generate a file in this format from Java, consider using the utility {@code * SoyUtils.generateCompileTimeGlobalsFile()}. * * @param compileTimeGlobalsFile The file containing compile-time globals. * @return This builder. * @throws IOException If there is an error reading the compile-time globals file. */ public Builder setCompileTimeGlobals(File compileTimeGlobalsFile) throws IOException { getGeneralOptions().setCompileTimeGlobals(compileTimeGlobalsFile); return this; }
/** * Sets the resource file containing compile-time globals. * * <p>Each line of the file should have the format * * <pre> * <global_name> = <primitive_data> * </pre> * * where primitive_data is a valid Soy expression literal for a primitive type (null, boolean, * integer, float, or string). Empty lines and lines beginning with "//" are ignored. The file * should be encoded in UTF-8. * * <p>If you need to generate a file in this format from Java, consider using the utility {@code * SoyUtils.generateCompileTimeGlobalsFile()}. * * @param compileTimeGlobalsResource The resource containing compile-time globals. * @return This builder. * @throws IOException If there is an error reading the compile-time globals file. */ public Builder setCompileTimeGlobals(URL compileTimeGlobalsResource) throws IOException { getGeneralOptions().setCompileTimeGlobals(compileTimeGlobalsResource); return this; }
/** * Sets the map from compile-time global name to value. * * <p>The values can be any of the Soy primitive types: null, boolean, integer, float (Java * double), or string. * * @param compileTimeGlobalsMap Map from compile-time global name to value. The values can be * any of the Soy primitive types: null, boolean, integer, float (Java double), or string. * @return This builder. * @throws IllegalArgumentException If one of the values is not a valid Soy primitive type. */ public Builder setCompileTimeGlobals(Map<String, ?> compileTimeGlobalsMap) { getGeneralOptions().setCompileTimeGlobals(compileTimeGlobalsMap); return this; }
/** * Sets the map from compile-time global name to value. * * <p>The values can be any of the Soy primitive types: null, boolean, integer, float (Java * double), or string. * * @param compileTimeGlobalsMap Map from compile-time global name to value. The values can be * any of the Soy primitive types: null, boolean, integer, float (Java double), or string. * @return This builder. * @throws IllegalArgumentException If one of the values is not a valid Soy primitive type. */ public Builder setCompileTimeGlobals(Map<String, ?> compileTimeGlobalsMap) { getGeneralOptions().setCompileTimeGlobals(compileTimeGlobalsMap); return this; }
/** * Disables optimizer. The optimizer tries to simplify the Soy AST by evaluating constant * expressions. It generally improves performance and should only be disabled in integration * tests. * * <p>This is public only because we need to set it in {@code SoyFileSetHelper}, that are * necessary for integration tests. Normal users should not use this. * * @return This builder. */ public Builder disableOptimizer() { getGeneralOptions().disableOptimizer(); return this; }
/** * Disables optimizer. The optimizer tries to simplify the Soy AST by evaluating constant * expressions. It generally improves performance and should only be disabled in integration * tests. * * <p>This is public only because we need to set it in {@code SoyFileSetHelper}, that are * necessary for integration tests. Normal users should not use this. * * @return This builder. */ public Builder disableOptimizer() { getGeneralOptions().disableOptimizer(); return this; }
/** * Sets whether to force strict autoescaping. Enabling will cause compile time exceptions if * non-strict autoescaping is used in namespaces or templates. * * @param strictAutoescapingRequired Whether strict autoescaping is required. * @return This builder. */ public Builder setStrictAutoescapingRequired(boolean strictAutoescapingRequired) { getGeneralOptions().setStrictAutoescapingRequired(strictAutoescapingRequired); return this; }
/** * Sets experimental features. These features are unreleased and are not generally available. * * @param experimentalFeatures * @return This builder. */ public Builder setExperimentalFeatures(List<String> experimentalFeatures) { getGeneralOptions().setExperimentalFeatures(experimentalFeatures); return this; }
/** * Sets whether to allow external calls (calls to undefined templates). * * @param allowExternalCalls Whether to allow external calls (calls to undefined templates). * @return This builder. */ public Builder setAllowExternalCalls(boolean allowExternalCalls) { getGeneralOptions().setAllowExternalCalls(allowExternalCalls); return this; }
/** * Sets whether to allow external calls (calls to undefined templates). * * @param allowExternalCalls Whether to allow external calls (calls to undefined templates). * @return This builder. */ public Builder setAllowExternalCalls(boolean allowExternalCalls) { getGeneralOptions().setAllowExternalCalls(allowExternalCalls); return this; }
/** * Sets whether to force strict autoescaping. Enabling will cause compile time exceptions if * non-strict autoescaping is used in namespaces or templates. * * @param strictAutoescapingRequired Whether strict autoescaping is required. * @return This builder. */ public Builder setStrictAutoescapingRequired(boolean strictAutoescapingRequired) { getGeneralOptions().setStrictAutoescapingRequired(strictAutoescapingRequired); return this; }
/** * Sets experimental features. These features are unreleased and are not generally available. * * @param experimentalFeatures * @return This builder. */ public Builder setExperimentalFeatures(List<String> experimentalFeatures) { getGeneralOptions().setExperimentalFeatures(experimentalFeatures); return this; }