@CompileStatic @org.gradle.api.tasks.CacheableTask abstract class AbstractGroovyTemplateCompileTask extends AbstractCompile
Abstract Gradle task for compiling templates, using GenericGroovyTemplateCompiler
Cacheable. What a view compiles to depends on the Groovy that compiles it and the classes it
is compiled against, which AbstractCompile declares as the classpath input, on the Java it
is compiled for, and on the Grails environment whose configuration it is compiled with, which is
getGrailsEnvironment().
Compiles every view, from an empty destination, each time it runs; see ViewCompileDestination. The compiler leaves the class of a view that is gone, which would otherwise be carried into the archive and the build cache.
| Type | Name and description |
|---|---|
ViewCompileOptions |
compileOptions |
Property<java.lang.String> |
compilerName |
Property<java.lang.String> |
fileExtension |
ConfigurableFileCollection |
grailsConfigurationPaths |
Property<java.lang.String> |
grailsEnvironmentThe Grails environment the views are compiled for, by name. |
Property<java.lang.String> |
packageName |
SetProperty<java.lang.String> |
projectPackageNames |
Property<java.lang.String> |
scriptBaseName |
FileTree |
source |
DirectoryProperty |
srcDir |
| Constructor and description |
|---|
AbstractGroovyTemplateCompileTask(ExecOperations execOperations, ObjectFactory objectFactory, java.lang.String extensionDefault, java.lang.String scriptBaseNameDefault, java.lang.String compilerNameDefault) |
| Type Params | Return Type | Name and description |
|---|---|---|
|
void |
execute(InputChanges inputs) |
|
protected FileSystemOperations |
getFileSystemOperations()Gradle's file operations, which empty the destination; Gradle supplies them to the task it generates. |
|
java.util.Set<java.lang.String> |
getProjectPackageNames(java.io.File baseDir) |
|
FileTree |
getSource() |
|
java.lang.String |
getStatedEnvironment()The environment stated to the forked compiler, as the grails.env system property in
place of any the fork options name, so that nothing the compiler inherits decides:
getGrailsEnvironment() by the environment's full name, which is what the views are
compiled for and so what the cache key holds. |
|
protected java.lang.Object |
populatePackages(java.io.File rootDir, java.util.Collection<java.lang.String> packageNames, java.lang.String prefix) |
|
void |
prepareArguments(java.util.List<java.lang.String> arguments) |
|
void |
setSource(java.lang.Object source) |
The Grails environment the views are compiled for, by name.
A view is compiled against the configuration of one environment: the forked compiler merges
that environment's block of application.yml over the rest before it reads the settings
of its view type. The environment is therefore part of what the views are, and part of the cache
key, so views compiled for one environment are not restored into a build for another.
Defaults as ViewCompileEnvironment.defaultFor says: to an environment the fork
options of getCompileOptions() already name, else to the one the build runs with, else
to development. Read as getStatedEnvironment(), which is the input.
Gradle's file operations, which empty the destination; Gradle supplies them to the task it generates.
The environment stated to the forked compiler, as the grails.env system property in
place of any the fork options name, so that nothing the compiler inherits decides:
getGrailsEnvironment() by the environment's full name, which is what the views are
compiled for and so what the cache key holds. A blank grailsEnvironment fails the build
here, before anything is compiled or removed.