diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index fb6dadf..f9f2ba0 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -3,6 +3,7 @@ repos: rev: v5.0.0 hooks: - id: trailing-whitespace + exclude: ^integration-tests/jbang/EmptyPIPComments\.j$ - id: end-of-file-fixer - id: check-yaml - id: check-added-large-files diff --git a/integration-tests/jbang/EmptyPIPComments.j b/integration-tests/jbang/EmptyPIPComments.j index ab500f1..5c288f2 100644 --- a/integration-tests/jbang/EmptyPIPComments.j +++ b/integration-tests/jbang/EmptyPIPComments.j @@ -3,9 +3,9 @@ //DEPS org.graalvm.python:jbang:${env.GRAALPY_VERSION:26.0.0} //PIP // one blank after PIP -//PIP +//PIP // three blanks after PIP -//PIP +//PIP public class EmptyPIPComments { public static void main(String[] args) { diff --git a/integration-tests/test_jbang_integration.py b/integration-tests/test_jbang_integration.py index a24c2ef..c6e87c0 100644 --- a/integration-tests/test_jbang_integration.py +++ b/integration-tests/test_jbang_integration.py @@ -317,6 +317,7 @@ def check_empty_comments(self, work_dir, java_file, log): self.assertEqual(0, result, f"command: {command}\n stdout: {out}") self.assertNotIn("[graalpy jbang integration]", out) + @unittest.skip # https://github.com/jbangdev/jbang/issues/2236 def test_malformed_tag_formats(self): jbang_templates_dir = os.path.join(os.path.dirname(__file__), "jbang") work_dir = self.tmpdir diff --git a/org.graalvm.python.jbang/src/main/java/org/graalvm/python/jbang/JBangIntegration.java b/org.graalvm.python.jbang/src/main/java/org/graalvm/python/jbang/JBangIntegration.java index fe874b8..a001668 100644 --- a/org.graalvm.python.jbang/src/main/java/org/graalvm/python/jbang/JBangIntegration.java +++ b/org.graalvm.python.jbang/src/main/java/org/graalvm/python/jbang/JBangIntegration.java @@ -180,8 +180,11 @@ public static Map postBuild(Path temporaryJar, Path pomFile, resourcesDirectory = Path.of(path); } } else if (comment.startsWith(PIP)) { - pkgs.addAll(Arrays.stream(comment.substring(PIP.length()).trim().split(" ")) - .filter(s -> !s.trim().isEmpty()).collect(Collectors.toList())); + String content = comment.substring(PIP.length()).trim(); + if (!content.isEmpty()) { + pkgs.addAll(Arrays.stream(content.split("\\s+")).filter(x -> !x.isBlank()) + .collect(Collectors.toList())); + } } } if (!pkgs.isEmpty()) { diff --git a/pom.xml b/pom.xml index 43d3eaa..78d3321 100644 --- a/pom.xml +++ b/pom.xml @@ -173,9 +173,9 @@ maven-compiler-plugin 3.14.0 - 21 - 21 - 21 + 17 + 17 + 17 -Xlint:all -Werror