我有两个命令来初始化和更新 git 子模块,我如何一起运行它。这是任务。
task gitSubModuleInit(type: Exec) {
description 'Initialize the git submodule'
commandLine "git", "submodule", "init"
}
task gitSubModuleUpdate(type: Exec) {
description 'Update the git submodule'
commandLine "git", "submodule", "update"
}
两个问题
1)如何在单个任务中运行 git submodule init 和更新任务?
2)是否可以将这些任务链接为构建任务的一部分?所以当我构建它时,它会自动更新子模块
最佳答案
当然:
task gitSubModuleInit(type: Exec) {
description 'Initialize the git submodule'
commandLine "git", "submodule", "init"
}
task gitSubModuleUpdate(type: Exec, dependsOn: gitSubModuleInit) {
description 'Update the git submodule'
commandLine "git", "submodule", "update"
}
<taskThatNeeds the files, probably compileJava>.dependsOn gitSubModuleUpdate
关于gradle - 我应该如何在单个 gradle 任务中运行执行两个 git 命令,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43983555/