build method
Generates the outputs for a given BuildStep
.
Implementation
@override
FutureOr<void> build(BuildStep buildStep) async {
log.info('processing: ${buildStep.inputId}');
final input = buildStep.inputId;
final output = AssetId(input.package, 'lib/assets.dart');
final configId = AssetId(input.package, 'pubspec.yaml');
final configRaw =
safeCast<YamlMap>(loadYaml(await buildStep.readAsString(configId)));
final config = Config.fromPubspec(configRaw ?? YamlMap());
await _markIntlFiles(buildStep, config);
await check(buildStep, config.intlFilename);
await check(buildStep, config.pubspecFilename);
final res = parseResources(config);
for (final decl in res.assets.declared) {
if (decl.endsWith('/')) {
final glob = Glob('$decl*');
final files = await buildStep.findAssets(glob).toList();
log.finest('$glob $files');
}
}
final generated = generateFile(res, config);
await buildStep.writeAsString(output, generated);
}