reference
DependsOn and finalizedBy
// taskA is executed after taskB
taskA.dependsOn(taskB)
// taskA is executed first, taskB is executed later
taskA.finalizedBy(taskB)
dependsOn(copy_aar, zip_maven, zip_mapping)
Copy the code
mustRunAfter
Blog.csdn.net/yao_94/arti…
PreBuild — Execute the specified task before build
task deleteHmsSdkAssetsApk {
doLast{
//do something
}
}
preBuild.dependsOn deleteHmsSdkAssetsApk
Copy the code
Project.afterevaluate – Executes the specified task after build
project.afterEvaluate {
}
allprojects{
afterEvaluate{ project,state->
println ${state. Failure ==null}"
}
beforeEvaluate { project ->
println "Start evaluating $project"}}Copy the code
Find a task
Use find to find a task, or return NULL if none is found
tasks.findByName
tasks.findByName("tetsTask")
Copy the code
tasks.findByPath
tasks.findByPath(":testProject:testTask")
Copy the code
Similarly, when you use GET to search for a task, a UnknowTaskException is thrown if the task cannot be found using GET
tasks.getByName
tasks.getByName("tetsTask")
tasks.getByPath(":testProject:testTask")
Copy the code
Transfrom
Transfrom: Using the Transform API, third-party plug-ins can process.class files before they are converted to dex files
project
.getExtensions()
.getByType(AppExtension.class)
.registerTransform(new ZedTransform(project));
Copy the code