forked from didi/DoKit
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
159 lines (138 loc) · 4.72 KB
/
build.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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
apply from: "config.gradle"
def runType = rootProject.ext.publish_config["run_type"]
def dokitPluginVersion = rootProject.ext.publish_config["version"]
def kotlinVersion = rootProject.ext.android["kotlin_version"]
def gradlePluginVersion = rootProject.ext.android["agp_module_verson"]
repositories {
google()
mavenCentral()
jcenter()
maven {
url "https://oss.sonatype.org/content/groups/public"
}
// maven { url 'https://artifactory.intra.xiaojukeji.com/artifactory/public' }
// maven {
// //本地插件地址
// url uri('/Users/didi/project/dokit_repo')
// }
}
dependencies {
classpath "com.android.tools.build:gradle:$gradlePluginVersion"
// MavenCentral
classpath "org.jetbrains.dokka:dokka-gradle-plugin:1.4.30"
if (runType == 1) {
classpath "io.github.didi.dokit:dokitx-plugin:$dokitPluginVersion"
}
//classpath "com.didiglobal.booster:booster-task-compression-pngquant:${rootProject.ext.android["booster_version"]}"
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion"
// classpath "com.didiglobal.booster:booster-gradle-plugin:3.3.1"
// classpath "com.didiglobal.booster:booster-task-analyser:3.3.1"
}
}
allprojects {
repositories {
google()
mavenCentral()
jcenter()
maven {
url "https://oss.sonatype.org/content/groups/public"
}
// maven { url 'https://artifactory.intra.xiaojukeji.com/artifactory/public' }
// maven {
// //本地插件地址
// url uri('/Users/didi/project/dokit_repo')
// }
}
}
task clean(type: Delete) {
doLast {
delete rootProject.buildDir
}
}
/**
* 删除指定目录下的文件
*/
task deleteSource(type: Delete) {
doFirst {
println("path===>${project.rootDir}")
println("===delete Plugin Source start===")
}
followSymlinks = true
delete "${project.rootDir}/dokit-plugin/src/main/kotlin"
doLast {
println("===delete Plugin Source end===")
}
}
/**
* 将buildSrc中的代码同步到doraemonkit-plugin中
*/
task copyPluginSource(type: Copy, dependsOn: deleteSource) {
doFirst {
println("===copy Plugin Source start===")
}
from "${project.rootDir}/buildSrc/src/main/kotlin"
into "${project.rootDir}/dokit-plugin/src/main/kotlin"
include('**/*')
doLast {
println("===copy Plugin Source end===")
}
}
/**
* 打包上传配置检查
*/
task checkUploadConfig4Maven() {
doLast {
if (rootProject.ext.publish_config["archives_type"] != 2) {
throw new RuntimeException("执行当前打包上传任务必须修改config.gradle配置中的archives_type = 2。")
}
try {
rootProject.project("dokit-rpc").name
rootProject.project("dokit-rpc-mc").name
} catch (Exception e) {
throw new RuntimeException("dokit rpc 相关模块未开启动。。。")
}
try {
rootProject.project("dokit-plugin").name
} catch (Exception e) {
throw new RuntimeException("dokit plugn 模块未开启动。。。")
}
}
}
task checkUploadConfig4Local() {
doLast {
if (rootProject.ext.publish_config["archives_type"] != 0) {
throw new RuntimeException("执行当前打包上传任务必须修改config.gradle配置中的archives_type = 0。")
}
try {
rootProject.project("dokit-rpc").name
rootProject.project("dokit-rpc-mc").name
} catch (Exception e) {
throw new RuntimeException("dokit rpc 相关模块未开启动。。。")
}
try {
rootProject.project("dokit-plugin").name
} catch (Exception e) {
throw new RuntimeException("dokit plugn 模块未开启动。。。")
}
}
}
task checkUploadConfig4Didi() {
doLast {
if (rootProject.ext.publish_config["archives_type"] != 1) {
throw new RuntimeException("执行当前打包上传任务必须修改config.gradle配置中的archives_type = 1。")
}
try {
rootProject.project("dokit-rpc").name
rootProject.project("dokit-rpc-mc").name
} catch (Exception e) {
throw new RuntimeException("dokit rpc 相关模块未开启动。。。")
}
try {
rootProject.project("dokit-plugin").name
} catch (Exception e) {
throw new RuntimeException("dokit plugn 模块未开启动。。。")
}
}
}