2017-09-15 19:23:36 +00:00
|
|
|
import 'package:build_runner/build_runner.dart';
|
|
|
|
import 'package:source_gen/source_gen.dart';
|
|
|
|
import 'package:angel_orm_generator/angel_orm_generator.dart';
|
|
|
|
import 'package:angel_serialize_generator/angel_serialize_generator.dart';
|
|
|
|
|
|
|
|
const String packageName = 'angel_orm_generator';
|
|
|
|
const List<String> allModels = const ['test/models/*.dart'];
|
|
|
|
const List<String> standaloneModels = const [
|
|
|
|
'test/models/author.dart',
|
|
|
|
'test/models/car.dart',
|
|
|
|
'test/models/foot.dart',
|
|
|
|
'test/models/fruit.dart',
|
2017-12-07 08:21:49 +00:00
|
|
|
'test/models/order.dart',
|
2017-09-15 19:23:36 +00:00
|
|
|
'test/models/role.dart'
|
|
|
|
];
|
|
|
|
const List<String> dependentModels = const [
|
|
|
|
'test/models/book.dart',
|
2017-12-07 08:21:49 +00:00
|
|
|
'test/models/customer.dart',
|
2017-09-15 19:23:36 +00:00
|
|
|
'test/models/leg.dart',
|
|
|
|
'test/models/tree.dart',
|
|
|
|
'test/models/user.dart'
|
|
|
|
];
|
|
|
|
|
|
|
|
final List<BuildAction> actions = [
|
|
|
|
new BuildAction(
|
|
|
|
new PartBuilder(const [const JsonModelGenerator()]),
|
|
|
|
packageName,
|
|
|
|
inputs: standaloneModels,
|
|
|
|
),
|
|
|
|
new BuildAction(
|
|
|
|
new PartBuilder(const [const JsonModelGenerator()]),
|
|
|
|
packageName,
|
|
|
|
inputs: dependentModels,
|
|
|
|
),
|
|
|
|
new BuildAction(
|
|
|
|
new LibraryBuilder(
|
|
|
|
const PostgresOrmGenerator(),
|
|
|
|
generatedExtension: '.orm.g.dart',
|
|
|
|
),
|
|
|
|
packageName,
|
|
|
|
inputs: standaloneModels,
|
|
|
|
),
|
|
|
|
new BuildAction(
|
|
|
|
new LibraryBuilder(
|
|
|
|
const PostgresOrmGenerator(),
|
|
|
|
generatedExtension: '.orm.g.dart',
|
|
|
|
),
|
|
|
|
packageName,
|
|
|
|
inputs: dependentModels,
|
|
|
|
),
|
|
|
|
new BuildAction(
|
|
|
|
new LibraryBuilder(
|
|
|
|
const PostgresServiceGenerator(),
|
|
|
|
generatedExtension: '.service.g.dart',
|
|
|
|
),
|
|
|
|
packageName,
|
|
|
|
inputs: allModels,
|
|
|
|
),
|
2017-11-18 20:10:58 +00:00
|
|
|
new BuildAction(
|
|
|
|
new LibraryBuilder(
|
|
|
|
const MigrationGenerator(),
|
|
|
|
generatedExtension: '.migration.g.dart',
|
|
|
|
),
|
|
|
|
packageName,
|
|
|
|
inputs: allModels,
|
|
|
|
),
|
2017-09-15 19:23:36 +00:00
|
|
|
new BuildAction(
|
|
|
|
const SqlMigrationBuilder(
|
|
|
|
temporary: true,
|
|
|
|
),
|
|
|
|
packageName,
|
|
|
|
inputs: allModels,
|
|
|
|
),
|
|
|
|
];
|