Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
GradlePlugin
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
Gradle
GradlePlugin
Commits
7e7e5587
Commit
7e7e5587
authored
May 31, 2023
by
tongzifang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix pyger
parent
46faf028
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
32 additions
and
18 deletions
+32
-18
build.gradle
build.gradle
+1
-1
OssUploadTask.groovy
src/main/groovy/com/qmai/android/plugin/OssUploadTask.groovy
+1
-1
PygerBuildAndUploadPlugin.groovy
.../com/qmai/android/plugin/PygerBuildAndUploadPlugin.groovy
+11
-5
PygerUploadPlugin.groovy
...n/groovy/com/qmai/android/plugin/PygerUploadPlugin.groovy
+1
-1
PygerUploadTask.groovy
...ain/groovy/com/qmai/android/plugin/PygerUploadTask.groovy
+18
-10
No files found.
build.gradle
View file @
7e7e5587
...
@@ -250,7 +250,7 @@ task hot{
...
@@ -250,7 +250,7 @@ task hot{
}
}
group
'com.qmai.android.plugin'
group
'com.qmai.android.plugin'
version
'1.99'
version
'1.99
.3
'
gradlePublish
{
gradlePublish
{
...
...
src/main/groovy/com/qmai/android/plugin/OssUploadTask.groovy
View file @
7e7e5587
...
@@ -83,7 +83,7 @@ class OssUploadTask extends DefaultTask {
...
@@ -83,7 +83,7 @@ class OssUploadTask extends DefaultTask {
//钉钉通知
//钉钉通知
MediaType
JSON
=
MediaType
.
parse
(
"application/json; charset=utf-8"
);
MediaType
JSON
=
MediaType
.
parse
(
"application/json; charset=utf-8"
);
def
gson
=
new
Gson
()
def
gson
=
new
Gson
()
def
content
=
"$
appName
: 下载地址为: https://files.qmai.cn/$ossPath$fileName\n当前分支: ${getBranch()}当前环境: $buildType\n目标cpu: $flavor"
def
content
=
"$
{appName.isEmpty() ? file.name : appName}
: 下载地址为: https://files.qmai.cn/$ossPath$fileName\n当前分支: ${getBranch()}当前环境: $buildType\n目标cpu: $flavor"
def
dingDingdetail
=
new
FsDetailInfoModel
(
content
)
def
dingDingdetail
=
new
FsDetailInfoModel
(
content
)
def
dingdingInfo
=
new
FsInfoModel
(
dingDingdetail
)
def
dingdingInfo
=
new
FsInfoModel
(
dingDingdetail
)
RequestBody
requestBody
=
RequestBody
.
create
(
JSON
,
gson
.
toJson
(
dingdingInfo
))
RequestBody
requestBody
=
RequestBody
.
create
(
JSON
,
gson
.
toJson
(
dingdingInfo
))
...
...
src/main/groovy/com/qmai/android/plugin/PygerBuildAndUploadPlugin.groovy
View file @
7e7e5587
...
@@ -19,13 +19,19 @@ class PygerBuildAndUploadPlugin implements Plugin<Project> {
...
@@ -19,13 +19,19 @@ class PygerBuildAndUploadPlugin implements Plugin<Project> {
app
.
getApplicationVariants
().
all
(
new
Action
<
ApplicationVariant
>()
{
app
.
getApplicationVariants
().
all
(
new
Action
<
ApplicationVariant
>()
{
@Override
@Override
void
execute
(
ApplicationVariant
applicationVariant
)
{
void
execute
(
ApplicationVariant
applicationVariant
)
{
def
name
=
applicationVariant
.
getName
()
def
taskName
=
applicationVariant
.
getName
()
def
buildType
=
applicationVariant
.
buildType
.
name
def
flavor
=
applicationVariant
.
flavorName
.
isEmpty
()
?
"未配置"
:
applicationVariant
.
flavorName
def
appName
=
applicationVariant
.
buildType
.
manifestPlaceholders
.
get
(
"app_name"
,
"企迈数店"
).
toString
()
applicationVariant
.
outputs
.
all
(
new
Action
<
BaseVariantOutput
>()
{
applicationVariant
.
outputs
.
all
(
new
Action
<
BaseVariantOutput
>()
{
@Override
@Override
void
execute
(
BaseVariantOutput
baseVariantOutput
)
{
void
execute
(
BaseVariantOutput
baseVariantOutput
)
{
def
task
=
project
.
getTasks
().
create
(
"BuildAndPyger"
+
firstLetterUpper
(
name
),
PygerUploadTask
.
class
,
baseVariantOutput
.
getOutputFile
(),
firstLetterUpper
(
name
),
pygerBean
.
key
)
def
task
=
project
.
getTasks
().
create
(
"BuildAndPyger"
+
firstLetterUpper
(
taskName
),
PygerUploadTask
.
class
,
baseVariantOutput
.
getOutputFile
(),
firstLetterUpper
(
buildType
),
pygerBean
.
key
,
flavor
,
appName
)
//先编译
//先编译
task
.
dependsOn
(
"assemble"
+
firstLetterUpper
(
n
ame
))
task
.
dependsOn
(
"assemble"
+
firstLetterUpper
(
taskN
ame
))
}
}
})
})
}
}
...
...
src/main/groovy/com/qmai/android/plugin/PygerUploadPlugin.groovy
View file @
7e7e5587
...
@@ -14,7 +14,7 @@ class PygerUploadPlugin implements Plugin<Project> {
...
@@ -14,7 +14,7 @@ class PygerUploadPlugin implements Plugin<Project> {
project
.
afterEvaluate
{
project
.
afterEvaluate
{
def
uploadFile
=
new
File
(
pygerBean
.
filePath
)
def
uploadFile
=
new
File
(
pygerBean
.
filePath
)
println
(
"PygerUploadPlugin file path = "
+
pygerBean
.
filePath
+
" file key = "
+
pygerBean
.
key
)
println
(
"PygerUploadPlugin file path = "
+
pygerBean
.
filePath
+
" file key = "
+
pygerBean
.
key
)
project
.
getTasks
().
create
(
"pygerUpload"
,
PygerUploadTask
.
class
,
uploadFile
,
"1"
,
pygerBean
.
key
)
project
.
getTasks
().
create
(
"pygerUpload"
,
PygerUploadTask
.
class
,
uploadFile
,
"1"
,
pygerBean
.
key
,
""
,
""
)
}
}
}
}
}
}
src/main/groovy/com/qmai/android/plugin/PygerUploadTask.groovy
View file @
7e7e5587
...
@@ -18,15 +18,24 @@ import javax.inject.Inject
...
@@ -18,15 +18,24 @@ import javax.inject.Inject
import
java.util.concurrent.TimeUnit
import
java.util.concurrent.TimeUnit
class
PygerUploadTask
extends
DefaultTask
{
class
PygerUploadTask
extends
DefaultTask
{
@OutputFile
File
file
;
@OutputFile
@Input
String
buildType
;
File
file
;
@Input
String
key
;
@Input
String
buildType
;
@Input
String
key
;
@Input
String
flavor
@Input
String
appName
@Inject
@Inject
PygerUploadTask
(
File
file
,
String
buildType
,
String
key
)
{
PygerUploadTask
(
File
file
,
String
buildType
,
String
key
,
String
flavor
,
String
appName
)
{
this
.
file
=
file
this
.
file
=
file
this
.
buildType
=
buildType
this
.
buildType
=
buildType
this
.
key
=
key
this
.
key
=
key
this
.
flavor
=
flavor
this
.
appName
=
appName
setGroup
(
"pyger"
)
setGroup
(
"pyger"
)
}
}
...
@@ -65,13 +74,12 @@ class PygerUploadTask extends DefaultTask {
...
@@ -65,13 +74,12 @@ class PygerUploadTask extends DefaultTask {
def
branch
=
""
def
branch
=
""
try
{
try
{
branch
=
getBranch
()
branch
=
getBranch
()
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
e
.
printStackTrace
();
println
(
"getBranch error = "
+
e
.
message
)
println
(
"getBranch error = "
+
e
.
message
)
}
}
String
content
=
file
.
name
+
": 下载地址: "
+
" https://www.pgyer.com/"
+
String
content
=
"${appName.isEmpty() ? file.name : appName}: 下载地址为: https://www.pgyer.com/$payInfoBean.data.buildShortcutUrl\n二维码地址: $payInfoBean.data.buildQRCodeURL\n当前分支: ${branch}\n当前环境: $buildType\n目标cpu: $flavor"
payInfoBean
.
data
.
buildShortcutUrl
+
" \n二维码地址: "
+
payInfoBean
.
data
.
buildQRCodeURL
+
" \n 当前环境: "
+
buildType
+
"\n 当前分支:"
+
branch
println
(
"fs content = ${content}"
)
println
(
"fs content = ${content}"
)
MediaType
JSON
=
MediaType
.
parse
(
"application/json; charset=utf-8"
);
MediaType
JSON
=
MediaType
.
parse
(
"application/json; charset=utf-8"
);
try
{
try
{
...
@@ -103,7 +111,7 @@ class PygerUploadTask extends DefaultTask {
...
@@ -103,7 +111,7 @@ class PygerUploadTask extends DefaultTask {
}
}
void
uploadFs
(
String
text
){
void
uploadFs
(
String
text
)
{
}
}
...
...
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