Include java.lang.invoke classes in bootstrap classpath.

This commit is contained in:
akwizgran
2017-11-16 15:26:05 +00:00
parent fc93ced067
commit e30e34f342
5 changed files with 28 additions and 24 deletions

View File

@@ -24,3 +24,27 @@ buildscript {
classpath files('libs/gradle-witness.jar')
}
}
// If a Java 6 JRE is available, check we're not using any Java 7 or 8 APIs
ext.useJava6StandardLibrary = { task ->
def home = System.env.JAVA_6_HOME;
if (home != null && !home.isEmpty()) {
println "Setting Java 6 bootstrap classpath for ${task.name}"
task.dependsOn createJavaLangInvokeJar
task.options.bootstrapClasspath = files(
"${project.rootDir}/build/invoke.jar",
"${home}/jre/lib/rt.jar",
"${home}/jre/lib/jsse.jar"
)
}
}
// Create a jar containing the java.lang.invoke classes for the Java 6 bootstrap classpath
task createJavaLangInvokeJar(type: Zip) {
archiveName 'invoke.jar'
destinationDir file("${project.rootDir}/build")
from zipTree("${System.getProperty('java.home')}/lib/rt.jar").matching {
include 'java/lang/invoke/*'
}
include '**/*'
}