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 3dcbfd038e9b..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" @@ -29,15 +31,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", + localPaths = arrayOf(RSDROID_AAR, RSDROID_ANDROID_AAR), + ) + addBackendArtifact( + configuration = "testImplementation", + useLocalBackend = useLocalBackend, + catalogAlias = "ankiBackend-testing", + localPaths = arrayOf(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", + localPaths = arrayOf(RSDROID_AAR, RSDROID_ANDROID_AAR), + ) + addBackendArtifact( + configuration = "testFixturesImplementation", + useLocalBackend = useLocalBackend, + catalogAlias = "ankiBackend-testing", + localPaths = arrayOf(RSDROID_TESTING_JAR), + ) dependencies.addProvider("testFixturesImplementation", libsLibrary("protobuf-kotlin-lite")) } } @@ -56,13 +78,14 @@ private fun Project.localBackendEnabled(): Boolean { private fun Project.addBackendArtifact( configuration: String, useLocalBackend: Boolean, - localPath: String, catalogAlias: 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