Просмотр исходного кода

更新Gradle脚本 (#3796)

使用version catalog
更新kotlin 1.9.23 ksp 1.0.19
ag2s20150909 2 лет назад
Родитель
Сommit
324a3dd851

+ 2 - 0
.idea/.gitignore

@@ -12,3 +12,5 @@
 /modules/
 /modules/
 /libraries/
 /libraries/
 /*.xml
 /*.xml
+# GitHub Copilot persisted chat sessions
+/copilot/chatSessions

+ 81 - 73
app/build.gradle

@@ -1,10 +1,17 @@
 plugins {
 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"
+//    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"
+
+    alias libs.plugins.android.application
+    alias libs.plugins.kotlin.android
+    alias libs.plugins.kotlin.parcelize
+    alias libs.plugins.room
+    alias libs.plugins.ksp
+    alias libs.plugins.google.services
 }
 }
 apply from: 'download.gradle'
 apply from: 'download.gradle'
 
 
@@ -102,11 +109,16 @@ android {
         }
         }
     }
     }
 
 
+
+    room {
+        schemaDirectory "$projectDir/schemas"
+    }
     // 设定Room的KSP参数
     // 设定Room的KSP参数
     ksp {
     ksp {
         arg("room.incremental", "true")
         arg("room.incremental", "true")
         arg("room.expandProjection", "true")
         arg("room.expandProjection", "true")
-        arg("room.schemaLocation", "$projectDir/schemas")
+        arg("room.generateKotlin", "false")
+        //arg("room.schemaLocation", "$projectDir/schemas")
 
 
     }
     }
 
 
@@ -136,133 +148,129 @@ android {
 }
 }
 
 
 dependencies {
 dependencies {
-    compileOnly "com.android.tools.build:gradle:$agp_version"
+    //compileOnly "com.android.tools.build:gradle:$agp_version"
     //noinspection GradleDependency,GradlePackageUpdate
     //noinspection GradleDependency,GradlePackageUpdate
-    coreLibraryDesugaring('com.android.tools:desugar_jdk_libs_nio:2.0.4')
-    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')
+    //coreLibraryDesugaring('com.android.tools:desugar_jdk_libs_nio:2.0.4')
+    coreLibraryDesugaring(libs.desugar)
+    testImplementation(libs.junit)
+    androidTestImplementation(libs.bundles.androidTest)
     //kotlin
     //kotlin
     //noinspection GradleDependency,DifferentStdlibGradleVersion
     //noinspection GradleDependency,DifferentStdlibGradleVersion
-    implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version")
+    implementation(libs.kotlin.stdlib)
     //Kotlin反射
     //Kotlin反射
     //noinspection GradleDependency,DifferentStdlibGradleVersion
     //noinspection GradleDependency,DifferentStdlibGradleVersion
-    implementation("org.jetbrains.kotlin:kotlin-reflect:$kotlin_version")
+    implementation(libs.kotlin.reflect)
+
+
     //协程
     //协程
-    def coroutines_version = '1.7.3'
-    implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutines_version")
-    implementation("org.jetbrains.kotlinx:kotlinx-coroutines-android:$coroutines_version")
+    //def coroutines_version = '1.7.3'
+    implementation(libs.bundles.coroutines)
+
 
 
     //图像处理库Toolkit
     //图像处理库Toolkit
-    implementation('com.github.android:renderscript-intrinsics-replacement-toolkit:b6363490c3')
+    implementation(libs.renderscript.intrinsics.replacement.toolkit)
 
 
     //androidX
     //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.9.0')
+    implementation(libs.core.ktx)
+    implementation(libs.appcompat.appcompat)
+    implementation(libs.activity.ktx)
+    implementation(libs.fragment.ktx)
+    implementation(libs.preference.ktx)
+    implementation(libs.androidx.constraintlayout)
+    implementation(libs.androidx.swiperefreshlayout)
+    implementation(libs.androidx.viewpager2)
+    implementation(libs.androidx.webkit)
 
 
     //google
     //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')
+    implementation(libs.material)
+    implementation(libs.flexbox)
+    implementation(libs.gson)
 
 
     //lifecycle
     //lifecycle
-    def lifecycle_version = '2.7.0'
-    implementation("androidx.lifecycle:lifecycle-common-java8:$lifecycle_version")
-    implementation("androidx.lifecycle:lifecycle-service:$lifecycle_version")
+    implementation(libs.lifecycle.common.java8)
+    implementation(libs.lifecycle.service)
 
 
     //media
     //media
-    implementation("androidx.media:media:1.7.0")
+    implementation(libs.media.media)
     // For media playback using ExoPlayer
     // For media playback using ExoPlayer
-    implementation "androidx.media3:media3-exoplayer:$media3_version"
+    implementation(libs.media3.exoplayer)
     // For loading data using the OkHttp network stack
     // For loading data using the OkHttp network stack
-    implementation "androidx.media3:media3-datasource-okhttp:$media3_version"
+    implementation(libs.media3.datasource.okhttp)
     // For exposing and controlling media sessions
     // For exposing and controlling media sessions
     //implementation "androidx.media3:media3-session:$media3_version"
     //implementation "androidx.media3:media3-session:$media3_version"
 
 
     //Splitties
     //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")
+    implementation(libs.splitties.appctx)
+    implementation(libs.splitties.systemservices)
+    implementation(libs.splitties.views)
 
 
     //room sql语句不高亮解决方法https://issuetracker.google.com/issues/234612964#comment6
     //room sql语句不高亮解决方法https://issuetracker.google.com/issues/234612964#comment6
-    implementation("androidx.room:room-runtime:$room_version")
-    implementation("androidx.room:room-ktx:$room_version")
+    implementation(libs.room.runtime)
+    implementation(libs.room.ktx)
     //kapt("androidx.room:room-compiler:$room_version")
     //kapt("androidx.room:room-compiler:$room_version")
-    ksp("androidx.room:room-compiler:$room_version")
-    androidTestImplementation("androidx.room:room-testing:$room_version")
+    ksp(libs.room.compiler)
+    androidTestImplementation(libs.room.testing)
 
 
     //liveEventBus
     //liveEventBus
-    implementation('com.github.michaellee123:LiveEventBus:1.8.14')
+    implementation(libs.liveeventbus)
 
 
     //规则相关
     //规则相关
-    implementation('org.jsoup:jsoup:1.16.2')
-    implementation('com.jayway.jsonpath:json-path:2.9.0')
-    implementation('cn.wanghaomiao:JsoupXpath:2.5.3')
+    implementation(libs.jsoup)
+    implementation(libs.json.path)
+    implementation(libs.jsoupxpath)
     implementation(project(path: ':modules:book'))
     implementation(project(path: ':modules:book'))
 
 
     //JS rhino
     //JS rhino
     implementation(project(path: ':modules:rhino1.7.3'))
     implementation(project(path: ':modules:rhino1.7.3'))
 
 
     //网络
     //网络
-    implementation('com.squareup.okhttp3:okhttp:4.12.0')
+    implementation(libs.okhttp)
     implementation(fileTree(dir: 'cronetlib', include: ['*.jar', '*.aar']))
     implementation(fileTree(dir: 'cronetlib', include: ['*.jar', '*.aar']))
-    implementation 'com.google.protobuf:protobuf-javalite:3.25.3'
+    implementation(libs.protobuf.javalite)
 
 
     //Glide
     //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")
+    implementation(libs.glide.glide)
+    ksp(libs.glide.ksp)
 
 
     //Svg
     //Svg
-    implementation("com.caverock:androidsvg-aar:1.4")
+    implementation(libs.androidsvg)
     //Glide svg plugin
     //Glide svg plugin
-    implementation("com.github.qoqa:glide-svg:4.0.2")
+    implementation(libs.glide.svg)
 
 
     //webServer
     //webServer
-    def nanoHttpdVersion = "2.3.1"
-    implementation("org.nanohttpd:nanohttpd:$nanoHttpdVersion")
-    implementation("org.nanohttpd:nanohttpd-websocket:$nanoHttpdVersion")
+    implementation(libs.nanohttpd.nanohttpd)
+    implementation(libs.nanohttpd.websocket)
 
 
     //二维码
     //二维码
     //noinspection GradleDependency
     //noinspection GradleDependency
-    implementation('com.github.jenly1314:zxing-lite:3.0.1')
+    implementation(libs.zxing.lite)
 
 
     //颜色选择
     //颜色选择
-    implementation('com.jaredrummler:colorpicker:1.1.0')
+    implementation(libs.colorpicker)
 
 
     //压缩解压
     //压缩解压
-    implementation 'me.zhanghai.android.libarchive:library:1.0.3'
+    implementation libs.libarchive
 
 
     //apache
     //apache
-    implementation('org.apache.commons:commons-text:1.11.0')
+    implementation(libs.commons.text)
 
 
     //MarkDown
     //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(libs.markwon.core)
+    implementation(libs.markwon.image.glide)
+    implementation(libs.markwon.ext.tables)
+    implementation(libs.markwon.html)
 
 
     //转换繁体
     //转换繁体
-    implementation('com.github.liuyueyi.quick-chinese-transfer:quick-transfer-core:0.2.13')
+    implementation(libs.quick.chinese.transfer.core)
 
 
     //加解密类库,有些书源使用
     //加解密类库,有些书源使用
     //noinspection GradleDependency,GradlePackageUpdate
     //noinspection GradleDependency,GradlePackageUpdate
-    implementation('cn.hutool:hutool-crypto:5.8.22')
+    implementation(libs.hutool.crypto)
 
 
     //firebase, 崩溃统计和性能统计
     //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.1'
+    implementation platform(libs.firebase.bom)
+    implementation libs.firebase.analytics
+    implementation libs.firebase.perf
 
 
     //LeakCanary, 内存泄露检测
     //LeakCanary, 内存泄露检测
     //debugImplementation('com.squareup.leakcanary:leakcanary-android:2.7')
     //debugImplementation('com.squareup.leakcanary:leakcanary-android:2.7')

+ 11 - 44
app/src/main/java/io/legado/app/help/exoplayer/ExoPlayerHelper.kt

@@ -5,7 +5,6 @@ import android.content.Context
 import android.net.Uri
 import android.net.Uri
 import androidx.media3.common.MediaItem
 import androidx.media3.common.MediaItem
 import androidx.media3.database.StandaloneDatabaseProvider
 import androidx.media3.database.StandaloneDatabaseProvider
-import androidx.media3.datasource.DataSource
 import androidx.media3.datasource.FileDataSource
 import androidx.media3.datasource.FileDataSource
 import androidx.media3.datasource.ResolvingDataSource
 import androidx.media3.datasource.ResolvingDataSource
 import androidx.media3.datasource.cache.Cache
 import androidx.media3.datasource.cache.Cache
@@ -16,9 +15,6 @@ import androidx.media3.datasource.cache.SimpleCache
 import androidx.media3.datasource.okhttp.OkHttpDataSource
 import androidx.media3.datasource.okhttp.OkHttpDataSource
 import androidx.media3.exoplayer.DefaultLoadControl
 import androidx.media3.exoplayer.DefaultLoadControl
 import androidx.media3.exoplayer.ExoPlayer
 import androidx.media3.exoplayer.ExoPlayer
-import androidx.media3.exoplayer.offline.DefaultDownloaderFactory
-import androidx.media3.exoplayer.offline.DownloadRequest
-import androidx.media3.exoplayer.offline.DownloaderFactory
 import androidx.media3.exoplayer.source.DefaultMediaSourceFactory
 import androidx.media3.exoplayer.source.DefaultMediaSourceFactory
 import com.google.gson.reflect.TypeToken
 import com.google.gson.reflect.TypeToken
 import io.legado.app.help.http.okHttpClient
 import io.legado.app.help.http.okHttpClient
@@ -26,7 +22,6 @@ import io.legado.app.utils.GSON
 import okhttp3.CacheControl
 import okhttp3.CacheControl
 import splitties.init.appCtx
 import splitties.init.appCtx
 import java.io.File
 import java.io.File
-import java.lang.reflect.Type
 import java.util.concurrent.TimeUnit
 import java.util.concurrent.TimeUnit
 
 
 
 
@@ -37,8 +32,7 @@ object ExoPlayerHelper {
     private const val SPLIT_TAG = "\uD83D\uDEA7"
     private const val SPLIT_TAG = "\uD83D\uDEA7"
 
 
     private val mapType by lazy {
     private val mapType by lazy {
-        val type: Type = object : TypeToken<Map<String?, String?>?>() {}.type
-        type
+        object : TypeToken<Map<String, String>>() {}.type
     }
     }
 
 
     fun createMediaItem(url: String, headers: Map<String, String>): MediaItem {
     fun createMediaItem(url: String, headers: Map<String, String>): MediaItem {
@@ -62,34 +56,7 @@ object ExoPlayerHelper {
         ).build()
         ).build()
     }
     }
 
 
-    /**
-     * 预下载
-     * @param uri 音频资源uri
-     * @param defaultRequestProperties 请求头
-     * @param progressCallBack 下载进度回调
-     */
-    fun preDownload(
-        uri: Uri,
-        defaultRequestProperties: Map<String, String>,
-        progressCallBack: (contentLength: Long, bytesDownloaded: Long, percentDownloaded: Float) -> Unit = { _: Long, _: Long, _: Float -> }
-    ) {
-        val request = DownloadRequest.Builder(uri.toString(), uri).build()
-        cacheDataSourceFactory.setDefaultRequestProperties(defaultRequestProperties)
-        okHttpClient.dispatcher.executorService.submit {
-            downloaderFactory.createDownloader(request)
-                .download { contentLength, bytesDownloaded, percentDownloaded ->
-                    progressCallBack(contentLength, bytesDownloaded, percentDownloaded)
-
-                }
-
-        }
 
 
-    }
-
-
-    private val downloaderFactory: DownloaderFactory by lazy {
-        DefaultDownloaderFactory(cacheDataSourceFactory, okHttpClient.dispatcher.executorService)
-    }
 
 
 
 
     private val resolvingDataSource: ResolvingDataSource.Factory by lazy {
     private val resolvingDataSource: ResolvingDataSource.Factory by lazy {
@@ -102,7 +69,7 @@ object ExoPlayerHelper {
                 res = res.withUri(Uri.parse(url))
                 res = res.withUri(Uri.parse(url))
                 try {
                 try {
                     val headers: Map<String, String> = GSON.fromJson(urls[1], mapType)
                     val headers: Map<String, String> = GSON.fromJson(urls[1], mapType)
-                    res = res.withAdditionalHeaders(headers)
+                    okhttpDataFactory.setDefaultRequestProperties(headers)
                 } catch (_: Exception) {
                 } catch (_: Exception) {
                 }
                 }
             }
             }
@@ -161,14 +128,14 @@ object ExoPlayerHelper {
      * @param headers
      * @param headers
      * @return
      * @return
      */
      */
-    private fun CacheDataSource.Factory.setDefaultRequestProperties(headers: Map<String, String> = mapOf()): CacheDataSource.Factory {
-        val declaredField = this.javaClass.getDeclaredField("upstreamDataSourceFactory")
-        declaredField.isAccessible = true
-        val df = declaredField[this] as DataSource.Factory
-        if (df is OkHttpDataSource.Factory) {
-            df.setDefaultRequestProperties(headers)
-        }
-        return this
-    }
+//    private fun CacheDataSource.Factory.setDefaultRequestProperties(headers: Map<String, String> = mapOf()): CacheDataSource.Factory {
+//        val declaredField = this.javaClass.getDeclaredField("upstreamDataSourceFactory")
+//        declaredField.isAccessible = true
+//        val df = declaredField[this] as DataSource.Factory
+//        if (df is OkHttpDataSource.Factory) {
+//            df.setDefaultRequestProperties(headers)
+//        }
+//        return this
+//    }
 
 
 }
 }

+ 1 - 0
app/src/main/java/io/legado/app/utils/UrlUtil.kt

@@ -155,6 +155,7 @@ object UrlUtil {
         val suffix = CustomUrl(str).getUrl()
         val suffix = CustomUrl(str).getUrl()
             .substringAfterLast(".", "")
             .substringAfterLast(".", "")
             .substringBefore("?")
             .substringBefore("?")
+            .substringBefore("/")
         //检查截取的后缀字符是否合法 [a-zA-Z0-9]
         //检查截取的后缀字符是否合法 [a-zA-Z0-9]
         return if (suffix.length > 5 || !suffix.matches(fileSuffixRegex)) {
         return if (suffix.length > 5 || !suffix.matches(fileSuffixRegex)) {
             AppLog.put("Cannot find legal suffix:\n target: $str\n suffix: $suffix")
             AppLog.put("Cannot find legal suffix:\n target: $str\n suffix: $suffix")

+ 22 - 12
build.gradle

@@ -4,22 +4,32 @@ buildscript {
     ext{
     ext{
         compile_sdk_version = 34
         compile_sdk_version = 34
         build_tool_version = '34.0.0'
         build_tool_version = '34.0.0'
-        kotlin_version = '1.9.22'
-        ksp_version = "1.0.17"
-        agp_version = '8.2.2'
-        media3_version = "1.2.1"
-        splitties_version = '3.0.0'
-        room_version = '2.6.1'
+//        kotlin_version = '1.9.22'
+//        ksp_version = "1.0.17"
+//        agp_version = '8.2.2'
+//        media3_version = "1.2.1"
+//        splitties_version = '3.0.0'
+//        room_version = '2.6.1'
     }
     }
 }
 }
 
 
 plugins {
 plugins {
-    id 'com.android.application' version "$agp_version" apply false
-    id 'com.android.library' version "$agp_version" apply false
-    id 'org.jetbrains.kotlin.android' version "$kotlin_version" apply false
-    id 'com.google.devtools.ksp' version "$kotlin_version-$ksp_version" apply false
-    id "de.undercouch.download" version "5.5.0" apply false
-    id "com.google.gms.google-services" version "4.4.0" apply false
+    //id 'com.android.application' version "$agp_version" apply false
+    //id 'com.android.library' version "$agp_version" apply false
+    //id 'org.jetbrains.kotlin.android' version "$kotlin_version" apply false
+    //id 'com.google.devtools.ksp' version "$kotlin_version-$ksp_version" apply false
+    //id "de.undercouch.download" version "5.5.0" apply false
+    //id "com.google.gms.google-services" version "4.4.0" apply false
+
+    alias libs.plugins.android.application apply false
+    alias libs.plugins.android.library apply false
+    alias libs.plugins.kotlin.android apply false
+    alias libs.plugins.kotlin.parcelize apply false
+    alias libs.plugins.ksp apply false
+    alias libs.plugins.google.services apply false
+    alias libs.plugins.room apply false
+
+    alias libs.plugins.download apply false
 }
 }
 
 
 tasks.register('clean', Delete) {
 tasks.register('clean', Delete) {

+ 181 - 0
gradle/libs.versions.toml

@@ -0,0 +1,181 @@
+[versions]
+
+kotlin = "1.9.23"
+ksp = "1.9.23-1.0.19"
+agp = "8.3.0"
+appcompat = "1.6.1"
+colorpicker = "1.1.0"
+commonsText = "1.11.0"
+constraintlayout = "2.1.4"
+core = "1.12.0"
+firebaseBom = "32.7.4"
+flexbox = "3.0.0"
+fragment = "1.6.2"
+
+#不要更新版本
+hutool = "5.8.22"
+
+libarchive = "1.0.3"
+lifecycle = "2.7.0"
+glide = "4.16.0"
+gson = "2.10.1"
+jsonPath = "2.9.0"
+jsoup = "1.16.2"
+jsoupxpath = "2.5.3"
+coroutines = "1.8.0"
+liveeventbus = "1.8.14"
+markwon = "4.6.2"
+material = "1.11.0"
+media = "1.7.0"
+media3 = "1.3.0"
+nanoHttpd = "2.3.1"
+okhttp = "4.12.0"
+preference = "1.2.1"
+protobufJavalite = "3.25.3"
+quickChineseTransfer = "0.2.13"
+room = "2.6.1"
+splitties = "3.0.0"
+
+activity = "1.8.2"
+kotlinxSerialization = "1.6.3"
+swiperefreshlayout = "1.1.0"
+viewpager2 = "1.0.0"
+webkit = "1.10.0"
+zxingLite = "3.0.1"
+
+
+[libraries]
+
+activity-activity = { module = "androidx.activity:activity", version.ref = "activity" }
+activity-compose = { module = "androidx.activity:activity-compose", version.ref = "activity" }
+activity-ktx = { module = "androidx.activity:activity-ktx", version.ref = "activity" }
+
+androidx-annotation = { group = "androidx.annotation", name = "annotation", version = "1.7.1" }
+#androidx-annotation-experimental = { group = "androidx.annotation", name = "annotation-experimental", version = "1.3.1" }
+
+appcompat-appcompat = { module = "androidx.appcompat:appcompat", version.ref = "appcompat" }
+androidx-constraintlayout = { module = "androidx.constraintlayout:constraintlayout", version.ref = "constraintlayout" }
+
+
+core-core = { module = "androidx.core:core", version.ref = "core" }
+core-ktx = { module = "androidx.core:core-ktx", version.ref = "core" }
+
+androidx-espresso-core = { module = "androidx.test.espresso:espresso-core", version = "3.5.1" }
+
+firebase-bom = { module = "com.google.firebase:firebase-bom", version.ref = "firebaseBom" }
+firebase-analytics = { module = "com.google.firebase:firebase-analytics" }
+firebase-perf = { module = "com.google.firebase:firebase-perf" }
+
+
+fragment-fragment = { module = "androidx.fragment:fragment", version.ref = "fragment" }
+fragment-ktx = { module = "androidx.fragment:fragment-ktx", version.ref = "fragment" }
+fragment-testing = { module = "androidx.fragment:fragment-testing", version.ref = "fragment" }
+
+androidx-junit = { module = "androidx.test.ext:junit", version = "1.1.5" }
+
+hutool-crypto = { module = "cn.hutool:hutool-crypto", version.ref = "hutool" }
+
+libarchive = { module = "me.zhanghai.android.libarchive:library", version.ref = "libarchive" }
+lifecycle-common-java8 = { module = "androidx.lifecycle:lifecycle-common-java8", version.ref = "lifecycle" }
+lifecycle-service = { module = "androidx.lifecycle:lifecycle-service", version.ref = "lifecycle" }
+
+media-media = { module = "androidx.media:media", version.ref = "media" }
+media3-datasource-okhttp = { module = "androidx.media3:media3-datasource-okhttp", version.ref = "media3" }
+media3-exoplayer = { module = "androidx.media3:media3-exoplayer", version.ref = "media3" }
+media3-session = { module = "androidx.media3:media3-session", version.ref = "media3" }
+
+markwon-core = { module = "io.noties.markwon:core", version.ref = "markwon" }
+markwon-image-glide = { module = "io.noties.markwon:image-glide", version.ref = "markwon" }
+markwon-ext-tables = { module = "io.noties.markwon:ext-tables", version.ref = "markwon" }
+markwon-html = { module = "io.noties.markwon:html", version.ref = "markwon" }
+
+
+nanohttpd-nanohttpd = { module = "org.nanohttpd:nanohttpd", version.ref = "nanoHttpd" }
+nanohttpd-websocket = { module = "org.nanohttpd:nanohttpd-websocket", version.ref = "nanoHttpd" }
+
+
+preference-preference = { module = "androidx.preference:preference", version.ref = "preference" }
+preference-ktx = { module = "androidx.preference:preference-ktx", version.ref = "preference" }
+
+okhttp = { module = "com.squareup.okhttp3:okhttp", version.ref = "okhttp" }
+protobuf-javalite = { module = "com.google.protobuf:protobuf-javalite", version.ref = "protobufJavalite" }
+
+quick-chinese-transfer-core = { module = "com.github.liuyueyi.quick-chinese-transfer:quick-transfer-core", version.ref = "quickChineseTransfer" }
+
+room-compiler = { module = "androidx.room:room-compiler", version.ref = "room" }
+room-ktx = { module = "androidx.room:room-ktx", version.ref = "room" }
+room-runtime = { module = "androidx.room:room-runtime", version.ref = "room" }
+room-testing = { module = "androidx.room:room-testing", version.ref = "room" }
+
+glide-glide = { module = "com.github.bumptech.glide:glide", version.ref = "glide" }
+glide-compiler = { module = "com.github.bumptech.glide:compiler", version.ref = "glide" }
+glide-compose = { module = "com.github.bumptech.glide:compose", version = "1.0.0-beta01" }
+glide-ksp = { module = "com.github.bumptech.glide:ksp", version.ref = "glide" }
+glide-avif = { module = "com.github.bumptech.glide:avif-integration", version.ref = "glide" }
+avif = { module = "org.aomedia.avif.android:avif", version = "1.0.1.262e11d" }
+glide-svg = { module = "com.github.qoqa:glide-svg", version = "4.0.2" }
+androidsvg = { module = "com.caverock:androidsvg-aar", version = "1.4" }
+
+splitties-appctx = { module = "com.louiscad.splitties:splitties-appctx", version.ref = "splitties" }
+splitties-activities = { module = "com.louiscad.splitties:splitties-activities", version.ref = "splitties" }
+splitties-systemservices = { module = "com.louiscad.splitties:splitties-systemservices", version.ref = "splitties" }
+splitties-views = { module = "com.louiscad.splitties:splitties-views", version.ref = "splitties" }
+
+androidx-runner = { module = "androidx.test:runner", version = "1.5.2" }
+androidx-swiperefreshlayout = { module = "androidx.swiperefreshlayout:swiperefreshlayout", version.ref = "swiperefreshlayout" }
+androidx-viewpager2 = { module = "androidx.viewpager2:viewpager2", version.ref = "viewpager2" }
+androidx-webkit = { module = "androidx.webkit:webkit", version.ref = "webkit" }
+colorpicker = { module = "com.jaredrummler:colorpicker", version.ref = "colorpicker" }
+commons-text = { module = "org.apache.commons:commons-text", version.ref = "commonsText" }
+desugar = { group = "com.android.tools", name = "desugar_jdk_libs_nio", version = "2.0.4" }
+
+flexbox = { module = "com.google.android.flexbox:flexbox", version.ref = "flexbox" }
+gson = { module = "com.google.code.gson:gson", version.ref = "gson" }
+json-path = { module = "com.jayway.jsonpath:json-path", version.ref = "jsonPath" }
+jsoup = { module = "org.jsoup:jsoup", version.ref = "jsoup" }
+jsoupxpath = { module = "cn.wanghaomiao:JsoupXpath", version.ref = "jsoupxpath" }
+junit = { module = "junit:junit", version = "4.13.2" }
+kotlinx-coroutines-android = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-android", version.ref = "coroutines" }
+kotlinx-coroutines-core = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-core", version.ref = "coroutines" }
+
+kotlin-stdlib = { module = "org.jetbrains.kotlin:kotlin-stdlib", version.ref = "kotlin" }
+kotlin-reflect = { module = "org.jetbrains.kotlin:kotlin-reflect", version.ref = "kotlin" }
+
+
+kotlinx-serialization-json = { module = "org.jetbrains.kotlinx:kotlinx-serialization-json", version.ref = "kotlinxSerialization" }
+kotlinx-serialization-protobuf = { module = "org.jetbrains.kotlinx:kotlinx-serialization-protobuf", version.ref = "kotlinxSerialization" }
+liveeventbus = { module = "com.github.michaellee123:LiveEventBus", version.ref = "liveeventbus" }
+material = { module = "com.google.android.material:material", version.ref = "material" }
+renderscript-intrinsics-replacement-toolkit = { module = "com.github.android:renderscript-intrinsics-replacement-toolkit", version = "b6363490c3" }
+zxing-lite = { module = "com.github.jenly1314:zxing-lite", version.ref = "zxingLite" }
+
+[bundles]
+coroutines = ["kotlinx-coroutines-core", "kotlinx-coroutines-android"]
+androidTest = ["androidx-espresso-core", "androidx-junit", "androidx-runner"]
+
+[plugins]
+
+android-application = { id = "com.android.application", version.ref = "agp" }
+android-library = { id = "com.android.library", version.ref = "agp" }
+android-test = { id = "com.android.test", version.ref = "agp" }
+
+androidx-benchmark = { id = "androidx.benchmark", version = "1.2.3" }
+
+kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" }
+kotlin-jvm = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" }
+kotlin-kapt = { id = "org.jetbrains.kotlin.kapt", version.ref = "kotlin" }
+kotlin-serialization = { id = "org.jetbrains.kotlin.plugin.serialization", version.ref = "kotlin" }
+kotlin-allopen = { id = "org.jetbrains.kotlin.plugin.allopen", version.ref = "kotlin" }
+kotlin-noarg = { id = "org.jetbrains.kotlin.plugin.noarg", version.ref = "kotlin" }
+kotlin-sam = { id = "org.jetbrains.kotlin.plugin.sam.with.receiver", version.ref = "kotlin" }
+kotlin-lombok = { id = "org.jetbrains.kotlin.plugin.lombok", version.ref = "kotlin" }
+kotlin-parcelize = { id = "org.jetbrains.kotlin.plugin.parcelize", version.ref = "kotlin" }
+
+google-services = { id = "com.google.gms.google-services", version = "4.4.1" }
+
+ksp = { id = "com.google.devtools.ksp", version.ref = "ksp" }
+room = { id = "androidx.room", version.ref = "room" }
+
+protobuf = { id = "com.google.protobuf", version = "0.9.4" }
+
+download = { id = "de.undercouch.download", version = "5.5.0" }

+ 2 - 2
gradle/wrapper/gradle-wrapper.properties

@@ -1,6 +1,6 @@
-#Tue Sep 12 01:36:42 CST 2023
+#Mon Mar 11 11:25:37 CST 2024
 distributionBase=GRADLE_USER_HOME
 distributionBase=GRADLE_USER_HOME
 distributionPath=wrapper/dists
 distributionPath=wrapper/dists
-distributionUrl=https\://services.gradle.org/distributions/gradle-8.3-bin.zip
+distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-bin.zip
 zipStoreBase=GRADLE_USER_HOME
 zipStoreBase=GRADLE_USER_HOME
 zipStorePath=wrapper/dists
 zipStorePath=wrapper/dists

+ 5 - 5
modules/book/build.gradle

@@ -1,6 +1,6 @@
 plugins {
 plugins {
-    id 'com.android.library'
-    id 'org.jetbrains.kotlin.android'
+    alias libs.plugins.android.library
+    alias libs.plugins.kotlin.android
 }
 }
 
 
 android {
 android {
@@ -13,7 +13,7 @@ android {
     }
     }
     defaultConfig {
     defaultConfig {
         minSdk 21
         minSdk 21
-        targetSdk 33
+        targetSdk 34
 
 
         testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
         testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
         consumerProguardFiles "consumer-rules.pro"
         consumerProguardFiles "consumer-rules.pro"
@@ -29,6 +29,6 @@ android {
 }
 }
 
 
 dependencies {
 dependencies {
-    compileOnly "com.android.tools.build:gradle:$agp_version"
-    implementation 'androidx.annotation:annotation:1.7.1'
+    implementation(libs.androidx.annotation)
+    //implementation 'androidx.annotation:annotation:1.7.1'
 }
 }

+ 13 - 7
modules/rhino1.7.3/build.gradle

@@ -1,6 +1,8 @@
 plugins {
 plugins {
-    id 'com.android.library'
-    id 'org.jetbrains.kotlin.android'
+    //d 'com.android.library'
+    //id 'org.jetbrains.kotlin.android'
+    alias libs.plugins.android.library
+    alias libs.plugins.kotlin.android
 }
 }
 
 
 android {
 android {
@@ -13,7 +15,7 @@ android {
     }
     }
     defaultConfig {
     defaultConfig {
         minSdk 21
         minSdk 21
-        targetSdk 33
+        targetSdk 34
 
 
         consumerProguardFiles "consumer-rules.pro"
         consumerProguardFiles "consumer-rules.pro"
     }
     }
@@ -25,14 +27,18 @@ android {
     lint {
     lint {
         checkDependencies true
         checkDependencies true
     }
     }
-    tasks.withType(JavaCompile) {
-        options.compilerArgs << "-Xlint:deprecation"
+    tasks.withType(JavaCompile).tap {
+        configureEach {
+            options.compilerArgs << "-Xlint:deprecation"
+        }
     }
     }
 }
 }
 
 
 dependencies {
 dependencies {
     api(fileTree(dir: 'lib', include: ['rhino-1.7.13-2.jar']))
     api(fileTree(dir: 'lib', include: ['rhino-1.7.13-2.jar']))
 
 
-    def coroutines_version = '1.7.3'
-    implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutines_version")
+    implementation(libs.kotlinx.coroutines.core)
+
+//    def coroutines_version = '1.7.3'
+//    implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutines_version")
 }
 }

+ 21 - 3
settings.gradle

@@ -1,8 +1,14 @@
 pluginManagement {
 pluginManagement {
     repositories {
     repositories {
+        google {
+            content {
+                includeGroupByRegex("com\\.android.*")
+                includeGroupByRegex("com\\.google.*")
+                includeGroupByRegex("androidx.*")
+            }
+        }
         //原仓库
         //原仓库
         gradlePluginPortal()
         gradlePluginPortal()
-        google()
         mavenCentral()
         mavenCentral()
         //镜像仓库,无法连接源仓库自行启用镜像仓库,不要提交修改
         //镜像仓库,无法连接源仓库自行启用镜像仓库,不要提交修改
         //maven { url "https://maven-central-asia.storage-download.googleapis.com/maven2/" }
         //maven { url "https://maven-central-asia.storage-download.googleapis.com/maven2/" }
@@ -17,9 +23,21 @@ dependencyResolutionManagement {
     repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
     repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
     repositories {
     repositories {
         //原仓库
         //原仓库
-        google()
+        google {
+            content {
+                includeGroupByRegex("com\\.android.*")
+                includeGroupByRegex("com\\.google.*")
+                includeGroupByRegex("androidx.*")
+            }
+        }
+        maven {
+            url 'https://jitpack.io'
+            content {
+                includeGroupByRegex("com\\.github.*")
+            }
+        }
         mavenCentral()
         mavenCentral()
-        maven { url 'https://jitpack.io' }
+
         //镜像仓库,无法连接源仓库自行启用镜像仓库,不要提交修改
         //镜像仓库,无法连接源仓库自行启用镜像仓库,不要提交修改
         //maven { url "https://maven-central-asia.storage-download.googleapis.com/maven2/" }
         //maven { url "https://maven-central-asia.storage-download.googleapis.com/maven2/" }
         //maven { url 'https://maven.aliyun.com/repository/google' }
         //maven { url 'https://maven.aliyun.com/repository/google' }