dependencyContributionsFor function
Expands a Blueprint's selections into catalog-declared regular dependency contributions.
devDependencies are deliberately excluded: composed dependencies flow into
the Change Plan's single dependencies map (merged with the lock's direct
deps), which is the regular dependency channel — routing build_runner /
freezed there would mislabel them. The fixed recipe brick already declares
the dev deps its codegen needs. A separate dev-dependency composition
channel lands with pubspec-emission-from-composer (needs the per-capability
bricks that don't exist yet — see plan_builder.dart's composedDependencies
doc). ponytail: regular-only until a plan dev-dep channel exists.
Implementation
List<Contribution> dependencyContributionsFor(
Blueprint blueprint,
Catalog catalog,
) {
final selections = <(String capabilityId, String optionId)>[
for (final entry in blueprint.singleSelections.entries)
(entry.key, entry.value),
for (final entry in blueprint.multiSelections.entries)
for (final optionId in entry.value) (entry.key, optionId),
];
final contributions = <Contribution>[];
for (final (capabilityId, optionId) in selections) {
final catalogEntry = catalog.find(capabilityId, optionId);
if (catalogEntry == null) continue; // unknown IDs are compatibility's job
final recipeRef = catalogEntry.recipeRefs.isNotEmpty
? catalogEntry.recipeRefs.first
: '$capabilityId.$optionId';
for (final dependency in catalogEntry.dependencies) {
contributions.add(
Contribution(
kind: ContributionKind.dependency,
canonicalKey: dependency.name,
content: dependency.version,
sourceRecipeRef: recipeRef,
),
);
}
}
return contributions;
}