From ca70ca50b94f2844b2cbb548d9901256f75cb216 Mon Sep 17 00:00:00 2001 From: David Allison <62114487+david-allison@users.noreply.github.com> Date: Thu, 29 Oct 2026 17:47:24 +0000 Subject: [PATCH 1/2] refactor(backend): addBackendArtifact: add arg names Assisted-by: GPT-6.1 Terra medium --- .../ichi2/anki/gradle/BackendDependencies.kt | 30 +++++++++++++++---- 1 file changed, 25 insertions(+), 5 deletions(-) diff --git a/buildSrc/src/main/kotlin/com/ichi2/anki/gradle/BackendDependencies.kt b/buildSrc/src/main/kotlin/com/ichi2/anki/gradle/BackendDependencies.kt index 3dcbfd038e9b..9af77743d7b8 100644 --- a/buildSrc/src/main/kotlin/com/ichi2/anki/gradle/BackendDependencies.kt +++ b/buildSrc/src/main/kotlin/com/ichi2/anki/gradle/BackendDependencies.kt @@ -29,15 +29,35 @@ fun DependencyHandlerScope.addAnkiBackendDependencies(project: Project) { with(project) { val useLocalBackend = localBackendEnabled() - addBackendArtifact("implementation", useLocalBackend, RSDROID_AAR, "ankiBackend-backend") - addBackendArtifact("testImplementation", useLocalBackend, RSDROID_TESTING_JAR, "ankiBackend-testing") + addBackendArtifact( + configuration = "implementation", + useLocalBackend = useLocalBackend, + catalogAlias = "ankiBackend-backend", + localPath = RSDROID_AAR, + ) + addBackendArtifact( + configuration = "testImplementation", + useLocalBackend = useLocalBackend, + catalogAlias = "ankiBackend-testing", + localPath = RSDROID_TESTING_JAR, + ) // protobuf is required when loading from a file, regardless of the backend source dependencies.addProvider("implementation", libsLibrary("protobuf-kotlin-lite")) if (project.hasTestFixtures) { - addBackendArtifact("testFixturesImplementation", useLocalBackend, RSDROID_AAR, "ankiBackend-backend") - addBackendArtifact("testFixturesImplementation", useLocalBackend, RSDROID_TESTING_JAR, "ankiBackend-testing") + addBackendArtifact( + configuration = "testFixturesImplementation", + useLocalBackend = useLocalBackend, + catalogAlias = "ankiBackend-backend", + localPath = RSDROID_AAR, + ) + addBackendArtifact( + configuration = "testFixturesImplementation", + useLocalBackend = useLocalBackend, + catalogAlias = "ankiBackend-testing", + localPath = RSDROID_TESTING_JAR, + ) dependencies.addProvider("testFixturesImplementation", libsLibrary("protobuf-kotlin-lite")) } } @@ -56,8 +76,8 @@ private fun Project.localBackendEnabled(): Boolean { private fun Project.addBackendArtifact( configuration: String, useLocalBackend: Boolean, - localPath: String, catalogAlias: String, + localPath: String, ) { if (useLocalBackend) { // ../Anki-Android-Backend From ff87c7a450a1726033cedf7247cddd042b953a91 Mon Sep 17 00:00:00 2001 From: David Allison <62114487+david-allison@users.noreply.github.com> Date: Thu, 29 Oct 2026 16:09:13 +0000 Subject: [PATCH 2/2] build: bump backend to 0.1.75-anki26.09.3 Backend 0.1.75 moved the Android adapters, native libraries, and web assets into `rsdroid-android`. See https://redirect.github.com/ankidroid/Anki-Android-Backend/pull/767 Assisted-by: GPT-6-Astra max --- AnkiDroid/build.gradle.kts | 8 +++++++- .../anki/pages/PageWebViewClientAssetTest.kt | 2 +- .../ichi2/anki/gradle/BackendDependencies.kt | 17 ++++++++++------- gradle/libs.versions.toml | 2 +- 4 files changed, 19 insertions(+), 10 deletions(-) diff --git a/AnkiDroid/build.gradle.kts b/AnkiDroid/build.gradle.kts index 2fe03b88a849..bf70733c3fb8 100644 --- a/AnkiDroid/build.gradle.kts +++ b/AnkiDroid/build.gradle.kts @@ -797,7 +797,13 @@ dependencies { localProperties.load(project.rootProject.file("local.properties").inputStream()) } if (localProperties["local_backend"] == "true") { - implementation(files(rootProject.file("../Anki-Android-Backend/rsdroid/build/outputs/aar/rsdroid-release.aar"))) + // Local AARs have no Maven metadata, so both the API and Android artifacts are needed. + implementation( + files( + rootProject.file("../Anki-Android-Backend/rsdroid/build/outputs/aar/rsdroid-release.aar"), + rootProject.file("../Anki-Android-Backend/rsdroid-android/build/outputs/aar/rsdroid-android-release.aar"), + ), + ) testImplementation(files(rootProject.file("../Anki-Android-Backend/rsdroid-testing/build/libs/rsdroid-testing.jar"))) } else { implementation(libs.ankiBackend.backend) diff --git a/AnkiDroid/src/test/java/com/ichi2/anki/pages/PageWebViewClientAssetTest.kt b/AnkiDroid/src/test/java/com/ichi2/anki/pages/PageWebViewClientAssetTest.kt index 8deba70cd909..09c788f29867 100644 --- a/AnkiDroid/src/test/java/com/ichi2/anki/pages/PageWebViewClientAssetTest.kt +++ b/AnkiDroid/src/test/java/com/ichi2/anki/pages/PageWebViewClientAssetTest.kt @@ -25,7 +25,7 @@ class PageWebViewClientAssetTest : PageWebViewClientTestBase() { // Pin the entire declaration, including the bootstrap script hash, to require review on backend updates. // Backend updates are expected to change this hash and fail this test until the new declaration is reviewed. - val expectedPolicy = "script-src 'self' 'sha256-KgVk6DKxcC2FwNZfJ2E4h8ryzLcg38Fu9Id96eo1C5A='" + val expectedPolicy = "script-src 'self' 'sha256-ZtbRHoVXnThxdihCTDoE7B58+asHn6tYkHhb2gnJ6hA='" assertEquals( listOf(expectedPolicy), policies, diff --git a/buildSrc/src/main/kotlin/com/ichi2/anki/gradle/BackendDependencies.kt b/buildSrc/src/main/kotlin/com/ichi2/anki/gradle/BackendDependencies.kt index 9af77743d7b8..2703ae26e90d 100644 --- a/buildSrc/src/main/kotlin/com/ichi2/anki/gradle/BackendDependencies.kt +++ b/buildSrc/src/main/kotlin/com/ichi2/anki/gradle/BackendDependencies.kt @@ -7,13 +7,15 @@ import org.gradle.kotlin.dsl.DependencyHandlerScope import java.io.File import java.util.Properties -// The Anki backend (rsdroid) is consumed either as a locally-built artifact in +// The Anki backend (rsdroid) is consumed either as locally-built artifacts in // ../Anki-Android-Backend (when `local_backend=true` in local.properties) or as // the published library from the version catalog. // Paths within the `Anki-Android-Backend` checkout, which sits beside the repo root. private const val RSDROID_AAR = "rsdroid/build/outputs/aar/rsdroid-release.aar" +private const val RSDROID_ANDROID_AAR = + "rsdroid-android/build/outputs/aar/rsdroid-android-release.aar" private const val RSDROID_TESTING_JAR = "rsdroid-testing/build/libs/rsdroid-testing.jar" @@ -33,13 +35,13 @@ fun DependencyHandlerScope.addAnkiBackendDependencies(project: Project) { configuration = "implementation", useLocalBackend = useLocalBackend, catalogAlias = "ankiBackend-backend", - localPath = RSDROID_AAR, + localPaths = arrayOf(RSDROID_AAR, RSDROID_ANDROID_AAR), ) addBackendArtifact( configuration = "testImplementation", useLocalBackend = useLocalBackend, catalogAlias = "ankiBackend-testing", - localPath = RSDROID_TESTING_JAR, + localPaths = arrayOf(RSDROID_TESTING_JAR), ) // protobuf is required when loading from a file, regardless of the backend source @@ -50,13 +52,13 @@ fun DependencyHandlerScope.addAnkiBackendDependencies(project: Project) { configuration = "testFixturesImplementation", useLocalBackend = useLocalBackend, catalogAlias = "ankiBackend-backend", - localPath = RSDROID_AAR, + localPaths = arrayOf(RSDROID_AAR, RSDROID_ANDROID_AAR), ) addBackendArtifact( configuration = "testFixturesImplementation", useLocalBackend = useLocalBackend, catalogAlias = "ankiBackend-testing", - localPath = RSDROID_TESTING_JAR, + localPaths = arrayOf(RSDROID_TESTING_JAR), ) dependencies.addProvider("testFixturesImplementation", libsLibrary("protobuf-kotlin-lite")) } @@ -77,12 +79,13 @@ private fun Project.addBackendArtifact( configuration: String, useLocalBackend: Boolean, catalogAlias: String, - localPath: String, + vararg localPaths: String, ) { if (useLocalBackend) { // ../Anki-Android-Backend val backendCheckout = File(rootProject.projectDir.parentFile, "Anki-Android-Backend") - dependencies.add(configuration, files(File(backendCheckout, localPath))) + // Local AARs have no Maven metadata, so both the API and Android artifacts are needed. + dependencies.add(configuration, files(localPaths.map { File(backendCheckout, it) })) } else { dependencies.addProvider(configuration, libsLibrary(catalogAlias)) } diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index d1c4cd31d9fb..4069cfd4b770 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -73,7 +73,7 @@ androidxWebkit = "1.16.0" # https://developer.android.com/jetpack/androidx/releases/work androidxWork = "2.12.0" # https://github.com/ankidroid/Anki-Android-Backend/ -ankiBackend = '0.1.74-anki26.09.3' +ankiBackend = '0.1.75-anki26.09.3' # Also update expectedPolicy in PageWebViewClientAssetTest autoService = "1.1.1" autoServiceAnnotations = "1.1.1" # https://github.com/skydoves/ColorPickerView/releases