Commit c53fd5ee authored by pengjunjign's avatar pengjunjign

add:优化导入脚本

parent 070aa09a
...@@ -19,7 +19,7 @@ allprojects { ...@@ -19,7 +19,7 @@ allprojects {
repositories { repositories {
google() google()
mavenCentral() mavenCentral()
maven {url 'https://developer.huawei.com/repo/'} maven { url 'https://developer.huawei.com/repo/' }
} }
} }
...@@ -27,9 +27,20 @@ task clean(type: Delete) { ...@@ -27,9 +27,20 @@ task clean(type: Delete) {
delete rootProject.buildDir delete rootProject.buildDir
} }
/**
* 导入推送模块,如果push目录下为空(包含隐藏文件,.git文件),则初始化子模块,拉取代码.
*/
task importPushModule() { task importPushModule() {
println("add submodule before") println("add submodule before")
"git submodule init".execute() File pushModuleFile = new File(getProjectDir().toString() + File.separatorChar + "push")
"git submodule update".execute() println("push module:" + pushModuleFile.toString())
//push目录下没有任何文件则视为没有初始化子模块
if (pushModuleFile.listFiles().length == 0) {
String cmd1 = "git submodule init".execute().text.trim()
String cmd2 = "git submodule update".execute().text.trim()
println(cmd1)
println(cmd2)
println("no init submodule , only init once in project")
}
println("add submodule after") println("add submodule after")
} }
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment