Skip to content

Commit

Permalink
Fix --exclude-config regression with Gradle
Browse files Browse the repository at this point in the history
Closes gh-340
  • Loading branch information
sdeleuze committed Oct 17, 2022
1 parent 713010f commit 65777a7
Showing 1 changed file with 11 additions and 1 deletion.
Expand Up @@ -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;
Expand Down Expand Up @@ -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<GraalVMReachabilityMetadataService> serviceProvider = project.getGradle()
project.getGradle()
.getSharedServices()
.registerIfAbsent("nativeConfigurationService", GraalVMReachabilityMetadataService.class, spec -> {
LogLevel logLevel = determineLogLevel();
Expand All @@ -436,6 +440,12 @@ private void configureJvmReachabilityExcludeConfigArgs(Project project, GraalVME
});
}

private Map.Entry<String, List<String>> 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);
Expand Down

0 comments on commit 65777a7

Please sign in to comment.