Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
P
PushPlatformDemo
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
pengjunjing
PushPlatformDemo
Commits
86c96460
Commit
86c96460
authored
May 31, 2021
by
pengjunjign
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add:增加每日拉取一次代码的功能
parent
c864aad8
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
34 additions
and
2 deletions
+34
-2
build.gradle
build.gradle
+34
-2
No files found.
build.gradle
View file @
86c96460
...
@@ -52,9 +52,41 @@ task importPushModule() {
...
@@ -52,9 +52,41 @@ task importPushModule() {
}
}
//切换所有子仓库的分支,有网络操作,会增加编译耗时,项目第一次完整构建完后视情况自行注释
//切换所有子仓库的分支,有网络操作,会增加编译耗时,项目第一次完整构建完后视情况自行注释
(
"git submodule foreach git checkout "
+
pushModuleCurrentBranch
).
execute
()
(
"git submodule foreach git checkout "
+
pushModuleCurrentBranch
).
execute
()
//拉取最新代码,有网络操作,会增加编译耗时,项目第一次完整构建完后视情况自行注释
if
(!
isToday
())
{
"git submodule foreach git pull"
.
execute
()
println
(
"execute:git submodule foreach git pull"
)
//拉取最新代码,有网络操作,会增加编译耗时,项目第一次完整构建完后视情况自行注释
"git submodule foreach git pull"
.
execute
()
}
println
(
"git submodule foreach git branch"
.
execute
().
text
)
println
(
"git submodule foreach git branch"
.
execute
().
text
)
println
(
"add submodule after"
)
println
(
"add submodule after"
)
}
/**
* @return 今天是否更新过代码
*/
boolean
isToday
()
{
def
result
=
false
File
file
=
new
File
(
getProjectDir
().
toString
()
+
File
.
separatorChar
+
"app"
+
File
.
separatorChar
+
"build"
+
File
.
separatorChar
+
"lastPullSubmoduleDate.txt"
)
SimpleDateFormat
dateFormat
=
new
SimpleDateFormat
(
"yyyy-MM-dd"
)
def
today
=
dateFormat
.
format
(
new
Date
())
if
(
file
.
exists
())
{
def
lines
=
file
.
readLines
()
if
(
lines
.
size
()
>
0
)
{
result
=
(
lines
.
get
(
0
)
==
today
)
}
}
//刷新日期内容
file
.
delete
()
file
.
createNewFile
()
BufferedWriter
fileWriter
=
new
BufferedWriter
(
new
OutputStreamWriter
(
new
FileOutputStream
(
file
,
true
),
"UTF-8"
));
fileWriter
.
write
(
today
)
fileWriter
.
write
(
"\n最后一次pull依赖仓库的时间,每日拉取一次"
)
fileWriter
.
flush
()
fileWriter
.
close
()
return
result
}
}
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment