mirror of
https://github.com/google/nomulus.git
synced 2025-07-22 18:55:58 +02:00
Make the formatting tasks work with Java 17 (take 2) (#2305)
We should not assume org.gradle.java.home to exist on kokoro or GCB.
This commit is contained in:
parent
a4903c27b9
commit
0112b3ae06
1 changed files with 8 additions and 2 deletions
10
build.gradle
10
build.gradle
|
@ -504,7 +504,13 @@ def createGetBuildSrcDirectDepsTask(outputFileName) {
|
|||
rootProject.ext {
|
||||
invokeJavaDiffFormatScript = { action ->
|
||||
def javaHome = project.findProperty('org.gradle.java.home')
|
||||
println("Running the formatting tool with JDK at $javaHome")
|
||||
def javaBin
|
||||
if (javaHome != null) {
|
||||
javaBin = "$javaHome/bin/java"
|
||||
} else {
|
||||
javaBin = ext.execInBash("which java", rootDir)
|
||||
}
|
||||
println("Running the formatting tool with $javaBin")
|
||||
def scriptDir = rootDir.path.endsWith('buildSrc')
|
||||
? "${rootDir}/../java-format"
|
||||
: "${rootDir}/java-format"
|
||||
|
@ -515,7 +521,7 @@ rootProject.ext {
|
|||
def pythonExe = getPythonExecutable()
|
||||
|
||||
return ext.execInBash(
|
||||
"JAVA=${javaHome}/bin/java PYTHON=${pythonExe} ${formatDiffScript} ${action}", "${workingDir}")
|
||||
"JAVA=${javaBin} PYTHON=${pythonExe} ${formatDiffScript} ${action}", "${workingDir}")
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue