From f8425658e4eacb78f114f7af6720da79b31f8f01 Mon Sep 17 00:00:00 2001 From: akwizgran <michael@briarproject.org> Date: Wed, 15 Nov 2017 16:46:15 +0000 Subject: [PATCH] Support Java 8 language features in Java modules. --- bramble-api/build.gradle | 14 ++++++++++++-- bramble-core/build.gradle | 14 ++++++++++++-- bramble-j2se/build.gradle | 4 ++-- briar-api/build.gradle | 14 ++++++++++++-- briar-core/build.gradle | 14 ++++++++++++-- settings.gradle | 3 ++- 6 files changed, 52 insertions(+), 11 deletions(-) diff --git a/bramble-api/build.gradle b/bramble-api/build.gradle index bded3ab754..e1d90cdd6d 100644 --- a/bramble-api/build.gradle +++ b/bramble-api/build.gradle @@ -1,6 +1,6 @@ apply plugin: 'java' -sourceCompatibility = 1.6 -targetCompatibility = 1.6 +sourceCompatibility = 1.8 +targetCompatibility = 1.8 apply plugin: 'witness' @@ -35,3 +35,13 @@ task jarTest(type: Jar, dependsOn: testClasses) { artifacts { testOutput jarTest } + +// If a Java 6 JRE is available, check we're not using any Java 7 or 8 APIs +tasks.withType(JavaCompile) { + doFirst { + def home = System.env.JAVA_6_HOME; + if (home != null && !home.isEmpty()) { + options.bootstrapClasspath = files("${home}/jre/lib/rt.jar", "${home}/jre/lib/jsse.jar") + } + } +} diff --git a/bramble-core/build.gradle b/bramble-core/build.gradle index 93a6c2c946..abc388449c 100644 --- a/bramble-core/build.gradle +++ b/bramble-core/build.gradle @@ -1,6 +1,6 @@ apply plugin: 'java' -sourceCompatibility = 1.6 -targetCompatibility = 1.6 +sourceCompatibility = 1.8 +targetCompatibility = 1.8 apply plugin: 'net.ltgt.apt' apply plugin: 'idea' @@ -38,3 +38,13 @@ task jarTest(type: Jar, dependsOn: testClasses) { artifacts { testOutput jarTest } + +// If a Java 6 JRE is available, check we're not using any Java 7 or 8 APIs +tasks.withType(JavaCompile) { + doFirst { + def home = System.env.JAVA_6_HOME; + if (home != null && !home.isEmpty()) { + options.bootstrapClasspath = files("${home}/jre/lib/rt.jar", "${home}/jre/lib/jsse.jar") + } + } +} diff --git a/bramble-j2se/build.gradle b/bramble-j2se/build.gradle index a140432b6e..f920589eb2 100644 --- a/bramble-j2se/build.gradle +++ b/bramble-j2se/build.gradle @@ -1,6 +1,6 @@ apply plugin: 'java' -sourceCompatibility = 1.7 -targetCompatibility = 1.7 +sourceCompatibility = 1.8 +targetCompatibility = 1.8 apply plugin: 'net.ltgt.apt' apply plugin: 'idea' diff --git a/briar-api/build.gradle b/briar-api/build.gradle index 33bc10b8cb..29f9f9aa79 100644 --- a/briar-api/build.gradle +++ b/briar-api/build.gradle @@ -1,7 +1,17 @@ apply plugin: 'java' -sourceCompatibility = 1.6 -targetCompatibility = 1.6 +sourceCompatibility = 1.8 +targetCompatibility = 1.8 dependencies { compile project(path: ':bramble-api', configuration: 'default') } + +// If a Java 6 JRE is available, check we're not using any Java 7 or 8 APIs +tasks.withType(JavaCompile) { + doFirst { + def home = System.env.JAVA_6_HOME; + if (home != null && !home.isEmpty()) { + options.bootstrapClasspath = files("${home}/jre/lib/rt.jar", "${home}/jre/lib/jsse.jar") + } + } +} diff --git a/briar-core/build.gradle b/briar-core/build.gradle index 6fc8e564bb..efbdf0a2af 100644 --- a/briar-core/build.gradle +++ b/briar-core/build.gradle @@ -1,6 +1,6 @@ apply plugin: 'java' -sourceCompatibility = 1.6 -targetCompatibility = 1.6 +sourceCompatibility = 1.8 +targetCompatibility = 1.8 apply plugin: 'net.ltgt.apt' apply plugin: 'idea' @@ -33,3 +33,13 @@ dependencyVerification { 'com.squareup.okio:okio:734269c3ebc5090e3b23566db558f421f0b4027277c79ad5d176b8ec168bb850', ] } + +// If a Java 6 JRE is available, check we're not using any Java 7 or 8 APIs +tasks.withType(JavaCompile) { + doFirst { + def home = System.env.JAVA_6_HOME; + if (home != null && !home.isEmpty()) { + options.bootstrapClasspath = files("${home}/jre/lib/rt.jar", "${home}/jre/lib/jsse.jar") + } + } +} diff --git a/settings.gradle b/settings.gradle index de661574c2..3f3670622d 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1,5 +1,6 @@ -include ':bramble-api', ':bramble-android' +include ':bramble-api' include ':bramble-core' +include ':bramble-android' include ':bramble-j2se' include ':briar-api' include ':briar-core' -- GitLab