rootPackageOrLocal function
Implementation
List<Package> rootPackageOrLocal(Metadata manifest) {
final rootManifestPath = '${manifest.workspaceRoot}/Cargo.toml';
// console.log(rootManifestPath); // Removed logging
final rootPackage = manifest.packages.firstWhere(
(pkg) => pkg.source == rootManifestPath,
orElse: () => Package(
name: '', version: '', id: '', targets: [], dependencies: []), // Dummy
);
if (rootPackage.name.isNotEmpty) {
return [rootPackage];
}
return manifest.packages.where((pkg) => pkg.source == null).toList();
}