-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuild.gradle
281 lines (238 loc) · 8.83 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
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
280
281
buildscript {
repositories {
mavenCentral()
google()
gradlePluginPortal()
maven { url 'https://maven.aliyun.com/repository/jcenter' }
maven { url 'https://maven.aliyun.com/repository/google' }
maven { url 'https://maven.aliyun.com/repository/central' }
maven { url 'https://maven.aliyun.com/repository/gradle-plugin' }
}
dependencies {
classpath GRADLE_CLASS_PATH
classpath PROTOBUF_CLASS_PATH
// classpath KOTLIN
}
}
final String ANDROID_TOP = "${rootDir}"
final String FRAMEWORK_PREBUILTS_DIR = "${ANDROID_TOP}/prebuilts/framework_intermediates/"
apply plugin: 'com.android.application'
apply plugin: 'com.google.protobuf'
def protocVersion = '3.8.0'
// 读取前面配置的keystore.properties
def keyProps = new Properties()
def keyPropsFile = rootProject.file('keystore/keystore.properties')
if (keyPropsFile.exists()) {
keyProps.load(new FileInputStream(keyPropsFile))
}
// 读取version.properties
def versionProps = new Properties()
def versionPropsFile = rootProject.file('version.properties')
if (versionPropsFile.exists()) {
versionProps.load(new FileInputStream(versionPropsFile))
}
android {
compileSdkVersion COMPILE_SDK
defaultConfig {
minSdkVersion 26
targetSdkVersion 33
versionCode versionProps['versionCode'].toInteger()
versionName versionProps['versionName']
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
vectorDrawables.useSupportLibrary = true
}
// 签名
signingConfigs {
release {
keyAlias keyProps['keyAlias']
keyPassword keyProps['keyPassword']
storeFile keyProps['storeFile'] ? file(keyProps['storeFile']) : null
storePassword keyProps['storePassword']
}
}
buildTypes {
debug {
minifyEnabled false
}
release {
signingConfig signingConfigs.release
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_11
targetCompatibility JavaVersion.VERSION_11
}
// The flavor dimensions for build variants (e.g. aospWithQuickstep, aospWithoutQuickstep)
// See: https://developer.android.com/studio/build/build-variants#flavor-dimensions
flavorDimensions "app", "recents"
productFlavors {
aosp {
dimension "app"
applicationId 'com.android.ttlauncher3'
testApplicationId 'com.android.launcher3.tests'
}
l3go {
dimension "app"
applicationId 'com.android.launcher3'
testApplicationId 'com.android.launcher3.tests'
}
withQuickstep {
dimension "recents"
minSdkVersion 28
}
withoutQuickstep {
dimension "recents"
}
}
// Disable release builds for now
android.variantFilter { variant ->
if (variant.buildType.name.endsWith('release')) {
variant.setIgnore(true)
}
}
sourceSets {
main {
res.srcDirs = ['res']
java.srcDirs = ['src', 'src_plugins']
manifest.srcFile 'AndroidManifest-common.xml'
proto {
srcDirs = ['protos/', 'protos_overrides/']
}
}
androidTest {
res.srcDirs = ['tests/res']
java.srcDirs = ['tests/src', 'tests/tapl']
manifest.srcFile "tests/AndroidManifest-common.xml"
}
androidTestDebug {
manifest.srcFile "tests/AndroidManifest.xml"
}
aosp {
java.srcDirs = ['src_flags', 'src_shortcuts_overrides']
}
aospWithoutQuickstep {
manifest.srcFile "AndroidManifest.xml"
}
aospWithQuickstep {
manifest.srcFile "quickstep/AndroidManifest-launcher.xml"
}
l3go {
res.srcDirs = ['go/res']
java.srcDirs = ['go/src']
manifest.srcFile "go/AndroidManifest.xml"
}
l3goWithoutQuickstepDebug {
manifest.srcFile "AndroidManifest.xml"
}
l3goWithQuickstepDebug {
manifest.srcFile "quickstep/AndroidManifest-launcher.xml"
}
withoutQuickstep {
java.srcDirs = ['src_ui_overrides']
}
withQuickstep {
res.srcDirs = ['quickstep/res', 'quickstep/recents_ui_overrides/res']
java.srcDirs = ['quickstep/src', 'quickstep/recents_ui_overrides/src']
manifest.srcFile "quickstep/AndroidManifest.xml"
}
}
}
allprojects {
repositories {
mavenCentral()
google()
gradlePluginPortal()
maven { url 'https://maven.aliyun.com/repository/jcenter' }
maven { url 'https://maven.aliyun.com/repository/google' }
maven { url 'https://maven.aliyun.com/repository/central' }
maven { url 'https://maven.aliyun.com/repository/gradle-plugin' }
}
}
dependencies {
implementation(platform("org.jetbrains.kotlin:kotlin-bom:1.8.0"))
implementation 'androidx.appcompat:appcompat:1.6.1'
implementation "androidx.dynamicanimation:dynamicanimation:${ANDROID_X_VERSION}"
implementation "androidx.recyclerview:recyclerview:1.3.1"
implementation "androidx.preference:preference:${ANDROID_X_VERSION}"
implementation project(':IconLoader')
implementation project(':mxlibrary')
implementation project(':launcherclient')
implementation 'androidx.slice:slice-core:1.0.0'
implementation 'com.google.protobuf:protobuf-javalite:3.8.0'
// withQuickstepImplementation project(':SharedLibWrapper')
// Recents lib dependency
withQuickstepImplementation fileTree(dir: "${FRAMEWORK_PREBUILTS_DIR}/libs", include: 'sysui_shared.jar')
// Required for AOSP to compile. This is already included in the sysui_shared.jar
withoutQuickstepImplementation fileTree(dir: "${FRAMEWORK_PREBUILTS_DIR}/libs", include: 'plugin_core.jar')
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'org.mockito:mockito-core:4.7.0'
androidTestImplementation 'com.google.dexmaker:dexmaker:1.2'
androidTestImplementation 'com.google.dexmaker:dexmaker-mockito:1.2'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test:rules:1.0.2'
androidTestImplementation 'com.android.support.test.uiautomator:uiautomator-v18:2.1.3'
androidTestImplementation "androidx.annotation:annotation:${ANDROID_X_VERSION}"
api 'com.airbnb.android:lottie:5.2.0'
implementation 'com.google.android.material:material:1.4.0'
implementation 'androidx.slice:slice-builders:1.0.0'
}
protobuf {
// Configure the protoc executable
protoc {
if (osdetector.os == "osx") {
artifact = "com.google.protobuf:protoc:${protocVersion}:osx-x86_64"
} else {
// artifact = "com.google.protobuf:protoc:${protocVersion}${PROTO_ARCH_SUFFIX}"
artifact = "com.google.protobuf:protoc:${protocVersion}"
}
}
generateProtoTasks {
all().each { task ->
task.builtins {
remove java
java {
option "lite"
}
}
}
}
}
tasks.register('upgradeVersion') {
group 'help'
description '构建新版本'
doLast {
println("---自动升级版本号---\n")
if (versionPropsFile.exists()) {
versionProps.load(new FileInputStream(versionPropsFile))
}
String oldVersionCode = versionProps['versionCode']
String oldVersionName = versionProps['versionName']
if (oldVersionCode == null || oldVersionName == null ||
oldVersionCode.isEmpty() || oldVersionName.isEmpty()) {
println("error:版本号不能为空")
return;
}
versionProps['versionCode'] = String.valueOf(versionProps['versionCode'].toInteger() + 1)
String str = versionProps['versionName'].toString()
versionProps['versionName'] = str.substring(0, str.lastIndexOf('.') + 1) +
(str.substring(str.lastIndexOf('.') + 1).toInteger() + 1)
String tip =
"版本号从$oldVersionName($oldVersionCode)升级到${versionProps['versionName']}(${versionProps['versionCode']})"
println(tip)
def writer = new FileWriter(versionPropsFile)
versionProps.store(writer, null)
writer.flush()
writer.close()
def tag = "v${versionProps['versionName']}"
cmdExecute("git pull")
cmdExecute("git add version.properties")
cmdExecute("git commit -m \"版本号升级为:$tag\"")
cmdExecute("git push origin")
cmdExecute("git tag $tag")
cmdExecute("git push origin $tag")
}
}
void cmdExecute(String cmd) {
println "\n执行$cmd"
println cmd.execute().text
}