unmatchedGroups function

List<String> unmatchedGroups(
  1. Iterable<String> projectPaths,
  2. List<String> groups,
  3. String executionRoot
)

The groups that no project in projectPaths belongs to, in the order given and each once.

Implementation

List<String> unmatchedGroups(
  Iterable<String> projectPaths,
  List<String> groups,
  String executionRoot,
) {
  final seen = <String>{
    for (final path in projectPaths) ...projectGroupsOf(path, executionRoot),
  };
  final unmatched = <String>[];
  for (final group in groups) {
    if (!seen.contains(group) && !unmatched.contains(group)) {
      unmatched.add(group);
    }
  }
  return unmatched;
}