From 5306f8ddc41ab1fbbc4625fdd8f9c9dece687de3 Mon Sep 17 00:00:00 2001 From: justinzeus Date: Fri, 6 Nov 2026 15:36:20 +0100 Subject: [PATCH] Keep optimized versions compatible with upgrade and update parsing --- app/build.gradle.kts | 6 +++++- .../damontecres/wholphin/test/VersionCompareTests.kt | 7 +++++++ docker/README.md | 11 +++++++---- 3 files changed, 19 insertions(+), 5 deletions(-) diff --git a/app/build.gradle.kts b/app/build.gradle.kts index 7b4c8e02..98f03a3a 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -138,7 +138,6 @@ configure { initWith(getByName("release")) signingConfig = signingConfigs.getByName("debug") applicationIdSuffix = ".opt" - versionNameSuffix = "-opt" matchingFallbacks += "release" } } @@ -240,6 +239,11 @@ androidComponents { "Wholphin-${variant.flavorName}-${variant.buildType}-${output.versionName.get()}-${output.versionCode.get()}$abi.apk" output.outputFileName = outputFileName } + if (variant.name == "defaultOptimized") { + tasks.withType().configureEach { + systemProperty("wolfskin.optimizedVersionName", variant.outputs.first().versionName.get()) + } + } if (variant.name == "defaultDebug") { val packagedApks = variant.artifacts.get(SingleArtifact.APK) val artifactLoader = variant.artifacts.getBuiltArtifactsLoader() diff --git a/app/src/test/java/com/github/damontecres/wholphin/test/VersionCompareTests.kt b/app/src/test/java/com/github/damontecres/wholphin/test/VersionCompareTests.kt index e7e63acd..fdd45e6a 100644 --- a/app/src/test/java/com/github/damontecres/wholphin/test/VersionCompareTests.kt +++ b/app/src/test/java/com/github/damontecres/wholphin/test/VersionCompareTests.kt @@ -1,5 +1,6 @@ package com.github.damontecres.wholphin.test +import com.github.damontecres.wholphin.BuildConfig import com.github.damontecres.wholphin.util.Version import org.junit.Assert import org.junit.Test @@ -18,6 +19,12 @@ class VersionCompareTests { val V_0_1_1_5 = Version.fromString("v0.1.1-5-gabc1234") } + @Test + fun optimizedVersionRemainsCompatibleWithUpgradeAndUpdateChecks() { + val optimizedVersion = Version.fromString(requireNotNull(System.getProperty("wolfskin.optimizedVersionName"))) + Assert.assertEquals(Version.fromString(BuildConfig.VERSION_NAME), optimizedVersion) + } + @Test fun testIsAtLeast() { Assert.assertTrue(V_0_2_0.isAtLeast(V_0_2_0)) diff --git a/docker/README.md b/docker/README.md index aa6e8bde..f014cc90 100644 --- a/docker/README.md +++ b/docker/README.md @@ -32,8 +32,9 @@ task without changing upstream's test configuration. The `optimized` build type inherits `release`: R8 optimization/minification, resource shrinking, non-debuggable code, dependency consumer keep rules and dependency baseline profiles. It changes only signing (the Android debug key), -package (`org.justinvisser.wolfskin.tv.opt`), launcher label (`Wolfskin (Opt)`) -and version-name suffix (`-opt`). The launcher icon/banner are unchanged. +package (`org.justinvisser.wolfskin.tv.opt`) and launcher label (`Wolfskin (Opt)`). +The launcher icon/banner and release-compatible version name are unchanged: +the shared upgrade/updater parser rejects extra suffixes such as `-opt`. `make apk` remains the clean, release-key-signed production build; neither its signing flow nor the existing debug build changes. @@ -98,8 +99,10 @@ consumer rules rather than adding blanket keeps. JVM tests do not prove minified Hilt/Room/serialization/JNI runtime safety; exercise sign-in, real Conductarr reads, artwork, database reopen and each player on the comparison box. `help --task :app:testDefaultOptimizedUnitTest` confirms that this non-debug -variant has no JVM unit-test task, just like release. Build logic is checked -through actual APK assembly and static artifact inspection, not mock unit tests. +variant has no JVM unit-test task, just like release. The existing debug JVM +`VersionCompareTests` receives the actual optimized version name from the variant +API and checks it with the same `Version.fromString` used by upgrade/update handling. +Build logic is otherwise checked through actual APK assembly and static inspection. ## Upstream v1.1.0 integration