Skip to content

Commit

Permalink
Prepare to publish. (#150)
Browse files Browse the repository at this point in the history
  • Loading branch information
matanlurey committed Oct 28, 2017
1 parent dbb52f5 commit f7d053c
Show file tree
Hide file tree
Showing 3 changed files with 62 additions and 3 deletions.
60 changes: 60 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,63 @@
## 2.0.0

Re-released without a direct dependency on `package:analyzer`!

For users of the `1.x` branch of `code_builder`, this is a pretty big breaking
change but ultimately is for the better - it's easier to evolve this library
now and even add your own builders on top of the library.

```dart
// Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
import 'package:code_builder/code_builder.dart';
import 'package:dart_style/dart_style.dart';
void main() {
final animal = new Class((b) => b
..name = 'Animal'
..extend = refer('Organism')
..methods.add(new Method.returnsVoid((b) => b
..name = 'eat'
..lambda = true
..body = const Code('print(\'Yum\')'))));
final emitter = new DartEmitter();
print(new DartFormatter().format('${animal.accept(emitter)}'));
}
```

...outputs...

```dart
class Animal extends Organism {
void eat() => print('Yum!');
}
```

**Major changes**:

* Builders now use `built_value`, and have a more consistent, friendly API.
* Builders are now consistent - they don't any work until code is emitted.
* It's possible to overwrite the built-in code emitting, formatting, etc by
providing your own visitors. See `DartEmitter` as an example of the built-in
visitor/emitter.
* Most of the expression and statement level helpers were removed; in practice
they were difficult to write and maintain, and many users commonly asked for
opt-out type APIs. See the `Code` example below:

```dart
void main() {
var code = new Code('x + y = z');
code.expression;
code.statement;
}
```

See the commit log, examples, and tests for full details. While we want to try
and avoid breaking changes, suggestions, new features, and incremental updates
are welcome!

## 2.0.0-beta

* Added `lazySpec` and `lazyCode` to lazily create code on visit [#145](https://github.com/dart-lang/code_builder/issues/145).
Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ All submissions, including submissions by project members, require review.
### File headers
All files in the project must start with the following header.

// Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
// Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.

Expand Down
3 changes: 1 addition & 2 deletions pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: code_builder
version: 2.0.0-beta
version: 2.0.0
description: A fluent API for generating Dart code
author: Dart Team <misc@dartlang.org>
homepage: https://github.com/dart-lang/code_builder
Expand All @@ -17,6 +17,5 @@ dependencies:
dev_dependencies:
build_runner: '>=0.4.0 <0.6.0'
built_value_generator: '>=2.0.0 <5.0.0'
io: '>=0.1.0 <0.3.0'
source_gen: '^0.7.0'
test: ^0.12.0

0 comments on commit f7d053c

Please sign in to comment.