-
Notifications
You must be signed in to change notification settings - Fork 28
/
config.gradle
142 lines (124 loc) · 3.69 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
project.ext {
configAppModule = { project ->
project.apply plugin: 'com.android.application'
// kotlin 配置
configKotlin project
// Android 配置
configAndroid(project)
// 通用依赖配置
configDependencies project
// ARouter 配置
// configARouter project
// cpp 配置
// configCpp project
}
configLibModule = { project ->
project.apply plugin: 'com.android.library'
// kotlin 配置
configKotlin project
// Android 配置
configAndroid(project)
// 通用依赖配置
configDependencies project
// ARouter 配置
// configARouter project
// cpp 配置
// configCpp project
}
/**
* Android 配置
*/
configAndroid = { project ->
project.android {
compileSdkVersion APP.compileSdkVersion
buildToolsVersion APP.buildToolsVersion
defaultConfig {
minSdkVersion APP.minSdkVersion
targetSdkVersion APP.targetSdkVersion
versionCode APP.versionCode
versionName APP.versionName
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
consumerProguardFiles 'consumer-rules.pro'
vectorDrawables.useSupportLibrary = true
}
// maven不缓存,解决SNAPSHOT频繁打包不刷新问题
configurations.all {
resolutionStrategy {
cacheChangingModulesFor 0, 'seconds'
}
}
buildTypes {
release {
// 大多数module不混淆,少数如需混淆覆盖配置即可
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
encoding "UTF8"
sourceCompatibility = 1.8
targetCompatibility = 1.8
}
kotlinOptions {
jvmTarget = "1.8"
}
viewBinding {
enabled = true
}
}
}
/**
* Kotlin 配置
*/
configKotlin = { project ->
// 应用 kotlin 插件
project.apply plugin: 'kotlin-android'
project.apply plugin: 'kotlin-kapt'
project.apply plugin: 'kotlin-parcelize'
// Kotlin 运行库
project.dependencies.implementation SDK.ktx_jdk7
// Kotlin 协程库
project.dependencies.implementation SDK.ktx_coroutines
}
/**
* cpp配置
*/
configCpp = { project ->
project.android {
defaultConfig {
externalNativeBuild {
cmake {
}
}
}
externalNativeBuild {
cmake {
path 'src/main/cpp/CMakeLists.txt'
}
}
}
}
/**
* 依赖配置
*/
configDependencies = { project ->
project.dependencies {
implementation SDK.activityx
// implementation SDK.activityx_ktx
implementation SDK.fragmentx
// implementation SDK.fragmentx_ktx
}
}
/**
* ARouter 配置
*/
configARouter = { project ->
project.kapt {
arguments {
arg("AROUTER_MODULE_NAME", project.getName())
}
}
project.dependencies.implementation 'com.alibaba:arouter-api:1.5.2'
project.dependencies.kapt 'com.alibaba:arouter-compiler:1.5.2'
}
}