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
273a73e6
Commit
273a73e6
authored
Jun 03, 2021
by
pengjunjign
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
remove:去除无用的代码
parent
86c96460
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
69 additions
and
63 deletions
+69
-63
build.gradle
app/build.gradle
+2
-2
build.gradle
build.gradle
+65
-61
gradle.properties
gradle.properties
+2
-0
No files found.
app/build.gradle
View file @
273a73e6
...
...
@@ -6,13 +6,13 @@ plugins {
android
{
signingConfigs
{
debug
{
storeFile
file
(
'\\
app\\
test_key.jks'
)
storeFile
file
(
'\\test_key.jks'
)
storePassword
'test_key'
keyPassword
'test_key'
keyAlias
'test_key'
}
config
{
storeFile
file
(
'
C:/Android/workspace/pushplatformdemo/app/
test_key.jks'
)
storeFile
file
(
'
\\
test_key.jks'
)
storePassword
'test_key'
keyPassword
'test_key'
keyAlias
'test_key'
...
...
build.gradle
View file @
273a73e6
...
...
@@ -3,8 +3,9 @@ import java.text.SimpleDateFormat
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript
{
ext
.
kotlin_version
=
'1.
5.0
'
ext
.
kotlin_version
=
'1.
3.72
'
repositories
{
jcenter
()
google
()
mavenCentral
()
maven
{
url
'https://developer.huawei.com/repo/'
}
...
...
@@ -15,11 +16,14 @@ buildscript {
classpath
'com.huawei.agconnect:agcp:1.3.1.300'
classpath
'com.huawei.agconnect:agcp:1.4.2.300'
classpath
"org.jfrog.buildinfo:build-info-extractor-gradle:4.15.2"
}
}
allprojects
{
repositories
{
jcenter
()
google
()
mavenCentral
()
maven
{
url
'https://developer.huawei.com/repo/'
}
...
...
@@ -30,63 +34,63 @@ task clean(type: Delete) {
delete
rootProject
.
buildDir
}
//推送模块目前使用的分支
String
pushModuleCurrentBranch
=
"dev"
/**
* 导入推送模块,
* 如果push目录下为空(包含隐藏文件,.git文件),
* 则初始化子模块,拉取代码,切换到指定的分支
*/
task
importPushModule
()
{
println
(
"add submodule before"
)
File
pushModuleFile
=
new
File
(
getProjectDir
().
toString
()
+
File
.
separatorChar
+
"push"
)
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"
)
}
//切换所有子仓库的分支,有网络操作,会增加编译耗时,项目第一次完整构建完后视情况自行注释
(
"git submodule foreach git checkout "
+
pushModuleCurrentBranch
).
execute
()
if
(!
isToday
())
{
println
(
"execute:git submodule foreach git pull"
)
//拉取最新代码,有网络操作,会增加编译耗时,项目第一次完整构建完后视情况自行注释
"git submodule foreach git pull"
.
execute
()
}
println
(
"git submodule foreach git branch"
.
execute
().
text
)
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
////推送模块目前使用的分支
//String pushModuleCurrentBranch = "dev"
//
///**
// * 导入推送模块,
// * 如果push目录下为空(包含隐藏文件,.git文件),
// * 则初始化子模块,拉取代码,切换到指定的分支
// */
//task importPushModule() {
// println("add submodule before")
// File pushModuleFile = new File(getProjectDir().toString() + File.separatorChar + "push")
// 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")
// }
// //切换所有子仓库的分支,有网络操作,会增加编译耗时,项目第一次完整构建完后视情况自行注释
// ("git submodule foreach git checkout " + pushModuleCurrentBranch).execute()
// if (!isToday()) {
// println("execute:git submodule foreach git pull")
// //拉取最新代码,有网络操作,会增加编译耗时,项目第一次完整构建完后视情况自行注释
// "git submodule foreach git pull".execute()
// }
// println("git submodule foreach git branch".execute().text)
// 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
gradle.properties
0 → 100644
View file @
273a73e6
android.useAndroidX
=
true
android.enableJetifier
=
true
\ 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