Enable GraalVM reachability metadata repository

Closes gh-31687
pull/31699/head
Moritz Halbritter 2 years ago
parent 70af81675e
commit 3703b317ce

@ -249,6 +249,11 @@ publishing.publications.withType(MavenPublication) {
plugin { plugin {
delegate.groupId('org.graalvm.buildtools') delegate.groupId('org.graalvm.buildtools')
delegate.artifactId('native-maven-plugin') delegate.artifactId('native-maven-plugin')
configuration {
metadataRepository {
delegate.enabled('true')
}
}
executions { executions {
execution { execution {
delegate.id('build-native') delegate.id('build-native')

@ -18,10 +18,12 @@ package org.springframework.boot.gradle.plugin;
import org.graalvm.buildtools.gradle.NativeImagePlugin; import org.graalvm.buildtools.gradle.NativeImagePlugin;
import org.graalvm.buildtools.gradle.dsl.GraalVMExtension; import org.graalvm.buildtools.gradle.dsl.GraalVMExtension;
import org.graalvm.buildtools.gradle.dsl.GraalVMReachabilityMetadataRepositoryExtension;
import org.graalvm.buildtools.gradle.tasks.BuildNativeImageTask; import org.graalvm.buildtools.gradle.tasks.BuildNativeImageTask;
import org.gradle.api.Action; import org.gradle.api.Action;
import org.gradle.api.Plugin; import org.gradle.api.Plugin;
import org.gradle.api.Project; import org.gradle.api.Project;
import org.gradle.api.plugins.ExtensionAware;
import org.gradle.api.plugins.JavaPlugin; import org.gradle.api.plugins.JavaPlugin;
import org.gradle.api.plugins.JavaPluginExtension; import org.gradle.api.plugins.JavaPluginExtension;
import org.gradle.api.tasks.SourceSet; import org.gradle.api.tasks.SourceSet;
@ -53,6 +55,13 @@ class NativeImagePluginAction implements PluginApplicationAction {
}); });
GraalVMExtension graalVmExtension = project.getExtensions().getByType(GraalVMExtension.class); GraalVMExtension graalVmExtension = project.getExtensions().getByType(GraalVMExtension.class);
graalVmExtension.getToolchainDetection().set(false); graalVmExtension.getToolchainDetection().set(false);
reachabilityExtensionOn(graalVmExtension).getEnabled().set(true);
}
private static GraalVMReachabilityMetadataRepositoryExtension reachabilityExtensionOn(
GraalVMExtension graalVmExtension) {
return ((ExtensionAware) graalVmExtension).getExtensions()
.getByType(GraalVMReachabilityMetadataRepositoryExtension.class);
} }
} }

@ -126,7 +126,8 @@ public class GradleBuild {
new File(pathOfJarContaining(JsonView.class)), new File(pathOfJarContaining(Platform.class)), new File(pathOfJarContaining(JsonView.class)), new File(pathOfJarContaining(Platform.class)),
new File(pathOfJarContaining(Toml.class)), new File(pathOfJarContaining(Lexer.class)), new File(pathOfJarContaining(Toml.class)), new File(pathOfJarContaining(Lexer.class)),
new File(pathOfJarContaining("org.graalvm.buildtools.gradle.NativeImagePlugin")), new File(pathOfJarContaining("org.graalvm.buildtools.gradle.NativeImagePlugin")),
new File(pathOfJarContaining("org.graalvm.reachability.JvmReachabilityMetadataRepository"))); new File(pathOfJarContaining("org.graalvm.reachability.GraalVMReachabilityMetadataRepository")),
new File(pathOfJarContaining("org.graalvm.buildtools.utils.SharedConstants")));
} }
private String pathOfJarContaining(String className) { private String pathOfJarContaining(String className) {

Loading…
Cancel
Save