forked from LinXueyuanStdio/TimeCatPlugin-PluginManager
-
Notifications
You must be signed in to change notification settings - Fork 0
/
publish.gradle
58 lines (54 loc) · 2.05 KB
/
publish.gradle
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
def configProps = new Properties()
File moduleConfig = rootProject.file("pluginConfig.properties")
if (moduleConfig.exists()) {
configProps.load(new FileInputStream(moduleConfig))
}
ext {
DIST_PATH = file(configProps.DIST_PATH)
PUBLISH_UUID = configProps.PUBLISH_UUID
PUBLISH_MANAGER_VERSION_CODE = configProps.PUBLISH_MANAGER_VERSION_CODE
PUBLISH_MANAGER_VERSION = configProps.PUBLISH_MANAGER_VERSION
PUBLISH_PLUGIN_VERSION_CODE = configProps.PUBLISH_PLUGIN_VERSION_CODE
PUBLISH_PLUGIN_VERSION = configProps.PUBLISH_PLUGIN_VERSION
}
def createCopyTask(projectName, buildType, version,name, apkName, inputFile, taskName) {
def outputFile = file("${DIST_PATH}/plugins/${PUBLISH_UUID}/${name}/${version}/${apkName}")
outputFile.getParentFile().mkdirs()
return tasks.create("copy${buildType.capitalize()}${name.capitalize()}Task", Copy) {
group = 'build'
description = "复制${name}到发布仓库."
from(inputFile.getParent()) {
include(inputFile.name)
rename { outputFile.name }
}
into(outputFile.getParent())
}.dependsOn("${projectName}:${taskName}")
}
task publish_plugin_to_dist {
def buildType = "release"
def moduleName = 'plugin-manager'
def pluginManagerApkFile = file(
"${project(":plugin-manager").getBuildDir()}" +
"/outputs/apk/${buildType}/" +
"${moduleName}-${buildType}.apk"
)
dependsOn createCopyTask(
':plugin-manager',
buildType,
PUBLISH_MANAGER_VERSION,
moduleName,
'plugin-manager.apk',
pluginManagerApkFile,
"assemble${buildType.capitalize()}"
)
def pluginZip = file("${getRootProject().getBuildDir()}/plugin-${buildType}.zip")
dependsOn createCopyTask(
':plugin-shadow-app',
buildType,
PUBLISH_PLUGIN_VERSION,
'plugin-zip',
"plugin-${buildType}.zip",
pluginZip,
"package${buildType.capitalize()}Plugin"
)
}