diff options
author | Reinier Zwitserloot <reinier@zwitserloot.com> | 2014-05-04 10:33:55 +0200 |
---|---|---|
committer | Reinier Zwitserloot <reinier@zwitserloot.com> | 2014-05-04 10:33:55 +0200 |
commit | 7079271802176caea4404fc7c80b4656346a2402 (patch) | |
tree | 18053476d31bce4d655dc4ff807067ae01772537 | |
parent | e890428077e48f8dcf14928267d506a0c1d36abf (diff) | |
download | lombok-7079271802176caea4404fc7c80b4656346a2402.tar.gz lombok-7079271802176caea4404fc7c80b4656346a2402.tar.bz2 lombok-7079271802176caea4404fc7c80b4656346a2402.zip |
thoroughly updated the launch targets for testing lombok in eclipse;
they should now be able to handle running JDK8 etc tests.
CAREFUL: You MUST name your JDK8 'JavaSE-1.8' or it won't work.
Also added a basic test for JDK8 features.
-rw-r--r-- | build.xml | 10 | ||||
-rw-r--r-- | buildScripts/eclipse-run-tests.template | 41 | ||||
-rw-r--r-- | test/core/src/lombok/RunTestsViaEcj.java | 11 | ||||
-rw-r--r-- | test/transform/resource/after-delombok/ValInTryWithResources.java | 1 | ||||
-rw-r--r-- | test/transform/resource/before/ValInTryWithResources.java | 2 |
5 files changed, 41 insertions, 24 deletions
@@ -431,9 +431,12 @@ ${sourceWarning}</echo> overwrite="true"> <filterset> <filter token="JAVAC_LOCATION" value="${test.location.javac}" /> + <filter token="ECJ_LOCATION" value="${test.location.ecj}" /> <filter token="RT_LOCATION" value="${test.location.bootclasspath}" /> + <filter token="JAVA_VERSION" value="${test.javaversion}" /> </filterset> </copy> + <echo>WARNING: If you wish to test JDK8 features in eclipse, there must be a JDK8 installation configured in your eclipse, and it must be called 'JavaSE-1.8'.</echo> </target> <target name="setupJavaOpenJDK6TestEnvironment" description="Sets up the test so that 'ant test' will test against OpenJDK6."> @@ -445,6 +448,7 @@ ${sourceWarning}</echo> <entry key="test.location.ecj" value="lib/ecj7/org.eclipse.custom-ecj.jar" /> <entry key="test.location.bootclasspath" value="lib/openJDK6Environment/rt-openjdk6.jar" /> <entry key="test.location.name" value="OpenJDK6" /> + <entry key="test.javaversion" value="6" /> </propertyfile> <echo>Tests will now run against OpenJDK6</echo> <antcall target="-createEclipseLaunchForTestEnvironmentIfEclipseProject" /> @@ -459,6 +463,7 @@ ${sourceWarning}</echo> <entry key="test.location.ecj" value="lib/ecj7/org.eclipse.custom-ecj.jar" /> <entry key="test.location.bootclasspath" value="lib/openJDK7Environment/rt-openjdk7.jar" /> <entry key="test.location.name" value="OpenJDK7" /> + <entry key="test.javaversion" value="7" /> </propertyfile> <echo>Tests will now run against OpenJDK7</echo> <antcall target="-createEclipseLaunchForTestEnvironmentIfEclipseProject" /> @@ -473,6 +478,7 @@ ${sourceWarning}</echo> <entry key="test.location.ecj" value="lib/ecj7/org.eclipse.custom-ecj.jar" /> <entry key="test.location.bootclasspath" value="lib/oracleJDK7Environment/rt.jar" /> <entry key="test.location.name" value="OracleJDK7" /> + <entry key="test.javaversion" value="7" /> </propertyfile> <echo>Tests will now run against Oracle JDK7</echo> <antcall target="-createEclipseLaunchForTestEnvironmentIfEclipseProject" /> @@ -487,12 +493,13 @@ ${sourceWarning}</echo> <entry key="test.location.ecj" value="lib/ecj8/org.eclipse.custom-ecj.jar" /> <entry key="test.location.bootclasspath" value="lib/oracleJDK8Environment/rt.jar" /> <entry key="test.location.name" value="OracleJDK8" /> + <entry key="test.javaversion" value="8" /> </propertyfile> <echo>Tests will now run against Oracle JDK8</echo> <antcall target="-createEclipseLaunchForTestEnvironmentIfEclipseProject" /> </target> - <target name="-failIfNoTestEnvironmentProperties" unless="test.location.ecj"> + <target name="-failIfNoTestEnvironmentProperties" unless="test.javaversion"> <fail>ERROR: No test environment set up. You need to set up a test environment, which consists of a version of javac, and a JRE runtime classpath ('rt.jar'). @@ -513,6 +520,7 @@ You can also create your own by writing a 'testenvironment.properties' file. The * test.location.ecj = /path/to/ecj6.jar * test.location.bootclasspath = /path/to/rt.jar * test.location.name = RandomUsefulNameToIdentifyThisSetup +* test.javaversion = 6 </fail> </target> diff --git a/buildScripts/eclipse-run-tests.template b/buildScripts/eclipse-run-tests.template index 1e23baa0..b7bc8b0d 100644 --- a/buildScripts/eclipse-run-tests.template +++ b/buildScripts/eclipse-run-tests.template @@ -1,19 +1,28 @@ <?xml version="1.0" encoding="UTF-8" standalone="no"?> <launchConfiguration type="org.eclipse.jdt.junit.launchconfig"> -<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS"> -<listEntry value="/lombok/test/core/src/lombok/RunAllTests.java"/> -</listAttribute> -<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES"> -<listEntry value="1"/> -</listAttribute> -<listAttribute key="org.eclipse.debug.ui.favoriteGroups"> -<listEntry value="org.eclipse.debug.ui.launchGroup.debug"/> -</listAttribute> -<stringAttribute key="org.eclipse.jdt.junit.CONTAINER" value=""/> -<booleanAttribute key="org.eclipse.jdt.junit.KEEPRUNNING_ATTR" value="false"/> -<stringAttribute key="org.eclipse.jdt.junit.TESTNAME" value=""/> -<stringAttribute key="org.eclipse.jdt.junit.TEST_KIND" value="org.eclipse.jdt.junit.loader.junit4"/> -<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="lombok.RunAllTests"/> -<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="lombok"/> -<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-javaagent:dist/lombok.jar -Xbootclasspath/p:@JAVAC_LOCATION@ -Ddelombok.bootclasspath=@RT_LOCATION@"/> + <listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS"> + <listEntry value="/lombok/test/core/src/lombok/RunAllTests.java"/> + </listAttribute> + <listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES"> + <listEntry value="1"/> + </listAttribute> + <listAttribute key="org.eclipse.debug.ui.favoriteGroups"> + <listEntry value="org.eclipse.debug.ui.launchGroup.debug"/> + </listAttribute> + <stringAttribute key="org.eclipse.jdt.junit.CONTAINER" value=""/> + <booleanAttribute key="org.eclipse.jdt.junit.KEEPRUNNING_ATTR" value="false"/> + <stringAttribute key="org.eclipse.jdt.junit.TESTNAME" value=""/> + <stringAttribute key="org.eclipse.jdt.junit.TEST_KIND" value="org.eclipse.jdt.junit.loader.junit4"/> + <booleanAttribute key="org.eclipse.jdt.launching.ATTR_USE_START_ON_FIRST_THREAD" value="true"/> + <listAttribute key="org.eclipse.jdt.launching.CLASSPATH"> + <listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry containerPath="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.@JAVA_VERSION@" path="1" type="4"/> "/> + <listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry internalArchive="/lombok/@ECJ_LOCATION@" path="3" type="2"/> "/> + <listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry internalArchive="/lombok/@JAVAC_LOCATION@" path="3" type="2"/> "/> + <listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry id="org.eclipse.jdt.launching.classpathentry.defaultClasspath"> <memento exportedEntriesOnly="false" project="lombok"/> </runtimeClasspathEntry> "/> + </listAttribute> + <booleanAttribute key="org.eclipse.jdt.launching.DEFAULT_CLASSPATH" value="false"/> + <stringAttribute key="org.eclipse.jdt.launching.JRE_CONTAINER" value="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.@JAVA_VERSION@"/> + <stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="lombok.RunAllTests"/> + <stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="lombok"/> + <stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-javaagent:dist/lombok.jar -Ddelombok.bootclasspath=@RT_LOCATION@"/> </launchConfiguration> diff --git a/test/core/src/lombok/RunTestsViaEcj.java b/test/core/src/lombok/RunTestsViaEcj.java index 8d1a8278..e23ebc4c 100644 --- a/test/core/src/lombok/RunTestsViaEcj.java +++ b/test/core/src/lombok/RunTestsViaEcj.java @@ -70,22 +70,22 @@ public class RunTestsViaEcj extends AbstractRunTests { warnings.put(CompilerOptions.OPTION_ReportUnusedLabel, "ignore"); warnings.put(CompilerOptions.OPTION_ReportUnusedImport, "ignore"); warnings.put(CompilerOptions.OPTION_ReportUnusedPrivateMember, "ignore"); - warnings.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_1_7); + warnings.put(CompilerOptions.OPTION_Source, "1." + Eclipse.getEcjCompilerVersion()); options.set(warnings); return options; } protected IErrorHandlingPolicy ecjErrorHandlingPolicy() { return new IErrorHandlingPolicy() { - @Override public boolean stopOnFirstError() { + public boolean stopOnFirstError() { return true; } - @Override public boolean proceedOnErrors() { + public boolean proceedOnErrors() { return false; } - @Override public boolean ignoreAllErrors() { + public boolean ignoreAllErrors() { return false; } }; @@ -124,7 +124,8 @@ public class RunTestsViaEcj extends AbstractRunTests { CompilationUnitDeclaration cud = compilationUnit_.get(); - result.append(cud.toString()); + if (cud == null) result.append("---- NO CompilationUnit provided by ecj ----"); + else result.append(cud.toString()); } private FileSystem createFileSystem(File file) { diff --git a/test/transform/resource/after-delombok/ValInTryWithResources.java b/test/transform/resource/after-delombok/ValInTryWithResources.java index 9aae99a2..42bd3193 100644 --- a/test/transform/resource/after-delombok/ValInTryWithResources.java +++ b/test/transform/resource/after-delombok/ValInTryWithResources.java @@ -1,4 +1,3 @@ -//version 7 import java.io.IOException; public class ValInTryWithResources { public void whyTryInsteadOfCleanup() throws IOException { diff --git a/test/transform/resource/before/ValInTryWithResources.java b/test/transform/resource/before/ValInTryWithResources.java index 780e1c71..a7820062 100644 --- a/test/transform/resource/before/ValInTryWithResources.java +++ b/test/transform/resource/before/ValInTryWithResources.java @@ -1,4 +1,4 @@ -//version 7 +//version 7: import lombok.val; import java.io.IOException; |