Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feature: add build.yaml setup for CombiningBuilder (dart-lang/source_…
Browse files Browse the repository at this point in the history
kevmoo authored Jun 18, 2018
1 parent b7113e1 commit afe69bc
Showing 2 changed files with 20 additions and 0 deletions.
9 changes: 9 additions & 0 deletions pkgs/source_gen/source_gen/build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Read about `build.yaml` at https://pub.dartlang.org/packages/build_config
builders:
combining_builder:
import: "package:source_gen/builder.dart"
builder_factories: ["combiningBuilder"]
build_extensions: {".dart": [".g.dart"]}
auto_apply: none
build_to: source
required_inputs: ['.g.part']
11 changes: 11 additions & 0 deletions pkgs/source_gen/source_gen/lib/builder.dart
Original file line number Diff line number Diff line change
@@ -24,6 +24,17 @@ import 'src/builder.dart';
const _outputExtensions = '.g.dart';
const _partFiles = '.g.part';

Builder combiningBuilder([BuilderOptions options]) {
if (options != null && options.config.isNotEmpty) {
if (log == null) {
throw new StateError('Upgrade `build_runner` to at least 0.8.2.');
} else {
log.warning('These options were ignored: `${options.config}`.');
}
}
return const CombiningBuilder();
}

/// A [Builder] which combines part files generated from [SharedPartBuilder].
///
/// This will glob all files of the form `.*.g.part`.

0 comments on commit afe69bc

Please sign in to comment.