From 49e60508713d1618c2e8a4ac8f29709f83690029 Mon Sep 17 00:00:00 2001 From: Alexey Andreev Date: Tue, 23 Jun 2015 18:23:57 +0400 Subject: [PATCH] Add wildcard-based class exclusion from JUnit mojo --- teavm-html4j/pom.xml | 3 +++ .../org/teavm/maven/BuildJavascriptTestMojo.java | 14 ++++++++++++++ 2 files changed, 17 insertions(+) diff --git a/teavm-html4j/pom.xml b/teavm-html4j/pom.xml index 571ca3af6..195a501d2 100644 --- a/teavm-html4j/pom.xml +++ b/teavm-html4j/pom.xml @@ -101,6 +101,9 @@ true true true + + **.GC*Test + diff --git a/teavm-maven/teavm-maven-plugin/src/main/java/org/teavm/maven/BuildJavascriptTestMojo.java b/teavm-maven/teavm-maven-plugin/src/main/java/org/teavm/maven/BuildJavascriptTestMojo.java index 2c6f338dd..a194b57ad 100644 --- a/teavm-maven/teavm-maven-plugin/src/main/java/org/teavm/maven/BuildJavascriptTestMojo.java +++ b/teavm-maven/teavm-maven-plugin/src/main/java/org/teavm/maven/BuildJavascriptTestMojo.java @@ -83,6 +83,9 @@ public class BuildJavascriptTestMojo extends AbstractMojo { @Parameter private String[] wildcards = { "**.*Test", "**.*UnitTest" }; + @Parameter + private String[] excludeWildcards = new String[0]; + @Parameter private boolean minifying = true; @@ -150,6 +153,10 @@ public class BuildJavascriptTestMojo extends AbstractMojo { this.wildcards = wildcards; } + public void setExcludeWildcards(String[] excludeWildcards) { + this.excludeWildcards = excludeWildcards; + } + public String[] getTransformers() { return transformers; } @@ -359,6 +366,13 @@ public class BuildJavascriptTestMojo extends AbstractMojo { if (!matches) { return; } + + for (String wildcard : excludeWildcards) { + if (FilenameUtils.wildcardMatch(simpleName, wildcard.replace('.', '/'))) { + return; + } + } + try { Class candidate = Class.forName(className, true, classLoader); if (tool.getAdapter().acceptClass(candidate)) {