1. 起因
    1. 某一天一个同事,在看那个glide,然后我路过,看到他为何不编译“glide”项目(他说,编译中出错,反正都是看源码而已,所以就懒得搞,然后我出于“好心”,给他弄一下,我擦)
    2. 报错:
      1. Process 'command 'git'' finished with non-zero exit value 128
        1. 这个简单,因为他是直接从github那里下载(得到一个zip文件,天朝clone github的代码很慢的)的,而不是直接clone出来,所以执行时,报这个错,很正常,只需要把在该文件夹中执行"git init"就行了
      2. Cannot evaluate module disklrucache : Configuration with name 'default' not found.
        1. 这个就比较麻烦了。是因为,检查到模块"disklrucache",只是一个“空目录”,所以gradle,不认识它。就直接报错。
      3. 问题来了:为什么 模块"disklrucache"是空目录,是因为在settings.gradle中声明的更新“外部模块”
        1. exec { commandLine "git", "submodule", "update", "--init", "--recursive"}
        2. 执行完,没有把“disklrucache”进行更新
        3. 然后进入正题了,git submodule
        4. 直接敲"git submodule"能查看当前git中有哪些子外部模块(相关文章:http://www.tuicool.com/articles/jqiEJzU
        5. 我查看后,没有声明disklrucache作为“子外部模块”,只留了那个目录在那里
        6. 只好查看一下,如何添加“子外部模块”
        7. 添加
为当前工程添加submodule,命令如下:
git submodule add 仓库地址 路径
  1. 以下代码,是我无聊写的。可以忽略的
def getGitModules(){
File configFile = file(".gitmodules")
println configFile.getAbsolutePath()
def lines = configFile.readLines()
String line = ""
String path = ""
String url = ""
Map<String,String> gitModules = new HashMap<>()
for (int i = 0; i < lines.size(); i++) {
line = lines.get(i)
if(line.startsWith("[submodule")){
path = lines.get(i+1).split(" = ")[1]
url = lines.get(i+2).split(" = ")[1]
//println String.format("path:%s",path)
//println String.format("url:%s",url)
if (url.endsWith(".git")) {
gitModules.put(path,url)
}
}
}
gitModules
}
 
def getGitModulesByClone(){
Map<String,String> gitModules = getGitModules()
String path = ""
String url = ""
for(String key: gitModules.keySet()){
File moduleDir = file(key)
if (moduleDir.exists()) {
moduleDir.delete()
}
path = key
url = gitModules.get(key)
println String.format("path:%s",path)
println String.format("url:%s",url)
try{
exec {
commandLine "git", "submodule", "add", url , key
}
}catch(Exception e){
 
}
}
}
def gitInit(){
exec {
commandLine "git", "init"
}
println("gitInit")
}
def gitSubmoduleUpdate(){
/**
try{
exec {
commandLine "git", "submodule", "update", "--init", "--recursive"
}
println("gitSubmoduleUpdate")
}catch(Exception e){
getGitModulesByClone()
}
*/
getGitModulesByClone()
}
 
try{
gitSubmoduleUpdate()
}catch(Exception e){
gitInit()
gitSubmoduleUpdate()
}
  1. 结论
    1. 注意事项

glide引出恶心的git submodule的更多相关文章

  1. git submodule初用

    git submodule主要是用于针对git项目中还存在git子模块的情况.在一般情况下,我们通过git clone 获取项目的时候会把项目中的所有信息都拿到.但是,如果相关中存在git子模块那么, ...

  2. git submodule 使用

    这个是备忘录,原网页: https://medium.com/@porteneuve/mastering-git-submodules-34c65e940407 http://cncc.bingj.c ...

  3. git submodule(转载)

    From:http://www.worldhello.net/2010/01/26/425.html 删除 git submodule (git 库子模组) 有两种情况会创建 git submodul ...

  4. Git submodule 特性

    当你习惯了代码的 VCS 后,基本上是离不开的. 作为一个依赖多个子项目组成的项目,要实现直观的代码逻辑结构,可以考虑使用 Git submodule 特性. 当然,如果只是单独的依赖的话,用依赖管理 ...

  5. Git subtree和Git submodule

    git submodule允许其他的仓库指定以一个commit嵌入仓库的子目录. git subtree替代git submodule命令,合并子仓库到项目中的子目录.不用像submodule那样每次 ...

  6. 使用git submodule管理一个需要多个分立开发或者第三方repo的项目

    在项目开发中,特别是web前端开发中,有非常多的开源第三方library,我们希望引用他们,同时也希望能够方便地保持这些第三方 开源repo的更新.另外一方面如果我们自己在开发一个网站的项目,这个项目 ...

  7. Git submodule实战

    http://blog.jqian.net/post/git-submodule.html 使用git管理的项目开发中,如果碰到公共库和基础工具,可以用submodule来管理. 常用操作 例如, 公 ...

  8. git submodule的操作

    对于有submodule的库,检出的方法是: git clone https://github.com/BelledonneCommunications/linphone-android.git -- ...

  9. git submodule相关操作

    $ cd 项目目录 // 初始化 $ git init $ git submodule add https://github.com/XXXX // 普通更新 $ git submodule upda ...

随机推荐

  1. react+typescript报错集锦<持续更新>

    typescript报错集锦 错误:Import sources within a group must be alphabetized.tslint(ordered-imports) 原因:impo ...

  2. CactiEZ安装与配置-监控网卡流量

    1.1. 环境 本例CactiEZ-10.1-x86_64.iso下载地址 https://pan.baidu.com/s/1vivDJqpgtoBXRLm2D-bBTQ 密码:u12l 测试环境 服 ...

  3. BZOJ.4513.[SDOI2016]储能表(数位DP)

    BZOJ 洛谷 切了一道简单的数位DP,终于有些没白做题的感觉了...(然而mjt更强没做过这类的题也切了orz) 看部分分,如果\(k=0\),就是求\(\sum_{i=0}^n\sum_{j=0} ...

  4. 英语口语练习系列-C29-鸟类-辨别身份-断弦的琴

    鸟类 sparrow sparrow 英 ['spærəʊ] 美 ['spæro] n. 麻雀:矮小的人 swallow swallow 英 ['swɒləʊ] 美 ['swɑlo] vt. 忍受:吞 ...

  5. php error_log() 范例

    <?php// 如果无法连接到数据库,发送通知到服务器日志if (!Ora_Logon($username, $password)) {    error_log("Oracle da ...

  6. [HDU1693]Eat the Trees

    Description: 给出n*m的方格,有些格子不能铺线,其它格子必须铺,可以形成多个闭合回路.问有多少种铺法? Hint: \(n,m<=12\) Solution: 与原来单回路那题转移 ...

  7. Ubuntu下使用cmake生成可执行文件

    1.单个CPP文件的cmake 首先编写一个简单的程序(main.cpp): #include <iostream> using namespace std; int main() { c ...

  8. BZOJ3945 : 无聊的邮递员

    因为两个人方案的对称性,可以将$k$除以$2$,转化为在$n-1$个间隔中设置若干断点,求第$k$小的增量. 对于选中的相邻的断点$(a,a+1)$和$(b,b+1)$,增量为$|x_a-x_{b+1 ...

  9. redis(三)

    string string是redis最基本的类型 最大能存储512MB数据 string类型是二进制安全的,即可以为任何数据,比如数字.图片.序列化对象等 命令 设置 设置键值 set key va ...

  10. 通过echarts的demo

    通过最近两天对echarts的了解,下面用echarts.js写了一个小效果: 效果的demo为: <!DOCTYPE html> <html lang="en" ...