Gradle 更新 git 个子模块
Gradle update git submodules
我有一个分为子模块的 gradle 项目。每次我需要用最新的资源构建项目时执行 git submodule update --init
不是很方便,所以我想知道是否有已知的方法来创建一个 gradle 任务来做到这一点?也许有一个现有的插件? Unix 和 windows 兼容性会很好。
回答后更新
正如 @VonC 所述,ajoberstar/gradle-git 完成了这项工作。
这是我最终得到的配置
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
// ...
与 this pull request 一样,您可以尝试添加一个 gradle 任务来为您执行子模块初始化。
这将取决于并使用 ajoberstar/gradle-git
.
task submodulesUpdate(type:Exec) {
description 'Updates (and inits) git submodules'
commandLine 'git', 'submodule', 'update', '--init', '--recursive'
group 'Build Setup'
}
我有一个分为子模块的 gradle 项目。每次我需要用最新的资源构建项目时执行 git submodule update --init
不是很方便,所以我想知道是否有已知的方法来创建一个 gradle 任务来做到这一点?也许有一个现有的插件? Unix 和 windows 兼容性会很好。
回答后更新
正如 @VonC 所述,ajoberstar/gradle-git 完成了这项工作。
这是我最终得到的配置
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
// ...
与 this pull request 一样,您可以尝试添加一个 gradle 任务来为您执行子模块初始化。
这将取决于并使用 ajoberstar/gradle-git
.
task submodulesUpdate(type:Exec) {
description 'Updates (and inits) git submodules'
commandLine 'git', 'submodule', 'update', '--init', '--recursive'
group 'Build Setup'
}