我想使用serializable包序列化一些类和一个自定义生成器来从同一个类中吐出一些额外的信息。我的问题是构建抱怨我无法覆盖输入:
[INFO] Build: Reading cached dependency graph completed, took 12ms
[INFO] Build: Finalizing build setup completed, took 43ms
[SEVERE] Build: Failed after 2775ms
InvalidOutputException: mongaba_model|lib/models/calltoaction.g.dart
Cannot overwrite inputs.
如何使用serializable并创建自定义生成器以在同一个类上使用?
感谢
答案 0 :(得分:1)
发现问题。我使用了两个阶段:
工具/ build.dart:
main() async {
PhaseGroup pg = new PhaseGroup()
..addPhase(serializablePhase(const ['lib/models/*.dart']))
..addPhase(modelablePhase(const ['lib/models/*.dart']));
await build(pg,
deleteFilesByDefault: true);
}
现在我改为在同一阶段使用两台发电机:
phase.dart:
modelablePhase([Iterable<String> globs = const ['bin/**.dart',
'web/**.dart', 'lib/**.dart']]) =>
new Phase()..addAction(
new GeneratorBuilder(const
[const ModelableGenerator(), const SerializableGenerator()]
),
new InputSet(new PackageGraph.forThisPackage().root.name, globs));
添加了这个答案,它可以帮助某人