Skip to content

Export only the modules on the runtime classpath - #771

Open
piercifani wants to merge 2 commits into
mainfrom
fix/export-skip-skipunit-aar
Open

piercifani wants to merge 2 commits into
mainfrom
fix/export-skip-skipunit-aar

Conversation

@piercifani

@piercifani piercifani commented Nov 30, 2026 •

Copy link
Copy Markdown
Contributor

Problem

In library mode, skip export copies the AAR of every module in the generated Gradle project. That includes test-only modules such as SkipUnit, which skipstone wires only as testImplementation / androidTestImplementation (see SkipstoneCommand.swift), so no exported module needs it at runtime.

Exported AARs carry no dependency metadata. So a consumer that adds every exported AAR to its app gets SkipUnit in release builds without SkipUnit's own dependencies (JUnit, androidx.test, and since SkipUnit 1.8.2 TestParameterInjector). Because the default ProGuard rules keep skip.**, R8 then fails with missing classes, for example:

Missing class com.google.testing.junit.testparameterinjector.TestParameterValue (referenced from: java.util.List skip.unit.SkipTestArgumentsProvider.provideValues(...))

Before 1.8.2, the same problem showed up as missing JUnit classes, which consumers had to silence with -dontwarn.

Change

For each variant, ask Gradle for the exported module's <variant>RuntimeClasspath (gradle -q :Module:dependencies --configuration debugRuntimeClasspath). Then copy only the AARs of that module and the project modules it resolves.

This needs no module names in the export: what counts as test-only is decided once, by the dependencies skipstone generates. App-mode export is unaffected because it builds the APK through Gradle project dependencies. The extra Gradle call takes about 0.6s per variant with the Gradle daemon already running.

Validation

Ran skip init --transpiled-model for a library that depends on SkipFoundation, then skip export (debug and release):

  • With released skip 1.9.20: DemoLib, SkipFoundation, SkipLib, and SkipUnit AARs.
  • With this branch: DemoLib, SkipFoundation, and SkipLib AARs, for both variants.
  • None of the remaining AARs' class files reference skip/unit/.

Related: skiptools/skip-unit#29 and #770 take a different approach, moving the parameterized-test runner into Android test fixtures. This change removes the need for that on the export path.

🤖 Generated with Claude Code

piercifani and others added 2 commits November 30, 2026 14:47
skipstone wires SkipUnit as testImplementation/androidTestImplementation, so no
exported module depends on it at runtime. Exporting it anyway put a test library
into consumers' release builds without its dependencies (JUnit, androidx.test,
TestParameterInjector), which R8 reports as missing classes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…g SkipUnit

Ask Gradle for the exported module's <variant>RuntimeClasspath and copy only the
AARs of that module and the project modules it resolves. Test-only modules such
as SkipUnit, which skipstone wires as testImplementation/androidTestImplementation,
are left out without naming them.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@piercifani piercifani changed the title Do not export the test-only SkipUnit AAR Export only the modules on the runtime classpath Nov 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant