Skip to content

Commit

Permalink
chore(tools): add script to update changelog with latest changes
Browse files Browse the repository at this point in the history
  • Loading branch information
halildurmus committed Nov 19, 2024
1 parent ac51803 commit 9c59c45
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 2 deletions.
5 changes: 3 additions & 2 deletions tools/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,11 @@ If you pass the `--test` (`-t`) flag, this tool will also test `generator` and

This folder also includes a few other small utilities of limited usefulness.

- `struct_sizes\struct_sizes.cpp`. Measures the size of structs in
- `struct_sizes\struct_sizes.cpp`: Measures the size of structs in
[packages\win32\lib\src\structs.g.dart] on 64-bit architectures so the
appropriate unit tests can be generated.
- `build.dart`. Generates EXE files for some of the Dart examples.
- `build.dart`: Generates EXE files for some of the Dart examples.
- `update_changelog.dart`: Updates the CHANGELOG.md with the latest changes.

[com_types.json]: ../packages/generator/data/com_types.json
[packages\generator\data]: ../packages/generator/data
Expand Down
35 changes: 35 additions & 0 deletions tools/update_changelog.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import 'dart:convert';
import 'dart:io';

void main(List<String> args) {
if (args.isEmpty) {
print('🚨 Usage: dart update_changelog.dart <tag>');
exit(1);
}

final tag = args[0];
if (!tag.startsWith('v')) {
print('❌ Tag must be in the format "vX.Y.Z".');
exit(1);
}

print('🚧 Starting changelog update for tag $tag...');
final result = Process.runSync(
'dart',
[
'run',
'hooks:update_changelog',
'--tag',
tag,
'--include-path',
'packages/win32/**/*',
'--repository',
'../../'
],
stdoutEncoding: utf8,
stderrEncoding: utf8,
workingDirectory: Platform.script.resolve('../packages/win32').toFilePath(),
);
stdout.write(result.stdout);
stderr.write(result.stderr);
}

0 comments on commit 9c59c45

Please sign in to comment.