feat(android): per-variant flavor source layering - #10
Merged
Conversation
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.
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars. ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Plus Run ID: 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. Comment |
…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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Phase 15 slice (pairs with Ulite-Team/Uliab#28): flavor-specific sources.
productFlavors.<name>.sources = [...]declares extra.java/.ktfiles compiled only into the variants that select that flavor:android.sources+ each selected flavor'ssources, deduplicated first-winscompileJava<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' APKsMechanics:
compute_variantsnow returns(variants, flavors)and eachVariantcarries its selected flavor names;FlavorInfomoved to module scope. Docs updated (docs/android-plugin.mdgains a Per-variant source layering section).No registry/version bump — that rides the next release tag as usual.