typeOnlyBridgeHeaders function

List<File> typeOnlyBridgeHeaders(
  1. String baseDir
)

Generated C headers of type-only spec files. Every module bridge that uses their shared types #includes them, so each C++ include dir needs a copy.

Implementation

List<File> typeOnlyBridgeHeaders(String baseDir) {
  final libDir = Directory(p.join(baseDir, 'lib'));
  if (!libDir.existsSync()) return [];
  return [
    for (final f in libDir.listSync(recursive: true).whereType<File>())
      if (f.path.endsWith('.native.dart') && !declaresNitroModule(f.readAsStringSync()))
        File(p.join(p.dirname(f.path), 'generated', 'cpp', '${p.basename(f.path).replaceAll('.native.dart', '')}.bridge.g.h')),
  ].where((h) => h.existsSync()).toList();
}