Commit e1ff3979 authored by Marc Schwede's avatar Marc Schwede 💬 Committed by Eric Eastwood
Browse files

refactored gradle tasks to overcome spontaneous download/moving

parent 601a45f0
......@@ -19,23 +19,44 @@ else {
secretProperties.setProperty("signing_key_alias", "${System.getenv('signing_key_alias')}")
}
// Download gitter-webapp assets from current release if assets folder not present
task fetchWebappAssets(type: Copy) {
String zipFile = "${buildDir}/tmp/webapp-artifacts.zip"
String assetsPath = "${projectDir}/src/main/assets"
String artifactURI = "https://gitlab.com/gitlab-org/gitter/webapp/-/jobs/artifacts/master/download?job=mobile-asset-build"
File f = new File(assetsPath)
if (!f.isDirectory()) {
new URL(artifactURI).withInputStream { i -> new File(zipFile).withOutputStream { it << i } }
from zipTree(zipFile)
into "."
doLast {
ant.move file: "./output/android/www",
todir: f.toPath()
delete("./output", zipFile)
}
// Download gitter-webapp assets from current release
task fetchWebappAssets(type: GradleBuild) {
description("Download gitter-webapp assets from current release and move")
tasks = ['configureWebappAssets', 'downloadWebappAssets']
}
task configureWebappAssets() {
doLast{
file("${buildDir}/tmp/fetchWebappAssets").mkdirs()
}
}
task downloadWebappAssets() {
def zipFile = file("${buildDir}/tmp/fetchWebappAssets/webapp-artifacts.zip")
doLast {
def artifactURI = "https://gitlab.com/gitlab-org/gitter/webapp/-/jobs/artifacts/master/download?job=mobile-asset-build"
println("Starte Download")
new URL(artifactURI).withInputStream { i -> zipFile.withOutputStream { it << i } }
}
}
task extractWebappAssets(type: Copy) {
def zipFile = file("${buildDir}/tmp/fetchWebappAssets/webapp-artifacts.zip")
def assetsDir = file("${projectDir}/src/main/assets")
println("Extrahiere")
from zipTree(zipFile)
into file("${buildDir}/tmp/fetchWebappAssets")
doLast {
println("versuche zu verschieben")
ant.move file: file("${buildDir}/tmp/fetchWebappAssets/output/android/www"),
todir: assetsDir
}
}
downloadWebappAssets.finalizedBy(extractWebappAssets)
android {
compileSdkVersion 26
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment