Class AotCacheTrainingPlugin
java.lang.Object
io.github.vpelikh.aot.gradle.AotCacheTrainingPlugin
- All Implemented Interfaces:
org.gradle.api.Plugin<org.gradle.api.Project>
public class AotCacheTrainingPlugin
extends Object
implements org.gradle.api.Plugin<org.gradle.api.Project>
Gradle plugin that records a JVM AOT cache (JEP 483 / JEP 514) from the project's
integration tests.
Apply the plugin and opt in:
plugins {
id 'io.github.vpelikh.aot-cache-training'
}
aotCacheTraining {
enabled = true
}
When enabled, the plugin:
- packages the application into its boot JAR;
- starts the packaged application in its own JVM through
io.github.vpelikh.aot.trainer.OutOfProcessTrainingLauncherwith-XX:AOTCacheOutput=<buildDir>/aot-cache/application.aot(optionally inside a container image); - runs the integration tests as an external HTTP client of that application;
- verifies through the
verifyAotCachetask that a non-empty cache was produced.
The cache is recorded against the packaged application's own class path, so it is
usable by the packaged application (including a container image built from it). This is
deliberately separate from the normal test task, which boots the application
in-process and cannot produce a cache the packaged application can load.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringThe name of the task that embeds the recorded cache into a copy of the boot JAR, sobootBuildImageships the cache inside the image.static final StringThe name of the task that records the cache.static final StringThe name of the verification task. -
Constructor Summary
Constructors -
Method Summary
-
Field Details
-
RECORD_TASK_NAME
-
VERIFY_TASK_NAME
-
EMBED_IMAGE_JAR_TASK_NAME
The name of the task that embeds the recorded cache into a copy of the boot JAR, sobootBuildImageships the cache inside the image.- See Also:
-
-
Constructor Details
-
AotCacheTrainingPlugin
public AotCacheTrainingPlugin()Create the plugin. Gradle instantiates it when the plugin is applied.
-
-
Method Details
-
apply
public void apply(org.gradle.api.Project project) - Specified by:
applyin interfaceorg.gradle.api.Plugin<org.gradle.api.Project>
-