diff --git a/native-gradle-plugin/src/main/java/org/graalvm/buildtools/gradle/NativeImagePlugin.java b/native-gradle-plugin/src/main/java/org/graalvm/buildtools/gradle/NativeImagePlugin.java index b845c9100..ce273edac 100644 --- a/native-gradle-plugin/src/main/java/org/graalvm/buildtools/gradle/NativeImagePlugin.java +++ b/native-gradle-plugin/src/main/java/org/graalvm/buildtools/gradle/NativeImagePlugin.java @@ -121,6 +121,7 @@ import java.net.URI; import java.net.URISyntaxException; import java.nio.file.Path; +import java.util.AbstractMap; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; @@ -424,8 +425,11 @@ private static URI computeMetadataRepositoryUri(Project project, } private void configureJvmReachabilityExcludeConfigArgs(Project project, GraalVMExtension graalExtension, NativeImageOptions options, SourceSet sourceSet) { + options.getExcludeConfig().putAll(graalVMReachabilityQuery(project, graalExtension, sourceSet, + DirectoryConfiguration::isOverride, this::getExclusionConfig, + Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue))); GraalVMReachabilityMetadataRepositoryExtension repositoryExtension = reachabilityExtensionOn(graalExtension); - Provider serviceProvider = project.getGradle() + project.getGradle() .getSharedServices() .registerIfAbsent("nativeConfigurationService", GraalVMReachabilityMetadataService.class, spec -> { LogLevel logLevel = determineLogLevel(); @@ -436,6 +440,12 @@ private void configureJvmReachabilityExcludeConfigArgs(Project project, GraalVME }); } + private Map.Entry> getExclusionConfig(ModuleVersionIdentifier moduleVersion, + DirectoryConfiguration configuration) { + String gav = moduleVersion.getGroup() + ":" + moduleVersion.getName() + ":" + moduleVersion.getVersion(); + return new AbstractMap.SimpleEntry<>(gav, Arrays.asList("^/META-INF/native-image/.*")); + } + private static LogLevel determineLogLevel() { LogLevel logLevel = LogLevel.DEBUG; String loggingProperty = System.getProperty(CONFIG_REPO_LOGLEVEL);