@groovy.transform.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 |
grailsConfigurationPaths |
Property<java.lang.String> |
packageName |
Property<java.lang.String> |
serverpath |
FileTree |
source |
DirectoryProperty |
srcDir |
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.
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.