Skip to content

Commit

Permalink
add a builder to clean up transitive digests (#3625)
Browse files Browse the repository at this point in the history
  • Loading branch information
jakemac53 authored Dec 13, 2023
1 parent 7368a7a commit 1fccc73
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 1 deletion.
5 changes: 5 additions & 0 deletions _test/test/goldens/generated_build_script.dart
Original file line number Diff line number Diff line change
Expand Up @@ -136,11 +136,16 @@ final _builders = <_i1.BuilderApplication>[
_i1.toAllPackages(),
isOptional: true,
hideOutput: true,
appliesBuilders: const [r'build_resolvers:transitive_digest_cleanup'],
),
_i1.applyPostProcess(
r'build_modules:module_cleanup',
_i6.moduleCleanup,
),
_i1.applyPostProcess(
r'build_resolvers:transitive_digest_cleanup',
_i8.transitiveDigestCleanup,
),
_i1.applyPostProcess(
r'build_web_compilers:dart2js_archive_extractor',
_i3.dart2jsArchiveExtractor,
Expand Down
4 changes: 4 additions & 0 deletions build_resolvers/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 2.4.2

- Add a builder to clean up transitive digest files from the build output.

## 2.4.1

- Fix an issue where deleted files were not removed from the analysis engine,
Expand Down
6 changes: 6 additions & 0 deletions build_resolvers/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,9 @@ builders:
is_optional: True
required_inputs: [".dart"]
build_to: cache
applies_builders:
- :transitive_digest_cleanup
post_process_builders:
transitive_digest_cleanup:
import: "package:build_resolvers/builder.dart"
builder_factory: transitiveDigestCleanup
4 changes: 4 additions & 0 deletions build_resolvers/lib/builder.dart
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ import 'src/build_asset_uri_resolver.dart';

Builder transitiveDigestsBuilder(_) => _TransitiveDigestsBuilder();

PostProcessBuilder transitiveDigestCleanup(BuilderOptions options) =>
FileDeletingBuilder([transitiveDigestExtension],
isEnabled: options.config['enabled'] as bool? ?? true);

/// Computes a digest comprised of the current libraries digest as well as its
/// transitive dependency digests, and writes it to a file next to the library.
///
Expand Down
2 changes: 1 addition & 1 deletion build_resolvers/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: build_resolvers
version: 2.4.1
version: 2.4.2
description: Resolve Dart code in a Builder
repository: https://github.com/dart-lang/build/tree/master/build_resolvers

Expand Down

0 comments on commit 1fccc73

Please sign in to comment.