Skip to content

Commit

Permalink
[Java] Use different URI for early access JDK build.
Browse files Browse the repository at this point in the history
  • Loading branch information
vyazelenko committed Jan 13, 2025
1 parent 7d04c25 commit 5c65251
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,14 @@ plugins {

defaultTasks 'clean', 'build'

static def rawBuildJavaVersion()
{
return System.getenv('BUILD_JAVA_VERSION') ?: JavaVersion.current().getMajorVersion()
}
boolean isEarlyAccessJavaVersion = rawBuildJavaVersion().endsWith("-ea")

static def getBuildJavaVersion() {
def buildJavaVersion = System.getenv('BUILD_JAVA_VERSION') ?: JavaVersion.current().getMajorVersion()
def buildJavaVersion = rawBuildJavaVersion()
if (buildJavaVersion.indexOf('.') > 0) {
buildJavaVersion = buildJavaVersion.substring(0, buildJavaVersion.indexOf('.'))
}
Expand Down Expand Up @@ -193,6 +199,8 @@ subprojects {
mkdir 'build/resources/main' // Avoid Javac warning about non-existing directory
}

options.compilerArgs.add('--release')
options.compilerArgs.add(java.sourceCompatibility.majorVersion)
options.compilerArgs.addAll(['-Xlint:all', '-Werror']) // Enable all warnings and treat them as errors
options.encoding = 'UTF-8'
options.deprecation = true
Expand Down Expand Up @@ -231,7 +239,7 @@ subprojects {
options.encoding = 'UTF-8'
options.docEncoding = 'UTF-8'
options.charSet = 'UTF-8'
if (buildJavaVersion > 23) { // early access JavaDoc location is different
if (isEarlyAccessJavaVersion) {
options.links("https://download.java.net/java/early_access/jdk${buildJavaVersion}/docs/api/")
}
else {
Expand Down

0 comments on commit 5c65251

Please sign in to comment.