Skip to content

Commit

Permalink
ci: print elapsed time while generating files
Browse files Browse the repository at this point in the history
  • Loading branch information
halildurmus committed Jul 27, 2024
1 parent e6f2ea1 commit 2b2a0a5
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions packages/generator/bin/generate.dart
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,9 @@ void generateComApis(Scope scope, Map<String, String> comTypesToGenerate) {
}

void main() async {
print('Loading Windows metadata...');
final stopwatch = Stopwatch()..start();

print('[${stopwatch.elapsed}] Loading Windows metadata...');
final wdkScope =
await MetadataStore.loadWdkMetadata(version: wdkMetadataVersion);
final win32Scope =
Expand All @@ -252,33 +254,35 @@ void main() async {
// references from Win32 metadata.
await MetadataStore.loadWinRTMetadata();

print('Loading and sorting functions...');
print('[${stopwatch.elapsed}] Loading and sorting functions...');
final functionsToGenerate = loadFunctionsFromJson();
saveFunctionsToJson(functionsToGenerate);

print('Generating struct_sizes.cpp...');
print('[${stopwatch.elapsed}] Generating struct_sizes.cpp...');
final structsToGenerate = loadMap('win32_structs.json');
saveMap(structsToGenerate, 'win32_structs.json');
generateStructSizeAnalyzer();

print('Generating structs...');
print('[${stopwatch.elapsed}] Generating structs...');
generateStructs([wdkScope, win32Scope], structsToGenerate);

print('Generating struct tests...');
print('[${stopwatch.elapsed}] Generating struct tests...');
generateStructSizeTests();

print('Validating callbacks...');
print('[${stopwatch.elapsed}] Validating callbacks...');
final callbacks = loadMap('win32_callbacks.json');
saveMap(callbacks, 'win32_callbacks.json');
// Win32 callbacks are manually created

print('Generating FFI function bindings...');
print('[${stopwatch.elapsed}] Generating FFI function bindings...');
generateFunctions([wdkScope, win32Scope], functionsToGenerate);

print('Generating COM interfaces...');
print('[${stopwatch.elapsed}] Generating COM interfaces...');
final comTypesToGenerate = loadMap('com_types.json');
saveMap(comTypesToGenerate, 'com_types.json');
generateComApis(win32Scope, comTypesToGenerate);

MetadataStore.close();
stopwatch.stop();
print('[${stopwatch.elapsed}] Completed.');
}

0 comments on commit 2b2a0a5

Please sign in to comment.