Skip to content

Commit 010a5a5

Browse files
Rework Maven plugin, add excludeConfig option, set useBuildArg to false on nix systems.
- Completely reworked Maven plugin (should fix many of previous issues and inconsistencies between main and test builds). - Added `classesDirectory`, `debug`, `fallback`, `verbose`, `sharedLibrary`, `configurationFileDirectories`, `excludeConfig` and `jvmArgs` properties in order to match those present in the Gradle plugin. - `useArgFile` is now set to true by default only on Windows - Added `excludeConfig` configuration option that allows skipping of configuration files that are present in classpath `jar` s.
1 parent 4ad8b74 commit 010a5a5

File tree

9 files changed

+625
-433
lines changed

9 files changed

+625
-433
lines changed

docs/src/docs/asciidoc/index.adoc

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,13 @@ If you are interested in contributing, please refer to our https://github.com/gr
2323
* Introduced the `metadataCopy` task.
2424
* Introduced the concept of agent modes.
2525
** Under the hood, the agent mode dictates what options are passed to the agent and how metadata produced by multiple runs get merged.
26+
* Added `excludeConfig` configuration option that allows skipping of configuration files that are present in classpath `jar` s.
27+
* `useArgFile` is now set to true by default only on Windows.
28+
29+
==== Maven plugin
30+
* Completely reworked Maven plugin (should fix many of previous issues and inconsistencies between main and test builds).
31+
* Added `classesDirectory`, `debug`, `fallback`, `verbose`, `sharedLibrary`, `configurationFileDirectories`, `excludeConfig` and `jvmArgs` properties in order to match those present in the Gradle plugin.
32+
* `useArgFile` is now set to true by default only on Windows.
2633

2734
=== Release 0.9.11
2835

native-gradle-plugin/src/main/java/org/graalvm/buildtools/gradle/NativeImagePlugin.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2021, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2021, 2022, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* The Universal Permissive License (UPL), Version 1.0
@@ -126,6 +126,7 @@
126126
import static org.graalvm.buildtools.gradle.internal.GradleUtils.transitiveProjectArtifacts;
127127
import static org.graalvm.buildtools.gradle.internal.NativeImageExecutableLocator.graalvmHomeProvider;
128128
import static org.graalvm.buildtools.utils.SharedConstants.AGENT_PROPERTY;
129+
import static org.graalvm.buildtools.utils.SharedConstants.IS_WINDOWS;
129130

130131
/**
131132
* Gradle plugin for GraalVM Native Image.
@@ -170,7 +171,7 @@ public void apply(Project project) {
170171

171172
logger = GraalVMLogger.of(project.getLogger());
172173
DefaultGraalVmExtension graalExtension = (DefaultGraalVmExtension) registerGraalVMExtension(project);
173-
graalExtension.getUseArgFile().convention(true);
174+
graalExtension.getUseArgFile().convention(IS_WINDOWS);
174175
project.getPlugins()
175176
.withType(JavaPlugin.class, javaPlugin -> configureJavaProject(project, nativeImageServiceProvider, graalExtension));
176177

native-gradle-plugin/src/main/java/org/graalvm/buildtools/gradle/dsl/GraalVMExtension.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2021, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2021, 2022, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* The Universal Permissive License (UPL), Version 1.0
@@ -99,7 +99,7 @@ public interface GraalVMExtension {
9999

100100
/**
101101
* Property driving the use of @-arg files when invoking native image.
102-
* This is enabled by default. For older native-image versions, this
102+
* This is enabled by default on Windows. For older native-image versions, this
103103
* needs to be disabled.
104104
*
105105
* @return the argument file property

native-gradle-plugin/src/main/java/org/graalvm/buildtools/gradle/dsl/NativeImageOptions.java

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2021, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2021, 2022, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* The Universal Permissive License (UPL), Version 1.0
@@ -171,14 +171,24 @@ public interface NativeImageOptions extends Named {
171171
Property<JavaLauncher> getJavaLauncher();
172172

173173
/**
174-
* Returns the list of configuration file directories (e.g resource-config.json, ...) which need
174+
* Returns the list of configuration file directories (e.g. resource-config.json, ...) which need
175175
* to be passed to native-image.
176176
*
177177
* @return a collection of directories
178178
*/
179179
@InputFiles
180180
ConfigurableFileCollection getConfigurationFileDirectories();
181181

182+
/**
183+
* Returns the map that as contains information about configuration that should be excluded
184+
* during image building. It consists of a jar regular expression as a key and a resource
185+
* regular expression as a value.
186+
*
187+
* @return a map of filters for configuration exclusion
188+
*/
189+
@Input
190+
MapProperty<String, String> getExcludeConfig();
191+
182192
@Nested
183193
NativeResourcesOptions getResources();
184194

native-gradle-plugin/src/main/java/org/graalvm/buildtools/gradle/internal/NativeImageCommandLineProvider.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2021, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2021, 2022, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* The Universal Permissive License (UPL), Version 1.0
@@ -104,6 +104,12 @@ public List<String> asArguments() {
104104
NativeImageOptions options = getOptions().get();
105105
List<String> cliArgs = new ArrayList<>(20);
106106

107+
options.getExcludeConfig().get().forEach((jarPath, resourcePattern) -> {
108+
cliArgs.add("--exclude-config");
109+
cliArgs.add(jarPath);
110+
cliArgs.add(resourcePattern);
111+
});
112+
107113
cliArgs.add("-cp");
108114
String classpathString = buildClasspathString(options);
109115
cliArgs.add(classpathString);

0 commit comments

Comments
 (0)