Skip to content

Commit

Permalink
update to build 0.7.0 (#128)
Browse files Browse the repository at this point in the history
  • Loading branch information
jakemac53 authored Jan 27, 2017
1 parent f811322 commit 3673391
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 22 deletions.
10 changes: 7 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 0.5.4

* Update to latest `build`, `build_runner`, and `build_test` releases.

## 0.5.3+2

* BugFix: Always release the Resolver instance, even when generation does not
Expand Down Expand Up @@ -55,7 +59,7 @@

## 0.5.1

* Added GeneratorBuilder option isStandalone to generate files that aren't
* Added GeneratorBuilder option isStandalone to generate files that aren't
part of source file.

## 0.5.0+3
Expand Down Expand Up @@ -86,7 +90,7 @@
files via the `BuildStep` class, and that is now also provided to
`Generator#generate` and `GeneratorForAnnotation#generateForAnnotatedElement`
as a second argument.

* Timestamps are no longer included in generated code.

* There is no longer a need to specify the files related to an individual
Expand All @@ -102,7 +106,7 @@

## 0.4.7+2

* Upgrade to `analyzer '^0.27.1'` and removed a work-around for a fixed
* Upgrade to `analyzer '^0.27.1'` and removed a work-around for a fixed
`analyzer` issue.

## 0.4.7+1
Expand Down
4 changes: 2 additions & 2 deletions lib/generators/json_literal_generator.dart
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ class JsonLiteralGenerator extends GeneratorForAnnotation<JsonLiteral> {
throw 'must be relative path to the source file';
}

var sourcePathDir = p.dirname(buildStep.input.id.path);
var sourcePathDir = p.dirname(buildStep.inputId.path);
var fileId = new AssetId(
buildStep.input.id.package, p.join(sourcePathDir, annotation.path));
buildStep.inputId.package, p.join(sourcePathDir, annotation.path));
var content = JSON.decode(await buildStep.readAsString(fileId));

var thing = JSON.encode(content);
Expand Down
20 changes: 7 additions & 13 deletions lib/src/builder.dart
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,10 @@ class GeneratorBuilder extends Builder {

@override
Future build(BuildStep buildStep) async {
var id = buildStep.input.id;
var resolver = await buildStep.resolve(id, resolveAllConstants: false);
try {
var lib = resolver.getLibrary(id);
if (lib == null) return;
await _generateForLibrary(lib, buildStep);
} finally {
resolver.release();
}
var resolver = await buildStep.resolver;
if (!resolver.isLibrary(buildStep.inputId)) return;
var lib = resolver.getLibrary(buildStep.inputId);
await _generateForLibrary(lib, buildStep);
}

@override
Expand All @@ -50,7 +45,7 @@ class GeneratorBuilder extends Builder {

Future _generateForLibrary(
LibraryElement library, BuildStep buildStep) async {
buildStep.logger.fine('Running $generators for ${buildStep.input.id}');
buildStep.logger.fine('Running $generators for ${buildStep.inputId}');
var generatedOutputs =
await _generate(library, generators, buildStep).toList();

Expand Down Expand Up @@ -91,9 +86,8 @@ if approppriate.""",
stack);
}

var outputId = _generatedFile(buildStep.input.id);
var output = new Asset(outputId, '$_topHeader$genPartContent');
buildStep.writeAsString(output);
buildStep.writeAsString(
_generatedFile(buildStep.inputId), '$_topHeader$genPartContent');
}

@override
Expand Down
8 changes: 4 additions & 4 deletions pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
name: source_gen
version: 0.5.3+2
version: 0.5.4
author: Dart Team <[email protected]>
description: Automatic sourcecode generation for Dart
homepage: https://github.com/dart-lang/source_gen
environment:
sdk: '>=1.12.0 <2.0.0'
dependencies:
analyzer: ^0.29.2
build: '>=0.2.1 <0.7.0'
build: ^0.7.0
dart_style: '>=0.1.7 <0.3.0'
path: ^1.3.2
dev_dependencies:
build_runner: ^0.1.0
build_test: ^0.3.0
build_runner: ^0.2.0
build_test: ^0.4.0
cli_util: ^0.0.1
collection: ^1.1.2
mockito: '>=0.11.0 <2.0.0'
Expand Down

0 comments on commit 3673391

Please sign in to comment.