mirror of
https://github.com/gmeligio/flutter-docker-image.git
synced 2026-05-24 12:30:34 +00:00
24 lines
733 B
Groovy
24 lines
733 B
Groovy
// Snippet to include at the end of android/app/build.gradle
|
|
import groovy.json.JsonSlurper
|
|
import groovy.json.JsonOutput
|
|
|
|
tasks.register('updateAndroidPlatform') {
|
|
doLast {
|
|
def jsonFile = new File("../../../version.json")
|
|
def jsonMap = new JsonSlurper().parseText(jsonFile.text)
|
|
|
|
def rawPlatformVersions = [flutter.targetSdkVersion, flutter.compileSdkVersion]
|
|
def platformVersions = rawPlatformVersions.unique()
|
|
|
|
jsonMap.android = [:]
|
|
jsonMap.android.platforms = platformVersions.collect { [version: it] }
|
|
|
|
println jsonMap
|
|
|
|
def jsonStr = JsonOutput.toJson(jsonMap)
|
|
def prettyStr = JsonOutput.prettyPrint(jsonStr)
|
|
|
|
jsonFile.write(prettyStr)
|
|
}
|
|
}
|