@@ -46,7 +46,7 @@ class AssetGraph implements GeneratedAssetHider {
46
46
47
47
final BuiltMap <String , LanguageVersion ?> packageLanguageVersions;
48
48
49
- Map <AssetId , Set <AssetId >>? _anchorOutputs ;
49
+ final Map <PostProcessAction , Set <AssetId >> _postProcessActions = {} ;
50
50
51
51
AssetGraph ._(
52
52
this .buildPhasesDigest,
@@ -161,11 +161,6 @@ class AssetGraph implements GeneratedAssetHider {
161
161
}
162
162
_nodesByPackage.putIfAbsent (node.id.package, () => {})[node.id.path] = node;
163
163
164
- if (node.type == NodeType .postProcessAnchor) {
165
- // Invalidate `_anchorOutputs`, it will be recomputed when needed.
166
- _anchorOutputs = null ;
167
- }
168
-
169
164
return node;
170
165
}
171
166
@@ -255,14 +250,14 @@ class AssetGraph implements GeneratedAssetHider {
255
250
var node = get (id);
256
251
if (node == null ) return removedIds;
257
252
removedIds.add (id);
258
- anchorOutputs ?? = _computeAnchorOutputs ();
253
+ /* anchorOutputs ??= _computeAnchorOutputs();
259
254
for (var anchor in (anchorOutputs[node.id] ?? const <AssetId>{})) {
260
255
_removeRecursive(
261
256
anchor,
262
257
removedIds: removedIds,
263
258
anchorOutputs: anchorOutputs,
264
259
);
265
- }
260
+ }*/
266
261
for (var output in node.primaryOutputs.toList ()) {
267
262
_removeRecursive (
268
263
output,
@@ -320,7 +315,7 @@ class AssetGraph implements GeneratedAssetHider {
320
315
/// Returns a cached value if possible. Recomputes if any
321
316
/// [AssetNode.postProcessAnchor] has been added since it was last computed;
322
317
/// not recomputed for removes as values for missing nodes are harmless.
323
- Map <AssetId , Set <AssetId >> _computeAnchorOutputs () {
318
+ /* Map<AssetId, Set<AssetId>> _computeAnchorOutputs() {
324
319
if (_anchorOutputs != null) return _anchorOutputs!;
325
320
final result = <AssetId, Set<AssetId>>{};
326
321
for (final node in allNodes) {
@@ -330,7 +325,7 @@ class AssetGraph implements GeneratedAssetHider {
330
325
}
331
326
}
332
327
return _anchorOutputs = result;
333
- }
328
+ }*/
334
329
335
330
/// All nodes in the graph, whether source files or generated outputs.
336
331
Iterable <AssetNode > get allNodes =>
@@ -340,6 +335,21 @@ class AssetGraph implements GeneratedAssetHider {
340
335
Iterable <AssetNode > packageNodes (String package) =>
341
336
_nodesByPackage[package]? .values ?? [];
342
337
338
+ Iterable <PostProcessAction > packagePostProcessActions (String package) =>
339
+ _postProcessActions.keys.where ((a) => a.primaryInput.package == package);
340
+
341
+ void clearPostProcessActionOutputs (PostProcessAction action) {
342
+ _postProcessActions[action]! .clear ();
343
+ }
344
+
345
+ void addPostProcessActionOutput (PostProcessAction action, AssetId output) {
346
+ _postProcessActions[action]! .add (output);
347
+ }
348
+
349
+ Iterable <AssetId > postProcessActionOutputs (PostProcessAction action) {
350
+ return _postProcessActions[action]! ;
351
+ }
352
+
343
353
/// All the generated outputs in the graph.
344
354
Iterable <AssetId > get outputs =>
345
355
allNodes.where ((n) => n.type == NodeType .generated).map ((n) => n.id);
@@ -649,12 +659,12 @@ class AssetGraph implements GeneratedAssetHider {
649
659
var inputs = allInputs.where ((input) => _actionMatches (action, input));
650
660
for (var input in inputs) {
651
661
var buildOptionsNodeId = builderOptionsIdForAction (action, actionNum);
652
- var anchor = AssetNode . postProcessAnchorForInputAndAction (
653
- input,
654
- actionNum,
655
- buildOptionsNodeId,
656
- );
657
- add (anchor) ;
662
+ var postProcessAction = PostProcessAction ((b) {
663
+ b.primaryInput = input;
664
+ b.actionNumber = actionNum;
665
+ b.builderOptionsId = buildOptionsNodeId;
666
+ } );
667
+ _postProcessActions[postProcessAction] = {} ;
658
668
}
659
669
actionNum++ ;
660
670
}
0 commit comments