From 4920733b5707de26f5d1d0be980d3e145464bdb8 Mon Sep 17 00:00:00 2001 From: anttil <anttil> Date: Fri, 14 Mar 2014 10:12:49 +0000 Subject: [PATCH] SWE-22 / SP-1216: handle java 1.6 vs 1.7 ecj compile issue SVN: 31138 --- gradle/javaproject.gradle | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/gradle/javaproject.gradle b/gradle/javaproject.gradle index 5381460644d..b1425c13ec2 100644 --- a/gradle/javaproject.gradle +++ b/gradle/javaproject.gradle @@ -8,6 +8,7 @@ task wrapper(type: Wrapper) { distributionUrl = "http://svncisd.ethz.ch/repos/cisd/ivy-repository/trunk/gradle/distribution/1.8/gradle-1.8-all.zip" } +addSource = (sourceCompatibility == org.gradle.api.JavaVersion.VERSION_1_6) sourceCompatibility='1.6' targetCompatibility='1.6' @@ -131,8 +132,13 @@ compileJava { doFirst { options.forkOptions.with { executable = 'java' - jvmArgs = ['-cp', configurations.ecj.asPath, 'org.eclipse.jdt.internal.compiler.batch.Main', - '-nowarn'] + if (addSource) { + jvmArgs = ['-cp', configurations.ecj.asPath, 'org.eclipse.jdt.internal.compiler.batch.Main', + '-nowarn', '-source', '1.6'] + } else { + jvmArgs = ['-cp', configurations.ecj.asPath, 'org.eclipse.jdt.internal.compiler.batch.Main', + '-nowarn'] + } } } } @@ -143,8 +149,13 @@ compileTestJava { doFirst { options.forkOptions.with { executable = 'java' - jvmArgs = ['-cp', configurations.ecj.asPath, 'org.eclipse.jdt.internal.compiler.batch.Main', - '-nowarn'] + if (addSource) { + jvmArgs = ['-cp', configurations.ecj.asPath, 'org.eclipse.jdt.internal.compiler.batch.Main', + '-nowarn', '-source', '1.6'] + } else { + jvmArgs = ['-cp', configurations.ecj.asPath, 'org.eclipse.jdt.internal.compiler.batch.Main', + '-nowarn'] + } } } } -- GitLab