aurora-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jco...@apache.org
Subject aurora git commit: Enforce a minimum java version rather than failing to compile when language features are not available in the current JDK.
Date Wed, 22 Jul 2015 15:05:20 GMT
Repository: aurora
Updated Branches:
  refs/heads/master c6eaf196d -> b64f7b68d


Enforce a minimum java version rather than failing to compile when language features are not
available in the current JDK.

Reviewed at https://reviews.apache.org/r/36671/


Project: http://git-wip-us.apache.org/repos/asf/aurora/repo
Commit: http://git-wip-us.apache.org/repos/asf/aurora/commit/b64f7b68
Tree: http://git-wip-us.apache.org/repos/asf/aurora/tree/b64f7b68
Diff: http://git-wip-us.apache.org/repos/asf/aurora/diff/b64f7b68

Branch: refs/heads/master
Commit: b64f7b68d125126b4c2532df84b3b042b36a0c9e
Parents: c6eaf19
Author: Joshua Cohen <jcohen@apache.org>
Authored: Wed Jul 22 10:04:44 2015 -0500
Committer: Joshua Cohen <jcohen@apache.org>
Committed: Wed Jul 22 10:04:44 2015 -0500

----------------------------------------------------------------------
 build.gradle | 17 +++++++++++++++--
 1 file changed, 15 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/aurora/blob/b64f7b68/build.gradle
----------------------------------------------------------------------
diff --git a/build.gradle b/build.gradle
index 69e4a91..fa2e268 100644
--- a/build.gradle
+++ b/build.gradle
@@ -12,6 +12,7 @@
  * limitations under the License.
  */
 import org.apache.aurora.build.CoverageReportCheck
+import org.gradle.api.JavaVersion
 
 plugins {
   id 'com.eriwen.gradle.js' version '1.12.1'
@@ -26,6 +27,8 @@ apply plugin: 'findbugs'
 apply plugin: 'jacoco'
 apply plugin: 'pmd'
 
+def minJavaVersion = JavaVersion.VERSION_1_8;
+
 allprojects {
   apply plugin: 'java'
   apply plugin: 'idea'
@@ -42,8 +45,8 @@ allprojects {
   }
 
   compileJava {
-    sourceCompatibility = 1.8
-    targetCompatibility = 1.8
+    sourceCompatibility = minJavaVersion
+    targetCompatibility = minJavaVersion
   }
 
   group 'org.apache.aurora'
@@ -213,6 +216,16 @@ compileJava {
   options.compilerArgs << '-Xlint:-serial'
 }
 
+task enforceVersion {
+  def foundVersion = JavaVersion.current();
+  if (foundVersion < minJavaVersion) {
+    throw new GradleException("Build requires at least Java ${minJavaVersion}; but ${foundVersion}"
+        + " was found. Consider setting JAVA_HOME to select a specific JDK on your system.");
+  }
+}
+
+compileJava.dependsOn(enforceVersion);
+
 task wrapper(type: Wrapper) {
   gradleVersion = project(':buildSrc').GRADLE_VERSION
 }


Mime
View raw message