Skip to content

feat(android): per-variant flavor source layering - #10

Merged
ulite-Amr merged 4 commits into
mainfrom
feat/flavor-source-layering
Aug 25, 2026
Merged

feat(android): per-variant flavor source layering#10
ulite-Amr merged 4 commits into
mainfrom
feat/flavor-source-layering

Conversation

@ulite-Amr

Copy link
Copy Markdown
Contributor

Summary

Phase 15 slice (pairs with Ulite-Team/Uliab#28): flavor-specific sources.

productFlavors.<name>.sources = [...] declares extra .java/.kt files compiled only into the variants that select that flavor:

  • A variant's effective source set = base android.sources + each selected flavor's sources, deduplicated first-wins
  • compileJava<V> / compileKotlin<V> take the merged per-variant list instead of the module-wide one, so a flavor's activities/features never leak into other flavors' APKs
  • Unsupported extensions are re-validated on the merged list

Mechanics: compute_variants now returns (variants, flavors) and each Variant carries its selected flavor names; FlavorInfo moved to module scope. Docs updated (docs/android-plugin.md gains a Per-variant source layering section).

No registry/version bump — that rides the next release tag as usual.

productFlavors blocks may declare sources = [...] — extra .java/.kt
files compiled only into the variants that select that flavor. A
variant's effective source set is android.sources plus each selected
flavor's sources, deduplicated first-wins, re-validated for supported
extensions on the merged list. compileJava<V>/compileKotlin<V> now take
the variant's merged list instead of the module-wide one.

compute_variants returns the parsed flavors map alongside the matrix,
and each Variant carries its selected flavor names; FlavorInfo moved to
module scope so both escape the function. Tests cover flavors carried
through the matrix and per-variant selection.
@coderabbitai

coderabbitai Bot commented Aug 24, 2026

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 30ada8f6-262b-4c72-a389-8d29f86a1562


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

…lper tests

- The stdlib jar fed to d8 is now resolved per variant from that
  variant's merged sources. Previously it keyed off the module-wide
  Kotlin list, so a pure-Java base with .kt files only under one flavor
  compiled that Kotlin but dexed without stdlib (guaranteed
  NoClassDefFoundError at runtime); Kotlin-free variants also no longer
  carry a bogus stdlib input on compileDex fingerprints.
- FlavorInfo/Variant: restore the doc comment and Debug derive to their
  rightful owners after the hoist.
- Extract the per-variant source merge into merge_variant_sources with
  unit tests (first-wins dedup, projectDir-relative resolution,
  extension rejection) and move the variant-matrix assertions out of the
  pascal_case test into their own test.
@ulite-Amr
ulite-Amr merged commit 6cc383f into main Aug 25, 2026
9 checks passed
@ulite-Amr
ulite-Amr deleted the feat/flavor-source-layering branch August 25, 2026 02:29
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