2017-06-17 16:45:31 +00:00
|
|
|
import 'package:build_runner/build_runner.dart';
|
|
|
|
import 'package:source_gen/source_gen.dart';
|
2017-07-10 21:49:00 +00:00
|
|
|
import 'package:angel_orm_generator/angel_orm_generator.dart';
|
|
|
|
import 'package:angel_serialize_generator/angel_serialize_generator.dart';
|
2017-06-17 16:45:31 +00:00
|
|
|
|
2017-07-15 15:11:57 +00:00
|
|
|
final InputSet ALL_MODELS =
|
2017-07-10 21:49:00 +00:00
|
|
|
new InputSet('angel_orm_generator', const ['test/models/*.dart']);
|
2017-07-15 20:18:53 +00:00
|
|
|
final InputSet STANDALONE_MODELS = new InputSet('angel_orm_generator', const [
|
|
|
|
'test/models/author.dart',
|
2017-08-01 05:45:54 +00:00
|
|
|
'test/models/car.dart',
|
|
|
|
'test/models/foot.dart',
|
2017-07-15 20:18:53 +00:00
|
|
|
'test/models/role.dart'
|
|
|
|
]);
|
2017-08-01 05:45:54 +00:00
|
|
|
final InputSet DEPENDENT_MODELS = new InputSet('angel_orm_generator', const [
|
|
|
|
'test/models/book.dart',
|
|
|
|
'test/models/leg.dart',
|
|
|
|
'test/models/user.dart'
|
|
|
|
]);
|
2017-06-24 21:21:32 +00:00
|
|
|
|
2017-06-17 16:45:31 +00:00
|
|
|
final PhaseGroup PHASES = new PhaseGroup()
|
|
|
|
..addPhase(new Phase()
|
2017-07-15 15:11:57 +00:00
|
|
|
..addAction(
|
|
|
|
new GeneratorBuilder([const JsonModelGenerator()]), STANDALONE_MODELS)
|
|
|
|
..addAction(
|
|
|
|
new GeneratorBuilder([const JsonModelGenerator()]), DEPENDENT_MODELS))
|
|
|
|
..addPhase(new Phase()
|
|
|
|
..addAction(
|
|
|
|
new GeneratorBuilder([new PostgresORMGenerator()],
|
|
|
|
isStandalone: true, generatedExtension: '.orm.g.dart'),
|
|
|
|
STANDALONE_MODELS))
|
2017-06-17 16:45:31 +00:00
|
|
|
..addPhase(new Phase()
|
|
|
|
..addAction(
|
2017-06-18 04:19:05 +00:00
|
|
|
new GeneratorBuilder([new PostgresORMGenerator()],
|
2017-06-17 16:45:31 +00:00
|
|
|
isStandalone: true, generatedExtension: '.orm.g.dart'),
|
2017-07-15 15:11:57 +00:00
|
|
|
DEPENDENT_MODELS))
|
2017-08-03 18:42:01 +00:00
|
|
|
..addPhase(new Phase()
|
|
|
|
..addAction(
|
|
|
|
new GeneratorBuilder([new PostgresServiceGenerator()],
|
|
|
|
isStandalone: true, generatedExtension: '.service.g.dart'),
|
|
|
|
ALL_MODELS))
|
2017-07-09 16:53:35 +00:00
|
|
|
..addPhase(new Phase()
|
2017-07-15 15:11:57 +00:00
|
|
|
..addAction(new SQLMigrationGenerator(temporary: true), ALL_MODELS));
|