start generator

This commit is contained in:
Tobe O 2019-02-03 16:03:47 -05:00
parent e0ef73d862
commit 5f8f8a1738
6 changed files with 430 additions and 0 deletions

View file

@ -0,0 +1,47 @@
# Generated by pub on 2019-02-03 15:26:58.676936.
analyzer:file:///Users/thosakwe/.pub-cache/hosted/pub.dartlang.org/analyzer-0.35.0/lib/
angel_model:file:///Users/thosakwe/.pub-cache/hosted/pub.dartlang.org/angel_model-1.0.1/lib/
angel_serialize:file:///Users/thosakwe/.pub-cache/hosted/pub.dartlang.org/angel_serialize-2.2.2+1/lib/
angel_serialize_generator:file:///Users/thosakwe/.pub-cache/hosted/pub.dartlang.org/angel_serialize_generator-2.4.1+1/lib/
args:file:///Users/thosakwe/.pub-cache/hosted/pub.dartlang.org/args-1.5.1/lib/
async:file:///Users/thosakwe/.pub-cache/hosted/pub.dartlang.org/async-2.0.8/lib/
build:file:///Users/thosakwe/.pub-cache/hosted/pub.dartlang.org/build-1.1.1/lib/
build_config:file:///Users/thosakwe/.pub-cache/hosted/pub.dartlang.org/build_config-0.3.1+4/lib/
built_collection:file:///Users/thosakwe/.pub-cache/hosted/pub.dartlang.org/built_collection-4.1.0/lib/
built_value:file:///Users/thosakwe/.pub-cache/hosted/pub.dartlang.org/built_value-6.3.0/lib/
charcode:file:///Users/thosakwe/.pub-cache/hosted/pub.dartlang.org/charcode-1.1.2/lib/
code_buffer:file:///Users/thosakwe/.pub-cache/hosted/pub.dartlang.org/code_buffer-1.0.1/lib/
code_builder:file:///Users/thosakwe/.pub-cache/hosted/pub.dartlang.org/code_builder-3.2.0/lib/
collection:file:///Users/thosakwe/.pub-cache/hosted/pub.dartlang.org/collection-1.14.11/lib/
convert:file:///Users/thosakwe/.pub-cache/hosted/pub.dartlang.org/convert-2.1.1/lib/
crypto:file:///Users/thosakwe/.pub-cache/hosted/pub.dartlang.org/crypto-2.0.6/lib/
csslib:file:///Users/thosakwe/.pub-cache/hosted/pub.dartlang.org/csslib-0.14.6/lib/
dart_style:file:///Users/thosakwe/.pub-cache/hosted/pub.dartlang.org/dart_style-1.2.3/lib/
fixnum:file:///Users/thosakwe/.pub-cache/hosted/pub.dartlang.org/fixnum-0.10.9/lib/
front_end:file:///Users/thosakwe/.pub-cache/hosted/pub.dartlang.org/front_end-0.1.10/lib/
glob:file:///Users/thosakwe/.pub-cache/hosted/pub.dartlang.org/glob-1.1.7/lib/
graphql_schema:file:///Users/thosakwe/.pub-cache/hosted/pub.dartlang.org/graphql_schema-1.0.2+1/lib/
html:file:///Users/thosakwe/.pub-cache/hosted/pub.dartlang.org/html-0.13.3+3/lib/
json_annotation:file:///Users/thosakwe/.pub-cache/hosted/pub.dartlang.org/json_annotation-2.0.0/lib/
kernel:file:///Users/thosakwe/.pub-cache/hosted/pub.dartlang.org/kernel-0.3.10/lib/
logging:file:///Users/thosakwe/.pub-cache/hosted/pub.dartlang.org/logging-0.11.3+2/lib/
matcher:file:///Users/thosakwe/.pub-cache/hosted/pub.dartlang.org/matcher-0.12.4/lib/
meta:file:///Users/thosakwe/.pub-cache/hosted/pub.dartlang.org/meta-1.1.7/lib/
package_config:file:///Users/thosakwe/.pub-cache/hosted/pub.dartlang.org/package_config-1.0.5/lib/
path:file:///Users/thosakwe/.pub-cache/hosted/pub.dartlang.org/path-1.6.2/lib/
plugin:file:///Users/thosakwe/.pub-cache/hosted/pub.dartlang.org/plugin-0.2.0+3/lib/
pub_semver:file:///Users/thosakwe/.pub-cache/hosted/pub.dartlang.org/pub_semver-1.4.2/lib/
pubspec_parse:file:///Users/thosakwe/.pub-cache/hosted/pub.dartlang.org/pubspec_parse-0.1.4/lib/
quiver:file:///Users/thosakwe/.pub-cache/hosted/pub.dartlang.org/quiver-2.0.1/lib/
quiver_hashcode:file:///Users/thosakwe/.pub-cache/hosted/pub.dartlang.org/quiver_hashcode-2.0.0/lib/
recase:file:///Users/thosakwe/.pub-cache/hosted/pub.dartlang.org/recase-2.0.1/lib/
source_gen:file:///Users/thosakwe/.pub-cache/hosted/pub.dartlang.org/source_gen-0.9.4+1/lib/
source_span:file:///Users/thosakwe/.pub-cache/hosted/pub.dartlang.org/source_span-1.5.4/lib/
stack_trace:file:///Users/thosakwe/.pub-cache/hosted/pub.dartlang.org/stack_trace-1.9.3/lib/
string_scanner:file:///Users/thosakwe/.pub-cache/hosted/pub.dartlang.org/string_scanner-1.0.4/lib/
term_glyph:file:///Users/thosakwe/.pub-cache/hosted/pub.dartlang.org/term_glyph-1.1.0/lib/
typed_data:file:///Users/thosakwe/.pub-cache/hosted/pub.dartlang.org/typed_data-1.1.6/lib/
utf:file:///Users/thosakwe/.pub-cache/hosted/pub.dartlang.org/utf-0.9.0+5/lib/
watcher:file:///Users/thosakwe/.pub-cache/hosted/pub.dartlang.org/watcher-0.9.7+10/lib/
yaml:file:///Users/thosakwe/.pub-cache/hosted/pub.dartlang.org/yaml-2.1.15/lib/
graphql_generator:lib/

View file

@ -0,0 +1,14 @@
builders:
graphql:
import: "package:graphql_generator/graphql_generator.dart"
builder_factories:
- graphQLBuilder
auto_apply: root_package
build_to: cache
build_extensions:
.dart:
- graphql_generator.g.part
required_inputs:
- angel_serialize.g.part
applies_builders:
- source_gen|combining_builder

View file

@ -0,0 +1,34 @@
import 'dart:async';
import 'package:analyzer/dart/element/element.dart';
import 'package:angel_serialize_generator/build_context.dart';
import 'package:angel_serialize_generator/context.dart';
import 'package:build/build.dart';
import 'package:code_builder/code_builder.dart';
import 'package:graphql_schema/graphql_schema.dart';
import 'package:source_gen/source_gen.dart';
/// Generates GraphQL schemas, statically.
Builder graphQLBuilder(_) {
return SharedPartBuilder([_GraphQLGenerator()], 'graphql_generator');
}
class _GraphQLGenerator extends GeneratorForAnnotation<GraphQLClass> {
@override
Future<String> generateForAnnotatedElement(
Element element, ConstantReader annotation, BuildStep buildStep) async {
if (element is ClassElement) {
var ctx = await buildContext(
element, annotation, buildStep, buildStep.resolver, false);
var lib = buildSchemaLibrary(ctx);
return lib.accept(DartEmitter()).toString();
} else {
throw UnsupportedError('@GraphQLClass() is only supported on classes.');
}
}
Library buildSchemaLibrary(BuildContext ctx) {
return Library((b) {
var clazz = ctx.clazz;
});
}
}

View file

View file

@ -0,0 +1,320 @@
# Generated by pub
# See https://www.dartlang.org/tools/pub/glossary#lockfile
packages:
analyzer:
dependency: transitive
description:
name: analyzer
url: "https://pub.dartlang.org"
source: hosted
version: "0.35.0"
angel_model:
dependency: transitive
description:
name: angel_model
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.1"
angel_serialize:
dependency: transitive
description:
name: angel_serialize
url: "https://pub.dartlang.org"
source: hosted
version: "2.2.2+1"
angel_serialize_generator:
dependency: "direct main"
description:
name: angel_serialize_generator
url: "https://pub.dartlang.org"
source: hosted
version: "2.4.1+1"
args:
dependency: transitive
description:
name: args
url: "https://pub.dartlang.org"
source: hosted
version: "1.5.1"
async:
dependency: transitive
description:
name: async
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.8"
build:
dependency: "direct main"
description:
name: build
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.1"
build_config:
dependency: "direct main"
description:
name: build_config
url: "https://pub.dartlang.org"
source: hosted
version: "0.3.1+4"
built_collection:
dependency: transitive
description:
name: built_collection
url: "https://pub.dartlang.org"
source: hosted
version: "4.1.0"
built_value:
dependency: transitive
description:
name: built_value
url: "https://pub.dartlang.org"
source: hosted
version: "6.3.0"
charcode:
dependency: transitive
description:
name: charcode
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.2"
code_buffer:
dependency: transitive
description:
name: code_buffer
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.1"
code_builder:
dependency: "direct main"
description:
name: code_builder
url: "https://pub.dartlang.org"
source: hosted
version: "3.2.0"
collection:
dependency: transitive
description:
name: collection
url: "https://pub.dartlang.org"
source: hosted
version: "1.14.11"
convert:
dependency: transitive
description:
name: convert
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.1"
crypto:
dependency: transitive
description:
name: crypto
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.6"
csslib:
dependency: transitive
description:
name: csslib
url: "https://pub.dartlang.org"
source: hosted
version: "0.14.6"
dart_style:
dependency: transitive
description:
name: dart_style
url: "https://pub.dartlang.org"
source: hosted
version: "1.2.3"
fixnum:
dependency: transitive
description:
name: fixnum
url: "https://pub.dartlang.org"
source: hosted
version: "0.10.9"
front_end:
dependency: transitive
description:
name: front_end
url: "https://pub.dartlang.org"
source: hosted
version: "0.1.10"
glob:
dependency: transitive
description:
name: glob
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.7"
graphql_schema:
dependency: "direct main"
description:
name: graphql_schema
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.2+1"
html:
dependency: transitive
description:
name: html
url: "https://pub.dartlang.org"
source: hosted
version: "0.13.3+3"
json_annotation:
dependency: transitive
description:
name: json_annotation
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.0"
kernel:
dependency: transitive
description:
name: kernel
url: "https://pub.dartlang.org"
source: hosted
version: "0.3.10"
logging:
dependency: transitive
description:
name: logging
url: "https://pub.dartlang.org"
source: hosted
version: "0.11.3+2"
matcher:
dependency: transitive
description:
name: matcher
url: "https://pub.dartlang.org"
source: hosted
version: "0.12.4"
meta:
dependency: transitive
description:
name: meta
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.7"
package_config:
dependency: transitive
description:
name: package_config
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.5"
path:
dependency: transitive
description:
name: path
url: "https://pub.dartlang.org"
source: hosted
version: "1.6.2"
plugin:
dependency: transitive
description:
name: plugin
url: "https://pub.dartlang.org"
source: hosted
version: "0.2.0+3"
pub_semver:
dependency: transitive
description:
name: pub_semver
url: "https://pub.dartlang.org"
source: hosted
version: "1.4.2"
pubspec_parse:
dependency: transitive
description:
name: pubspec_parse
url: "https://pub.dartlang.org"
source: hosted
version: "0.1.4"
quiver:
dependency: transitive
description:
name: quiver
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.1"
quiver_hashcode:
dependency: transitive
description:
name: quiver_hashcode
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.0"
recase:
dependency: "direct main"
description:
name: recase
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.1"
source_gen:
dependency: "direct main"
description:
name: source_gen
url: "https://pub.dartlang.org"
source: hosted
version: "0.9.4+1"
source_span:
dependency: transitive
description:
name: source_span
url: "https://pub.dartlang.org"
source: hosted
version: "1.5.4"
stack_trace:
dependency: transitive
description:
name: stack_trace
url: "https://pub.dartlang.org"
source: hosted
version: "1.9.3"
string_scanner:
dependency: transitive
description:
name: string_scanner
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.4"
term_glyph:
dependency: transitive
description:
name: term_glyph
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.0"
typed_data:
dependency: transitive
description:
name: typed_data
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.6"
utf:
dependency: transitive
description:
name: utf
url: "https://pub.dartlang.org"
source: hosted
version: "0.9.0+5"
watcher:
dependency: transitive
description:
name: watcher
url: "https://pub.dartlang.org"
source: hosted
version: "0.9.7+10"
yaml:
dependency: transitive
description:
name: yaml
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.15"
sdks:
dart: ">=2.1.0-dev.5.0 <3.0.0"

View file

@ -0,0 +1,15 @@
name: graphql_generator
version: 1.0.0-alpha
description: Generates GraphQL schemas from Dart classes, for use with pkg:graphql_server.
author: Tobe O <thosakwe@gmail.com>
homepage: https://github.com/angel-dart/graphql
environment:
sdk: ">=2.0.0 <3.0.0"
dependencies:
angel_serialize_generator: ^2.0.0
build: ^1.0.0
build_config: ^0.3.0
code_builder: ^3.0.0
graphql_schema: ^1.0.2
recase: ^2.0.0
source_gen: ^0.9.4