Migrate android module layout discovery to the variant API - #12120
Migrate android module layout discovery to the variant API#12120daniel-mohedano wants to merge 3 commits into
Conversation
Bits has a CI fix ready🟢 Investigated · 🟢 Fix prepared · ⚪ Validation skipped · 🟠 Ready
View in Datadog | Reviewed commit 3a95df2 · Any feedback? Reach out in #deveng-pr-agent |
…ls-to-new-variant-api
Test Environment - sbt-scalatestJob Status: 🟢 success
Baseline: median of |
|
🎯 Code Coverage (details) 🔗 Commit SHA: 3a95df2 | Docs | Datadog PR Page | Give us feedback! |
Test Environment - nebula-release-pluginJob Status: 🔴 failed
Baseline: median of |
Test Environment - pass4sJob Status: 🟢 success
Baseline: median of |
Test Environment - netflix-zuulJob Status: 🔴 failed
Baseline: median of |
Test Environment - heliboardJob Status: 🟢 success
Baseline: median of |
🟢 Java Benchmark SLOs — All performance SLOs passed
PR vs. master results
Commit: Load and DaCapo benchmarks can be triggered manually in the GitLab pipeline. Results will appear in the Benchmarking Platform UI after completion. |
Test Environment - reactive-streams-jvmJob Status: 🔴 failed
Baseline: median of |
Test Environment - sonar-kotlinJob Status: 🔴 failed
Baseline: median of |
Test Environment - jolokiaJob Status: 🔴 failed
Baseline: median of |
Test Environment - okhttpJob Status: 🔴 failed
Baseline: median of |
Test Environment - spring_bootJob Status: 🔴 failed
Baseline: median of |
Test Environment - sonar-javaJob Status: 🔴 failed
Baseline: median of |
What Does This Do
applicationVariantsandlibraryVariantsAPIs with Android Components callbacks registered before project evaluation.Testtask throughconfigureTestTask.ScopedArtifact.CLASSESusingScope.PROJECT.onVariant(Action)API and obtains source roots from the matching main compilation..classfiles.Motivation
AGP 9 disables the legacy variant APIs by default, and AGP 10 is expected to remove them. The existing discovery logic would therefore stop finding Android module layouts on newer AGP versions.
The previous implementation also inferred the production variant from test-task names and hard-coded compiler output locations. This could miss valid production outputs or include test fixtures and project-local dependency artifacts in coverage.
Using the relationship exposed by AGP gives us the direct flow from production variant, to test component, to the exact Gradle test task.
Additional Notes
Older AGP versions that do not expose
configureTestTaskfall back to the generic Gradle module layout.Contributor Checklist
type:and (comp:orinst:) labels in addition to any other useful labelsclose,fix, or any linking keywords when referencing an issueUse
solvesinstead, and assign the PR milestone to the issueJira ticket: SDTEST-3803