-
Notifications
You must be signed in to change notification settings - Fork 74
Open
Labels
P3A lower priority bug or feature requestA lower priority bug or feature requestpackage:hookspackage:native_toolchain_c
Milestone
Description
When dealing with:
We'd like users to not have to manually make the transitive closure of dependencies. We should provide some helper code to do this.
Rough sketch:
Set<String> transitiveDeps(String dylib) {
final all = <String>{};
final worklist = [dylib];
while (worklist.isNotEmpty) {
final current = worklist.removeLast();
for (final path in depsOfDylib(current)) {
if (all.add(path)) {
worklist.add(path);
}
}
}
return all;
}
Set<String> depsOfDylib(String dylib) {
final result = Process.runSync('otool', ['-L', dylib]);
return regexp
.allMatches(result.stdout)
.map((match) => match.namedGroup('path')!)
.toSet();
}
final regexp = RegExp(r'^\s+(?<path>[^\s]*)\s+', multiLine: true);
final homebrewDir = '${Platform.environment['HOME']}/.homebrew';
We'd need something for all OSes.
Thanks @mkustermann for reporting and the sketch!
Metadata
Metadata
Assignees
Labels
P3A lower priority bug or feature requestA lower priority bug or feature requestpackage:hookspackage:native_toolchain_c
Type
Projects
Status
No status