Skip to content

Commit 303a735

Browse files
committed
[native_assets_cli] Validate tagged union syntax
1 parent 763c3ce commit 303a735

File tree

8 files changed

+411
-130
lines changed

8 files changed

+411
-130
lines changed

pkgs/hook/tool/generate_syntax.dart

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ final rootSchemas = loadSchemas([
1818
packageUri.resolve('../data_assets/doc/schema/'),
1919
]);
2020

21-
void main() {
21+
void main(List<String> args) {
2222
for (final packageName in generateFor) {
2323
const schemaName = 'shared';
2424
final schemaUri = packageUri.resolve(
@@ -66,6 +66,16 @@ void main() {
6666
]
6767
: null,
6868
).analyze();
69+
final textDumpFile = File.fromUri(
70+
packageUri.resolve(
71+
'../native_assets_cli/lib/src/$packageName/syntax.g.txt',
72+
),
73+
);
74+
if (args.contains('-d')) {
75+
textDumpFile.writeAsStringSync(analyzedSchema.toString());
76+
} else if (textDumpFile.existsSync()) {
77+
textDumpFile.deleteSync();
78+
}
6979
final output =
7080
SyntaxGenerator(
7181
analyzedSchema,

0 commit comments

Comments
 (0)