public final class SoyFileSet extends Object
Note: Soy file (or resource) contents must be encoded in UTF-8.
| Modifier and Type | Class and Description |
|---|---|
static class |
SoyFileSet.Builder
Builder for a
SoyFileSet. |
static interface |
SoyFileSet.SoyFileSetFactory
Injectable factory for creating an instance of this class.
|
| Modifier and Type | Method and Description |
|---|---|
static SoyFileSet.Builder |
builder()
Creates a builder with the standard set of Soy directives, functions, and types.
|
SoySauce |
compileTemplates()
This is an extremely experimental API and subject to change.
|
List<String> |
compileToIncrementalDomSrc(SoyJsSrcOptions jsSrcOptions)
Compiles this Soy file set into iDOM source code files and returns these JS files as a list of
strings, one per file.
|
List<String> |
compileToJsSrc(SoyJsSrcOptions jsSrcOptions,
SoyMsgBundle msgBundle)
Compiles this Soy file set into JS source code files and returns these JS files as a list of
strings, one per file.
|
void |
compileToPySrcFiles(String outputPathFormat,
String inputFilePathPrefix,
SoyPySrcOptions pySrcOptions)
Compiles this Soy file set into Python source code files and writes these Python files to
disk.
|
SoyTofu |
compileToTofu()
Compiles this Soy file set into a Java object (type
SoyTofu) capable of rendering the
compiled templates. |
SoyMsgBundle |
extractMsgs()
Extracts all messages from this Soy file set into a SoyMsgBundle (which can then be turned
into an extracted messages file with the help of a SoyMsgBundleHandler).
|
SoyMsgBundle |
pruneTranslatedMsgs(SoyMsgBundle origTransMsgBundle)
Prunes messages from a given message bundle, keeping only messages used in this Soy file set.
|
public static SoyFileSet.Builder builder()
If you need additional directives, functions, or types, create the Builder instance using Guice. If your project doesn't otherwise use Guice, you can just use Guice.createInjector with only the modules you need, similar to the implementation of this method.
public SoyMsgBundle extractMsgs()
SoyCompilationException - If compilation fails.public SoyMsgBundle pruneTranslatedMsgs(SoyMsgBundle origTransMsgBundle)
Important: Do not use directly. This is subject to change and your code will break.
Note: This method memoizes intermediate results to improve efficiency in the case that it is called multiple times (which is a common case). Thus, this method will not work correctly if the underlying Soy files are modified between calls to this method.
origTransMsgBundle - The message bundle to prune.SoyCompilationException - If compilation fails.public SoyTofu compileToTofu()
SoyTofu) capable of rendering the
compiled templates.SoyTofu object.SoyCompilationException - If compilation fails.public SoySauce compileTemplates()
See com/google/template/soy/jbcsrc/README.md for background on this new backend.
Compiles this Soy file set into a set of java classes implementing the
CompiledTemplate interface.
SoyCompilationException - If compilation fails.public List<String> compileToJsSrc(SoyJsSrcOptions jsSrcOptions, @Nullable SoyMsgBundle msgBundle)
jsSrcOptions - The compilation options for the JS Src output target.msgBundle - The bundle of translated messages, or null to use the messages from the Soy
source.SoyCompilationException - If compilation fails.public List<String> compileToIncrementalDomSrc(SoyJsSrcOptions jsSrcOptions) throws IOException
jsSrcOptions - The compilation options for the JS Src output target.SoyCompilationException - If compilation fails.IOExceptionpublic void compileToPySrcFiles(String outputPathFormat, String inputFilePathPrefix, SoyPySrcOptions pySrcOptions) throws IOException
outputPathFormat - The format string defining how to build the output file path
corresponding to an input file path.inputFilePathPrefix - The prefix prepended to all input file paths (can be empty string).pySrcOptions - The compilation options for the Python Src output target.SoyCompilationException - If compilation fails.IOException - If there is an error in opening/reading a message file or opening/writing
an output JS file.