Skip to content

Commit e12140d

Browse files
committed
- fixed NPE if empty pythonHome includes or excludes
- empty includes should be handled like the default ".*"
1 parent 641114e commit e12140d

File tree

2 files changed

+21
-6
lines changed
  • graalpython
    • graalpy-archetype-polyglot-app/src/main/resources/archetype-resources
    • graalpy-maven-plugin/src/main/java/org/graalvm/python/maven/plugin

2 files changed

+21
-6
lines changed

graalpython/graalpy-archetype-polyglot-app/src/main/resources/archetype-resources/pom.xml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,14 +51,15 @@
5151
<package>termcolor==2.2</package>
5252
</packages>
5353
<pythonHome>
54-
<!-- java-like regular expression what file paths should be included into venv/home;
55-
default is all -->
5654
<includes>
55+
<!-- java-like regular expression what file paths should be included into venv/home;
56+
if empty than default is all -->
5757
<include>.*</include>
58-
</includes>
58+
</includes>
59+
<excludes>
5960
<!-- java-like regular expression what file paths should be excluded from venv/home;
6061
default is none -->
61-
<excludes>
62+
<!-- <exclude></exclude> -->
6263
</excludes>
6364
</pythonHome>
6465
</configuration>

graalpython/graalpy-maven-plugin/src/main/java/org/graalvm/python/maven/plugin/ManageResourcesMojo.java

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -178,9 +178,23 @@ public static class PythonHome {
178178
private void manageHome() throws MojoExecutionException {
179179
var homeDirectory = getHomeDirectory(project);
180180
if (pythonHome == null) {
181-
delete(homeDirectory);
182-
return;
181+
pythonHome = new PythonHome();
182+
pythonHome.includes = Arrays.asList(".*");
183+
pythonHome.excludes = Collections.emptyList();
184+
} else {
185+
if (pythonHome.includes != null) {
186+
trim(pythonHome.includes);
187+
}
188+
if (pythonHome.includes == null || pythonHome.includes.isEmpty()) {
189+
pythonHome.includes = Arrays.asList(".*");
190+
}
191+
if (pythonHome.excludes == null) {
192+
pythonHome.excludes = Collections.emptyList();
193+
} else {
194+
trim(pythonHome.excludes);
195+
}
183196
}
197+
184198
var tag = homeDirectory.resolve("tagfile");
185199
var graalPyVersion = getGraalPyVersion(project);
186200

0 commit comments

Comments
 (0)