@CompileStatic @org.gradle.work.DisableCachingByDefault(because: What a forked compiler produces is not described by this task's inputs) abstract class GroovyPageForkCompileTask extends AbstractCompile
Abstract Gradle task for compiling templates, using GroovyPageForkedCompiler This Task is a Forked Java Task that is configurable with fork options provided by ViewCompileOptions
Not cacheable. A page is compiled by a forked Groovy, and what comes out depends on which
Groovy did it -- which this task's inputs do not describe, because AbstractCompile does
not track its own classpath: an application building a native image resolves Groovy 6, and one
training a cache resolves Groovy 5. Cached, the first build's pages were handed to the second,
which failed at the moment a page was first rendered, with
BUG! your call tried to do a property set -- long after the build said it had
succeeded.
Which Java did the compiling is described, by getJavaLauncher(). Which Groovy is not, and this stays uncacheable until it is.
Compiling them again costs seconds. Getting this wrong costs an afternoon.
| Type | Name and description |
|---|---|
ViewCompileOptions |
compileOptions |
Property<java.lang.Boolean> |
compileStaticWhether the pages this task compiles are compiled statically. |
Property<java.lang.Boolean> |
compileStaticStrictWhether the pages this task compiles are held to the names they declare. |
DirectoryProperty |
destinationDirectory |
ConfigurableFileCollection |
generatedViewsDirectories of pages the build generated, compiled in the same compilation as the source, each page named by its path under the directory holding it, as though it were in the source, where a page at the same path takes precedence. |
ConfigurableFileCollection |
grailsConfigurationPaths |
ConfigurableFileCollection |
optionalPagesFiles that each name, one per line, pages of the source that are optional, as paths relative to it. |
Property<java.lang.String> |
packageName |
Property<java.lang.String> |
serverpath |
FileTree |
source |
DirectoryProperty |
srcDirThe directory of the pages, which the compiler names them under. |
java.lang.String |
tmpDirPath |
| Constructor and description |
|---|
GroovyPageForkCompileTask(ExecOperations execOperations, ObjectFactory objectFactory) |
| Type Params | Return Type | Name and description |
|---|---|---|
|
protected void |
compile() |
|
void |
execute() |
|
protected java.lang.String |
getCompilerName() |
|
java.lang.String |
getFileExtension() |
|
abstract Property<JavaLauncher> |
getJavaLauncher()The Java runtime the pages are compiled by. |
|
FileTree |
getSource() |
|
void |
prepareArguments(java.util.List<java.lang.String> arguments) |
|
void |
setSource(java.lang.Object source) |
Whether the pages this task compiles are compiled statically.
Stated to the forked compiler as the grails.views.gsp.compileStatic system property,
which is the same setting grails-app/conf/application.yml carries and the same one the
running application reads, so that a page compiled here compiles the same way there.
Whether the pages this task compiles are held to the names they declare. See compileStatic.
Directories of pages the build generated, compiled in the same compilation as the source, each
page named by its path under the directory holding it, as though it were in the source, where a
page at the same path takes precedence. Part of getSource(), so a project whose only
pages are generated compiles them. One compilation rather than two, because each would write a
gsp/views.properties and an archive keeps only the first.
Files that each name, one per line, pages of the source that are optional, as paths relative to it. An optional page that does not compile is left out with a warning rather than failing the build: a page generated from a template a dependency supplies is an optimisation, and without it the page is produced when it is first rendered.
The directory of the pages, which the compiler names them under. Internal rather than an input directory: its pages are fingerprinted as part of getSource(), and it need not exist - a project whose only pages are generated, a plugin that scaffolds controllers and has no views of its own, has none, and an input directory that does not exist fails validation.
The Java runtime the pages are compiled by.
Compilation is forked, and a forked process runs whatever JVM it is given rather than the
one the project asked for. Left to itself it inherits the JVM running Gradle, so a project
declaring a toolchain gets its pages compiled by a different Java than everything else it
builds -- which shows up as an UnsupportedClassVersionError at the moment a page is
first rendered, long after the build called itself successful.
Nested rather than internal because the Java that did the compiling is part of what the result is: pages built by one are not left standing when the build asks for another.