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
9e67dcce
Commit
9e67dcce
authored
Nov 29, 2024
by
tongzifang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add legu
parent
bb5d9819
Changes
11
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
469 additions
and
19 deletions
+469
-19
deviceStreaming.xml
.idea/caches/deviceStreaming.xml
+329
-0
gradle.xml
.idea/gradle.xml
+2
-9
kotlinc.xml
.idea/kotlinc.xml
+1
-1
migrations.xml
.idea/migrations.xml
+10
-0
misc.xml
.idea/misc.xml
+1
-1
runConfigurations.xml
.idea/runConfigurations.xml
+17
-0
build.gradle
build.gradle
+7
-1
local.properties
local.properties
+2
-2
MultiUploadBean.groovy
...ain/groovy/com/qmai/android/plugin/MultiUploadBean.groovy
+12
-0
OssAndPygerPlugin.groovy
...n/groovy/com/qmai/android/plugin/OssAndPygerPlugin.groovy
+64
-0
OssUploadTask.groovy
src/main/groovy/com/qmai/android/plugin/OssUploadTask.groovy
+24
-5
No files found.
.idea/caches/deviceStreaming.xml
0 → 100644
View file @
9e67dcce
This diff is collapsed.
Click to expand it.
.idea/gradle.xml
View file @
9e67dcce
...
...
@@ -4,6 +4,7 @@
<component
name=
"GradleSettings"
>
<option
name=
"linkedExternalProjectsSettings"
>
<GradleProjectSettings>
<option
name=
"testRunner"
value=
"CHOOSE_PER_TEST"
/>
<option
name=
"externalProjectPath"
value=
"$PROJECT_DIR$"
/>
<option
name=
"gradleJvm"
value=
"1.8"
/>
<option
name=
"modules"
>
...
...
@@ -11,15 +12,7 @@
<option
value=
"$PROJECT_DIR$"
/>
</set>
</option>
</GradleProjectSettings>
<GradleProjectSettings>
<option
name=
"externalProjectPath"
value=
"$PROJECT_DIR$"
/>
<option
name=
"gradleJvm"
value=
"1.8"
/>
<option
name=
"modules"
>
<set>
<option
value=
"$PROJECT_DIR$"
/>
</set>
</option>
<option
name=
"resolveExternalAnnotations"
value=
"false"
/>
</GradleProjectSettings>
</option>
</component>
...
...
.idea/kotlinc.xml
View file @
9e67dcce
<?xml version="1.0" encoding="UTF-8"?>
<project
version=
"4"
>
<component
name=
"KotlinJpsPluginSettings"
>
<option
name=
"version"
value=
"1.
6.21
"
/>
<option
name=
"version"
value=
"1.
7.22
"
/>
</component>
</project>
\ No newline at end of file
.idea/migrations.xml
0 → 100644
View file @
9e67dcce
<?xml version="1.0" encoding="UTF-8"?>
<project
version=
"4"
>
<component
name=
"ProjectMigrations"
>
<option
name=
"MigrateToGradleLocalJavaHome"
>
<set>
<option
value=
"$PROJECT_DIR$"
/>
</set>
</option>
</component>
</project>
\ No newline at end of file
.idea/misc.xml
View file @
9e67dcce
<project
version=
"4"
>
<component
name=
"ExternalStorageConfigurationManager"
enabled=
"true"
/>
<component
name=
"ProjectRootManager"
version=
"2"
languageLevel=
"JDK_1_8"
default=
"true"
project-jdk-name=
"1.8"
project-jdk-type=
"JavaSDK"
/>
<component
name=
"ProjectRootManager"
version=
"2"
languageLevel=
"JDK_1_8"
default=
"true"
project-jdk-name=
"
corretto-
1.8"
project-jdk-type=
"JavaSDK"
/>
</project>
\ No newline at end of file
.idea/runConfigurations.xml
0 → 100644
View file @
9e67dcce
<?xml version="1.0" encoding="UTF-8"?>
<project
version=
"4"
>
<component
name=
"RunConfigurationProducerService"
>
<option
name=
"ignoredProducers"
>
<set>
<option
value=
"com.intellij.execution.junit.AbstractAllInDirectoryConfigurationProducer"
/>
<option
value=
"com.intellij.execution.junit.AllInPackageConfigurationProducer"
/>
<option
value=
"com.intellij.execution.junit.PatternConfigurationProducer"
/>
<option
value=
"com.intellij.execution.junit.TestInClassConfigurationProducer"
/>
<option
value=
"com.intellij.execution.junit.UniqueIdConfigurationProducer"
/>
<option
value=
"com.intellij.execution.junit.testDiscovery.JUnitTestDiscoveryConfigurationProducer"
/>
<option
value=
"org.jetbrains.kotlin.idea.junit.KotlinJUnitRunConfigurationProducer"
/>
<option
value=
"org.jetbrains.kotlin.idea.junit.KotlinPatternConfigurationProducer"
/>
</set>
</option>
</component>
</project>
\ No newline at end of file
build.gradle
View file @
9e67dcce
...
...
@@ -133,6 +133,12 @@ gradlePlugin {
implementationClass
=
'com.qmai.android.plugin.OssFileUploadPlugin'
}
}
plugins
{
OssAndPyger
{
id
=
'GradlePlugin.OssAndPyger'
implementationClass
=
'com.qmai.android.plugin.OssAndPygerPlugin'
}
}
plugins
{
pygerUpload
{
id
=
'GradlePlugin.pygerUpload'
...
...
@@ -251,7 +257,7 @@ task hot{
}
group
'com.qmai.android.plugin'
version
'1.1
03
'
version
'1.1
10.17
'
gradlePublish
{
...
...
local.properties
View file @
9e67dcce
...
...
@@ -4,5 +4,5 @@
# Location of the SDK. This is only used by Gradle.
# For customization when using a Version Control System, please read the
# header note.
#Tue
Aug 22 12:10:35
CST 2023
sdk.dir
=
/Users/
leiwang
/Library/Android/sdk
#Tue
May 30 18:13:00
CST 2023
sdk.dir
=
/Users/
tongzi
/Library/Android/sdk
src/main/groovy/com/qmai/android/plugin/MultiUploadBean.groovy
0 → 100644
View file @
9e67dcce
package
com.qmai.android.plugin
/***
* oss 上传需要的参数
*/
class
MultiUploadBean
{
String
ossPath
String
appName
String
versionCode
String
versionName
ArrayList
<
String
>
flavors
=
[]
ArrayList
<
String
>
buildTypes
=
[]
}
src/main/groovy/com/qmai/android/plugin/OssAndPygerPlugin.groovy
0 → 100644
View file @
9e67dcce
package
com.qmai.android.plugin
import
org.gradle.api.Plugin
import
org.gradle.api.Project
/***
* 编译加上传到oss中
*/
class
OssAndPygerPlugin
implements
Plugin
<
Project
>
{
@Override
void
apply
(
Project
project
)
{
MultiUploadBean
ossUploadFileBean
=
project
.
getExtensions
().
create
(
"uploadOssAndPyger"
,
MultiUploadBean
.
class
)
PygerBean
pygerBean
=
project
.
getExtensions
().
create
(
"BuildAndPygerInfo"
,
PygerBean
.
class
)
project
.
afterEvaluate
{
print
(
"-OssAndPygerPlugin---buildTypes--:$ossUploadFileBean.buildTypes"
)
print
(
"-OssAndPygerPlugin---flavors--:$ossUploadFileBean.flavors"
)
if
(
ossUploadFileBean
.
buildTypes
!=
null
)
{
List
<
List
<
String
>>
combinedList
=
new
ArrayList
<>()
ossUploadFileBean
.
buildTypes
.
forEach
{
type
->
if
(
ossUploadFileBean
.
flavors
==
null
||
ossUploadFileBean
.
flavors
.
size
()
==
0
)
{
List
<
String
>
child
=
new
ArrayList
<>()
child
.
add
(
type
)
child
.
add
(
""
)
combinedList
.
add
(
child
)
}
else
{
ossUploadFileBean
.
flavors
.
forEach
{
flavor
->
List
<
String
>
child
=
new
ArrayList
<>()
child
.
add
(
type
)
child
.
add
(
flavor
)
combinedList
.
add
(
child
)
}
}
}
print
(
"-OssAndPygerPlugin---combinedList--:$combinedList"
)
combinedList
.
forEach
{
combinedListItem
->
String
type
=
combinedListItem
.
get
(
0
)
String
flavor
=
combinedListItem
.
get
(
1
)
String
taskOssName
=
"uploadOss${firstLetterUpper(type)}${firstLetterUpper(flavor)}"
String
taskPygerName
=
"uploadPyger${firstLetterUpper(type)}${firstLetterUpper(flavor)}"
print
(
"-OssAndPygerPlugin--taskName:$taskOssName"
)
print
(
"-OssAndPygerPlugin--taskPygerName:$taskPygerName"
)
String
dirName
=
"${project.layout.buildDirectory.asFile.get()}/outputs/apk/$flavor/$type/"
String
apkName
=
"qmsd_${type}_${flavor}"
+
"_${ossUploadFileBean.versionCode}_${ossUploadFileBean.versionName}.apk"
def
uploadFile
=
new
File
(
dirName
+
apkName
)
print
(
"-OssAndPygerPlugin--dirName apkName:${dirName + apkName}"
)
project
.
getTasks
().
register
(
taskOssName
,
OssUploadTask
.
class
,
uploadFile
,
ossUploadFileBean
.
ossPath
,
type
,
flavor
,
ossUploadFileBean
.
appName
)
project
.
getTasks
().
register
(
taskPygerName
,
PygerUploadTask
.
class
,
uploadFile
,
firstLetterUpper
(
type
),
pygerBean
.
key
,
flavor
,
ossUploadFileBean
.
appName
)
}
}
}
};
//首字符大写
String
firstLetterUpper
(
String
str
)
{
char
[]
cs
=
str
.
toCharArray
()
cs
[
0
]
-=
32
return
String
.
valueOf
(
cs
)
}
}
src/main/groovy/com/qmai/android/plugin/OssUploadTask.groovy
View file @
9e67dcce
...
...
@@ -71,7 +71,7 @@ class OssUploadTask extends DefaultTask {
try
{
println
(
"file name= "
+
file
.
name
)
println
(
"file path= "
+
file
.
absolutePath
+
" "
+
file
.
getCanonicalPath
())
// println("begin upload " + file.exists())
// println("begin upload " + file.exists())
PutObjectRequest
putObjectRequest
=
new
PutObjectRequest
(
bucketName
,
ossPath
+
fileName
,
file
)
ossClient
.
putObject
(
putObjectRequest
)
println
(
"--------------------------------------------------------------------------"
)
...
...
@@ -89,7 +89,13 @@ class OssUploadTask extends DefaultTask {
//https://cli.im/api/qrcode/code?text
def
downloadUrl
=
"https://files.qmai.cn/$ossPath$fileName"
def
qrDownloadUrl
=
"https://cli.im/api/qrcode/code?text=${downloadUrl}"
def
content
=
"${appName.isEmpty() ? file.name : appName}: 下载地址为: https://files.qmai.cn/$ossPath$fileName\n 二维码地址:$qrDownloadUrl\n 当前环境: $buildType\n目标cpu: $flavor\n当前分支: ${getBranch()}"
def
content
=
"${appName.isEmpty() ? file.name : appName}: "
+
"下载地址为: https://files.qmai.cn/$ossPath$fileName\n"
+
"二维码地址:$qrDownloadUrl\n"
+
"当前环境: $buildType\n"
+
"目标cpu: $flavor\n"
+
"是否加固: ${isLegu{}}\n"
+
"当前分支: ${getBranch()}"
def
dingDingdetail
=
new
FsDetailInfoModel
(
content
)
def
dingdingInfo
=
new
FsInfoModel
(
dingDingdetail
)
RequestBody
requestBody
=
RequestBody
.
create
(
JSON
,
gson
.
toJson
(
dingdingInfo
))
...
...
@@ -114,6 +120,19 @@ class OssUploadTask extends DefaultTask {
}
}
@Input
boolean
isLegu
()
{
Map
<
String
,
String
>
map
=
System
.
getenv
()
if
(
map
==
null
)
{
return
false
}
String
str
=
map
.
get
(
"legu"
)
if
(
str
==
null
)
{
return
false
}
else
{
return
str
==
"true"
}
}
@Input
boolean
isInJenkins
()
{
...
...
@@ -154,14 +173,14 @@ class OssUploadTask extends DefaultTask {
}
@Input
OssParamsBean
getOssInfo
(){
OssParamsBean
getOssInfo
()
{
OssParamsBean
ossParamsBean
=
new
OssParamsBean
()
Map
<
String
,
String
>
params
=
System
.
getenv
()
Map
<
String
,
String
>
params
=
System
.
getenv
()
ossParamsBean
.
app_oss_endpoint
=
params
.
get
(
"app_oss_endpoint"
)
ossParamsBean
.
app_oss_accessKeyId
=
params
.
get
(
"app_oss_accessKeyId"
)
ossParamsBean
.
app_oss_accessKeySecret
=
params
.
get
(
"app_oss_accessKeySecret"
)
ossParamsBean
.
app_oss_path
=
params
.
get
(
"app_oss_path"
)
ossParamsBean
.
app_oss_bucketName
=
params
.
get
(
"app_oss_bucketName"
)
return
ossParamsBean
return
ossParamsBean
}
}
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