-
Notifications
You must be signed in to change notification settings - Fork 5
/
config.gradle
279 lines (261 loc) · 13.6 KB
/
config.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
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
import java.text.SimpleDateFormat
import java.util.regex.Matcher
import java.util.regex.Pattern
ext {
// 上传bintray的配置
bintray = [
groupId : "com.excellence",
publishVersion: "1.0.0",
website : "https://github.com/VeiZhang",
licences : ['Apache-2.0']
]
// 插件
plugins = [
application : "com.android.application",
library : "com.android.library",
maven : "com.github.dcendents.android-maven",
bintray : "com.jfrog.bintray",
novoda : "com.novoda.bintray-release",
greendao : "org.greenrobot.greendao",
"greendao-gradle": "org.greenrobot:greendao-gradle-plugin:3.2.2"
]
// 配置
android = [
/*************************原生配置*************************/
compileSdkVersion : 28,
buildToolsVersion : "25.0.0",
minSdkVersion : 21,
targetSdkVersion : 21,
versionCode : getVersionCode(),
versionName : getVersionName(),
/*************************自定义配置*************************/
androidSupportSdkVersion: "23.0.0",
retrofit2 : "2.5.0",
leakcanary : "1.6.3",
exoplayer : "2.10.4",
ijkplayer : "0.8.8",
ffmpeg : "1.2.2",
"imageloader" : "1.0.0",
]
// 依赖
dependencies = [
/*************************原生依赖*************************/
"appcompat-v7" : "com.android.support:appcompat-v7:${android["androidSupportSdkVersion"]}",
"support-v4" : "com.android.support:support-v4:${android["androidSupportSdkVersion"]}",
"cardview-v7" : "com.android.support:cardview-v7:${android["androidSupportSdkVersion"]}",
"recyclerview-v7" : "com.android.support:recyclerview-v7:${android["androidSupportSdkVersion"]}",
"design" : "com.android.support:design:${android["androidSupportSdkVersion"]}",
"annotations" : "com.android.support:support-annotations:${android["androidSupportSdkVersion"]}",
"gridlayout-v7" : "com.android.support:gridlayout-v7:${android["androidSupportSdkVersion"]}",
"constraint-layout" : "com.android.support.constraint:constraint-layout:1.1.2",
/*************************第三方依赖*************************/
// https://github.com/square/retrofit
"retrofit2" : "com.squareup.retrofit2:retrofit:${android["retrofit2"]}",
"converter-scalars" : "com.squareup.retrofit2:converter-scalars:${android["retrofit2"]}",
"converter-gson" : "com.squareup.retrofit2:converter-gson:${android["retrofit2"]}",
"adapter-rxjava" : "com.squareup.retrofit2:adapter-rxjava:${android["retrofit2"]}",
"adapter-rxjava2" : "com.squareup.retrofit2:adapter-rxjava2:${android["retrofit2"]}",
// https://github.com/square/okhttp
"okhttp" : "com.squareup.okhttp3:okhttp:3.14.2",
// https://github.com/greenrobot/greenDAO
"greendao" : "org.greenrobot:greendao:3.2.2",
// https://github.com/yuweiguocn/GreenDaoUpgradeHelper
"greendao-helper" : "io.github.yuweiguocn:GreenDaoUpgradeHelper:2.2.1",
// https://github.com/bumptech/glide
"glide" : "com.github.bumptech.glide:glide:4.9.0",
// https://github.com/square/picasso
"picasso" : "com.squareup.picasso:picasso:2.71828",
// https://github.com/facebook/fresco
"fresco" : "com.facebook.fresco:fresco:2.0.0",
// https://github.com/greenrobot/EventBus
"eventbus" : "org.greenrobot:eventbus:3.1.1",
// https://github.com/BuglyDevTeam/Bugly-Android
"bugly" : "com.tencent.bugly:crashreport:3.0.0",
"bugly-native" : "com.tencent.bugly:nativecrashreport:3.7.1",
// https://bintray.com/android/android-utils/com.android.volley.volley
"volley" : "com.android.volley:volley:1.1.1",
// https://github.com/ReactiveX/RxJava
"rxjava" : "io.reactivex:rxjava:1.3.8",
"rxjava2" : "io.reactivex.rxjava2:rxjava:2.2.9",
"rxandroid" : "io.reactivex:rxandroid:2.1.1",
"rxandroid2" : 'io.reactivex.rxjava2:rxandroid:2.1.1',
// https://github.com/JakeWharton/RxBinding
"rxbinding" : 'com.jakewharton.rxbinding2:rxbinding:2.2.0',
// https://github.com/google/gson
"gson" : "com.google.code.gson:gson:2.8.5",
// https://github.com/alibaba/fastjson
"fastjson" : "com.alibaba:fastjson:1.1.70.android",
// https://github.com/apache/commons-lang
"commons-lang3" : "org.apache.commons:commons-lang3:3.9",
// https://github.com/square/leakcanary
"leakcanary" : "com.squareup.leakcanary:leakcanary-android:${android["leakcanary"]}",
"leakcanary-release" : "com.squareup.leakcanary:leakcanary-android-no-op:${android["leakcanary"]}",
"leakcanary-fragment" : "com.squareup.leakcanary:leakcanary-support-fragment:${android["leakcanary"]}",
// https://github.com/YoKeyword/Fragmentation
"fragmentation" : "me.yokeyword:fragmentation:1.3.7",
// https://github.com/airbnb/lottie-android,2.8.0+是为了兼容AndroidX,没有用到AndroidX,则使用版本2.7.0,否则莫名其妙会报错
"lottie" : "com.airbnb.android:lottie:2.7.0",
// https://github.com/google/ExoPlayer,2.8.4+是为了兼容AndroidX
"exoplayer" : "com.google.android.exoplayer:exoplayer:${android["exoplayer"]}",
"exoplayer-core" : "com.google.android.exoplayer:exoplayer-core:${android["exoplayer"]}",
"exoplayer-dash" : "com.google.android.exoplayer:exoplayer-dash:${android["exoplayer"]}",
"exoplayer-hls" : "com.google.android.exoplayer:exoplayer-hls:${android["exoplayer"]}",
"exoplayer-smoothstreaming" : "com.google.android.exoplayer:exoplayer-smoothstreaming:${android["exoplayer"]}",
"exoplayer-ui" : "com.google.android.exoplayer:exoplayer-ui:${android["exoplayer"]}",
"exoplayer-extension-gvr" : "com.google.android.exoplayer:extension-gvr:${android["exoplayer"]}",
"exoplayer-extension-mediasession": "com.google.android.exoplayer:extension-mediasession:${android["exoplayer"]}",
"exoplayer-extension-okhttp" : "com.google.android.exoplayer:extension-okhttp:${android["exoplayer"]}",
"exoplayer-extension-rtmp" : "com.google.android.exoplayer:extension-rtmp:${android["exoplayer"]}",
// https://github.com/Bilibili/ijkplayer
"ijkplayer-java" : "tv.danmaku.ijk.media:ijkplayer-java:${android["ijkplayer"]}",
"ijkplayer-armv7a" : "tv.danmaku.ijk.media:ijkplayer-armv7a:${android["ijkplayer"]}",
"ijkplayer-armv5" : "tv.danmaku.ijk.media:ijkplayer-armv5:${android["ijkplayer"]}",
"ijkplayer-arm64" : "tv.danmaku.ijk.media:ijkplayer-arm64:${android["ijkplayer"]}",
"ijkplayer-x86" : "tv.danmaku.ijk.media:ijkplayer-x86:${android["ijkplayer"]}",
"ijkplayer-x86_64" : "tv.danmaku.ijk.media:ijkplayer-x86_64:${android["ijkplayer"]}",
"ijkplayer-exo" : "tv.danmaku.ijk.media:ijkplayer-exo:${android["ijkplayer"]}",
// https://github.com/zaclimon/Tsutaeru
"xipl" : "com.zaclimon:xipl:0.2.2",
"tiflibrary" : "com.zaclimon:tiflibrary:0.2.2",
/*************************个人依赖*************************/
// https://github.com/VeiZhang/BaseToolsLibrary
"basetools" : "com.excellence:basetools:1.2.6",
// https://github.com/VeiZhang/Permission
"permission" : "com.excellence:permission:1.0.2",
// https://github.com/VeiZhang/RetrofitClient
"retrofit-client" : "com.excellence:retrofit:1.0.5",
"retrofit-client2" : "com.excellence.retrofit:retrofit2:2.0.0",
// https://github.com/VeiZhang/QSkinLoader
"skinloader" : "com.excellence:skinloader:1.2.2",
// https://github.com/VeiZhang/ToastKit
"toast" : "com.excellence:toast:1.1.0",
// https://github.com/VeiZhang/MailSender
"mailsender" : "com.excellence:mailsender:1.0.0",
// https://github.com/VeiZhang/Downloader
"downloader" : "com.excellence:downloader:1.2.0",
// https://github.com/VeiZhang/AppStatistics
"app-statistics" : "com.excellence:app-statistics:1.0.1",
// https://github.com/VeiZhang/AndroidExec
"exec" : "com.excellence:exec:1.1.2",
// https://github.com/VeiZhang/AndroidFFmpeg
"ffmpeg" : "com.excellence:ffmpeg:${android["ffmpeg"]}",
"ffmpeg-java" : "com.excellence:ffmpeg-java:${android["ffmpeg"]}",
"ffmpeg-armeabi" : "com.excellence:ffmpeg-armeabi:${android["ffmpeg"]}",
"ffmpeg-armv7a" : "com.excellence:ffmpeg-armv7a:${android["ffmpeg"]}",
"ffmpeg-x86" : "com.excellence:ffmpeg-x86:${android["ffmpeg"]}",
// https://github.com/VeiZhang/ImageLoader
"imageloader" : "com.excellence:imageloader:${android["imageloader"]}",
"imageloader-fresco" : "com.excellence:imageloader-fresco:${android["imageloader"]}",
"imageloader-picasso" : "com.excellence:imageloader-picasso:${android["imageloader"]}",
"imageloader-glide" : "com.excellence:imageloader-glide:${android["imageloader"]}",
// https://github.com/VeiZhang/DIY-EpgView
"epgview" : "com.excellence:diy-epgview:1.0.2"
]
}
/***********************APP版本控制的通用方法***********************/
/**
* svn
* 直接读取svn版本号作为版本控制
*/
/**
* git
*
* git tag作为版本名称
* git 版本号有两种方法
* ①一种是把提交次数作为versionCode
* ②另外一种是把tag的数量作为versionCode
*/
/**
* 获取版本
* @return
*/
def getVersionName() {
def date = getDate()
def version = getSvnVersionCode()
if (version != 0) {
return "1.0.${version} [${date}]"
}
version = getGitTag()
if (version != 0) {
return "${version} [${date}]"
}
if (version == 0) {
version = 1
}
/**
* 错误的版本信息,请检查
*/
return "0.${version} [${date}]"
}
/**
* 获取版本号
* @return
*/
def getVersionCode() {
def versionCode = getSvnVersionCode()
if (versionCode == 0) {
versionCode = getGitVersionCode()
}
if (versionCode == 0) {
versionCode = 1
}
return versionCode
}
/***********************读取Git信息***********************/
/**
* 读取当前分支最近的一次git tag
* @return tag
*/
def getGitTag() {
try {
def process = ("git describe --abbrev=0 --tags").execute()
def tag = process.text.trim()
return tag
} catch (e) {
println e.getMessage()
}
return 0
}
/**
* 以git提交的数量作为其版本号
* @return tag的数量
*/
def getGitVersionCode() {
try {
def process = ("git rev-list --all --count").execute()
def version = process.text.trim().toInteger()
return version
} catch (e) {
println e.getMessage()
}
return 0
}
/***********************读取SVN信息***********************/
/**
* 根据svn提交版本生成版本号
* @return
*/
def getSvnVersionCode() {
try {
def process = ("svnversion -c " + getBuildDir().parent).execute()
process.waitFor()
def version = process.in.text
Pattern pattern = Pattern.compile("(\\d+:)?(\\d+)\\D")
Matcher matcher = pattern.matcher(version)
if (matcher.find()) {
version = matcher.group(matcher.groupCount())
}
return Integer.parseInt(version)
} catch (e) {
println e.getMessage()
}
return 0
}
/**
* 获取日期
* @return
*/
def getDate() {
String date = new SimpleDateFormat("MMddyyyy").format(new Date())
return date
}