6.6.0 - Fix3 - 修复 Temurin 平台无法构建项目

This commit is contained in:
SuperMonster003
2024-12-02 16:47:24 +08:00
parent 789dff8ad6
commit 3ec26dc281

View File

@@ -69,7 +69,10 @@ class Utils {
Project project Project project
String sourceDir = File.separator String sourceDir = File.separator
File sourceFile = project.file(File.separator)
String destDir = File.separator String destDir = File.separator
File destFile = project.file(File.separator)
File cacheFile File cacheFile
File cacheRootFile File cacheRootFile
@@ -80,7 +83,7 @@ class Utils {
File getSkipFile() { File getSkipFile() {
if (privateSkipFile == null) { if (privateSkipFile == null) {
privateSkipFile = project.file(new File(destDir, "${cacheFileName}.skip")) privateSkipFile = project.file(new File(destFile, "${cacheFileName}.skip"))
} }
privateSkipFile privateSkipFile
} }
@@ -89,7 +92,7 @@ class Utils {
File getTempOutFile() { File getTempOutFile() {
if (privateTempOutFile == null) { if (privateTempOutFile == null) {
privateTempOutFile = project.file(new File(destDir, "temp-extracted")) privateTempOutFile = project.file(new File(destFile, "temp-extracted"))
} }
privateTempOutFile privateTempOutFile
} }
@@ -109,13 +112,16 @@ class Utils {
} }
LibDeployer setSourceDir(String sourceDir) { LibDeployer setSourceDir(String sourceDir) {
this.sourceDir = new File(sourceDir).path this.sourceDir = sourceDir
this.sourceFile = project.file(sourceDir)
return this return this
} }
LibDeployer setDestDir(String destDir) { LibDeployer setDestDir(String destDir) {
this.destDir = new File(destDir).path def destFile = project.file(destDir)
project.file(destDir).mkdirs() destFile.mkdirs()
this.destDir = destDir
this.destFile = destFile
return this return this
} }
@@ -154,6 +160,7 @@ class Utils {
void clean() { void clean() {
project.delete skipFile project.delete skipFile
println(skipFile)
project.delete tempOutFile project.delete tempOutFile
deleteDestAccordingToSrc() deleteDestAccordingToSrc()
deleteCacheAccordingToMd5() deleteCacheAccordingToMd5()
@@ -265,8 +272,8 @@ class Utils {
private void printExtractInfo() { private void printExtractInfo() {
def title = "Extract the archive file for \"${project.ext["projectName"]}\" Gradle project" def title = "Extract the archive file for \"${project.ext["projectName"]}\" Gradle project"
def srcInfo = "Source: ${cacheFile.absolutePath}" def srcInfo = "Source: $cacheFile"
def destInfo = "Destination: ${project.file(destDir).absolutePath}" def destInfo = "Destination: $destFile"
def hintInfo = cacheFileExtensionName == "7z" ? [ def hintInfo = cacheFileExtensionName == "7z" ? [
"Extracting \"7z\" archive file may take some time to complete.", "Extracting \"7z\" archive file may take some time to complete.",
] : [] ] : []
@@ -318,7 +325,7 @@ class Utils {
default: default:
throw new GradleException("Unknown archive file type: $cacheFileExtensionName") throw new GradleException("Unknown archive file type: $cacheFileExtensionName")
} }
println("All files extracted into [ ${project.file(destDir)} ]") println("All files extracted into [ $destFile ]")
if (!skipFile.exists()) { if (!skipFile.exists()) {
skipFile.parentFile.mkdirs() skipFile.parentFile.mkdirs()
skipFile.createNewFile() skipFile.createNewFile()
@@ -345,9 +352,9 @@ class Utils {
// @Caution by SuperMonster003 on Oct 22, 2024. // @Caution by SuperMonster003 on Oct 22, 2024.
// ! This operation is NOT safe. // ! This operation is NOT safe.
// ! zh-CN: 此操作存在安全隐患. // ! zh-CN: 此操作存在安全隐患.
project.delete destDir project.delete destFile.absolutePath
def tmp = project.file(destDir).parentFile def tmp = destFile.parentFile
while (tmp != project.projectDir) { while (tmp != project.projectDir) {
if (tmp.listFiles().toList().isEmpty()) { if (tmp.listFiles().toList().isEmpty()) {
println("Delete empty directory: $tmp.absolutePath") println("Delete empty directory: $tmp.absolutePath")
@@ -484,7 +491,7 @@ class Utils {
} }
String formattedTotalExtractedSize = formatFileSize(totalExtractedSize) String formattedTotalExtractedSize = formatFileSize(totalExtractedSize)
print String.format("\rExtraction complete [ %s | %s ]\n", project.file(destDir).absolutePath, formattedTotalExtractedSize) print String.format("\rExtraction complete [ %s | %s ]\n", destFile.absolutePath, formattedTotalExtractedSize)
System.out.flush() System.out.flush()
println() println()
@@ -492,7 +499,7 @@ class Utils {
project.copy { project.copy {
from tempOutFile from tempOutFile
into destDir into destFile
} }
project.delete tempOutFile project.delete tempOutFile
} }
@@ -550,14 +557,14 @@ class Utils {
} }
String formattedUncompressedSize = formatFileSize(totalExtractedSize) String formattedUncompressedSize = formatFileSize(totalExtractedSize)
print String.format("\rExtraction complete [ %s | %s ]\n", project.file(destDir).absolutePath, formattedUncompressedSize) print String.format("\rExtraction complete [ %s | %s ]\n", destFile.absolutePath, formattedUncompressedSize)
System.out.flush() System.out.flush()
sevenZFile.close() sevenZFile.close()
project.copy { project.copy {
from tempOutFile from tempOutFile
into destDir into destFile
} }
project.delete tempOutFile project.delete tempOutFile
} }