我有一个分级项目,它被划分为子模块。每次我需要用最新的源代码构建项目时,执行git submodule update --init并不是很方便,所以我想知道是否有一种已知的方法来创建一个gradle任务?也许有一个现有的插件?Unix和windows的兼容性会很好。
应答后的更新
正如@VonC所指出的,职业明星/格格特做了这项工作。
这是我最后得到的配置
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'org.ajoberstar:gradle-git:1.6.0'
}
}
apply plugin: 'org.ajoberstar.grgit'
task submodulesUpdate(type:Exec) {
description 'Updates (and inits) git submodules'
commandLine 'git', 'submodule', 'update', '--init', '--recursive'
group 'Build Setup'
}
task build
build.dependsOn submodulesUpdate
// ...发布于 2018-05-14 05:00:35
就像在此拉请求中一样,您可以尝试添加一个gradle任务,为您执行子模块init。
这将取决于并使用ajoberstar/gradle-git。
task submodulesUpdate(type:Exec) {
description 'Updates (and inits) git submodules'
commandLine 'git', 'submodule', 'update', '--init', '--recursive'
group 'Build Setup'
}https://stackoverflow.com/questions/50321417
复制相似问题