You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
36 lines
1.4 KiB
36 lines
1.4 KiB
|
1 day ago
|
// Writes the samples of the interoperability of stage 7b, Dart to Go: the
|
||
|
|
// files of the recipes of test/seal_interop_support.dart, sealed locators
|
||
|
|
// with their envelopes, author key files and Ed25519 signatures, which this
|
||
|
|
// library writes with SeededRandomSource, and samples.json, the recipes,
|
||
|
|
// into a directory. tool/seal_interop_go_verdicts.go then opens them with
|
||
|
|
// Go and writes test/vectors/seal_interop.json; the tests write the files
|
||
|
|
// again from the recipes and compare them with what Go read.
|
||
|
|
//
|
||
|
|
// dart run tool/seal_interop_dart_samples.dart <directory>
|
||
|
|
//
|
||
|
|
// ignore_for_file: avoid_print
|
||
|
|
import 'dart:convert';
|
||
|
|
import 'dart:io';
|
||
|
|
|
||
|
|
import '../test/seal_interop_support.dart';
|
||
|
|
|
||
|
|
void main(List<String> args) {
|
||
|
|
if (args.length != 1) {
|
||
|
|
stderr.writeln('usage: dart run tool/seal_interop_dart_samples.dart <dir>');
|
||
|
|
exit(2);
|
||
|
|
}
|
||
|
|
final dir = Directory(args.single)..createSync(recursive: true);
|
||
|
|
final recipes = interopRecipes();
|
||
|
|
for (var i = 0; i < recipes.length; i++) {
|
||
|
|
final files = interopFiles(recipes[i]);
|
||
|
|
for (final e in files.entries) {
|
||
|
|
File('${dir.path}/$i.${e.key}').writeAsBytesSync(e.value);
|
||
|
|
}
|
||
|
|
print('${recipes[i]['name']}: ${files.keys.join(', ')}');
|
||
|
|
}
|
||
|
|
File('${dir.path}/samples.json').writeAsStringSync(
|
||
|
|
const JsonEncoder.withIndent(' ').convert({'samples': recipes}),
|
||
|
|
);
|
||
|
|
print('wrote ${recipes.length} samples to ${dir.path}');
|
||
|
|
}
|