commit db2a7090428b8c3b0e60a743fc720fe3d0608513
parent 2917f1b6e50b30eba4d58ffabef7faa26e131157
Author: rhunk <101876869+rhunk@users.noreply.github.com>
Date:   Thu,  5 Oct 2023 00:01:12 +0200

build: update dependencies
- add "core" and "all" product flavor

Diffstat:
Mapp/build.gradle.kts | 65+++++++++++++++++++++++++++++++++++++++++++++++------------------
Mbuild.gradle.kts | 1+
Mcore/build.gradle.kts | 1-
Mgradle.properties | 2+-
Mgradle/libs.versions.toml | 52+++++++++++++++++++++++++++-------------------------
Mnative/build.gradle.kts | 5+++--
6 files changed, 79 insertions(+), 47 deletions(-)

diff --git a/app/build.gradle.kts b/app/build.gradle.kts @@ -15,7 +15,7 @@ android { } composeOptions { - kotlinCompilerExtensionVersion = "1.4.8" + kotlinCompilerExtensionVersion = "1.5.2" } defaultConfig { @@ -53,6 +53,11 @@ android { excludes += "META-INF/*.kotlin_module" } } + + create("core") { + dimension = "abi" + } + create("armv8") { ndk { abiFilters += "arm64-v8a" @@ -66,15 +71,25 @@ android { } dimension = "abi" } + + create("all") { + ndk { + abiFilters += listOf("arm64-v8a", "armeabi-v7a") + } + dimension = "abi" + } } properties["debug_flavor"]?.let { - android.productFlavors[it.toString()].setIsDefault(true) + android.productFlavors.find { it.name == it.toString()}?.setIsDefault(true) } applicationVariants.all { - outputs.map { it as BaseVariantOutputImpl }.forEach { variant -> - variant.outputFileName = "app-${rootProject.ext["appVersionName"]}-${variant.name}.apk" + outputs.map { it as BaseVariantOutputImpl }.forEach { outputVariant -> + outputVariant.outputFileName = when { + name.startsWith("core") -> "core.apk" + else -> "snapenhance_${rootProject.ext["appVersionName"]}-${outputVariant.name}.apk" + } } } @@ -88,30 +103,44 @@ android { } } +androidComponents { + onVariants(selector().withFlavor("abi", "core")) { + it.packaging.jniLibs.apply { + pickFirsts.set(listOf("**/lib${rootProject.ext["nativeName"]}.so")) + excludes.set(listOf("**/*.so")) + } + } +} + dependencies { + fun fullImplementation(dependencyNotation: Any) { + compileOnly(dependencyNotation) + for (flavorName in listOf("armv8", "armv7", "all")) { + dependencies.add("${flavorName}Implementation", dependencyNotation) + } + } + implementation(project(":core")) - implementation(libs.androidx.material.icons.core) - implementation(libs.androidx.material.ripple) - implementation(libs.androidx.material.icons.extended) - implementation(libs.androidx.material3) - implementation(libs.androidx.activity.ktx) - implementation(libs.androidx.navigation.compose) implementation(libs.androidx.documentfile) implementation(libs.gson) - implementation(libs.coil.compose) - implementation(libs.coil.video) implementation(libs.ffmpeg.kit) implementation(libs.osmdroid.android) implementation(libs.rhino) - implementation(libs.bcprov.jdk18on) - - debugImplementation("androidx.compose.ui:ui-tooling:1.4.3") - implementation("androidx.compose.ui:ui-tooling-preview:1.4.3") - implementation(kotlin("reflect")) + implementation(libs.androidx.activity.ktx) + fullImplementation(libs.bcprov.jdk18on) + fullImplementation(libs.androidx.navigation.compose) + fullImplementation(libs.androidx.material.icons.core) + fullImplementation(libs.androidx.material.ripple) + fullImplementation(libs.androidx.material.icons.extended) + fullImplementation(libs.androidx.material3) + fullImplementation(libs.coil.compose) + fullImplementation(libs.coil.video) + fullImplementation(libs.androidx.ui.tooling.preview) + debugImplementation(libs.androidx.ui.tooling) } afterEvaluate { - properties["debug_assemble_task"]?.let { tasks.named(it.toString()) }?.orNull?.doLast { + properties["debug_assemble_task"]?.let { tasks.findByName(it.toString()) }?.doLast { runCatching { val apkDebugFile = android.applicationVariants.find { it.buildType.name == "debug" && it.flavorName == properties["debug_flavor"] }?.outputs?.first()?.outputFile ?: return@doLast exec { diff --git a/build.gradle.kts b/build.gradle.kts @@ -8,5 +8,6 @@ plugins { rootProject.ext.set("appVersionName", "2.0.0") rootProject.ext.set("appVersionCode", 10) rootProject.ext.set("applicationId", "me.rhunk.snapenhance") +rootProject.ext.set("nativeName", java.security.SecureRandom().nextLong(1000000000, 99999999999).toString(16)) true // Needed to make the Suppress annotation work for the plugins block \ No newline at end of file diff --git a/core/build.gradle.kts b/core/build.gradle.kts @@ -34,7 +34,6 @@ tasks.register("getVersion") { dependencies { compileOnly(files("libs/LSPosed-api-1.0-SNAPSHOT.jar")) implementation(libs.coroutines) - implementation(libs.kotlin.reflect) implementation(libs.recyclerview) implementation(libs.gson) implementation(libs.okhttp) diff --git a/gradle.properties b/gradle.properties @@ -1,4 +1,4 @@ -org.gradle.jvmargs=-Xmx4096m -Dfile.encoding=UTF-8 +org.gradle.jvmargs=-Xmx6G -Xms6G -Dfile.encoding=UTF-8 android.useAndroidX=true kotlin.code.style=official android.nonTransitiveRClass=true diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml @@ -1,47 +1,49 @@ [versions] -agp = "8.1.1" -bcprov-jdk18on = "1.76" -coil-compose = "2.4.0" -junit = "4.13.2" -kotlin = "1.8.22" +agp = "8.1.2" +kotlin = "1.9.0" kotlinx-coroutines-android = "1.7.3" -kotlin-reflect = "1.9.0" -material-icons-core = "1.5.0" -material-icons-extended = "1.6.0-alpha04" -navigation-compose = "2.7.1" + +activity-ktx = "1.8.0" +androidx-documentfile = "1.1.0-alpha01" +material-icons-core = "1.5.3" +material-icons-extended = "1.6.0-alpha07" +coil-compose = "2.4.0" +navigation-compose = "2.7.4" +osmdroid-android = "6.1.16" recyclerview = "1.3.1" + +bcprov-jdk18on = "1.76" +dexlib2 = "2.5.2" +ffmpeg-kit = "5.1.LTS" # DO NOT UPDATE FFMPEG-KIT TO "5.1" it breaks stuff :3 gson = "2.10.1" -# DO NOT UPDATE FFMPEG-KIT TO "5.1" it breaks stuff :3 -ffmpeg-kit = "5.1.LTS" -osmdroid-android = "6.1.16" +junit = "4.13.2" +material3 = "1.1.2" okhttp = "5.0.0-alpha.11" -dexlib2 = "2.5.2" -androidx-documentfile = "1.1.0-alpha01" -activity-ktx = "1.7.2" -material3 = "1.1.1" rhino = "1.7.14" +ui-tooling-preview = "1.5.3" [libraries] +androidx-activity-ktx = { group = "androidx.activity", name = "activity-ktx", version.ref = "activity-ktx" } +androidx-documentfile = { group = "androidx.documentfile", name = "documentfile", version.ref = "androidx-documentfile" } +androidx-material3 = { group = "androidx.compose.material3", name = "material3", version.ref = "material3" } androidx-material-icons-core = { module = "androidx.compose.material:material-icons-core", version.ref = "material-icons-core" } androidx-material-icons-extended = { module = "androidx.compose.material:material-icons-extended", version.ref = "material-icons-extended" } androidx-material-ripple = { module = "androidx.compose.material:material-ripple", version.ref = "material-icons-core" } androidx-navigation-compose = { module = "androidx.navigation:navigation-compose", version.ref = "navigation-compose" } +androidx-ui-tooling = { module = "androidx.compose.ui:ui-tooling", version.ref = "ui-tooling-preview" } +androidx-ui-tooling-preview = { module = "androidx.compose.ui:ui-tooling-preview", version.ref = "ui-tooling-preview" } bcprov-jdk18on = { module = "org.bouncycastle:bcprov-jdk18on", version.ref = "bcprov-jdk18on" } coil-compose = { module = "io.coil-kt:coil-compose", version.ref = "coil-compose" } coil-video = { module = "io.coil-kt:coil-video", version.ref = "coil-compose" } coroutines = { group = "org.jetbrains.kotlinx", name = "kotlinx-coroutines-android", version.ref = "kotlinx-coroutines-android" } -junit = { module = "junit:junit", version.ref = "junit" } -kotlin-reflect = { group = "org.jetbrains.kotlin", name = "kotlin-reflect", version.ref = "kotlin-reflect" } -recyclerview = { group = "androidx.recyclerview", name = "recyclerview", version.ref = "recyclerview" } -gson = { group = "com.google.code.gson", name = "gson", version.ref = "gson" } +dexlib2 = { group = "org.smali", name = "dexlib2", version.ref = "dexlib2" } ffmpeg-kit = { group = "com.arthenica", name = "ffmpeg-kit-full-gpl", version.ref = "ffmpeg-kit" } -osmdroid-android = { group = "org.osmdroid", name = "osmdroid-android", version.ref = "osmdroid-android" } +gson = { group = "com.google.code.gson", name = "gson", version.ref = "gson" } +junit = { module = "junit:junit", version.ref = "junit" } okhttp = { group = "com.squareup.okhttp3", name = "okhttp", version.ref = "okhttp" } -dexlib2 = { group = "org.smali", name = "dexlib2", version.ref = "dexlib2" } -androidx-documentfile = { group = "androidx.documentfile", name = "documentfile", version.ref = "androidx-documentfile" } -androidx-activity-ktx = { group = "androidx.activity", name = "activity-ktx", version.ref = "activity-ktx" } -androidx-material3 = { group = "androidx.compose.material3", name = "material3", version.ref = "material3" } +osmdroid-android = { group = "org.osmdroid", name = "osmdroid-android", version.ref = "osmdroid-android" } +recyclerview = { group = "androidx.recyclerview", name = "recyclerview", version.ref = "recyclerview" } rhino = { module = "org.mozilla:rhino", version.ref = "rhino" } diff --git a/native/build.gradle.kts b/native/build.gradle.kts @@ -3,7 +3,7 @@ plugins { alias(libs.plugins.kotlinAndroid) } -val nativeName = System.nanoTime().toString(16) +val nativeName = rootProject.ext.get("nativeName") android { namespace = rootProject.ext["applicationId"].toString() + ".nativelib" @@ -29,7 +29,8 @@ android { } ndk { //noinspection ChromeOsAbiSupport - abiFilters += listOf("arm64-v8a", "armeabi-v7a") + abiFilters += properties["custom_abi_filters"]?.toString()?.split(",") + ?: listOf("arm64-v8a", "armeabi-v7a") } } }