feat: Merge integrations if a patch or any of its dependencies need them

This commit is contained in:
Alberto Ponces 2022-09-23 17:20:19 +01:00
parent 9561153bfb
commit d84230fa22

View File

@ -87,10 +87,21 @@ class PatcherAPI {
.toList();
}
bool dependencyNeedsIntegrations(String name) {
return name.contains('integrations') ||
_patches.any(
(patch) =>
patch.name == name &&
(patch.dependencies.any(
(dep) => dependencyNeedsIntegrations(dep),
)),
);
}
Future<bool> needsIntegrations(List<Patch> selectedPatches) async {
return selectedPatches.any(
(patch) => patch.dependencies.any(
(dep) => dep.contains('integrations'),
(dep) => dependencyNeedsIntegrations(dep),
),
);
}