首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >分级更新git子模块

分级更新git子模块
EN

Stack Overflow用户
提问于 2018-05-13 23:14:56
回答 1查看 3.1K关注 0票数 3

我有一个分级项目,它被划分为子模块。每次我需要用最新的源代码构建项目时,执行git submodule update --init并不是很方便,所以我想知道是否有一种已知的方法来创建一个gradle任务?也许有一个现有的插件?Unix和windows的兼容性会很好。

应答后的更新

正如@VonC所指出的,职业明星/格格特做了这项工作。

这是我最后得到的配置

代码语言:javascript
复制
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

// ...
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2018-05-14 05:00:35

就像在此拉请求中一样,您可以尝试添加一个gradle任务,为您执行子模块init。

这将取决于并使用ajoberstar/gradle-git

代码语言:javascript
复制
task submodulesUpdate(type:Exec) {
    description 'Updates (and inits) git submodules'
    commandLine 'git', 'submodule', 'update', '--init', '--recursive'
    group 'Build Setup'
}
票数 3
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/50321417

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档