将依赖项添加到现有的assembleDebug任务

时间:2015-09-05 12:31:48

标签: android gradle android-gradle build.gradle gradlew

我的任务看起来像这样,我的构建类型为assembleDebugDaily。我正在尝试运行Task dailyCiBuild

task versionGitTagBuild() {
    doLast {
        println "Versioning git tag build finished"
    }

}
task zipAlignAPK(){
    doLast{
        println "ZipAlign Completed"
    }
}
tasks.whenTaskAdded { task ->
    if (task.name == 'assembleDebugDaily') {
        task.mustRunAfter versionGitTagBuild //*This line is the problem*
        zipAlignAPK.dependsOn(task)
    }
}
task copyToBuildShare(){
        dependsOn zipAlignAPK
        doLast {
            println("Finished")

        }
}
task dailyCiBuild(){
    dependsOn copyToBuildShare
    doLast{
        println "CI Build Finished"
    }
}

它总是导致stackOverflow错误。如果我删除上面指示的行。它成功构建。我做错了什么以及如何实现上述功能?

0 个答案:

没有答案