File tree Expand file tree Collapse file tree 4 files changed +29
-2
lines changed
pkgs/provides_builder/lib Expand file tree Collapse file tree 4 files changed +29
-2
lines changed Original file line number Diff line number Diff line change @@ -25,9 +25,15 @@ class _SomeBuilder implements Builder {
25
25
Future build (BuildStep buildStep) async {
26
26
if (! await buildStep.canRead (buildStep.inputId)) return ;
27
27
28
- await buildStep.writeAsBytes (
28
+ final content = await buildStep.readAsString (buildStep.inputId);
29
+
30
+ if (content.contains ('// resolve_me' )) {
31
+ await buildStep.resolver.libraryFor (buildStep.inputId);
32
+ }
33
+
34
+ await buildStep.writeAsString (
29
35
buildStep.inputId.changeExtension ('.something.dart' ),
30
- buildStep. readAsBytes (buildStep.inputId) ,
36
+ content ,
31
37
);
32
38
}
33
39
}
Original file line number Diff line number Diff line change @@ -144,5 +144,23 @@ void main() {
144
144
]),
145
145
);
146
146
});
147
+
148
+ test ('incremental build after resolve missing import' , () async {
149
+ final dartSource = File (p.join ('lib' , 'app.dart' ));
150
+ dartSource.writeAsStringSync (
151
+ // Trigger resolving source in pkgs/provides_builder/lib/builders.dart.
152
+ '// resolve_me\n '
153
+ // Resolve an import that does not exist.
154
+ "import 'package:missing/missing.dart';\n "
155
+ '${dartSource .readAsStringSync ()}' ,
156
+ );
157
+ await runBuild ();
158
+
159
+ // Rebuild and check the previously-missing import does not cause a crash.
160
+ dartSource.writeAsStringSync ('//\n ${dartSource .readAsStringSync ()}' );
161
+
162
+ final result = await runBuild ();
163
+ expect (result.stdout, isNot (contains ('PackageNotFoundException' )));
164
+ });
147
165
});
148
166
}
Original file line number Diff line number Diff line change 1
1
## 9.2.0-wip
2
2
3
3
- Removed unused dev_deps: ` test_process ` .
4
+ - Bug fix: fix incremental build after build with import of missing package.
4
5
5
6
## 9.2.0-dev.1
6
7
Original file line number Diff line number Diff line change @@ -454,6 +454,8 @@ class SingleStepReaderWriter extends AssetReader
454
454
// Add to the graph for input tracking.
455
455
_runningBuild.assetGraph.add (AssetNode .missingSource (id));
456
456
return PhasedValue .fixed ('' );
457
+ } else if (node.type == NodeType .missingSource) {
458
+ return PhasedValue .fixed ('' );
457
459
}
458
460
459
461
if (node.type == NodeType .generated) {
You can’t perform that action at this time.
0 commit comments