Skip to content

Commit

Permalink
Add cleanup of .g.part files (dart-lang/source_gen#362)
Browse files Browse the repository at this point in the history
Towards dart-lang/source_gen#319

These never need to be served or included in the merged output directory
so they should always be cleaned by the post process builder.
  • Loading branch information
natebosch authored Jul 19, 2018
1 parent 2c3fe5d commit 7e6fca7
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
7 changes: 6 additions & 1 deletion source_gen/source_gen/source_gen/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,9 @@ builders:
build_extensions: {".dart": [".g.dart"]}
auto_apply: none
build_to: source
required_inputs: ['.g.part']
required_inputs: [".g.part"]
applies_builders: ["source_gen|part_cleanup"]
post_process_builders:
part_cleanup:
import: "package:source_gen/builder.dart"
builder_factory: "partCleanup"
3 changes: 3 additions & 0 deletions source_gen/source_gen/source_gen/lib/builder.dart
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ Builder combiningBuilder([BuilderOptions options]) {
return builder;
}

PostProcessBuilder partCleanup(BuilderOptions options) =>
const FileDeletingBuilder(const ['.g.part']);

/// A [Builder] which combines part files generated from [SharedPartBuilder].
///
/// This will glob all files of the form `.*.g.part`.
Expand Down
2 changes: 1 addition & 1 deletion source_gen/source_gen/source_gen/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ environment:
dependencies:
analyzer: '>=0.31.0 <0.33.0'
async: ^2.0.7
build: '>=0.10.0 <0.13.0'
build: ^0.12.4
dart_style: '>=0.1.7 <2.0.0'
meta: ^1.1.0
path: ^1.3.2
Expand Down

0 comments on commit 7e6fca7

Please sign in to comment.