2022-05-23 23:45:37 +08:00
|
|
|
plugins {
|
|
|
|
id "com.android.application"
|
|
|
|
id 'org.jetbrains.kotlin.android'
|
|
|
|
id 'kotlin-parcelize'
|
2023-07-22 20:52:40 +08:00
|
|
|
//id 'kotlin-kapt'
|
|
|
|
id 'com.google.devtools.ksp'
|
2022-05-26 14:48:12 +08:00
|
|
|
//id "com.google.gms.google-services"
|
2022-05-23 23:45:37 +08:00
|
|
|
}
|
2022-01-03 23:59:44 +08:00
|
|
|
apply from: 'download.gradle'
|
|
|
|
|
|
|
|
static def releaseTime() {
|
|
|
|
return new Date().format("yy.MMddHH", TimeZone.getTimeZone("GMT+8"))
|
|
|
|
}
|
|
|
|
|
|
|
|
def name = "legado"
|
|
|
|
def version = "3." + releaseTime()
|
2022-04-25 14:43:22 +08:00
|
|
|
def gitCommits = Integer.parseInt('git rev-list HEAD --count'.execute().text.trim())
|
2022-01-03 23:59:44 +08:00
|
|
|
|
|
|
|
android {
|
2022-12-19 12:49:59 +08:00
|
|
|
compileSdk = compile_sdk_version
|
2022-05-23 23:45:37 +08:00
|
|
|
namespace 'io.legado.app'
|
2023-02-21 19:53:10 +08:00
|
|
|
kotlin {
|
|
|
|
jvmToolchain {
|
2023-04-15 23:36:24 +08:00
|
|
|
languageVersion.set(JavaLanguageVersion.of(17))
|
2023-02-21 19:53:10 +08:00
|
|
|
}
|
2022-01-03 23:59:44 +08:00
|
|
|
}
|
2022-05-23 23:45:37 +08:00
|
|
|
|
2022-01-03 23:59:44 +08:00
|
|
|
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
|
2022-03-07 20:23:08 +08:00
|
|
|
enableV3Signing = true
|
|
|
|
enableV4Signing = true
|
2022-01-03 23:59:44 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
defaultConfig {
|
|
|
|
applicationId "io.legado.app"
|
2023-09-20 11:21:28 +08:00
|
|
|
minSdk 21
|
2022-09-30 18:48:44 +08:00
|
|
|
targetSdk 33
|
2022-01-04 00:17:34 +08:00
|
|
|
versionCode 10000 + gitCommits
|
2022-01-03 23:59:44 +08:00
|
|
|
versionName version
|
|
|
|
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
|
|
|
project.ext.set("archivesBaseName", name + "_" + version)
|
|
|
|
|
2022-09-29 13:57:59 +08:00
|
|
|
buildConfigField "String", "Cronet_Version", "\"$CronetVersion\""
|
2022-11-09 23:23:04 +08:00
|
|
|
buildConfigField "String", "Cronet_Main_Version", "\"$CronetMainVersion\""
|
2022-09-29 13:57:59 +08:00
|
|
|
|
2022-01-03 23:59:44 +08:00
|
|
|
javaCompileOptions {
|
|
|
|
annotationProcessorOptions {
|
|
|
|
arguments += [
|
|
|
|
"room.incremental" : "true",
|
|
|
|
"room.expandProjection": "true",
|
|
|
|
"room.schemaLocation" : "$projectDir/schemas".toString()
|
|
|
|
]
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
buildFeatures {
|
2022-10-03 19:10:28 +08:00
|
|
|
buildConfig true
|
2022-01-03 23:59:44 +08:00
|
|
|
viewBinding true
|
|
|
|
}
|
|
|
|
buildTypes {
|
|
|
|
release {
|
|
|
|
if (project.hasProperty("RELEASE_STORE_FILE")) {
|
|
|
|
signingConfig signingConfigs.myConfig
|
|
|
|
}
|
|
|
|
applicationIdSuffix '.release'
|
|
|
|
|
2023-05-14 22:45:38 +08:00
|
|
|
minifyEnabled true
|
|
|
|
shrinkResources true
|
2022-01-03 23:59:44 +08:00
|
|
|
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'
|
|
|
|
}
|
2022-09-29 13:57:59 +08:00
|
|
|
}
|
2023-04-15 23:41:45 +08:00
|
|
|
//noinspection GrDeprecatedAPIUsage
|
2023-04-15 23:36:24 +08:00
|
|
|
flavorDimensions = ['mode']
|
2022-01-03 23:59:44 +08:00
|
|
|
productFlavors {
|
|
|
|
app {
|
|
|
|
dimension "mode"
|
2022-09-30 16:45:41 +08:00
|
|
|
manifestPlaceholders.put("APP_CHANNEL_VALUE", "app")
|
2022-01-03 23:59:44 +08:00
|
|
|
}
|
|
|
|
}
|
2023-03-07 13:51:23 +08:00
|
|
|
|
2023-07-30 16:16:58 +08:00
|
|
|
android.applicationVariants.configureEach { variant ->
|
|
|
|
variant.outputs.configureEach {
|
2023-04-15 23:36:24 +08:00
|
|
|
def flavor = variant.productFlavors[0].name
|
|
|
|
outputFileName = "${name}_${flavor}_${defaultConfig.versionName}.apk"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-07-22 20:52:40 +08:00
|
|
|
// 设定Room的KSP参数
|
|
|
|
ksp {
|
|
|
|
arg("room.incremental", "true")
|
|
|
|
arg("room.expandProjection", "true")
|
|
|
|
arg("room.schemaLocation", "$projectDir/schemas")
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2022-01-03 23:59:44 +08:00
|
|
|
compileOptions {
|
|
|
|
// Flag to enable support for the new language APIs
|
2023-03-29 22:00:40 +08:00
|
|
|
coreLibraryDesugaringEnabled true
|
2023-04-16 16:08:33 +08:00
|
|
|
// Sets Java compatibility
|
2023-04-15 23:36:24 +08:00
|
|
|
sourceCompatibility JavaVersion.VERSION_17
|
|
|
|
targetCompatibility JavaVersion.VERSION_17
|
2022-01-03 23:59:44 +08:00
|
|
|
}
|
2023-04-15 23:36:24 +08:00
|
|
|
packaging {
|
2023-03-11 08:18:47 +08:00
|
|
|
resources.excludes.add('META-INF/*')
|
2023-03-07 14:58:14 +08:00
|
|
|
}
|
2023-03-09 22:47:20 +08:00
|
|
|
|
2022-01-03 23:59:44 +08:00
|
|
|
sourceSets {
|
|
|
|
// Adds exported schema location as test app assets.
|
|
|
|
androidTest.assets.srcDirs += files("$projectDir/schemas".toString())
|
|
|
|
}
|
2022-05-24 00:40:48 +08:00
|
|
|
lint {
|
|
|
|
checkDependencies true
|
|
|
|
}
|
2023-07-30 16:16:58 +08:00
|
|
|
tasks.withType(JavaCompile).tap {
|
|
|
|
configureEach {
|
|
|
|
//options.compilerArgs << "-Xlint:unchecked"
|
|
|
|
}
|
2022-01-03 23:59:44 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
dependencies {
|
2022-09-29 13:57:59 +08:00
|
|
|
compileOnly "com.android.tools.build:gradle:$agp_version"
|
2023-03-29 22:00:40 +08:00
|
|
|
//noinspection GradleDependency,GradlePackageUpdate
|
2023-04-03 13:10:25 +08:00
|
|
|
coreLibraryDesugaring('com.android.tools:desugar_jdk_libs_nio:2.0.3')
|
2022-01-03 23:59:44 +08:00
|
|
|
testImplementation('junit:junit:4.13.2')
|
2023-01-04 20:20:04 +08:00
|
|
|
androidTestImplementation('androidx.test:runner:1.5.2')
|
2023-03-25 16:43:12 +08:00
|
|
|
androidTestImplementation('androidx.test.ext:junit:1.1.5')
|
2023-01-04 12:13:17 +08:00
|
|
|
androidTestImplementation('androidx.test.espresso:espresso-core:3.5.1')
|
2022-01-03 23:59:44 +08:00
|
|
|
//kotlin
|
2022-09-19 20:10:49 +08:00
|
|
|
//noinspection GradleDependency,DifferentStdlibGradleVersion
|
2022-01-03 23:59:44 +08:00
|
|
|
implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version")
|
|
|
|
//Kotlin反射
|
2022-09-19 20:10:49 +08:00
|
|
|
//noinspection GradleDependency,DifferentStdlibGradleVersion
|
2022-01-03 23:59:44 +08:00
|
|
|
implementation("org.jetbrains.kotlin:kotlin-reflect:$kotlin_version")
|
|
|
|
//协程
|
2023-07-31 13:00:59 +08:00
|
|
|
def coroutines_version = '1.7.3'
|
2022-01-03 23:59:44 +08:00
|
|
|
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutines_version")
|
|
|
|
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-android:$coroutines_version")
|
|
|
|
|
2022-05-24 21:00:42 +08:00
|
|
|
//图像处理库Toolkit
|
|
|
|
implementation('com.github.android:renderscript-intrinsics-replacement-toolkit:b6363490c3')
|
|
|
|
|
2022-01-03 23:59:44 +08:00
|
|
|
//androidX
|
2023-09-20 10:55:41 +08:00
|
|
|
implementation('androidx.core:core-ktx:1.12.0')
|
2023-02-09 12:11:48 +08:00
|
|
|
implementation('androidx.appcompat:appcompat:1.6.1')
|
2023-05-29 13:07:39 +08:00
|
|
|
implementation('androidx.activity:activity-ktx:1.7.2')
|
2023-07-30 16:16:58 +08:00
|
|
|
implementation('androidx.fragment:fragment-ktx:1.6.1')
|
2023-09-20 10:55:41 +08:00
|
|
|
implementation('androidx.preference:preference-ktx:1.2.1')
|
2022-05-26 09:52:27 +08:00
|
|
|
implementation('androidx.constraintlayout:constraintlayout:2.1.4')
|
2022-01-03 23:59:44 +08:00
|
|
|
implementation('androidx.swiperefreshlayout:swiperefreshlayout:1.1.0')
|
|
|
|
implementation('androidx.viewpager2:viewpager2:1.0.0')
|
2023-09-20 10:55:41 +08:00
|
|
|
implementation('androidx.webkit:webkit:1.8.0')
|
2022-03-12 23:43:47 +08:00
|
|
|
|
2022-04-11 17:16:15 +08:00
|
|
|
//google
|
2023-05-06 16:40:51 +08:00
|
|
|
implementation('com.google.android.material:material:1.9.0')
|
2022-01-03 23:59:44 +08:00
|
|
|
implementation('com.google.android.flexbox:flexbox:3.0.0')
|
2023-01-09 12:19:31 +08:00
|
|
|
implementation('com.google.code.gson:gson:2.10.1')
|
2022-01-03 23:59:44 +08:00
|
|
|
|
2022-03-12 22:23:29 +08:00
|
|
|
//lifecycle
|
2023-09-18 20:51:15 +08:00
|
|
|
def lifecycle_version = '2.6.2'
|
2022-03-12 22:23:29 +08:00
|
|
|
implementation("androidx.lifecycle:lifecycle-common-java8:$lifecycle_version")
|
2022-10-19 17:53:24 +08:00
|
|
|
implementation("androidx.lifecycle:lifecycle-service:$lifecycle_version")
|
2022-03-12 22:23:29 +08:00
|
|
|
|
2022-01-03 23:59:44 +08:00
|
|
|
//media
|
2022-04-22 14:16:47 +08:00
|
|
|
implementation("androidx.media:media:1.6.0")
|
2023-05-11 19:53:56 +08:00
|
|
|
// 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"
|
|
|
|
|
2022-01-03 23:59:44 +08:00
|
|
|
//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")
|
|
|
|
|
2023-02-19 20:44:56 +08:00
|
|
|
//room sql语句不高亮解决方法https://issuetracker.google.com/issues/234612964#comment6
|
2022-01-03 23:59:44 +08:00
|
|
|
implementation("androidx.room:room-runtime:$room_version")
|
|
|
|
implementation("androidx.room:room-ktx:$room_version")
|
2023-07-22 20:52:40 +08:00
|
|
|
//kapt("androidx.room:room-compiler:$room_version")
|
|
|
|
ksp("androidx.room:room-compiler:$room_version")
|
2022-09-17 12:01:26 +08:00
|
|
|
androidTestImplementation("androidx.room:room-testing:$room_version")
|
2022-01-03 23:59:44 +08:00
|
|
|
|
|
|
|
//liveEventBus
|
|
|
|
implementation('io.github.jeremyliao:live-event-bus-x:1.8.0')
|
|
|
|
|
|
|
|
//规则相关
|
2023-05-01 13:15:21 +08:00
|
|
|
implementation('org.jsoup:jsoup:1.16.1')
|
2023-03-27 13:01:11 +08:00
|
|
|
implementation('com.jayway.jsonpath:json-path:2.8.0')
|
2023-03-07 13:06:09 +08:00
|
|
|
implementation('cn.wanghaomiao:JsoupXpath:2.5.3')
|
2023-03-30 08:40:58 +08:00
|
|
|
implementation(project(path: ':modules:book'))
|
2022-01-03 23:59:44 +08:00
|
|
|
|
|
|
|
//JS rhino
|
2023-09-20 11:21:28 +08:00
|
|
|
implementation(project(path: ':modules:rhino1.7.3'))
|
2022-01-03 23:59:44 +08:00
|
|
|
|
|
|
|
//网络
|
2023-04-24 13:11:49 +08:00
|
|
|
implementation('com.squareup.okhttp3:okhttp:4.11.0')
|
2023-09-20 11:21:28 +08:00
|
|
|
implementation(fileTree(dir: 'cronetlib', include: ['*.jar', '*.aar']))
|
2023-09-24 18:19:42 +08:00
|
|
|
implementation 'com.google.protobuf:protobuf-javalite:3.24.3'
|
2022-01-03 23:59:44 +08:00
|
|
|
|
|
|
|
//Glide
|
2023-09-24 18:19:42 +08:00
|
|
|
def glideVersion = "4.16.0"
|
2022-02-09 19:51:12 +08:00
|
|
|
implementation("com.github.bumptech.glide:glide:$glideVersion")
|
2023-07-22 20:52:40 +08:00
|
|
|
//kapt("com.github.bumptech.glide:compiler:$glideVersion")
|
|
|
|
ksp("com.github.bumptech.glide:ksp:$glideVersion")
|
2022-01-03 23:59:44 +08:00
|
|
|
|
2022-10-08 19:35:39 +08:00
|
|
|
//Svg
|
|
|
|
implementation("com.caverock:androidsvg-aar:1.4")
|
|
|
|
//Glide svg plugin
|
|
|
|
implementation("com.github.qoqa:glide-svg:4.0.2")
|
|
|
|
|
2022-01-03 23:59:44 +08:00
|
|
|
//webServer
|
|
|
|
def nanoHttpdVersion = "2.3.1"
|
|
|
|
implementation("org.nanohttpd:nanohttpd:$nanoHttpdVersion")
|
|
|
|
implementation("org.nanohttpd:nanohttpd-websocket:$nanoHttpdVersion")
|
|
|
|
|
|
|
|
//二维码
|
2023-09-24 18:19:42 +08:00
|
|
|
//noinspection GradleDependency
|
2023-04-15 23:36:24 +08:00
|
|
|
implementation('com.github.jenly1314:zxing-lite:2.4.0')
|
2022-01-03 23:59:44 +08:00
|
|
|
|
|
|
|
//颜色选择
|
|
|
|
implementation('com.jaredrummler:colorpicker:1.1.0')
|
|
|
|
|
2023-09-14 16:28:40 +08:00
|
|
|
//压缩解压
|
|
|
|
implementation 'me.zhanghai.android.libarchive:library:1.0.1'
|
|
|
|
|
2022-01-03 23:59:44 +08:00
|
|
|
//apache
|
2022-09-29 12:31:05 +08:00
|
|
|
implementation('org.apache.commons:commons-text:1.10.0')
|
2022-01-03 23:59:44 +08:00
|
|
|
|
|
|
|
//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")
|
|
|
|
|
|
|
|
//转换繁体
|
2023-04-10 13:00:56 +08:00
|
|
|
implementation('com.github.liuyueyi.quick-chinese-transfer:quick-transfer-core:0.2.13')
|
2022-01-03 23:59:44 +08:00
|
|
|
|
2022-05-27 08:01:24 +08:00
|
|
|
//加解密类库,有些书源使用
|
2022-09-17 23:29:18 +08:00
|
|
|
//noinspection GradleDependency,GradlePackageUpdate
|
2023-07-31 13:01:29 +08:00
|
|
|
implementation('cn.hutool:hutool-crypto:5.8.21')
|
2022-01-11 20:41:37 +08:00
|
|
|
|
2022-05-27 08:01:24 +08:00
|
|
|
//firebase, 崩溃统计和性能统计, 会导致共存版本崩溃
|
|
|
|
//implementation platform('com.google.firebase:firebase-bom:30.0.1')
|
|
|
|
//implementation 'com.google.firebase:firebase-analytics-ktx:21.0.0'
|
|
|
|
//implementation 'com.google.firebase:firebase-perf-ktx:20.0.6'
|
2022-01-03 23:59:44 +08:00
|
|
|
|
2022-08-17 15:19:01 +08:00
|
|
|
//LeakCanary, 内存泄露检测
|
2022-02-26 23:08:13 +08:00
|
|
|
//debugImplementation('com.squareup.leakcanary:leakcanary-android:2.7')
|
2022-05-27 08:01:24 +08:00
|
|
|
|
|
|
|
//com.github.AmrDeveloper:CodeView代码编辑已集成到应用内
|
|
|
|
//epubLib集成到应用内
|
2022-01-03 23:59:44 +08:00
|
|
|
}
|