Skip to content

Commit

Permalink
Remove setting BP_NATIVE_IMAGE
Browse files Browse the repository at this point in the history
Closes gh-32884
  • Loading branch information
mhalbritter committed Sep 17, 2024
1 parent 9ca857b commit 9294c00
Show file tree
Hide file tree
Showing 7 changed files with 6 additions and 43 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -265,13 +265,6 @@ publishing.publications.withType(MavenPublication) {
plugin {
delegate.groupId('org.springframework.boot')
delegate.artifactId('spring-boot-maven-plugin')
configuration {
image {
env {
delegate.BP_NATIVE_IMAGE("true")
}
}
}
executions {
execution {
delegate.id('process-aot')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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`
|
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.


Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
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;

/**
Expand All @@ -59,7 +58,6 @@ public void execute(Project project) {
configureMainNativeBinaryClasspath(project, sourceSets, graalVmExtension);
configureTestNativeBinaryClasspath(sourceSets, graalVmExtension);
copyReachabilityMetadataToBootJar(project);
configureBootBuildImageToProduceANativeImage(project);
configureJarManifestNativeAttribute(project);
});
}
Expand Down Expand Up @@ -102,12 +100,6 @@ private void copyReachabilityMetadataToBootJar(Project project) {
.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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,13 +88,6 @@ void reachabilityMetadataConfigurationFilesFromFileRepositoryAreCopiedToJar() th
"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();
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,10 @@ bootJar {
manifest {
attributes(
'Implementation-Version': '1.0.0',
'Implementation-Title': "Paketo Test"
'Implementation-Title': 'Paketo Test',
// This shouldn't be necessary.
// See https://github.com/spring-projects/spring-boot/issues/42338
'Spring-Boot-Native-Processed': 'true'
)
}
}

bootBuildImage {
environment = ['BP_NATIVE_IMAGE': 'true',
//see https://github.com/paketo-buildpacks/native-image/issues/321
'BP_NATIVE_IMAGE_BUILD_ARGUMENTS': '-H:-AddAllFileSystemProviders']
}

0 comments on commit 9294c00

Please sign in to comment.