#431 add JDK 9 to integration tests and remove processor_plugin_java_7 tests (they did exactly the same as the _java_8 variant, for what we are concerned).

Use -DprocessorIntegrationTest.canUseJdk9=false in case no JDK9 is configured in the toolchains.xml file
This commit is contained in:
Andreas Gudian 2015-02-06 20:43:24 +01:00 committed by Gunnar Morling
parent 83ace655e1
commit 762113aa60
3 changed files with 30 additions and 10 deletions

View File

@ -33,4 +33,15 @@
<jdkHome>C:\Program Files\Java\jdk1.8.0_11</jdkHome> <jdkHome>C:\Program Files\Java\jdk1.8.0_11</jdkHome>
</configuration> </configuration>
</toolchain> </toolchain>
<toolchain>
<type>jdk</type>
<provides>
<version>1.9.0</version>
<vendor>oracle</vendor>
<id>jdk1.9</id>
</provides>
<configuration>
<jdkHome>C:\Program Files\Java\jdk1.9.0</jdkHome>
</configuration>
</toolchain>
</toolchains> </toolchains>

View File

@ -64,6 +64,11 @@ public @interface ProcessorSuite {
*/ */
ORACLE_JAVA_8( null, "javac", "1.8" ), ORACLE_JAVA_8( null, "javac", "1.8" ),
/**
* Use an Oracle JDK 1.9 (or 1.9.x) via toolchain support to perform the processing
*/
ORACLE_JAVA_9( "oracle-[1.9,1.10)", "javac", "1.9" ),
/** /**
* Use the eclipse compiler with 1.7 source/target level from tycho-compiler-jdt to perform the build and * Use the eclipse compiler with 1.7 source/target level from tycho-compiler-jdt to perform the build and
* processing * processing
@ -76,12 +81,6 @@ public @interface ProcessorSuite {
*/ */
ECLIPSE_JDT_JAVA_8( null, "jdt", "1.8" ), ECLIPSE_JDT_JAVA_8( null, "jdt", "1.8" ),
/**
* Use the maven-processor-plugin with 1.7 source/target level with the same JDK that runs the mvn build to
* perform the processing
*/
PROCESSOR_PLUGIN_JAVA_7( null, null, "1.7" ),
/** /**
* Use the maven-processor-plugin with 1.8 source/target level with the same JDK that runs the mvn build to * Use the maven-processor-plugin with 1.8 source/target level with the same JDK that runs the mvn build to
* perform the processing * perform the processing
@ -91,8 +90,8 @@ public @interface ProcessorSuite {
/** /**
* Use all available processing variants * Use all available processing variants
*/ */
ALL( ORACLE_JAVA_6, ORACLE_JAVA_7, ORACLE_JAVA_8, ECLIPSE_JDT_JAVA_7, ECLIPSE_JDT_JAVA_8, ALL( ORACLE_JAVA_6, ORACLE_JAVA_7, ORACLE_JAVA_8, ORACLE_JAVA_9, ECLIPSE_JDT_JAVA_7, ECLIPSE_JDT_JAVA_8,
PROCESSOR_PLUGIN_JAVA_7, PROCESSOR_PLUGIN_JAVA_8 ), PROCESSOR_PLUGIN_JAVA_8 ),
/** /**
* Use all JDK8 compatible processing variants * Use all JDK8 compatible processing variants

View File

@ -57,6 +57,8 @@ public class ProcessorSuiteRunner extends ParentRunner<ProcessorTestCase> {
*/ */
public static final String SYS_PROP_DEBUG = "processorIntegrationTest.debug"; public static final String SYS_PROP_DEBUG = "processorIntegrationTest.debug";
public static final String SYS_PROP_CAN_USE_JDK_9 = "processorIntegrationTest.canUseJdk9";
public static final class ProcessorTestCase { public static final class ProcessorTestCase {
private final String baseDir; private final String baseDir;
private final ProcessorType processor; private final ProcessorType processor;
@ -65,12 +67,15 @@ public class ProcessorSuiteRunner extends ParentRunner<ProcessorTestCase> {
public ProcessorTestCase(String baseDir, ProcessorType processor) { public ProcessorTestCase(String baseDir, ProcessorType processor) {
this.baseDir = baseDir; this.baseDir = baseDir;
this.processor = processor; this.processor = processor;
this.ignored = !TOOLCHAINS_ENABLED && processor.getToolchain() != null; this.ignored =
( !TOOLCHAINS_ENABLED && processor.getToolchain() != null )
|| ( processor == ProcessorType.ORACLE_JAVA_9 && !CAN_USE_JDK_9 );
} }
} }
private static final File SPECIFIED_TOOLCHAINS_FILE = getSpecifiedToolchainsFile(); private static final File SPECIFIED_TOOLCHAINS_FILE = getSpecifiedToolchainsFile();
private static final boolean TOOLCHAINS_ENABLED = toolchainsFileExists(); private static final boolean TOOLCHAINS_ENABLED = toolchainsFileExists();
private static final boolean CAN_USE_JDK_9 = canUseJdk9();
private final List<ProcessorTestCase> methods; private final List<ProcessorTestCase> methods;
@ -184,7 +189,8 @@ public class ProcessorSuiteRunner extends ParentRunner<ProcessorTestCase> {
verifier.addCliOption( "-Dcompiler-source-target-version=" + child.processor.getSourceTargetVersion() ); verifier.addCliOption( "-Dcompiler-source-target-version=" + child.processor.getSourceTargetVersion() );
if ( "1.8".equals( child.processor.getSourceTargetVersion() ) ) { if ( "1.8".equals( child.processor.getSourceTargetVersion() )
|| "1.9".equals( child.processor.getSourceTargetVersion() ) ) {
verifier.addCliOption( "-Dmapstruct-artifact-id=mapstruct-jdk8" ); verifier.addCliOption( "-Dmapstruct-artifact-id=mapstruct-jdk8" );
} }
else { else {
@ -275,6 +281,10 @@ public class ProcessorSuiteRunner extends ParentRunner<ProcessorTestCase> {
return null; return null;
} }
private static boolean canUseJdk9() {
return Boolean.parseBoolean( System.getProperty( SYS_PROP_CAN_USE_JDK_9, "true" ) );
}
private static boolean toolchainsFileExists() { private static boolean toolchainsFileExists() {
if ( null != SPECIFIED_TOOLCHAINS_FILE ) { if ( null != SPECIFIED_TOOLCHAINS_FILE ) {
return SPECIFIED_TOOLCHAINS_FILE.exists(); return SPECIFIED_TOOLCHAINS_FILE.exists();