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:
parent
95dbb2cd34
commit
e95082cefb
5 changed files with 28 additions and 1288 deletions
|
@ -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()
|
Loading…
Add table
Add a link
Reference in a new issue