diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 802b78384..2bdd544dc 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -8,7 +8,7 @@ on: workflow_dispatch: jobs: - check: + build: runs-on: ubuntu-latest steps: - name: Checkout @@ -27,7 +27,6 @@ jobs: uses: Swatinem/rust-cache@v2 with: workspaces: "./app/src/main/rust" - shared-key: ${{ runner.os }} - name: Rustfmt Check working-directory: ./app/src/main/rust @@ -40,158 +39,54 @@ jobs: - name: Setup Gradle uses: gradle/actions/setup-gradle@v3 with: - cache-read-only: true + cache-encryption-key: ${{ secrets.GradleEncryptionKey }} + gradle-home-cache-cleanup: true - name: Spotless Check run: ./gradlew spotlessCheck - default: - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v4 - - - name: Setup Java - uses: actions/setup-java@v4 - with: - distribution: temurin - java-version: 21 - - - name: Install Rust Toolchain - run: rustup update && rustup target add armv7-linux-androideabi aarch64-linux-android i686-linux-android x86_64-linux-android && rustup component add rustfmt clippy - - - name: Rust Cache - uses: Swatinem/rust-cache@v2 - with: - workspaces: "./app/src/main/rust" - shared-key: ${{ runner.os }} - save-if: "false" - - - name: Setup Gradle - uses: gradle/actions/setup-gradle@v3 - with: - cache-encryption-key: ${{ secrets.GradleEncryptionKey }} - gradle-home-cache-cleanup: true - - name: CMake Cache uses: actions/cache@v4 with: path: app/.cxx - key: cmake-default-${{ hashFiles('gradle/libs.versions.toml', 'app/build.gradle.kts', 'app/src/main/cpp/CMakeLists.txt') }} - restore-keys: cmake-default- + key: cmake-${{ hashFiles('gradle/libs.versions.toml', 'app/build.gradle.kts', 'app/src/main/cpp/CMakeLists.txt') }} + restore-keys: cmake- - name: Build - run: ./gradlew assembleDefaultRelease + run: ./gradlew assembleRelease - name: Upload ARM64 uses: actions/upload-artifact@v4 with: - name: default-arm64-v8a-${{ github.sha }} - path: app/build/outputs/apk/default/release/app-default-arm64-v8a-release.apk + name: arm64-v8a-${{ github.sha }} + path: app/build/outputs/apk/release/app-arm64-v8a-release.apk - name: Upload x86_64 uses: actions/upload-artifact@v4 with: - name: default-x86_64-${{ github.sha }} - path: app/build/outputs/apk/default/release/app-default-x86_64-release.apk + name: x86_64-${{ github.sha }} + path: app/build/outputs/apk/release/app-x86_64-release.apk - name: Upload ARM32 uses: actions/upload-artifact@v4 with: - name: default-armeabi-v7a-${{ github.sha }} - path: app/build/outputs/apk/default/release/app-default-armeabi-v7a-release.apk + name: armeabi-v7a-${{ github.sha }} + path: app/build/outputs/apk/release/app-armeabi-v7a-release.apk - name: Upload x86 uses: actions/upload-artifact@v4 with: - name: default-x86-${{ github.sha }} - path: app/build/outputs/apk/default/release/app-default-x86-release.apk + name: x86-${{ github.sha }} + path: app/build/outputs/apk/release/app-x86-release.apk - name: Upload mapping uses: actions/upload-artifact@v4 with: - name: default-mapping-${{ github.sha }} - path: app/build/outputs/mapping/defaultRelease/mapping.txt + name: mapping-${{ github.sha }} + path: app/build/outputs/mapping/release/mapping.txt - name: Upload native debug symbols uses: actions/upload-artifact@v4 with: - name: default-native-debug-symbols-${{ github.sha }} - path: app/build/outputs/native-debug-symbols/defaultRelease/native-debug-symbols.zip - - marshmallow: - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v4 - - - name: Setup Java - uses: actions/setup-java@v4 - with: - distribution: temurin - java-version: 21 - - - name: Install Rust Toolchain - run: rustup update && rustup target add armv7-linux-androideabi aarch64-linux-android i686-linux-android x86_64-linux-android && rustup component add rustfmt clippy - - - name: Rust Cache - uses: Swatinem/rust-cache@v2 - with: - workspaces: "./app/src/main/rust" - shared-key: ${{ runner.os }} - save-if: "false" - - - name: Setup Gradle - uses: gradle/actions/setup-gradle@v3 - with: - cache-encryption-key: ${{ secrets.GradleEncryptionKey }} - gradle-home-cache-cleanup: true - - - name: CMake Cache - uses: actions/cache@v4 - with: - path: app/.cxx - key: cmake-marshmallow-${{ hashFiles('gradle/libs.versions.toml', 'app/build.gradle.kts', 'app/src/main/cpp/CMakeLists.txt') }} - restore-keys: cmake-marshmallow- - - - name: Install Build Tools - run: echo "y" | ${ANDROID_SDK_ROOT}/cmdline-tools/latest/bin/sdkmanager --install "build-tools;35.0.0-rc1" - - - name: Build - run: ./gradlew assembleMarshmallowRelease - - - name: Upload ARM64 - uses: actions/upload-artifact@v4 - with: - name: marshmallow-arm64-v8a-${{ github.sha }} - path: app/build/outputs/apk/marshmallow/release/app-marshmallow-arm64-v8a-release.apk - - - name: Upload x86_64 - uses: actions/upload-artifact@v4 - with: - name: marshmallow-x86_64-${{ github.sha }} - path: app/build/outputs/apk/marshmallow/release/app-marshmallow-x86_64-release.apk - - - name: Upload ARM32 - uses: actions/upload-artifact@v4 - with: - name: marshmallow-armeabi-v7a-${{ github.sha }} - path: app/build/outputs/apk/marshmallow/release/app-marshmallow-armeabi-v7a-release.apk - - - name: Upload x86 - uses: actions/upload-artifact@v4 - with: - name: marshmallow-x86-${{ github.sha }} - path: app/build/outputs/apk/marshmallow/release/app-marshmallow-x86-release.apk - - - name: Upload mapping - uses: actions/upload-artifact@v4 - with: - name: marshmallow-mapping-${{ github.sha }} - path: app/build/outputs/mapping/marshmallowRelease/mapping.txt - - - name: Upload native debug symbols - uses: actions/upload-artifact@v4 - with: - name: marshmallow-native-debug-symbols-${{ github.sha }} - path: app/build/outputs/native-debug-symbols/marshmallowRelease/native-debug-symbols.zip + name: native-debug-symbols-${{ github.sha }} + path: app/build/outputs/native-debug-symbols/release/native-debug-symbols.zip diff --git a/.github/workflows/releases.yml b/.github/workflows/releases.yml index 26d1df181..de0daec29 100644 --- a/.github/workflows/releases.yml +++ b/.github/workflows/releases.yml @@ -6,8 +6,7 @@ on: - "*" jobs: - linux: - name: Build + build: runs-on: ubuntu-latest steps: - name: Checkout @@ -30,11 +29,9 @@ jobs: - name: CMake Cache uses: actions/cache@v4 with: - path: | - app/.cxx - app/src/main/cpp/nettle/nettle - key: ${{ runner.os }}-cmake-${{ hashFiles('gradle/libs.versions.toml', 'app/build.gradle.kts', 'app/src/main/cpp/CMakeLists.txt') }} - restore-keys: ${{ runner.os }}-cmake- + path: app/.cxx + key: cmake-${{ hashFiles('gradle/libs.versions.toml', 'app/build.gradle.kts', 'app/src/main/cpp/CMakeLists.txt') }} + restore-keys: cmake- - name: Gradle Build uses: gradle/actions/setup-gradle@v3 @@ -43,39 +40,23 @@ jobs: - name: Rename Apks run: | - mv app/build/outputs/apk/default/release/app-default-universal-release.apk EhViewer-${{ github.ref_name }}-default-universal.apk - mv app/build/outputs/apk/default/release/app-default-arm64-v8a-release.apk EhViewer-${{ github.ref_name }}-default-arm64-v8a.apk - mv app/build/outputs/apk/default/release/app-default-x86_64-release.apk EhViewer-${{ github.ref_name }}-default-x86_64.apk - mv app/build/outputs/apk/default/release/app-default-x86-release.apk EhViewer-${{ github.ref_name }}-default-x86.apk - mv app/build/outputs/apk/default/release/app-default-armeabi-v7a-release.apk EhViewer-${{ github.ref_name }}-default-armeabi-v7a.apk - mv app/build/outputs/mapping/defaultRelease/mapping.txt EhViewer-${{ github.ref_name }}-default-mapping.txt - mv app/build/outputs/native-debug-symbols/defaultRelease/native-debug-symbols.zip EhViewer-${{ github.ref_name }}-default-native-debug-symbols.zip - - mv app/build/outputs/apk/marshmallow/release/app-marshmallow-universal-release.apk EhViewer-${{ github.ref_name }}-marshmallow-universal.apk - mv app/build/outputs/apk/marshmallow/release/app-marshmallow-arm64-v8a-release.apk EhViewer-${{ github.ref_name }}-marshmallow-arm64-v8a.apk - mv app/build/outputs/apk/marshmallow/release/app-marshmallow-x86_64-release.apk EhViewer-${{ github.ref_name }}-marshmallow-x86_64.apk - mv app/build/outputs/apk/marshmallow/release/app-marshmallow-x86-release.apk EhViewer-${{ github.ref_name }}-marshmallow-x86.apk - mv app/build/outputs/apk/marshmallow/release/app-marshmallow-armeabi-v7a-release.apk EhViewer-${{ github.ref_name }}-marshmallow-armeabi-v7a.apk - mv app/build/outputs/mapping/marshmallowRelease/mapping.txt EhViewer-${{ github.ref_name }}-marshmallow-mapping.txt - mv app/build/outputs/native-debug-symbols/marshmallowRelease/native-debug-symbols.zip EhViewer-${{ github.ref_name }}-marshmallow-native-debug-symbols.zip + mv app/build/outputs/apk/release/app-universal-release.apk EhViewer-${{ github.ref_name }}-universal.apk + mv app/build/outputs/apk/release/app-arm64-v8a-release.apk EhViewer-${{ github.ref_name }}-arm64-v8a.apk + mv app/build/outputs/apk/release/app-x86_64-release.apk EhViewer-${{ github.ref_name }}-x86_64.apk + mv app/build/outputs/apk/release/app-x86-release.apk EhViewer-${{ github.ref_name }}-x86.apk + mv app/build/outputs/apk/release/app-armeabi-v7a-release.apk EhViewer-${{ github.ref_name }}-armeabi-v7a.apk + mv app/build/outputs/mapping/release/mapping.txt EhViewer-${{ github.ref_name }}-mapping.txt + mv app/build/outputs/native-debug-symbols/release/native-debug-symbols.zip EhViewer-${{ github.ref_name }}-native-debug-symbols.zip - name: Releases uses: softprops/action-gh-release@v2 with: body: Bump Version files: | - EhViewer-${{ github.ref_name }}-default-universal.apk - EhViewer-${{ github.ref_name }}-default-arm64-v8a.apk - EhViewer-${{ github.ref_name }}-default-x86_64.apk - EhViewer-${{ github.ref_name }}-default-x86.apk - EhViewer-${{ github.ref_name }}-default-armeabi-v7a.apk - EhViewer-${{ github.ref_name }}-default-mapping.txt - EhViewer-${{ github.ref_name }}-default-native-debug-symbols.zip - - EhViewer-${{ github.ref_name }}-marshmallow-universal.apk - EhViewer-${{ github.ref_name }}-marshmallow-arm64-v8a.apk - EhViewer-${{ github.ref_name }}-marshmallow-x86_64.apk - EhViewer-${{ github.ref_name }}-marshmallow-x86.apk - EhViewer-${{ github.ref_name }}-marshmallow-armeabi-v7a.apk - EhViewer-${{ github.ref_name }}-marshmallow-mapping.txt - EhViewer-${{ github.ref_name }}-marshmallow-native-debug-symbols.zip + EhViewer-${{ github.ref_name }}-universal.apk + EhViewer-${{ github.ref_name }}-arm64-v8a.apk + EhViewer-${{ github.ref_name }}-x86_64.apk + EhViewer-${{ github.ref_name }}-x86.apk + EhViewer-${{ github.ref_name }}-armeabi-v7a.apk + EhViewer-${{ github.ref_name }}-mapping.txt + EhViewer-${{ github.ref_name }}-native-debug-symbols.zip diff --git a/README.md b/README.md index 3b377ea0d..ad75d6e2e 100644 --- a/README.md +++ b/README.md @@ -66,13 +66,6 @@ and [Dynamic Color](https://m3.material.io/styles/color/dynamic-color/overview) # Download -| Flavor | Feature | -|-------------|-----------------------------------| -| Default | Android 9+, full support | -| Marshmallow | Android 6.0-8.1, limited support* | - -\* May not support some archives - Get it on GitHub diff --git a/app/build.gradle.kts b/app/build.gradle.kts index 2b9074c65..e0bdf1d7b 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -60,7 +60,7 @@ android { defaultConfig { applicationId = "moe.tarsin.ehviewer" - minSdk = 28 + minSdk = 23 targetSdk = 34 versionCode = 180051 versionName = "1.12.0" @@ -81,7 +81,6 @@ android { "nb-rNO", ), ) - buildConfigField("String", "RAW_VERSION_NAME", "\"$versionName$versionNameSuffix\"") buildConfigField("String", "COMMIT_SHA", "\"$commitSha\"") buildConfigField("String", "REPO_NAME", "\"$repoName\"") ndk { @@ -89,26 +88,16 @@ android { } } - flavorDimensions += "api" - - productFlavors { - create("default") - create("marshmallow") { - minSdk = 23 - applicationIdSuffix = ".m" - versionNameSuffix = "-M" - compileOptions { - isCoreLibraryDesugaringEnabled = true - } - } - } - externalNativeBuild { cmake { path = File("src/main/cpp/CMakeLists.txt") } } + compileOptions { + isCoreLibraryDesugaringEnabled = true + } + kotlinOptions { freeCompilerArgs = listOf( // https://kotlinlang.org/docs/compiler-reference.html#progressive @@ -143,6 +132,9 @@ android { } packaging { + dex { + useLegacyPackaging = false + } resources { excludes += "/META-INF/**" excludes += "/kotlin/**" diff --git a/app/proguard-rules.pro b/app/proguard-rules.pro index bb0768de0..fa406b20d 100644 --- a/app/proguard-rules.pro +++ b/app/proguard-rules.pro @@ -16,5 +16,7 @@ -dontwarn org.conscrypt.Conscrypt +-keepattributes LineNumberTable + -allowaccessmodification -repackageclasses diff --git a/app/src/main/kotlin/com/hippo/ehviewer/updater/AppUpdater.kt b/app/src/main/kotlin/com/hippo/ehviewer/updater/AppUpdater.kt index 9fd7c6044..a1b2a82e8 100644 --- a/app/src/main/kotlin/com/hippo/ehviewer/updater/AppUpdater.kt +++ b/app/src/main/kotlin/com/hippo/ehviewer/updater/AppUpdater.kt @@ -54,7 +54,7 @@ object AppUpdater { return Release(shortSha, changelog, archiveUrl) } } else { - val curVersion = BuildConfig.RAW_VERSION_NAME + val curVersion = BuildConfig.VERSION_NAME val release = ghStatement(LATEST_RELEASE_URL).executeAndParseAs() val latestVersion = release.version val description = release.info diff --git a/app/src/main/kotlin/com/hippo/ehviewer/util/AppConfig.kt b/app/src/main/kotlin/com/hippo/ehviewer/util/AppConfig.kt index aaf079578..02ced6abc 100644 --- a/app/src/main/kotlin/com/hippo/ehviewer/util/AppConfig.kt +++ b/app/src/main/kotlin/com/hippo/ehviewer/util/AppConfig.kt @@ -15,6 +15,7 @@ */ package com.hippo.ehviewer.util +import android.os.Build import android.os.Environment import com.hippo.unifile.UniFile import com.hippo.unifile.asUniFile @@ -30,6 +31,10 @@ object AppConfig { private const val PARSE_ERROR = "parse_error" private const val CRASH = "crash" + val abi = Build.SUPPORTED_ABIS[0].takeIf { + it in setOf("arm64-v8a", "x86_64", "armeabi-v7a", "x86") + } ?: "universal" + private val externalAppDir: File? get() { if (Environment.MEDIA_MOUNTED == Environment.getExternalStorageState()) { diff --git a/app/src/main/kotlin/tachiyomi/data/release/GithubRelease.kt b/app/src/main/kotlin/tachiyomi/data/release/GithubRelease.kt index dca48e5ad..0c1929d2d 100644 --- a/app/src/main/kotlin/tachiyomi/data/release/GithubRelease.kt +++ b/app/src/main/kotlin/tachiyomi/data/release/GithubRelease.kt @@ -1,16 +1,9 @@ package tachiyomi.data.release -import android.os.Build -import com.hippo.ehviewer.BuildConfig +import com.hippo.ehviewer.util.AppConfig import kotlinx.serialization.SerialName import kotlinx.serialization.Serializable -private val abi = Build.SUPPORTED_ABIS[0].takeIf { - it in setOf("arm64-v8a", "x86_64", "armeabi-v7a", "x86") -} ?: "universal" - -fun matchVariant(name: String) = name.contains(BuildConfig.FLAVOR) && name.contains(abi) - /** * Contains information about the latest release from GitHub. */ @@ -22,7 +15,7 @@ data class GithubRelease( @SerialName("assets") val assets: List, ) { fun getDownloadLink(): String { - val asset = assets.find { matchVariant(it.downloadLink) } ?: assets[0] + val asset = assets.find { it.downloadLink.contains(AppConfig.abi) } ?: assets[0] return asset.downloadLink } } diff --git a/app/src/main/kotlin/tachiyomi/data/release/GithubWorkflow.kt b/app/src/main/kotlin/tachiyomi/data/release/GithubWorkflow.kt index 0c55c0d45..3e444c982 100644 --- a/app/src/main/kotlin/tachiyomi/data/release/GithubWorkflow.kt +++ b/app/src/main/kotlin/tachiyomi/data/release/GithubWorkflow.kt @@ -1,5 +1,6 @@ package tachiyomi.data.release +import com.hippo.ehviewer.util.AppConfig import kotlinx.serialization.SerialName import kotlinx.serialization.Serializable @@ -20,7 +21,7 @@ data class GithubArtifacts( @SerialName("artifacts") val artifacts: List, ) { fun getDownloadLink(): String { - return (artifacts.find { matchVariant(it.name) } ?: artifacts[0]).downloadLink + return (artifacts.find { it.name.contains(AppConfig.abi) } ?: artifacts[0]).downloadLink } } diff --git a/docs/README/zh-cn.md b/docs/README/zh-cn.md index 44429419b..a9bf7a112 100644 --- a/docs/README/zh-cn.md +++ b/docs/README/zh-cn.md @@ -65,13 +65,6 @@ # 下载 -| 变种 | 功能 | -|-------------|------------------------| -| Default | Android 9+, 完全支持 | -| Marshmallow | Android 6.0-8.1, 有限支持* | - -\* 可能不支持某些压缩包 - Get it on GitHub diff --git a/docs/README/zh-tw.md b/docs/README/zh-tw.md index a71208a31..537d1c70a 100644 --- a/docs/README/zh-tw.md +++ b/docs/README/zh-tw.md @@ -65,13 +65,6 @@ # 下載 -| 變種 | 功能 | -|-------------|------------------------| -| Default | Android 9+, 完全支援 | -| Marshmallow | Android 6.0-8.1, 有限支援* | - -\* 可能不支援某些壓縮包 - Get it on GitHub