Skip to content

Commit

Permalink
Merge pull request #172 from groovy/java16
Browse files Browse the repository at this point in the history
Add Java 16 to supported checks
  • Loading branch information
keeganwitt authored Oct 1, 2020
2 parents 0eb84aa + 8509655 commit 7640b66
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 4 deletions.
3 changes: 2 additions & 1 deletion integrationTest.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -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}..."
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
<!-- this is a property so that site generation can use it -->
<sourcePluginVersion>3.2.1</sourcePluginVersion>
<!-- this is a property so that site generation and integration tests can use it -->
<groovyVersion>3.0.5</groovyVersion>
<groovyVersion>3.0.6</groovyVersion>
</properties>

<dependencies>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*/
Expand Down Expand Up @@ -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.");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*/
Expand Down Expand Up @@ -386,7 +391,11 @@ protected void resetStubModifiedDates(final Set<File> 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.");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down

0 comments on commit 7640b66

Please sign in to comment.