mirror of
https://github.com/spring-projects/spring-boot.git
synced 2026-09-17 12:09:16 +00:00
Merge branch '3.5.x' into 4.0.x
Closes gh-49321
This commit is contained in:
+6
@@ -0,0 +1,6 @@
|
||||
plugins {
|
||||
id 'org.springframework.boot' version '{version-spring-boot}'
|
||||
id 'java'
|
||||
}
|
||||
|
||||
apply plugin: 'org.springframework.boot.aot'
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
plugins {
|
||||
id("org.springframework.boot") version "{version-spring-boot}"
|
||||
java
|
||||
}
|
||||
|
||||
apply(plugin = "org.springframework.boot.aot")
|
||||
+20
-2
@@ -4,8 +4,8 @@
|
||||
Spring AOT is a process that analyzes your code at build-time in order to generate an optimized version of it.
|
||||
It is most often used to help generate GraalVM native images.
|
||||
|
||||
The Spring Boot Gradle plugin provides tasks that can be used to perform AOT processing on both application and test code.
|
||||
The tasks are configured automatically when the {url-native-build-tools-docs-gradle-plugin}[GraalVM Native Image plugin] is applied:
|
||||
The `org.springframework.boot.aot` Gradle plugin provides tasks that can be used to perform AOT processing on both application and test code.
|
||||
The plugin is applied automatically when the {url-native-build-tools-docs-gradle-plugin}[GraalVM Native Image plugin] is applied:
|
||||
|
||||
[tabs]
|
||||
======
|
||||
@@ -23,6 +23,24 @@ include::example$aot/apply-native-image-plugin.gradle.kts[]
|
||||
----
|
||||
======
|
||||
|
||||
If you want to xref:reference:packaging/aot.adoc[run an AOT-processed application on the JVM] rather than as a native image, apply the `org.springframework.boot.aot` plugin directly:
|
||||
|
||||
[tabs]
|
||||
======
|
||||
Groovy::
|
||||
+
|
||||
[source,groovy,indent=0,subs="verbatim,attributes"]
|
||||
----
|
||||
include::example$aot/apply-aot-plugin.gradle[]
|
||||
----
|
||||
Kotlin::
|
||||
+
|
||||
[source,kotlin,indent=0,subs="verbatim,attributes"]
|
||||
----
|
||||
include::example$aot/apply-aot-plugin.gradle.kts[]
|
||||
----
|
||||
======
|
||||
|
||||
|
||||
|
||||
[[aot.processing-applications]]
|
||||
|
||||
+52
@@ -0,0 +1,52 @@
|
||||
/*
|
||||
* Copyright 2012-present the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.boot.gradle.docs;
|
||||
|
||||
import org.junit.jupiter.api.TestTemplate;
|
||||
import org.junit.jupiter.api.extension.ExtendWith;
|
||||
|
||||
import org.springframework.boot.gradle.junit.GradleMultiDslExtension;
|
||||
import org.springframework.boot.testsupport.gradle.testkit.GradleBuild;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
/**
|
||||
* Tests for AOT documentation.
|
||||
*
|
||||
* @author Andy Wilkinson
|
||||
*/
|
||||
@ExtendWith(GradleMultiDslExtension.class)
|
||||
class AotDocumentationTests {
|
||||
|
||||
@SuppressWarnings("NullAway.Init")
|
||||
GradleBuild gradleBuild;
|
||||
|
||||
@TestTemplate
|
||||
void applyNativeImagePlugin() {
|
||||
assertThat(this.gradleBuild.script(Examples.DIR + "aot/apply-native-image-plugin").build("tasks").getOutput())
|
||||
.contains("nativeCompile")
|
||||
.contains("aotClasses");
|
||||
}
|
||||
|
||||
@TestTemplate
|
||||
void applyAotPlugin() {
|
||||
assertThat(this.gradleBuild.script(Examples.DIR + "aot/apply-aot-plugin").build("tasks").getOutput())
|
||||
.contains("aotClasses")
|
||||
.doesNotContain("nativeCompile");
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user