-
-
Notifications
You must be signed in to change notification settings - Fork 308
Expand file tree
/
Copy pathconfigs.gradle.kts
More file actions
56 lines (49 loc) · 1.75 KB
/
configs.gradle.kts
File metadata and controls
56 lines (49 loc) · 1.75 KB
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
// 测试服
val SERVER_TYPE_TEST = "test"
// 预发布服
val SERVER_TYPE_PREVIEW = "pre"
// 正式服
val SERVER_TYPE_PRODUCT = "product"
var taskName = gradle.startParameter.taskNames.firstOrNull() ?: ""
// 打印当前执行的任务名称
println("GradleLog TaskNameOutput $taskName")
var serverType = SERVER_TYPE_PRODUCT
serverType = when {
taskName.endsWith("Debug") -> SERVER_TYPE_TEST
taskName.endsWith("Preview") -> SERVER_TYPE_PREVIEW
else -> SERVER_TYPE_PRODUCT
}
// 从 Gradle 命令中读取参数配置,例如:./gradlew assembleRelease -P ServerType="test"
if (project.hasProperty("ServerType")) {
serverType = project.property("ServerType").toString()
}
// 打印当前服务器配置
println("GradleLog ServerTypeOutput $serverType")
// 友盟 AppKey
extra["UMENG_APP_KEY"] = "5cb16d93570df399fd0014e2"
// QQ AppId
extra["QQ_APP_ID"] = "101828096"
// QQ Secret
extra["QQ_APP_SECRET"] = "9dfd3300c3aa3c4596a07796c64914b2"
// 微信 AppId
extra["WX_APP_ID"] = "wxd35706cc9f46114c"
// 微信 Secret
extra["WX_APP_SECRET"] = "0c8c7cf831dd135a32b3e395ea459b5a"
when (serverType) {
SERVER_TYPE_TEST, SERVER_TYPE_PREVIEW -> {
extra["LOG_ENABLE"] = true
extra["BUGLY_ID"] = "请自行替换 Bugly 上面的 AppId"
extra["BUGLY_KEY"] = "请自行替换 Bugly 上面的 AppKey"
extra["HOST_URL"] = if (serverType == SERVER_TYPE_PREVIEW) {
"https://www.pre.baidu.com/"
} else {
"https://www.test.baidu.com/"
}
}
SERVER_TYPE_PRODUCT -> {
extra["LOG_ENABLE"] = false
extra["BUGLY_ID"] = "请自行替换 Bugly 上面的 AppId"
extra["BUGLY_KEY"] = "请自行替换 Bugly 上面的 AppKey"
extra["HOST_URL"] = "https://www.baidu.com/"
}
}