@Incubating public interface TwirlSourceSet extends LanguageSourceSet
apply plugin: 'play'
model {
components {
play {
sources {
withType(TwirlSourceSet) {
// Use template format views.formats.csv.CsvFormat for all files named *.scala.csv
// Additionally, include views.formats.csv._ package imports in generated sources.
addUserTemplateFormat("csv", "views.formats.csv.CsvFormat", "views.formats.csv._")
// Add these additional imports to all generated Scala code from Twirl templates
additionalImports = [ 'my.pkg._', 'my.pkg.MyClass' ]
}
}
}
}
}
Named.Namer| Modifier and Type | Method and Description |
|---|---|
void |
addUserTemplateFormat(String extension,
String templateType,
String... imports)
Adds a custom template format.
|
List<String> |
getAdditionalImports()
Returns the list of additional imports to add to the generated Scala code.
|
TwirlImports |
getDefaultImports()
The default imports that should be added to generated source files
|
List<TwirlTemplateFormat> |
getUserTemplateFormats()
Returns the custom template formats configured for this source set.
|
void |
setAdditionalImports(List<String> additionalImports)
Sets the additional imports to add to all generated Scala code.
|
void |
setDefaultImports(TwirlImports defaultImports)
Sets the default imports that should be added to generated source files to the given language
|
void |
setUserTemplateFormats(List<TwirlTemplateFormat> userTemplateFormats)
Sets the custom template formats for this source set.
|
generatedBy, getParentName, getSourcebuiltBy, getBuildTask, hasBuildDependencies, setBuildTaskgetBuildDependenciesgetProjectPathgetDisplayName, getNameTwirlImports getDefaultImports()
void setDefaultImports(TwirlImports defaultImports)
List<TwirlTemplateFormat> getUserTemplateFormats()
void setUserTemplateFormats(List<TwirlTemplateFormat> userTemplateFormats)
void addUserTemplateFormat(String extension, String templateType, String... imports)
extension - file extension this template applies to (e.g., html).templateType - fully-qualified type for this template format.imports - additional imports to add for the custom template format.List<String> getAdditionalImports()