Fall back to Java 13 APIs for forbidden API checks when using JDK 14 (#50095)

Closes #50041

(cherry picked from commit 4745b77ddefcaa5b00e700bd8e3ec7752f03c52d)
This commit is contained in:
Mark Vieira 2019-12-11 13:01:54 -08:00
parent c043aa887f
commit f42537a0f4
No known key found for this signature in database
GPG Key ID: CA947EF7E6D4B105
1 changed files with 5 additions and 7 deletions

View File

@ -24,6 +24,7 @@ import de.thetaphi.forbiddenapis.gradle.ForbiddenApisPlugin
import org.elasticsearch.gradle.ExportElasticsearchBuildResourcesTask import org.elasticsearch.gradle.ExportElasticsearchBuildResourcesTask
import org.elasticsearch.gradle.VersionProperties import org.elasticsearch.gradle.VersionProperties
import org.elasticsearch.gradle.info.BuildParams import org.elasticsearch.gradle.info.BuildParams
import org.gradle.api.JavaVersion
import org.gradle.api.Project import org.gradle.api.Project
import org.gradle.api.artifacts.Configuration import org.gradle.api.artifacts.Configuration
import org.gradle.api.plugins.JavaBasePlugin import org.gradle.api.plugins.JavaBasePlugin
@ -145,16 +146,13 @@ class PrecommitTasks {
doFirst { doFirst {
// we need to defer this configuration since we don't know the runtime java version until execution time // we need to defer this configuration since we don't know the runtime java version until execution time
targetCompatibility = BuildParams.runtimeJavaVersion.majorVersion targetCompatibility = BuildParams.runtimeJavaVersion.majorVersion
/*
TODO: Reenable once Gradle supports Java 13 or later!
if (BuildParams.runtimeJavaVersion > JavaVersion.VERSION_13) { if (BuildParams.runtimeJavaVersion > JavaVersion.VERSION_13) {
project.logger.info( project.logger.warn(
"Forbidden APIs does not support java version past 13. Will use the signatures from 13 for ", "Forbidden APIs does not support Java versions past 13. Will use the signatures from 13 for {}.",
BuildParams.runtimeJavaVersion` BuildParams.runtimeJavaVersion
) )
targetCompatibility = JavaVersion.VERSION_13.getMajorVersion() targetCompatibility = JavaVersion.VERSION_13.majorVersion
} }
*/
} }
bundledSignatures = [ bundledSignatures = [
"jdk-unsafe", "jdk-deprecated", "jdk-non-portable", "jdk-system-out" "jdk-unsafe", "jdk-deprecated", "jdk-non-portable", "jdk-system-out"