Files
MoGoEagleEye/codequality/code_inspect.gradle
2023-09-27 14:21:40 +08:00

25 lines
686 B
Groovy
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
task runCodeInspect {
group = "codeInspect"
description = "静态代码检查统一触发pmd detekt任务"
}
project.afterEvaluate {
bindTask("pmd", "runCodeInspect")
bindTask("detekt", "runCodeInspect")
}
/**
* 绑定任务
* @param taskName 任务名称
* @param targetTaskName 被绑定的任务名称
* @param action taskName指定的任务执行完成后的回调
*/
def bindTask(String taskName, String targetTaskName) {
def task = project.tasks.findByName(taskName)
if (task != null) {
logger.lifecycle("${task} will be run")
def targetTask = project.tasks.findByName(targetTaskName)
targetTask.finalizedBy(task)
}
}