mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-03-22 15:19:59 +07:00
Build scripts: redownload jdk and jbre if previous download was
interrupted
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
import de.undercouch.gradle.tasks.download.DownloadAction
|
||||
|
||||
/*
|
||||
* Copyright 2000-2016 JetBrains s.r.o.
|
||||
*
|
||||
@@ -50,6 +52,47 @@ catch (UnknownHostException e) {
|
||||
project.ext.inJetBrainsNetwork = false
|
||||
}
|
||||
|
||||
class DownloadActionWrapper extends DownloadAction {
|
||||
DownloadActionWrapper(Project project) {
|
||||
super(project)
|
||||
}
|
||||
|
||||
@Override
|
||||
void execute() throws IOException {
|
||||
def destFile = getDest()
|
||||
if (destFile == null || !destFile.exists()) {
|
||||
def tempFile = new File(destFile.absolutePath + ".part")
|
||||
dest(tempFile)
|
||||
overwrite(true)
|
||||
onlyIfNewer(false)
|
||||
super.execute()
|
||||
dest(destFile)
|
||||
tempFile.renameTo(destFile)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class DownloadWrapperExtension implements Configurable<DownloadWrapperExtension> {
|
||||
Project project
|
||||
|
||||
DownloadWrapperExtension(Project project) {
|
||||
this.project = project
|
||||
}
|
||||
|
||||
@Override
|
||||
DownloadWrapperExtension configure(Closure cl) {
|
||||
DownloadActionWrapper da = ConfigureUtil.configure(cl, new DownloadActionWrapper(project))
|
||||
try {
|
||||
da.execute()
|
||||
}
|
||||
catch (IOException e) {
|
||||
throw new IllegalStateException("Could not download file", e)
|
||||
}
|
||||
return this
|
||||
}
|
||||
}
|
||||
project.extensions.create('downloadWrapper', DownloadWrapperExtension.class, project)
|
||||
|
||||
apply from: 'setupJdk.gradle'
|
||||
apply from: 'setupJbre.gradle'
|
||||
apply from: 'setupKotlin.gradle'
|
||||
|
||||
@@ -17,10 +17,9 @@ jrePlatformsToDownload(targetOs).each { platform ->
|
||||
outputs.file(outputFile)
|
||||
doLast {
|
||||
logger.info("Downloading $jbrexArtifactName to $outputFile")
|
||||
download {
|
||||
downloadWrapper {
|
||||
src "$jdkRepo/${jbrexArtifactName}.tar.gz"
|
||||
dest outputFile
|
||||
onlyIfNewer true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -34,10 +34,9 @@ task downloadJdk18 {
|
||||
outputs.file(outputFile)
|
||||
doLast {
|
||||
logger.info("Downloading up JDK 1.8 to compile (using $jdkRepo repo)")
|
||||
download {
|
||||
downloadWrapper {
|
||||
src "$jdkRepo/intellij-jdk/${artifactName}"
|
||||
dest outputFile
|
||||
onlyIfNewer true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user