From 4f1c7eacd1bf3521c8c8fa9dc5beb4a93355484e Mon Sep 17 00:00:00 2001 From: Keegan Witt Date: Thu, 1 Oct 2020 11:52:14 -0400 Subject: [PATCH 1/3] Update test Groovy version to 3.0.6 --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 6258f5db0..4bd005531 100644 --- a/pom.xml +++ b/pom.xml @@ -24,7 +24,7 @@ 3.2.1 - 3.0.5 + 3.0.6 From 0e1d3d18a1790a15aec5e85e4276bdba79b13b6b Mon Sep 17 00:00:00 2001 From: Keegan Witt Date: Thu, 1 Oct 2020 11:53:14 -0400 Subject: [PATCH 2/3] Add 3.0.6 and 4.0.0-alpha-1 to integration test versions --- integrationTest.groovy | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/integrationTest.groovy b/integrationTest.groovy index 10bea8de7..e4af829c9 100644 --- a/integrationTest.groovy +++ b/integrationTest.groovy @@ -20,7 +20,8 @@ groovyVersions = ["1.5.0", "1.5.1", "1.5.2", "1.5.3", "1.5.4", "1.5.5", "1.5.6", "2.4.0-beta-1", "2.4.0-beta-2", "2.4.0-beta-3", "2.4.0-beta-4", "2.4.0-rc-1", "2.4.0-rc-2", "2.4.0", "2.4.1", "2.4.2", "2.4.3", "2.4.4", "2.4.5", "2.4.6", "2.4.7", "2.4.8", "2.4.9", "2.4.10", "2.4.11", "2.4.12", "2.4.13", "2.4.14", "2.4.15", "2.4.16", "2.4.17", "2.4.18", "2.4.19", "2.4.20", "2.5.0-alpha-1", "2.5.0-beta-1", "2.5.0-beta-2", "2.5.0-beta-3", "2.5.0-rc-1", "2.5.0-rc-2", "2.5.0", "2.5.1", "2.5.2", "2.5.3", "2.5.4", "2.5.5", "2.5.6", "2.5.7", "2.5.8", "2.5.9", "2.5.10", "2.5.11", "2.5.12", "2.5.13", "2.6.0-alpha-1", "2.6.0-alpha-2", "2.6.0-alpha-3", - "3.0.0-alpha-1", "3.0.0-alpha-2", "3.0.0-alpha-3", "3.0.0-alpha-4", "3.0.0-beta-1", "3.0.0-beta-2", "3.0.0-beta-3", "3.0.0-rc-1", "3.0.0-rc-2", "3.0.0-rc-3", "3.0.0", "3.0.1", "3.0.2", "3.0.3", "3.0.4", "3.0.5"] + "3.0.0-alpha-1", "3.0.0-alpha-2", "3.0.0-alpha-3", "3.0.0-alpha-4", "3.0.0-beta-1", "3.0.0-beta-2", "3.0.0-beta-3", "3.0.0-rc-1", "3.0.0-rc-2", "3.0.0-rc-3", "3.0.0", "3.0.1", "3.0.2", "3.0.3", "3.0.4", "3.0.5", "3.0.6", + "4.0.0-alpha-1"] for (int i = 0; i < groovyVersions.size(); i++) { def groovyVersion = groovyVersions[i] System.out.print "Testing Groovy ${groovyVersion}..." From 850965504bdceb001e181ab2ae3ec7d2f7d700a6 Mon Sep 17 00:00:00 2001 From: Keegan Witt Date: Thu, 1 Oct 2020 11:55:12 -0400 Subject: [PATCH 3/3] Add Java 16 to supported checks (closes #170) --- .../gmavenplus/mojo/AbstractCompileMojo.java | 11 ++++++++++- .../gmavenplus/mojo/AbstractGenerateStubsMojo.java | 11 ++++++++++- .../gmavenplus/mojo/AbstractCompileMojoTest.java | 14 ++++++++++++++ 3 files changed, 34 insertions(+), 2 deletions(-) diff --git a/src/main/java/org/codehaus/gmavenplus/mojo/AbstractCompileMojo.java b/src/main/java/org/codehaus/gmavenplus/mojo/AbstractCompileMojo.java index f67a45338..abc78b9fe 100644 --- a/src/main/java/org/codehaus/gmavenplus/mojo/AbstractCompileMojo.java +++ b/src/main/java/org/codehaus/gmavenplus/mojo/AbstractCompileMojo.java @@ -40,6 +40,11 @@ */ public abstract class AbstractCompileMojo extends AbstractGroovySourcesMojo { + /** + * Groovy 3.0.6 version. + */ + protected static final Version GROOVY_3_0_6 = new Version(3, 0, 6); + /** * Groovy 3.0.3 version. */ @@ -418,7 +423,11 @@ protected Object setupCompilerConfiguration(final File compileOutputDirectory, f * org.codehaus.groovy.classgen.asm.WriterController. */ protected void verifyGroovyVersionSupportsTargetBytecode() { - if ("15".equals(targetBytecode)) { + if ("16".equals(targetBytecode)) { + if (groovyOlderThan(GROOVY_3_0_6)) { + throw new IllegalArgumentException("Target bytecode 16 requires Groovy " + GROOVY_3_0_6 + " or newer."); + } + } else if ("15".equals(targetBytecode)) { if (groovyOlderThan(GROOVY_3_0_3)) { throw new IllegalArgumentException("Target bytecode 15 requires Groovy " + GROOVY_3_0_3 + " or newer."); } diff --git a/src/main/java/org/codehaus/gmavenplus/mojo/AbstractGenerateStubsMojo.java b/src/main/java/org/codehaus/gmavenplus/mojo/AbstractGenerateStubsMojo.java index a6e03ae20..79dd47e88 100644 --- a/src/main/java/org/codehaus/gmavenplus/mojo/AbstractGenerateStubsMojo.java +++ b/src/main/java/org/codehaus/gmavenplus/mojo/AbstractGenerateStubsMojo.java @@ -44,6 +44,11 @@ public abstract class AbstractGenerateStubsMojo extends AbstractGroovyStubSource * (although it does create the target directory) when I use other versions. */ + /** + * Groovy 3.0.6 version. + */ + protected static final Version GROOVY_3_0_6 = new Version(3, 0, 6); + /** * Groovy 3.0.3 version. */ @@ -386,7 +391,11 @@ protected void resetStubModifiedDates(final Set stubs) { * org.codehaus.groovy.classgen.asm.WriterController. */ protected void verifyGroovyVersionSupportsTargetBytecode() { - if ("15".equals(targetBytecode)) { + if ("16".equals(targetBytecode)) { + if (groovyOlderThan(GROOVY_3_0_6)) { + throw new IllegalArgumentException("Target bytecode 16 requires Groovy " + GROOVY_3_0_6 + " or newer."); + } + } else if ("15".equals(targetBytecode)) { if (groovyOlderThan(GROOVY_3_0_3)) { throw new IllegalArgumentException("Target bytecode 15 requires Groovy " + GROOVY_3_0_3 + " or newer."); } diff --git a/src/test/java/org/codehaus/gmavenplus/mojo/AbstractCompileMojoTest.java b/src/test/java/org/codehaus/gmavenplus/mojo/AbstractCompileMojoTest.java index da39d9930..60c8731ee 100644 --- a/src/test/java/org/codehaus/gmavenplus/mojo/AbstractCompileMojoTest.java +++ b/src/test/java/org/codehaus/gmavenplus/mojo/AbstractCompileMojoTest.java @@ -306,6 +306,20 @@ public void testJava15WithSupportedGroovy() { testMojo.verifyGroovyVersionSupportsTargetBytecode(); } + @Test(expected = IllegalArgumentException.class) + public void testJava16WithUnsupportedGroovy() { + testMojo = new TestMojo("3.0.5"); + testMojo.targetBytecode = "16"; + testMojo.verifyGroovyVersionSupportsTargetBytecode(); + } + + @Test + public void testJava16WithSupportedGroovy() { + testMojo = new TestMojo("3.0.6"); + testMojo.targetBytecode = "16"; + testMojo.verifyGroovyVersionSupportsTargetBytecode(); + } + @Test(expected = IllegalArgumentException.class) public void testUnrecognizedJava() { testMojo = new TestMojo("2.1.2");