getDependencies method

Future<void> getDependencies(
  1. String libFile
)

Detects the packages of the library file libFile.

The found packages will be stored in libFiles.

Implementation

Future<void> getDependencies(String libFile) async {
  final lines = await executeResult('ldd', [libFile]);
  RegExp regExp = RegExp(r'^\s+(\S+)');
  int ix = 1;
  for (var line in lines) {
    if (!line.contains('statically linked')) {
      final matcher = regExp.firstMatch(line);
      if (matcher != null) {
        final package = matcher.group(1)!;
        libFiles.add(package);
      }
    }
    if (++ix % 10 == 0 && ix > 1) {
      logStatus('${ix} of ${lines.length} lines processed...');
    }
  }
}