From 07e18914e8c52a52cd024f74c9c460e5f3e01f6b Mon Sep 17 00:00:00 2001 From: ag2s20150909 Date: Mon, 11 Mar 2024 14:09:30 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0Gradle=E8=84=9A=E6=9C=AC=20(#?= =?UTF-8?q?3796)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 使用version catalog 更新kotlin 1.9.23 ksp 1.0.19 --- .idea/.gitignore | 2 + app/build.gradle | 154 ++++++++------- .../app/help/exoplayer/ExoPlayerHelper.kt | 55 ++---- .../main/java/io/legado/app/utils/UrlUtil.kt | 1 + build.gradle | 34 ++-- gradle/libs.versions.toml | 181 ++++++++++++++++++ gradle/wrapper/gradle-wrapper.properties | 4 +- modules/book/build.gradle | 10 +- modules/rhino1.7.3/build.gradle | 20 +- settings.gradle | 24 ++- 10 files changed, 339 insertions(+), 146 deletions(-) create mode 100644 gradle/libs.versions.toml diff --git a/.idea/.gitignore b/.idea/.gitignore index 3a9e1aca5..0e304a64f 100644 --- a/.idea/.gitignore +++ b/.idea/.gitignore @@ -12,3 +12,5 @@ /modules/ /libraries/ /*.xml +# GitHub Copilot persisted chat sessions +/copilot/chatSessions diff --git a/app/build.gradle b/app/build.gradle index 112035fcc..05020d495 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -1,10 +1,17 @@ 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' @@ -102,11 +109,16 @@ android { } } + + room { + schemaDirectory "$projectDir/schemas" + } // 设定Room的KSP参数 ksp { arg("room.incremental", "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 { - compileOnly "com.android.tools.build:gradle:$agp_version" + //compileOnly "com.android.tools.build:gradle:$agp_version" //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 //noinspection GradleDependency,DifferentStdlibGradleVersion - implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version") + implementation(libs.kotlin.stdlib) //Kotlin反射 //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 - implementation('com.github.android:renderscript-intrinsics-replacement-toolkit:b6363490c3') + implementation(libs.renderscript.intrinsics.replacement.toolkit) //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 - 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 - 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 - implementation("androidx.media:media:1.7.0") + implementation(libs.media.media) // For media playback using ExoPlayer - implementation "androidx.media3:media3-exoplayer:$media3_version" + implementation(libs.media3.exoplayer) // 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 //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") + implementation(libs.splitties.appctx) + implementation(libs.splitties.systemservices) + implementation(libs.splitties.views) //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") - ksp("androidx.room:room-compiler:$room_version") - androidTestImplementation("androidx.room:room-testing:$room_version") + ksp(libs.room.compiler) + androidTestImplementation(libs.room.testing) //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')) //JS rhino 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 'com.google.protobuf:protobuf-javalite:3.25.3' + implementation(libs.protobuf.javalite) //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 - implementation("com.caverock:androidsvg-aar:1.4") + implementation(libs.androidsvg) //Glide svg plugin - implementation("com.github.qoqa:glide-svg:4.0.2") + implementation(libs.glide.svg) //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 - 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 - implementation('org.apache.commons:commons-text:1.11.0') + implementation(libs.commons.text) //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 - implementation('cn.hutool:hutool-crypto:5.8.22') + implementation(libs.hutool.crypto) //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, 内存泄露检测 //debugImplementation('com.squareup.leakcanary:leakcanary-android:2.7') diff --git a/app/src/main/java/io/legado/app/help/exoplayer/ExoPlayerHelper.kt b/app/src/main/java/io/legado/app/help/exoplayer/ExoPlayerHelper.kt index 7a1a5bcc9..c4f6268a6 100644 --- a/app/src/main/java/io/legado/app/help/exoplayer/ExoPlayerHelper.kt +++ b/app/src/main/java/io/legado/app/help/exoplayer/ExoPlayerHelper.kt @@ -5,7 +5,6 @@ import android.content.Context import android.net.Uri import androidx.media3.common.MediaItem import androidx.media3.database.StandaloneDatabaseProvider -import androidx.media3.datasource.DataSource import androidx.media3.datasource.FileDataSource import androidx.media3.datasource.ResolvingDataSource 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.exoplayer.DefaultLoadControl 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 com.google.gson.reflect.TypeToken import io.legado.app.help.http.okHttpClient @@ -26,7 +22,6 @@ import io.legado.app.utils.GSON import okhttp3.CacheControl import splitties.init.appCtx import java.io.File -import java.lang.reflect.Type import java.util.concurrent.TimeUnit @@ -37,8 +32,7 @@ object ExoPlayerHelper { private const val SPLIT_TAG = "\uD83D\uDEA7" private val mapType by lazy { - val type: Type = object : TypeToken?>() {}.type - type + object : TypeToken>() {}.type } fun createMediaItem(url: String, headers: Map): MediaItem { @@ -62,34 +56,7 @@ object ExoPlayerHelper { ).build() } - /** - * 预下载 - * @param uri 音频资源uri - * @param defaultRequestProperties 请求头 - * @param progressCallBack 下载进度回调 - */ - fun preDownload( - uri: Uri, - defaultRequestProperties: Map, - 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 { @@ -102,7 +69,7 @@ object ExoPlayerHelper { res = res.withUri(Uri.parse(url)) try { val headers: Map = GSON.fromJson(urls[1], mapType) - res = res.withAdditionalHeaders(headers) + okhttpDataFactory.setDefaultRequestProperties(headers) } catch (_: Exception) { } } @@ -161,14 +128,14 @@ object ExoPlayerHelper { * @param headers * @return */ - private fun CacheDataSource.Factory.setDefaultRequestProperties(headers: Map = 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 = 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 +// } } \ No newline at end of file diff --git a/app/src/main/java/io/legado/app/utils/UrlUtil.kt b/app/src/main/java/io/legado/app/utils/UrlUtil.kt index 97d9b6c7d..54cad3fb7 100644 --- a/app/src/main/java/io/legado/app/utils/UrlUtil.kt +++ b/app/src/main/java/io/legado/app/utils/UrlUtil.kt @@ -155,6 +155,7 @@ object UrlUtil { val suffix = CustomUrl(str).getUrl() .substringAfterLast(".", "") .substringBefore("?") + .substringBefore("/") //检查截取的后缀字符是否合法 [a-zA-Z0-9] return if (suffix.length > 5 || !suffix.matches(fileSuffixRegex)) { AppLog.put("Cannot find legal suffix:\n target: $str\n suffix: $suffix") diff --git a/build.gradle b/build.gradle index ce45860d0..b9dd69223 100644 --- a/build.gradle +++ b/build.gradle @@ -4,22 +4,32 @@ buildscript { ext{ compile_sdk_version = 34 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 { - 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) { diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml new file mode 100644 index 000000000..550762864 --- /dev/null +++ b/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" } \ No newline at end of file diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 1c0c71b3a..25c48bceb 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/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 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 zipStorePath=wrapper/dists diff --git a/modules/book/build.gradle b/modules/book/build.gradle index 89fb2850f..6f2d95dc5 100644 --- a/modules/book/build.gradle +++ b/modules/book/build.gradle @@ -1,6 +1,6 @@ plugins { - id 'com.android.library' - id 'org.jetbrains.kotlin.android' + alias libs.plugins.android.library + alias libs.plugins.kotlin.android } android { @@ -13,7 +13,7 @@ android { } defaultConfig { minSdk 21 - targetSdk 33 + targetSdk 34 testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" consumerProguardFiles "consumer-rules.pro" @@ -29,6 +29,6 @@ android { } 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' } \ No newline at end of file diff --git a/modules/rhino1.7.3/build.gradle b/modules/rhino1.7.3/build.gradle index 3f48b6547..2a30a1545 100644 --- a/modules/rhino1.7.3/build.gradle +++ b/modules/rhino1.7.3/build.gradle @@ -1,6 +1,8 @@ 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 { @@ -13,7 +15,7 @@ android { } defaultConfig { minSdk 21 - targetSdk 33 + targetSdk 34 consumerProguardFiles "consumer-rules.pro" } @@ -25,14 +27,18 @@ android { lint { checkDependencies true } - tasks.withType(JavaCompile) { - options.compilerArgs << "-Xlint:deprecation" + tasks.withType(JavaCompile).tap { + configureEach { + options.compilerArgs << "-Xlint:deprecation" + } } } dependencies { 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") } \ No newline at end of file diff --git a/settings.gradle b/settings.gradle index cddd92de5..68253c064 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1,8 +1,14 @@ pluginManagement { repositories { + google { + content { + includeGroupByRegex("com\\.android.*") + includeGroupByRegex("com\\.google.*") + includeGroupByRegex("androidx.*") + } + } //原仓库 gradlePluginPortal() - google() mavenCentral() //镜像仓库,无法连接源仓库自行启用镜像仓库,不要提交修改 //maven { url "https://maven-central-asia.storage-download.googleapis.com/maven2/" } @@ -17,9 +23,21 @@ dependencyResolutionManagement { repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS) repositories { //原仓库 - google() + google { + content { + includeGroupByRegex("com\\.android.*") + includeGroupByRegex("com\\.google.*") + includeGroupByRegex("androidx.*") + } + } + maven { + url 'https://jitpack.io' + content { + includeGroupByRegex("com\\.github.*") + } + } mavenCentral() - maven { url 'https://jitpack.io' } + //镜像仓库,无法连接源仓库自行启用镜像仓库,不要提交修改 //maven { url "https://maven-central-asia.storage-download.googleapis.com/maven2/" } //maven { url 'https://maven.aliyun.com/repository/google' }