Skip to content

fix(build): resolve Robolectric SDK jars through Gradle - #2040

Merged
bmc08gt merged 1 commit into
code/cashfrom
fix/robolectric-sdk-jars
Nov 25, 2026
Merged

bmc08gt merged 1 commit into
code/cashfrom
fix/robolectric-sdk-jars

Conversation

@bmc08gt

@bmc08gt bmc08gt commented Nov 25, 2026

Copy link
Copy Markdown
Collaborator

Flipcash2's test job failed in every class pinned to @Config(sdk = [34]) (core, core-ui, features:balance), each in classMethod with AssertionError at MavenArtifactFetcher.java:129. Robolectric downloads the android-all jar for an SDK level from inside the test JVM, and that download failed. Classes on SDK 36 in the same tasks passed. Neither workflow caches ~/.m2, so every run downloads these jars again. The log doesn't show why the download fails on runners.

Gradle now resolves org.robolectric:android-all-instrumented for each SDK level the tests run on, and each Test task writes a robolectric-deps.properties that points Robolectric at those files. The jars land in the Gradle dependency cache, which CI already restores.

  • SDK levels: 36 (libs/test-utils' robolectric.properties), 32, 34 and 35 (@Config), and 24, Robolectric's default for flipcash.kmp.library modules, which don't have test-utils on the classpath.
  • Each SDK gets its own configuration. The jars are versions of one module, so a shared configuration resolved only the newest.
  • Jars are task inputs with PathSensitivity.NAME_ONLY, so where the Gradle cache sits on a machine doesn't change the cache key.
  • An SDK missing from the list fails with no artifacts found for DependencyJar{...} instead of downloading. A Robolectric bump that renames its jars has to update the pins in libs.versions.toml.
  • AndroidLibraryConventionPlugin, KmpAppLibraryConventionPlugin and KmpLibraryConventionPlugin call the helper. The app applies none of them, so it gets it through a new flipcash.robolectric.sdks plugin.
  • Dependabot ignores android-all-instrumented: each pin is the build one Robolectric release loads for one SDK level, and "newer" versions belong to other levels.

Removing the SDK 34 entry made the SDK 34 classes fail with no artifacts found, and removing SDK 35 did the same for the app's AndroidWiringTest, so tests read the mapping rather than ~/.m2.

Flipcash2's test job failed in every class pinned to @config(sdk = [34])
with AssertionError at MavenArtifactFetcher.java:129: Robolectric's
download of the android-all jar failed inside the test JVM. Neither
workflow caches ~/.m2, so each run downloads these jars again.

Gradle now resolves the android-all-instrumented jars for SDK 24, 32,
34, 35 and 36, and each Test task writes a robolectric-deps.properties
pointing Robolectric at them. The jars land in the Gradle dependency
cache that CI already restores. An SDK missing from the list fails with
"no artifacts found for DependencyJar{...}" instead of downloading.

The convention plugins call the helper; the app, which applies none of
them, gets it through a new flipcash.robolectric.sdks plugin. Dependabot
ignores the jars, since each pin is the build a Robolectric release
loads for one SDK level.
@bmc08gt
bmc08gt requested a review from jeffyanta as a code owner November 25, 2026 16:03
@bmc08gt bmc08gt self-assigned this Nov 25, 2026
@github-actions github-actions Bot added the area: build-system Gradle, convention plugins, build-logic label Nov 25, 2026
@bmc08gt bmc08gt added the type: fix Bug fix label Nov 25, 2026
@bmc08gt
bmc08gt merged commit b3888a8 into code/cash Nov 25, 2026
6 of 7 checks passed
bmc08gt added a commit that referenced this pull request Nov 26, 2026
…2051)

* fix(build): fetch Robolectric android-all jars from Google's Central mirror

The Flipcash2 Build and Deploy run after #2040 failed while storing the
configuration cache: Maven Central answered the android-all-instrumented
14-robolectric-10818077-i7 jar request with 429 Too Many Requests. The
setup-java Gradle cache restored, but it held no android-all jars, so the
run had to download them.

Gradle now looks up org.robolectric:android-all-instrumented on
maven-central.storage-download.googleapis.com before mavenCentral(). The
filter covers that one module, so every other dependency still resolves
from Central. All five pinned SDK jars and poms are on the mirror; a
missing one falls through to Central.

* fix(build): try Google's Central mirror before Central everywhere

The android-all filter left every other Central download exposed, and
CI kept hitting 429s on them. 2051's unit-test and OCP SDK jobs failed
resolving kotlin-gradle-plugin-annotations:2.4.21 for build-logic's
kotlin-dsl, which the plugin portal redirects to repo.maven.apache.org.
2052 failed on nativeruntime-dist-compat:1.0.20 and the android-all jar.

The mirror now sits ahead of mavenCentral() with no content filter in
both settings blocks, the root buildscript, build-logic and buildSrc.
build-logic and buildSrc gain a pluginManagement block because their
default is the plugin portal alone. An artifact the mirror lacks 404s
and falls through: portal-only plugins such as kotlin-dsl and
foojay-resolver do that now.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: build-system Gradle, convention plugins, build-logic type: fix Bug fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant