Skip to content

Commit ed42823

Browse files
committed
Harmonize AOT goal/task names
Closes gh-31918
2 parents 973e23d + c0b3d36 commit ed42823

File tree

15 files changed

+40
-40
lines changed

15 files changed

+40
-40
lines changed

Diff for: spring-boot-project/spring-boot-starters/spring-boot-starter-parent/build.gradle

+2-2
Original file line numberDiff line numberDiff line change
@@ -233,9 +233,9 @@ publishing.publications.withType(MavenPublication) {
233233
delegate.artifactId('spring-boot-maven-plugin')
234234
executions {
235235
execution {
236-
delegate.id('aot-generate')
236+
delegate.id('process-aot')
237237
goals {
238-
delegate.goal('aot-generate')
238+
delegate.goal('process-aot')
239239
}
240240
}
241241
}

Diff for: spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/asciidoc/reacting.adoc

+2-2
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,8 @@ When Gradle's {application-plugin}[`application` plugin] is applied to a project
7070
When the {nbt-gradle-plugin}[GraalVM Native Image plugin] is applied to a project, the Spring Boot plugin:
7171

7272
. Applies the `org.springframework.boot.aot` plugin that:
73-
.. Registers a `GenerateAotSources` task named `generateAotSources` that will generate AOT-optimized source code for the application.
74-
.. Configures the Java compilation and process resources tasks for the `aot` source set to depend upon `generateAotSources`.
73+
.. Registers a `ProcessAot` task named `processAot` that will generate AOT-optimized source code for the application.
74+
.. Configures the Java compilation and process resources tasks for the `aot` source set to depend upon `processAot`.
7575
. Adds the output of the `aot` source set to the classpath of the `nativeCompile` task.
7676
. Configures the GraalVM extension to disable Toolchain detection.
7777

Diff for: spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/plugin/SpringBootAotPlugin.java

+9-9
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
import org.gradle.api.tasks.SourceSetContainer;
3535
import org.gradle.api.tasks.TaskProvider;
3636

37-
import org.springframework.boot.gradle.tasks.aot.GenerateAotSources;
37+
import org.springframework.boot.gradle.tasks.aot.ProcessAot;
3838

3939
/**
4040
* Gradle plugin for Spring Boot AOT.
@@ -50,17 +50,17 @@ public class SpringBootAotPlugin implements Plugin<Project> {
5050
public static final String AOT_SOURCE_SET_NAME = "aot";
5151

5252
/**
53-
* Name of the default {@link GenerateAotSources} task.
53+
* Name of the default {@link ProcessAot} task.
5454
*/
55-
public static final String GENERATE_AOT_SOURCES_TASK_NAME = "generateAotSources";
55+
public static final String PROCESS_AOT_TASK_NAME = "processAot";
5656

5757
@Override
5858
public void apply(Project project) {
5959
PluginContainer plugins = project.getPlugins();
6060
plugins.withType(JavaPlugin.class).all((javaPlugin) -> {
6161
plugins.withType(SpringBootPlugin.class).all((bootPlugin) -> {
6262
SourceSet aotSourceSet = configureAotSourceSet(project);
63-
registerGenerateAotSourcesTask(project, aotSourceSet);
63+
registerProcessAotTask(project, aotSourceSet);
6464
});
6565
});
6666
}
@@ -97,11 +97,11 @@ private void configureJavaRuntimeUsageAttribute(Project project, AttributeContai
9797
attributes.attribute(Usage.USAGE_ATTRIBUTE, javaRuntime);
9898
}
9999

100-
private void registerGenerateAotSourcesTask(Project project, SourceSet aotSourceSet) {
100+
private void registerProcessAotTask(Project project, SourceSet aotSourceSet) {
101101
TaskProvider<ResolveMainClassName> resolveMainClassName = project.getTasks()
102102
.named(SpringBootPlugin.RESOLVE_MAIN_CLASS_NAME_TASK_NAME, ResolveMainClassName.class);
103-
TaskProvider<GenerateAotSources> generateAotSources = project.getTasks()
104-
.register(GENERATE_AOT_SOURCES_TASK_NAME, GenerateAotSources.class, (task) -> {
103+
TaskProvider<ProcessAot> processAot = project.getTasks().register(PROCESS_AOT_TASK_NAME, ProcessAot.class,
104+
(task) -> {
105105
Provider<Directory> generatedClasses = project.getLayout().getBuildDirectory()
106106
.dir("generated/aotClasses");
107107
aotSourceSet.getOutput().dir(generatedClasses);
@@ -114,9 +114,9 @@ private void registerGenerateAotSourcesTask(Project project, SourceSet aotSource
114114
task.getArtifactId().set(project.provider(() -> project.getName()));
115115
});
116116
project.getTasks().named(aotSourceSet.getCompileJavaTaskName())
117-
.configure((compileJava) -> compileJava.dependsOn(generateAotSources));
117+
.configure((compileJava) -> compileJava.dependsOn(processAot));
118118
project.getTasks().named(aotSourceSet.getProcessResourcesTaskName())
119-
.configure((processResources) -> processResources.dependsOn(generateAotSources));
119+
.configure((processResources) -> processResources.dependsOn(processAot));
120120
}
121121

122122
}
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,13 @@
2828
import org.gradle.api.tasks.TaskAction;
2929

3030
/**
31-
* Custom {@link JavaExec} task for generating sources ahead of time.
31+
* Custom {@link JavaExec} task for processing code ahead-of-time.
3232
*
3333
* @author Andy Wilkinson
3434
* @since 3.0.0
3535
*/
3636
@CacheableTask
37-
public class GenerateAotSources extends JavaExec {
37+
public class ProcessAot extends JavaExec {
3838

3939
private final Property<String> applicationClass;
4040

@@ -48,7 +48,7 @@ public class GenerateAotSources extends JavaExec {
4848

4949
private final Property<String> artifactId;
5050

51-
public GenerateAotSources() {
51+
public ProcessAot() {
5252
this.applicationClass = getProject().getObjects().property(String.class);
5353
this.sourcesDir = getProject().getObjects().directoryProperty();
5454
this.resourcesDir = getProject().getObjects().directoryProperty();

Diff for: spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/test/java/org/springframework/boot/gradle/plugin/SpringBootAotPluginIntegrationTests.java

+10-10
Original file line numberDiff line numberDiff line change
@@ -39,30 +39,30 @@ class SpringBootAotPluginIntegrationTests {
3939
GradleBuild gradleBuild;
4040

4141
@TestTemplate
42-
void noGenerateAotSourcesTaskWithoutAotPluginApplied() {
43-
assertThat(this.gradleBuild.build("taskExists", "-PtaskName=generateAotSources").getOutput())
44-
.contains("generateAotSources exists = false");
42+
void noProcessAotTaskWithoutAotPluginApplied() {
43+
assertThat(this.gradleBuild.build("taskExists", "-PtaskName=processAot").getOutput())
44+
.contains("processAot exists = false");
4545
}
4646

4747
@TestTemplate
48-
void applyingAotPluginCreatesGenerateAotSourcesTask() {
49-
assertThat(this.gradleBuild.build("taskExists", "-PtaskName=generateAotSources").getOutput())
50-
.contains("generateAotSources exists = true");
48+
void applyingAotPluginCreatesProcessAotTask() {
49+
assertThat(this.gradleBuild.build("taskExists", "-PtaskName=processAot").getOutput())
50+
.contains("processAot exists = true");
5151
}
5252

5353
@TestTemplate
54-
void generateAotSourcesHasLibraryResourcesOnItsClasspath() throws IOException {
54+
void processAotHasLibraryResourcesOnItsClasspath() throws IOException {
5555
File settings = new File(this.gradleBuild.getProjectDir(), "settings.gradle");
5656
Files.write(settings.toPath(), List.of("include 'library'"));
5757
File library = new File(this.gradleBuild.getProjectDir(), "library");
5858
library.mkdirs();
5959
Files.write(library.toPath().resolve("build.gradle"), List.of("plugins {", " id 'java-library'", "}"));
60-
assertThat(this.gradleBuild.build("generateAotSourcesClasspath").getOutput()).contains("library.jar");
60+
assertThat(this.gradleBuild.build("processAotClasspath").getOutput()).contains("library.jar");
6161
}
6262

6363
@TestTemplate
64-
void generateAotSourcesHasTransitiveRuntimeDependenciesOnItsClasspath() {
65-
String output = this.gradleBuild.build("generateAotSourcesClasspath").getOutput();
64+
void processAotHasTransitiveRuntimeDependenciesOnItsClasspath() {
65+
String output = this.gradleBuild.build("processAotClasspath").getOutput();
6666
assertThat(output).contains("org.jboss.logging" + File.separatorChar + "jboss-logging");
6767
}
6868

Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ dependencies {
88
implementation project(":library")
99
}
1010

11-
task('generateAotSourcesClasspath') {
11+
task('processAotClasspath') {
1212
doFirst {
13-
tasks.findByName('generateAotSources').classpath.files.each { println it }
13+
tasks.findByName('processAot').classpath.files.each { println it }
1414
}
1515
}
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ dependencies {
1212
implementation "org.hibernate.orm:hibernate-core:6.1.1.Final"
1313
}
1414

15-
task('generateAotSourcesClasspath') {
15+
task('processAotClasspath') {
1616
doFirst {
17-
tasks.findByName('generateAotSources').classpath.files.each { println it }
17+
tasks.findByName('processAot').classpath.files.each { println it }
1818
}
1919
}

Diff for: spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/docs/asciidoc/aot.adoc

+3-3
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ Based on your `@SpringBootApplication`-annotated main class, the AOT engine gene
66
Additional post-processing of the factory is possible using callbacks.
77
For instance, these are used to generate the necessary reflection configuration that GraalVM needs to initialize the context in a native image.
88

9-
To configure your application to use this feature, add an execution for the `aot-generate` goal, as shown in the following example:
9+
To configure your application to use this feature, add an execution for the `process-aot` goal, as shown in the following example:
1010

1111
[source,xml,indent=0,subs="verbatim,attributes",tabsize=4]
1212
----
@@ -16,7 +16,7 @@ include::../maven/aot/pom.xml[tags=aot]
1616
As the `BeanFactory` is fully prepared at build-time, conditions are also evaluated.
1717
This has an important difference compared to what a regular Spring Boot application does at runtime.
1818
For instance, if you want to opt-in or opt-out for certain features, you need to configure the environment used at build time to do so.
19-
The `aot-generate` goal shares a number of properties with the <<run,run goal>> for that reason.
19+
The `process-aot` goal shares a number of properties with the <<run,run goal>> for that reason.
2020

2121

22-
include::goals/aot-generate.adoc[leveloffset=+1]
22+
include::goals/process-aot.adoc[leveloffset=+1]

Diff for: spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/docs/maven/aot/pom.xml

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@
1010
<artifactId>spring-boot-maven-plugin</artifactId>
1111
<executions>
1212
<execution>
13-
<id>aot-generate</id>
13+
<id>process-aot</id>
1414
<goals>
15-
<goal>aot-generate</goal>
15+
<goal>process-aot</goal>
1616
</goals>
1717
</execution>
1818
</executions>

Diff for: spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/intTest/projects/aot-class-proxy/pom.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
<executions>
2020
<execution>
2121
<goals>
22-
<goal>aot-generate</goal>
22+
<goal>process-aot</goal>
2323
</goals>
2424
</execution>
2525
</executions>

Diff for: spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/intTest/projects/aot-jdk-proxy/pom.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
<executions>
2020
<execution>
2121
<goals>
22-
<goal>aot-generate</goal>
22+
<goal>process-aot</goal>
2323
</goals>
2424
</execution>
2525
</executions>

Diff for: spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/intTest/projects/aot/pom.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
<executions>
2020
<execution>
2121
<goals>
22-
<goal>aot-generate</goal>
22+
<goal>process-aot</goal>
2323
</goals>
2424
</execution>
2525
</executions>

Diff for: spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/AotGenerateMojo.java renamed to spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/ProcessAotMojo.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -57,10 +57,10 @@
5757
* @author Andy Wilkinson
5858
* @since 3.0.0
5959
*/
60-
@Mojo(name = "aot-generate", defaultPhase = LifecyclePhase.PREPARE_PACKAGE, threadSafe = true,
60+
@Mojo(name = "process-aot", defaultPhase = LifecyclePhase.PREPARE_PACKAGE, threadSafe = true,
6161
requiresDependencyResolution = ResolutionScope.COMPILE_PLUS_RUNTIME,
6262
requiresDependencyCollection = ResolutionScope.COMPILE_PLUS_RUNTIME)
63-
public class AotGenerateMojo extends AbstractDependencyFilterMojo {
63+
public class ProcessAotMojo extends AbstractDependencyFilterMojo {
6464

6565
private static final String AOT_PROCESSOR_CLASS_NAME = "org.springframework.boot.AotProcessor";
6666

0 commit comments

Comments
 (0)