build.yaml

This commit is contained in:
Tobe O 2018-03-02 14:49:47 -05:00
parent e3b1dc86ba
commit 43579da76a
3 changed files with 42 additions and 3 deletions

View file

@ -0,0 +1,23 @@
targets:
_json_model_builder:
_serializer_builder:
builders:
json_model:
target: "_json_model_builder"
import: "package:angel_serialize_generator/angel_serialize_generator.dart"
builder_factories:
- jsonModel
auto_apply: dependents
build_extensions:
.dart:
- ".g.dart"
serializer:
target: "_serializer_builder"
import: "package:angel_serialize_generator/angel_serialize_generator.dart"
builder_factories:
- serializeGenerator
auto_apply: dependents
build_extensions:
.dart:
- ".serializer.g.dart"

View file

@ -10,9 +10,25 @@ import 'package:recase/recase.dart';
import 'package:source_gen/source_gen.dart' hide LibraryBuilder;
import 'build_context.dart';
import 'context.dart';
part 'model.dart';
part 'serialize.dart';
Builder jsonModelBuilder(_) {
return new PartBuilder(
const [const JsonModelGenerator()],
generatedExtension: '.g.dart',
);
}
Builder serializerBuilder(_) {
return new PartBuilder(
const [const SerializerGenerator()],
generatedExtension: '.g.dart',
);
}
/// Converts a [DartType] to a [TypeReference].
TypeReference convertTypeReference(DartType t) {
return new TypeReference((b) {
@ -28,8 +44,7 @@ TypeReference convertTypeReference(DartType t) {
bool isModelClass(DartType t) {
if (t == null) return false;
if (serializableTypeChecker.hasAnnotationOf(t.element))
return true;
if (serializableTypeChecker.hasAnnotationOf(t.element)) return true;
if (t is InterfaceType) {
return isModelClass(t.superclass);

View file

@ -8,6 +8,7 @@ environment:
dependencies:
angel_serialize:
path: ../angel_serialize
build_config: ">=0.0.0 <2.0.0"
code_builder: ^2.0.0
id: ^1.0.0
recase: ^1.0.0