Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade to latest build_runner. #342

Merged
merged 1 commit into from
Feb 12, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

language: dart
dart: stable
dart: dev
script:
- tool/presubmit
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# Changelog

# 5.2.0

- Upgrade to latest `built_runner`. You no longer need `build.dart` or
`watch.dart`. Instead, make sure you have a dev dependency on
`built_value_generator` and `build_runner`, then run
`pub run build_runner build` or `pub run build_runner watch`.
- Note: this version requires the pre release of the Dart 2 SDK.

# 5.1.3

- Generate simpler deserialization code for `built_collection` instances.
Expand Down
12 changes: 9 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,16 @@ built_value.
Simple examples are
[here](https://github.com/google/built_value.dart/tree/master/example/lib/example.dart).

Codegen is triggered via either a
[build.dart](https://github.com/google/built_value.dart/blob/master/example/tool/build.dart)
Since `v5.2.0` codegen is triggered by running `pub run build_runner build` to
do a one-off build or `pub run build_runner watch` to continuously watch your
source and update the generated output when it changes. Note that you need a
dev dependency on `built_value_generator` and `build_runner`. See the example
[pubspec.yaml](https://github.com/google/built_value.dart/blob/master/example/pubspec.yaml).

If using a version before v5.2.0, codegen is triggered via either a
[build.dart](https://github.com/google/built_value.dart/blob/92783c27a08ac3c73f28bb08736b9d4a30fa3b7e/example/tool/build.dart)
to do a one-off build or a
[watch.dart](https://github.com/google/built_value.dart/blob/master/example/tool/watch.dart)
[watch.dart](https://github.com/google/built_value.dart/blob/92783c27a08ac3c73f28bb08736b9d4a30fa3b7e/example/tool/watch.dart)
to continuously watch your source and update generated output.

## Value Types
Expand Down
18 changes: 11 additions & 7 deletions benchmark/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,23 +1,27 @@
name: benchmark
version: 5.1.3
version: 5.2.0
description: >
Benchmark, not for publishing.
authors:
- David Morgan <[email protected]>
homepage: https://github.com/google/built_value.dart

environment:
sdk: '>=1.8.0 <2.0.0'
sdk: '>=2-0-0-dev <2.0.0'

dependencies:
browser: any
built_collection: '>=2.0.0 <4.0.0'
built_value: ^5.1.3
built_value: ^5.2.0

dev_dependencies:
build: ^0.11.1
build_runner: ^0.6.0
built_value_generator: ^5.1.3
source_gen: ^0.7.0
build_runner: ^0.7.9
# built_value_generator: ^5.2.0
built_value_generator:
path: ../built_value_generator
quiver: '>=0.21.0 <0.29.0'
test: any

dependency_overrides:
built_value:
path: ../built_value
20 changes: 0 additions & 20 deletions benchmark/tool/build.dart

This file was deleted.

20 changes: 0 additions & 20 deletions benchmark/tool/watch.dart

This file was deleted.

5 changes: 3 additions & 2 deletions built_value/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: built_value
version: 5.1.3
version: 5.2.0
description: >
Value types with builders, Dart classes as enums, and serialization.
This library is the runtime dependency.
Expand All @@ -8,9 +8,10 @@ authors:
homepage: https://github.com/google/built_value.dart

environment:
sdk: '>=1.21.0 <2.0.0'
sdk: '>=2-0-0-dev <2.0.0'

dependencies:
build_config: ^0.2.3
built_collection: '>=2.0.0 <4.0.0'
collection: ^1.0.0
fixnum: ^0.10.0
Expand Down
8 changes: 8 additions & 0 deletions built_value_generator/build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
builders:
built_value:
target: ":built_value_generator"
import: "package:built_value_generator/builder.dart"
builder_factories: ["builtValue"]
build_extensions: {".dart": [".g.dart"]}
auto_apply: dependents
build_to: source
12 changes: 12 additions & 0 deletions built_value_generator/lib/builder.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
// Copyright (c) 2018, Google Inc. 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:build/build.dart';

import 'package:built_value_generator/built_value_generator.dart';
import 'package:source_gen/source_gen.dart';

Builder builtValue(BuilderOptions options) => new PartBuilder([
new BuiltValueGenerator(),
], requireLibraryDirective: false);
20 changes: 12 additions & 8 deletions built_value_generator/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: built_value_generator
version: 5.1.3
version: 5.2.0
description: >
Value types with builders, Dart classes as enums, and serialization.
This library is the dev dependency.
Expand All @@ -8,17 +8,21 @@ authors:
homepage: https://github.com/google/built_value.dart

environment:
sdk: '>=1.12.0-dev.5.10 <2.0.0'
sdk: '>=2-0-0-dev <2.0.0'

dependencies:
analyzer: '>=0.29.0 <0.31.0'
build: ^0.11.1
analyzer: '>=0.29.0 <0.32.0'
build: ^0.12.0
built_collection: '>=2.0.0 <4.0.0'
built_value: ^5.1.3
source_gen: ^0.7.0
# built_value: ^5.2.0
source_gen: ^0.7.4
quiver: '>=0.21.0 <0.29.0'

dev_dependencies:
build_test: ^0.9.0
build_runner: ^0.6.0
build_test: ^0.10.0
build_runner: ^0.7.9
test: any

dependency_overrides:
built_value:
path: ../built_value
4 changes: 2 additions & 2 deletions built_value_generator/test/enum_class_generator_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -104,11 +104,11 @@ void main() {
await generate(correctInput.replaceAll(
'class TestEnum extends EnumClass {',
'class TestEnum extends EnumClass {\n'
' static const anInt = 3;')),
' static const aNull = null;')),
endsWith(r'''
// Error: Please make the following changes to use EnumClass:
//
// 1. Specify a type for field "anInt".
// 1. Specify a type for field "aNull".
'''));
});

Expand Down
20 changes: 0 additions & 20 deletions built_value_generator/tool/build.dart

This file was deleted.

17 changes: 10 additions & 7 deletions built_value_test/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: built_value_test
version: 5.1.3
version: 5.2.0
description: >
Value types with builders, Dart classes as enums, and serialization.
This library provides test support.
Expand All @@ -8,17 +8,20 @@ authors:
homepage: https://github.com/google/built_value.dart

environment:
sdk: '>=1.8.0 <2.0.0'
sdk: '>=2-0-0-dev <2.0.0'

dependencies:
built_value: ^5.1.3
built_value: ^5.2.0
built_collection: '>=2.0.0 <4.0.0'
collection: ^1.0.0
quiver: '>=0.21.0 <0.29.0'
test: any

dev_dependencies:
build: ^0.11.1
build_runner: ^0.6.0
built_value_generator: ^5.1.3
source_gen: ^0.7.0
build_runner: ^0.7.9
built_value_generator:
path: ../built_value_generator

dependency_overrides:
built_value:
path: ../built_value
18 changes: 11 additions & 7 deletions chat_example/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,26 +1,30 @@
name: chat_example
version: 5.1.3
version: 5.2.0
description: >
Just an example, not for publishing.
authors:
- David Morgan <[email protected]>
homepage: https://github.com/google/built_value.dart

environment:
sdk: '>=1.8.0 <2.0.0'
sdk: '>=2-0-0-dev <2.0.0'

dependencies:
browser: ^0.10.0
built_collection: '>=2.0.0 <4.0.0'
built_value: ^5.1.3
built_value: ^5.2.0
shelf: ^0.6.0
shelf_proxy: ^0.1.0
shelf_web_socket: ^0.2.1
web_socket_channel: ^1.0.0

dev_dependencies:
build: ^0.11.1
build_runner: ^0.6.0
built_value_generator: ^5.1.3
source_gen: ^0.7.0
build_runner: ^0.7.9
# built_value_generator: ^5.2.0
built_value_generator:
path: ../built_value_generator
test: any

dependency_overrides:
built_value:
path: ../built_value
21 changes: 0 additions & 21 deletions chat_example/tool/build.dart

This file was deleted.

22 changes: 0 additions & 22 deletions chat_example/tool/watch.dart

This file was deleted.

18 changes: 11 additions & 7 deletions end_to_end_test/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,23 +1,27 @@
name: end_to_end_test
version: 5.1.3
version: 5.2.0
description: >
Tests, not for publishing.
authors:
- David Morgan <[email protected]>
homepage: https://github.com/google/built_value.dart

environment:
sdk: '>=1.8.0 <2.0.0'
sdk: '>=2-0-0-dev <2.0.0'

dependencies:
built_collection: '>=2.0.0 <4.0.0'
built_value: ^5.1.3
built_value: ^5.2.0

dev_dependencies:
build: ^0.11.1
build_runner: ^0.6.0
built_value_generator: ^5.1.3
build: ^0.12.0
# built_value_generator: ^5.2.0
built_value_generator:
path: ../built_value_generator
fixnum: ^0.10.0
source_gen: ^0.7.0
quiver: '>=0.21.0 <0.29.0'
test: any

dependency_overrides:
built_value:
path: ../built_value
Loading