External dependencies: preserve symlinks while unpacking JDKs on Mac

This commit is contained in:
Alexander Zolotov
2017-04-05 14:34:05 +03:00
parent abe04c861b
commit dcd5141d30
+12 -13
View File
@@ -60,24 +60,23 @@ task setupJdk18(dependsOn: downloadJdk18) {
def unpackJdk(jdkArchive, outputDir) {
logger.info("Unpacking $jdkArchive to ${outputDir}")
file(outputDir).deleteDir()
if (!org.gradle.internal.os.OperatingSystem.current().isWindows()) {
exec { commandLine 'mkdir', '-p', outputDir }
exec { commandLine 'tar', 'xpf', "${jdkArchive.absolutePath}", '--directory', outputDir }
def jdkContents = file("${outputDir}/jdk/Contents")
if (org.gradle.internal.os.OperatingSystem.current().isMacOsX() && jdkContents.exists()) {
copy {
from fileTree(jdkContents)
into outputDir
}
jdkContents.deleteDir()
}
}
else {
def currentOs = org.gradle.internal.os.OperatingSystem.current()
if (currentOs.isWindows()) {
copy {
from tarTree(jdkArchive)
into outputDir
}
}
else {
exec { commandLine 'mkdir', '-p', outputDir }
exec { commandLine 'tar', 'xpf', "$jdkArchive.absolutePath", '--directory', outputDir }
def jdkContents = file("${outputDir}/jdk/Contents")
if (currentOs.isMacOsX() && jdkContents.exists()) {
jdkContents.listFiles().each { file ->
exec { commandLine 'mv', "$file.absolutePath", outputDir }
}
}
}
}
static def currentPlatformName() {