Gradle 调用命令脚本
android {
...
afterEvaluate {
if (project.hasProperty("assembleRelease")) {
assembleRelease.doLast {
println "==========Copy the release lib==========="
doReleaseTask.execute()
println "=========You can do something here=========="
}
}
if (project.hasProperty("assembleDebug")) {
assembleDebug.doLast {
println "==========Copy the debug lib==========="
doDebugTask.execute()
}
}
}
}
task doReleaseTask(type: Exec) {
commandLine "./copyLibVersion.sh", "release"
}
task doDebugTask(type: Exec) {
commandLine "./copyLibVersion.sh", "debug"
}