Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
AndroidBuildScript
Project
Project
Details
Activity
Releases
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
pub
AndroidBuildScript
Commits
0965ac6e
Commit
0965ac6e
authored
Mar 18, 2021
by
maweidong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat:新增APP版本
parent
9f92431c
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
52 additions
and
53 deletions
+52
-53
Register.Method.gradle
BuildScript/Register.Method.gradle
+52
-53
No files found.
BuildScript/Register.Method.gradle
View file @
0965ac6e
import
javax.net.ssl.HostnameVerifier
import
javax.net.ssl.HttpsURLConnection
import
javax.net.ssl.SSLSession
import
java.text.SimpleDateFormat
import
java.text.SimpleDateFormat
import
java.util.regex.Matcher
import
java.util.regex.Matcher
import
java.util.regex.Pattern
import
java.util.regex.Pattern
...
@@ -94,37 +91,34 @@ def isSnapshot() {
...
@@ -94,37 +91,34 @@ def isSnapshot() {
return
"SNAPSHOT"
==
getChannelString
()
return
"SNAPSHOT"
==
getChannelString
()
}
}
//task printenv() {
task
printenv
()
{
//// for (Map.Entry<String, String> entry : System.getenv()) {
getBizModuleLastVersion
()
//// println("key:${entry.key},value:${entry.value}")
}
//// }
// getBizModuleLastVersion()
//}
def
getBizModuleLastVersion
()
{
def
getBizModuleLastVersion
()
{
def
modules
=
[
def
modules
=
[
"yit_shell"
,
"yit_shell"
,
"yit_shop"
,
//
"yit_shop",
"yit_live"
,
//
"yit_live",
"yit_cms"
,
//
"yit_cms",
"yit_base"
,
//
"yit_base",
"yit_food"
,
//
"yit_food",
"yit_browser"
,
//
"yit_browser",
"yit_category"
,
//
"yit_category",
"yit_qr"
,
//
"yit_qr",
"yit_productinfo"
,
//
"yit_productinfo",
"yit_mine"
,
//
"yit_mine",
"yit_search"
,
//
"yit_search",
"yit_cart"
,
//
"yit_cart",
"yit_post"
,
//
"yit_post",
"yit_login"
,
//
"yit_login",
"yit_auction"
,
//
"yit_auction",
"yit_social"
,
//
"yit_social",
"yit_imagepicker"
,
//
"yit_imagepicker",
"yit_share"
,
//
"yit_share",
"yit_picker"
,
//
"yit_picker",
"yit_flutter"
//
"yit_flutter"
]
]
def
group
=
"com.yitlib.module"
def
group
=
"com.yitlib.module"
for
(
def
module
:
modules
)
{
for
(
def
module
:
modules
)
{
...
@@ -139,41 +133,27 @@ def getHttpVersion(def group, def module) {
...
@@ -139,41 +133,27 @@ def getHttpVersion(def group, def module) {
HttpURLConnection
connection
=
null
HttpURLConnection
connection
=
null
InputStream
is
=
null
InputStream
is
=
null
BufferedReader
br
=
null
BufferedReader
br
=
null
String
result
=
null
// 返回结果字符串
String
Builder
builder
=
new
StringBuilder
(
"\n"
)
// 返回结果字符串
try
{
try
{
// 创建远程url连接对象
URL
url
=
new
URL
(
"https://nexus3.yit.com/repository/maven-public/$group_path/$module/maven-metadata.xml"
)
URL
url
=
new
URL
(
"https://nexus3.yit.com/repository/maven-public/$group_path/$module/maven-metadata.xml"
)
println
(
url
)
// 通过远程url连接对象打开一个连接 , 强转成httpURLConnection类
connection
=
(
HttpURLConnection
)
url
.
openConnection
()
connection
=
(
HttpURLConnection
)
url
.
openConnection
()
// 设置连接方式:get
connection
.
setRequestMethod
(
"GET"
)
connection
.
setRequestMethod
(
"GET"
)
// 设置连接主机服务器的超时时间:15000毫秒
connection
.
setConnectTimeout
(
15000
)
connection
.
setConnectTimeout
(
15000
)
// 设置读取远程返回的数据时间:60000毫秒
connection
.
setReadTimeout
(
60000
)
connection
.
setReadTimeout
(
60000
)
// 发送请求
connection
.
connect
()
connection
.
connect
()
// 通过connection连接,获取输入流
if
(
connection
.
getResponseCode
()
==
200
)
{
if
(
connection
.
getResponseCode
()
==
200
)
{
is
=
connection
.
getInputStream
()
is
=
connection
.
getInputStream
()
// 封装输入流is,并指定字符集
br
=
new
BufferedReader
(
new
InputStreamReader
(
is
,
"UTF-8"
))
br
=
new
BufferedReader
(
new
InputStreamReader
(
is
,
"UTF-8"
))
// 存放数据
String
temp
StringBuffer
sbf
=
new
StringBuffer
()
String
temp
=
null
while
((
temp
=
br
.
readLine
())
!=
null
)
{
while
((
temp
=
br
.
readLine
())
!=
null
)
{
sbf
.
append
(
temp
)
builder
.
append
(
temp
).
append
(
"\n"
)
sbf
.
append
(
"\r\n"
)
}
}
result
=
sbf
.
toString
()
}
}
}
catch
(
MalformedURLException
e
)
{
}
catch
(
Exception
e
)
{
e
.
printStackTrace
()
}
catch
(
IOException
e
)
{
e
.
printStackTrace
()
e
.
printStackTrace
()
}
finally
{
}
finally
{
// 关闭资源
if
(
null
!=
br
)
{
if
(
null
!=
br
)
{
try
{
try
{
br
.
close
()
br
.
close
()
...
@@ -189,12 +169,31 @@ def getHttpVersion(def group, def module) {
...
@@ -189,12 +169,31 @@ def getHttpVersion(def group, def module) {
e
.
printStackTrace
()
e
.
printStackTrace
()
}
}
}
}
connection
.
disconnect
()
// 关闭远程连接
connection
.
disconnect
()
// 关闭远程连接
}
}
def
xmlSlurper
=
new
XmlSlurper
()
def
response
=
xmlSlurper
.
parseText
(
result
)
Pattern
pattern
=
Pattern
.
compile
(
"<versions>(.|\n)+</versions>"
)
println
(
"$module=${response.versioning.latest}"
)
Matcher
matcher
=
pattern
.
matcher
(
builder
)
List
<
String
>
dataSet
=
new
ArrayList
<>()
try
{
if
(
matcher
.
find
())
{
def
versions
=
matcher
.
group
()
.
replaceAll
(
"<version>"
,
""
)
.
replaceAll
(
"</version>"
,
""
)
.
replaceAll
(
"<versions>"
,
""
)
.
replaceAll
(
"</versions>"
,
""
)
.
split
(
"\n"
)
for
(
String
version
:
versions
)
{
dataSet
.
add
(
version
)
}
}
}
catch
(
Exception
e
)
{
e
.
printStackTrace
()
}
// dataSet.each { it -> println(it) }
}
}
...
...
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