Skip to content

Commit

Permalink
Clean up excludeConfig processing in Gradle plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
lazar-mitrovic committed Jun 9, 2022
1 parent 1f2d92f commit 0afe2d8
Showing 1 changed file with 12 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -104,11 +104,8 @@ public Provider<RegularFile> getClasspathJar() {
return classpathJar;
}

@Override
public List<String> asArguments() {
NativeImageOptions options = getOptions().get();
List<String> cliArgs = new ArrayList<>(20);

private List<String> buildExcludeConfigArgs(NativeImageOptions options) {
List<String> args = new ArrayList<>();
options.getExcludeConfig().get().forEach((dependency, listOfResourcePatterns) -> {
// Resolve jar for this dependency.
project.getConfigurations().getByName("runtimeClasspath").getIncoming().artifactView(view -> {
Expand All @@ -125,12 +122,19 @@ public List<String> asArguments() {
return false;
});
}).getFiles().forEach(jarPath -> listOfResourcePatterns.forEach(resourcePattern -> {
cliArgs.add("--exclude-config");
cliArgs.add(jarPath.toPath().toAbsolutePath().toString());
cliArgs.add(String.format("\"%s\"", resourcePattern));
args.add("--exclude-config");
args.add(jarPath.toPath().toAbsolutePath().toString());
args.add(String.format("\"%s\"", resourcePattern));
}));
});
return args;
}

@Override
public List<String> asArguments() {
NativeImageOptions options = getOptions().get();
List<String> cliArgs = new ArrayList<>(20);
cliArgs.addAll(buildExcludeConfigArgs(options));
cliArgs.add("-cp");
String classpathString = buildClasspathString(options);
cliArgs.add(classpathString);
Expand Down

0 comments on commit 0afe2d8

Please sign in to comment.