1
0
Fork 0
mirror of https://github.com/gsantner/dandelion synced 2025-09-09 10:19:42 +02:00

Download podlist at build time

This commit is contained in:
Gregor Santner 2016-11-02 17:10:29 +01:00
parent 95dbb2cd34
commit e95082cefb
5 changed files with 28 additions and 1288 deletions

View file

@ -76,5 +76,29 @@ task copyRepoFiles(type: Copy) {
}
}
// Download Podlist
final String PODLIST_PATH = "app/src/main/res/raw/podlist.json"
final String PODLIST_URL = 'https://raw.githubusercontent.com/Diaspora-for-Android/diaspora-android-extras/master/podList/podlist.json'
downloadFile(PODLIST_PATH, PODLIST_URL, false)
// Do if we build in release (signed apk) mode
android.applicationVariants.all { v ->
if (v.buildType.name == "release"){
v.assemble.doFirst {
downloadFile(PODLIST_PATH, PODLIST_URL, true)
}
}
}
}
tasks.copyRepoFiles.execute()
def downloadFile(filePath, url, downloadIfExists ) {
def f = new File(filePath)
if (f.exists() && downloadIfExists){
f.delete();
}
if (!f.exists()) {
new URL(url).withInputStream{ i -> f.withOutputStream{ it << i }}
}
}
tasks.copyRepoFiles.execute()