@groovy.transform.CompileStatic @org.gradle.work.DisableCachingByDefault(because: Runs the application and records what it did, which is not reproducible) abstract class TrainAotCacheTask extends DefaultTask
Runs the application once so the JDK can write down what starting it needs.
The run is the point. A cache records the classes loaded and linked, and the profiles of the methods that ran, so the next start reads them rather than working them out again -- which means what the next start is fast at is whatever this run did. A run that only refreshes the context leaves every request path to be worked out on the day.
So the application is started, asked for the pages an application is asked for, and then asked to stop. It has to stop of its own accord: the cache is written as the JVM exits, and a run that is killed writes nothing.
| Constructor and description |
|---|
TrainAotCacheTask() |
| Type Params | Return Type | Name and description |
|---|---|---|
|
abstract DirectoryProperty |
getApplicationDirectory()The extracted application: the cache is only usable against the layout it was trained on. |
|
abstract Property<java.lang.String> |
getArchiveFileName() |
|
abstract RegularFileProperty |
getCacheFile() |
|
abstract Property<java.lang.String> |
getJavaExecutable() |
|
abstract Property<java.lang.String> |
getJavaVendor() |
|
abstract Property<java.lang.String> |
getJavaVersion()The version of the JDK above, which is the JDK the cache will only ever be readable by. |
|
abstract ListProperty<java.lang.String> |
getJvmArguments()Given to the training run, and to be given to every run that reads the cache. |
|
abstract RegularFileProperty |
getMetadataFile()Written beside the cache, so what the cache was made from can be checked before it is used. |
|
abstract ListProperty<java.lang.String> |
getPaths()The paths to ask for, so their methods are profiled rather than met for the first time later. |
|
abstract Property<java.lang.Integer> |
getPort() |
|
abstract Property<java.lang.Integer> |
getStartTimeoutSeconds() |
|
void |
train() |
The extracted application: the cache is only usable against the layout it was trained on.
Compared by what is in it and where each file sits within it, not by where the directory itself is. Without saying so, Gradle takes the absolute path to be part of the input and refuses to validate the task at all -- and a build that did run would key its result to a path, so the same application checked out somewhere else, or built on CI, would agree about everything and still share nothing.
The version of the JDK above, which is the JDK the cache will only ever be readable by.
Given to the training run, and to be given to every run that reads the cache.
Written beside the cache, so what the cache was made from can be checked before it is used.
The paths to ask for, so their methods are profiled rather than met for the first time later.