Gradle: Releases in Archiv kopieren

Avatar of domjosdomjos - 16. Oktober 2019 - Gradle

Es kann ein Task erstellt werden, welcher die zuvor erstellten Releases in ein Archiv kopiert.

task archiveReleases(type: Copy) {
    def appPath = projectDir.toString() + "/app"
    def releasePath = appPath + "/release"
    def apkDebugPath = appPath + "/build/outputs/apk/debug"
    def aabDebugPath = appPath + "/build/outputs/bundle/debug"

    from apkDebugPath
    from aabDebugPath
    from releasePath

    // generate path
    def release
    def type
    if(propVersionCode.contains(".beta")) {
        release = propVersionCode.split("\\.beta")[0].trim()
        type = "beta/"
    } else if(propVersionCode.contains(".alpha")) {
        release = propVersionCode.split("\\.alpha")[0].trim()
        type = "alpha/"
    } else {
        release = propVersionCode
        type = ""
    }

    into "${projectDir}/data/releases/Version ${release}/${type}"
}
New comment

0 comments