Remove setting BP_NATIVE_IMAGE
Closes gh-32884
This commit is contained in:
@@ -152,7 +152,7 @@ Acceptable values are `ALWAYS`, `NEVER`, and `IF_NOT_PRESENT`.
|
||||
| `environment`
|
||||
|
|
||||
| Environment variables that should be passed to the builder.
|
||||
| Empty or `['BP_NATIVE_IMAGE': 'true']` when {url-native-build-tools-docs-gradle-plugin}[GraalVM Native Image plugin] is applied.
|
||||
| Empty.
|
||||
|
||||
| `buildpacks`
|
||||
|
|
||||
|
||||
@@ -89,6 +89,6 @@ When the {url-native-build-tools-docs-gradle-plugin}[GraalVM Native Image plugin
|
||||
. Configures the GraalVM extension to disable Toolchain detection.
|
||||
. Configures each GraalVM native binary to require GraalVM 22.3 or later.
|
||||
. Configures the `bootJar` task to include the reachability metadata produced by the `collectReachabilityMetadata` task in its jar.
|
||||
. Configures the `bootBuildImage` task to set `BP_NATIVE_IMAGE` to `true` in its environment.
|
||||
. Configures the `bootJar` task to add the `Spring-Boot-Native-Processed: true` manifest entry.
|
||||
|
||||
|
||||
|
||||
@@ -32,7 +32,6 @@ import org.gradle.api.plugins.JavaPlugin;
|
||||
import org.gradle.api.plugins.JavaPluginExtension;
|
||||
import org.gradle.api.tasks.SourceSetContainer;
|
||||
|
||||
import org.springframework.boot.gradle.tasks.bundling.BootBuildImage;
|
||||
import org.springframework.boot.gradle.tasks.bundling.BootJar;
|
||||
|
||||
/**
|
||||
@@ -59,7 +58,6 @@ class NativeImagePluginAction implements PluginApplicationAction {
|
||||
configureMainNativeBinaryClasspath(project, sourceSets, graalVmExtension);
|
||||
configureTestNativeBinaryClasspath(sourceSets, graalVmExtension);
|
||||
copyReachabilityMetadataToBootJar(project);
|
||||
configureBootBuildImageToProduceANativeImage(project);
|
||||
configureJarManifestNativeAttribute(project);
|
||||
});
|
||||
}
|
||||
@@ -102,12 +100,6 @@ class NativeImagePluginAction implements PluginApplicationAction {
|
||||
.configure((bootJar) -> bootJar.from(project.getTasks().named("collectReachabilityMetadata")));
|
||||
}
|
||||
|
||||
private void configureBootBuildImageToProduceANativeImage(Project project) {
|
||||
project.getTasks()
|
||||
.named(SpringBootPlugin.BOOT_BUILD_IMAGE_TASK_NAME, BootBuildImage.class)
|
||||
.configure((bootBuildImage) -> bootBuildImage.getEnvironment().put("BP_NATIVE_IMAGE", "true"));
|
||||
}
|
||||
|
||||
private void configureJarManifestNativeAttribute(Project project) {
|
||||
project.getTasks()
|
||||
.named(SpringBootPlugin.BOOT_JAR_TASK_NAME, BootJar.class)
|
||||
|
||||
@@ -88,13 +88,6 @@ class NativeImagePluginActionIntegrationTests {
|
||||
"META-INF/native-image/org.jline/jline/3.21.0/resource-config.json");
|
||||
}
|
||||
|
||||
@TestTemplate
|
||||
void bootBuildImageIsConfiguredToBuildANativeImage() {
|
||||
writeDummySpringApplicationAotProcessorMainClass();
|
||||
BuildResult result = this.gradleBuild.build("bootBuildImageConfiguration");
|
||||
assertThat(result.getOutput()).contains("BP_NATIVE_IMAGE = true");
|
||||
}
|
||||
|
||||
@TestTemplate
|
||||
void developmentOnlyDependenciesDoNotAppearInNativeImageClasspath() {
|
||||
writeDummySpringApplicationAotProcessorMainClass();
|
||||
|
||||
@@ -1,12 +0,0 @@
|
||||
plugins {
|
||||
id 'org.springframework.boot' version '{version}'
|
||||
id 'java'
|
||||
}
|
||||
|
||||
apply plugin: 'org.graalvm.buildtools.native'
|
||||
|
||||
task('bootBuildImageConfiguration') {
|
||||
doFirst {
|
||||
println "BP_NATIVE_IMAGE = ${tasks.getByName('bootBuildImage').environment.get()['BP_NATIVE_IMAGE']}"
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user