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
71a7b4a8
Commit
71a7b4a8
authored
May 30, 2023
by
tongzifang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add flavor
parent
1f7e37b6
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
6 additions
and
17 deletions
+6
-17
OssBuildAndUploadPlugin.groovy
...vy/com/qmai/android/plugin/OssBuildAndUploadPlugin.groovy
+3
-7
OssFileUploadPlugin.groovy
...groovy/com/qmai/android/plugin/OssFileUploadPlugin.groovy
+1
-1
OssUploadTask.groovy
src/main/groovy/com/qmai/android/plugin/OssUploadTask.groovy
+2
-9
No files found.
src/main/groovy/com/qmai/android/plugin/OssBuildAndUploadPlugin.groovy
View file @
71a7b4a8
...
...
@@ -24,20 +24,16 @@ class OssBuildAndUploadPlugin implements Plugin<Project> {
def
taskName
=
applicationVariant
.
getName
()
def
buildType
=
applicationVariant
.
buildType
.
name
def
flavor
=
applicationVariant
.
flavorName
def
versionCode
=
applicationVariant
.
versionCode
def
versionName
=
applicationVariant
.
versionName
def
appName
=
applicationVariant
.
buildType
.
manifestPlaceholders
.
get
(
"app_name"
,
"企迈数店"
)
def
appName
=
applicationVariant
.
buildType
.
manifestPlaceholders
.
get
(
"app_name"
,
"企迈数店"
).
toString
()
applicationVariant
.
outputs
.
all
(
new
Action
<
BaseVariantOutput
>()
{
@Override
void
execute
(
BaseVariantOutput
baseVariantOutput
)
{
File
flie
=
baseVariantOutput
.
getOutputFile
()
def
task
=
project
.
getTasks
().
create
(
"buildAndOss"
+
firstLetterUpper
(
taskName
),
OssUploadTask
.
class
,
flie
,
ossBean
.
ossPath
,
buildType
,
flavor
,
versionCode
,
versionName
,
appName
)
OssUploadTask
.
class
,
flie
,
ossBean
.
ossPath
,
firstLetterUpper
(
buildType
),
firstLetterUpper
(
flavor
),
appName
)
//先编译
// task.dependsOn("clean")
task
.
dependsOn
(
"assemble"
+
firstLetterUpper
(
n
ame
))
task
.
dependsOn
(
"assemble"
+
firstLetterUpper
(
taskN
ame
))
}
})
}
...
...
src/main/groovy/com/qmai/android/plugin/OssFileUploadPlugin.groovy
View file @
71a7b4a8
...
...
@@ -11,7 +11,7 @@ class OssFileUploadPlugin implements Plugin<Project> {
project
.
afterEvaluate
{
def
uploadFile
=
new
File
(
ossUploadFileBean
.
localPath
)
println
(
"single upload file "
+
uploadFile
.
exists
()
+
" "
+
uploadFile
.
absolutePath
)
project
.
getTasks
().
create
(
"uploadOssFile"
,
OssUploadTask
.
class
,
uploadFile
,
ossUploadFileBean
.
ossPath
,
""
)
project
.
getTasks
().
create
(
"uploadOssFile"
,
OssUploadTask
.
class
,
uploadFile
,
ossUploadFileBean
.
ossPath
,
""
,
""
,
""
)
}
}
...
...
src/main/groovy/com/qmai/android/plugin/OssUploadTask.groovy
View file @
71a7b4a8
...
...
@@ -28,20 +28,14 @@ class OssUploadTask extends DefaultTask {
@Input
String
flavor
@Input
int
versionCode
@Input
String
versionName
@Input
String
appName
@Inject
OssUploadTask
(
File
file
,
String
ossPath
,
buildType
,
flavor
,
versionCode
,
versionName
,
appName
)
{
OssUploadTask
(
File
file
,
String
ossPath
,
buildType
,
flavor
,
appName
)
{
this
.
file
=
file
this
.
ossPath
=
ossPath
this
.
buildType
=
buildType
this
.
flavor
=
flavor
this
.
versionCode
=
versionCode
this
.
versionName
=
versionName
this
.
appName
=
appName
setGroup
(
"oss"
)
...
...
@@ -89,8 +83,7 @@ class OssUploadTask extends DefaultTask {
//钉钉通知
MediaType
JSON
=
MediaType
.
parse
(
"application/json; charset=utf-8"
);
def
gson
=
new
Gson
()
def
content
=
"$appName: 下载地址为: "
+
"https://files.qmai.cn/"
+
ossPath
+
fileName
+
" 当前分支: "
+
getBranch
()+
" 当前环境: "
+
buildType
+
" 当前abi: $flavor"
def
content
=
"$appName: 下载地址为: https://files.qmai.cn/$ossPath$fileName 当前分支: ${getBranch()} 当前环境: $buildType 目标cpu: $flavor"
def
dingDingdetail
=
new
FsDetailInfoModel
(
content
)
def
dingdingInfo
=
new
FsInfoModel
(
dingDingdetail
)
RequestBody
requestBody
=
RequestBody
.
create
(
JSON
,
gson
.
toJson
(
dingdingInfo
))
...
...
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