Skip to content

Support Android JVM test agents with lazy variant configuration - #419

Merged
ryandens merged 3 commits into
mainfrom
codex/fix-260-android-unit-tests
Oct 17, 2026
Merged

ryandens merged 3 commits into
mainfrom
codex/fix-260-android-unit-tests

Conversation

@ryandens

@ryandens ryandens commented Oct 17, 2026 •

Copy link
Copy Markdown
Owner

Closes #260.

Adds com.ryandens.javaagent-test-android in a separate android subproject, following the structure and configuration-avoidance guidance in #300. Android application and library modules can attach agents to their host-side JVM tests without applying the incompatible Java plugin.

Uses AGP’s public onVariants and lazy configureTestTask APIs, covering arbitrary flavors/build types and either plugin order. Each host test resolves versionless agents from its own runtime classpath, including BOM constraints and selected-version overrides. Shared javaagent declarations and testJavaagent option overrides use the existing resolver. Enablement stays lazy; disabled agents are not resolved, and project agent JARs retain their producing-task dependencies.

Validation: the full build passes with 40 tests on AGP 9.4.1 / Gradle 9.8.1; all nine Android regressions also pass on AGP 8.13.2 / Gradle 9.5.0. Coverage includes configuration-cache reuse, build-cache restoration, Isolated Projects, parallel execution, lazy help, and disabled/empty configurations. CI provisions the Android SDK and runs both compatibility suites on Linux and Windows; both platforms pass on the latest head. Fixtures use private, pre-created Android preference caches, and CI retains their reports. AGP is compile-only in the published module; generated publication metadata was checked.

@testlens-app

testlens-app Bot commented Oct 17, 2026

Copy link
Copy Markdown

🔎 No tests executed 🔎

🏷️ Commit: 495d366
▶️ Tests: 0 executed
⚪️ Checks: 3/3 completed


Learn more about TestLens at testlens.app/docs.

@ryandens
ryandens marked this pull request as ready for review October 17, 2026 20:03
@ryandens
ryandens merged commit a5aa23b into main Oct 17, 2026
3 checks passed
@ryandens
ryandens deleted the codex/fix-260-android-unit-tests branch October 17, 2026 20:03
ryandens added a commit that referenced this pull request Oct 17, 2026
Kotlin Multiplatform projects declare JVM test tasks such as `jvmTest`
or `desktopTest` instead of Java's `test` task. Configure JVM `Test`
tasks lazily so agents attach with either plugin order and projects
without JVM targets remain supported.

Resolve agents independently per test task, inferring omitted versions
from its runtime classpath while preserving shared declarations,
dependency-specific options, and configuration-cache reuse. Add
Multiplatform usage documentation and regression coverage for default
and named JVM targets, plugin order, disabling agents, and non-JVM
projects.

Validation: `./gradlew :plugin:check` passes (30 tests, formatting
checks, and plugin validation). Rechecked after rebasing onto the
Android support change in #419.

Closes #323.
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.

InvalidUserDataException when applying to Android application

1 participant