forked from gedoor/legado
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
272 lines (235 loc) · 9.66 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
plugins {
id "com.android.application"
id 'org.jetbrains.kotlin.android'
id 'kotlin-parcelize'
//id 'kotlin-kapt'
id 'com.google.devtools.ksp'
id "com.google.gms.google-services"
}
apply from: 'download.gradle'
static def releaseTime() {
return new Date().format("yy.MMddHH", TimeZone.getTimeZone("GMT+8"))
}
def name = "legado"
def version = "3." + releaseTime()
def gitCommits = Integer.parseInt('git rev-list HEAD --count'.execute().text.trim())
android {
compileSdk = compile_sdk_version
namespace 'io.legado.app'
kotlin {
jvmToolchain {
languageVersion.set(JavaLanguageVersion.of(17))
}
}
signingConfigs {
if (project.hasProperty("RELEASE_STORE_FILE")) {
myConfig {
storeFile file(RELEASE_STORE_FILE)
storePassword RELEASE_STORE_PASSWORD
keyAlias RELEASE_KEY_ALIAS
keyPassword RELEASE_KEY_PASSWORD
v1SigningEnabled true
v2SigningEnabled true
enableV3Signing = true
enableV4Signing = true
}
}
}
defaultConfig {
applicationId "io.legado.app"
minSdk 21
targetSdk 33
versionCode 10000 + gitCommits
versionName version
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
project.ext.set("archivesBaseName", name + "_" + version)
buildConfigField "String", "Cronet_Version", "\"$CronetVersion\""
buildConfigField "String", "Cronet_Main_Version", "\"$CronetMainVersion\""
javaCompileOptions {
annotationProcessorOptions {
arguments += [
"room.incremental" : "true",
"room.expandProjection": "true",
"room.schemaLocation" : "$projectDir/schemas".toString()
]
}
}
}
buildFeatures {
buildConfig true
viewBinding true
}
buildTypes {
release {
if (project.hasProperty("RELEASE_STORE_FILE")) {
signingConfig signingConfigs.myConfig
}
applicationIdSuffix '.release'
minifyEnabled true
shrinkResources true
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
debug {
if (project.hasProperty("RELEASE_STORE_FILE")) {
signingConfig signingConfigs.myConfig
}
applicationIdSuffix '.debug'
versionNameSuffix 'debug'
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
//noinspection GrDeprecatedAPIUsage
flavorDimensions = ['mode']
productFlavors {
app {
dimension "mode"
manifestPlaceholders.put("APP_CHANNEL_VALUE", "app")
}
}
android.applicationVariants.configureEach { variant ->
variant.outputs.configureEach {
def flavor = variant.productFlavors[0].name
outputFileName = "${name}_${flavor}_${defaultConfig.versionName}.apk"
}
}
// 设定Room的KSP参数
ksp {
arg("room.incremental", "true")
arg("room.expandProjection", "true")
arg("room.schemaLocation", "$projectDir/schemas")
}
compileOptions {
// Flag to enable support for the new language APIs
coreLibraryDesugaringEnabled true
// Sets Java compatibility
sourceCompatibility JavaVersion.VERSION_17
targetCompatibility JavaVersion.VERSION_17
}
packaging {
resources.excludes.add('META-INF/*')
}
sourceSets {
// Adds exported schema location as test app assets.
androidTest.assets.srcDirs += files("$projectDir/schemas".toString())
}
lint {
checkDependencies true
}
tasks.withType(JavaCompile).tap {
configureEach {
//options.compilerArgs << "-Xlint:unchecked"
}
}
}
dependencies {
compileOnly "com.android.tools.build:gradle:$agp_version"
//noinspection GradleDependency,GradlePackageUpdate
coreLibraryDesugaring('com.android.tools:desugar_jdk_libs_nio:2.0.3')
testImplementation('junit:junit:4.13.2')
androidTestImplementation('androidx.test:runner:1.5.2')
androidTestImplementation('androidx.test.ext:junit:1.1.5')
androidTestImplementation('androidx.test.espresso:espresso-core:3.5.1')
//kotlin
//noinspection GradleDependency,DifferentStdlibGradleVersion
implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version")
//Kotlin反射
//noinspection GradleDependency,DifferentStdlibGradleVersion
implementation("org.jetbrains.kotlin:kotlin-reflect:$kotlin_version")
//协程
def coroutines_version = '1.7.3'
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutines_version")
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-android:$coroutines_version")
//图像处理库Toolkit
implementation('com.github.android:renderscript-intrinsics-replacement-toolkit:b6363490c3')
//androidX
implementation('androidx.core:core-ktx:1.12.0')
implementation('androidx.appcompat:appcompat:1.6.1')
implementation('androidx.activity:activity-ktx:1.8.1')
implementation('androidx.fragment:fragment-ktx:1.6.2')
implementation('androidx.preference:preference-ktx:1.2.1')
implementation('androidx.constraintlayout:constraintlayout:2.1.4')
implementation('androidx.swiperefreshlayout:swiperefreshlayout:1.1.0')
implementation('androidx.viewpager2:viewpager2:1.0.0')
implementation('androidx.webkit:webkit:1.8.0')
//google
implementation('com.google.android.material:material:1.10.0')
implementation('com.google.android.flexbox:flexbox:3.0.0')
implementation('com.google.code.gson:gson:2.10.1')
//lifecycle
def lifecycle_version = '2.6.2'
implementation("androidx.lifecycle:lifecycle-common-java8:$lifecycle_version")
implementation("androidx.lifecycle:lifecycle-service:$lifecycle_version")
//media
implementation("androidx.media:media:1.6.0")
// For media playback using ExoPlayer
implementation "androidx.media3:media3-exoplayer:$media3_version"
// For loading data using the OkHttp network stack
implementation "androidx.media3:media3-datasource-okhttp:$media3_version"
// For exposing and controlling media sessions
//implementation "androidx.media3:media3-session:$media3_version"
//Splitties
implementation("com.louiscad.splitties:splitties-appctx:$splitties_version")
implementation("com.louiscad.splitties:splitties-systemservices:$splitties_version")
implementation("com.louiscad.splitties:splitties-views:$splitties_version")
//room sql语句不高亮解决方法https://issuetracker.google.com/issues/234612964#comment6
implementation("androidx.room:room-runtime:$room_version")
implementation("androidx.room:room-ktx:$room_version")
//kapt("androidx.room:room-compiler:$room_version")
ksp("androidx.room:room-compiler:$room_version")
androidTestImplementation("androidx.room:room-testing:$room_version")
//liveEventBus
implementation('io.github.jeremyliao:live-event-bus-x:1.8.0')
//规则相关
implementation('org.jsoup:jsoup:1.16.2')
implementation('com.jayway.jsonpath:json-path:2.8.0')
implementation('cn.wanghaomiao:JsoupXpath:2.5.3')
implementation(project(path: ':modules:book'))
//JS rhino
implementation(project(path: ':modules:rhino1.7.3'))
//网络
implementation('com.squareup.okhttp3:okhttp:4.11.0')
implementation(fileTree(dir: 'cronetlib', include: ['*.jar', '*.aar']))
implementation 'com.google.protobuf:protobuf-javalite:3.24.3'
//Glide
def glideVersion = "4.16.0"
implementation("com.github.bumptech.glide:glide:$glideVersion")
//kapt("com.github.bumptech.glide:compiler:$glideVersion")
ksp("com.github.bumptech.glide:ksp:$glideVersion")
//Svg
implementation("com.caverock:androidsvg-aar:1.4")
//Glide svg plugin
implementation("com.github.qoqa:glide-svg:4.0.2")
//webServer
def nanoHttpdVersion = "2.3.1"
implementation("org.nanohttpd:nanohttpd:$nanoHttpdVersion")
implementation("org.nanohttpd:nanohttpd-websocket:$nanoHttpdVersion")
//二维码
//noinspection GradleDependency
implementation('com.github.jenly1314:zxing-lite:3.0.1')
//颜色选择
implementation('com.jaredrummler:colorpicker:1.1.0')
//压缩解压
implementation 'me.zhanghai.android.libarchive:library:1.0.3'
//apache
implementation('org.apache.commons:commons-text:1.11.0')
//MarkDown
def markwonVersion = "4.6.2"
implementation("io.noties.markwon:core:$markwonVersion")
implementation("io.noties.markwon:image-glide:$markwonVersion")
implementation("io.noties.markwon:ext-tables:$markwonVersion")
implementation("io.noties.markwon:html:$markwonVersion")
//转换繁体
implementation('com.github.liuyueyi.quick-chinese-transfer:quick-transfer-core:0.2.13')
//加解密类库,有些书源使用
//noinspection GradleDependency,GradlePackageUpdate
implementation('cn.hutool:hutool-crypto:5.8.22')
//firebase, 崩溃统计和性能统计
implementation platform('com.google.firebase:firebase-bom:32.5.0')
implementation 'com.google.firebase:firebase-analytics:21.5.0'
implementation 'com.google.firebase:firebase-perf:20.5.0'
//LeakCanary, 内存泄露检测
//debugImplementation('com.squareup.leakcanary:leakcanary-android:2.7')
//com.github.AmrDeveloper:CodeView代码编辑已集成到应用内
//epubLib集成到应用内
}