@@ -142,7 +142,8 @@ Future<InitializedCompilerState> initializeIncrementalCompiler(
142
142
Target target,
143
143
{FileSystem fileSystem,
144
144
Map <ExperimentalFlag , bool > experiments,
145
- Map <String , String > environmentDefines}) async {
145
+ Map <String , String > environmentDefines,
146
+ bool trackNeededDillLibraries: false }) async {
146
147
inputSummaries.sort ((a, b) => a.toString ().compareTo (b.toString ()));
147
148
148
149
IncrementalCompiler incrementalCompiler;
@@ -189,6 +190,7 @@ Future<InitializedCompilerState> initializeIncrementalCompiler(
189
190
workerInputCache[sdkSummary] = cachedSdkInput;
190
191
incrementalCompiler = new IncrementalCompiler .fromComponent (
191
192
new CompilerContext (processedOpts), cachedSdkInput.component);
193
+ incrementalCompiler.trackNeededDillLibraries = trackNeededDillLibraries;
192
194
} else {
193
195
options = oldState.options;
194
196
options.inputSummaries = inputSummaries;
@@ -205,6 +207,7 @@ Future<InitializedCompilerState> initializeIncrementalCompiler(
205
207
// Reuse the incremental compiler, but reset as needed.
206
208
incrementalCompiler = oldState.incrementalCompiler;
207
209
incrementalCompiler.invalidateAllSources ();
210
+ incrementalCompiler.trackNeededDillLibraries = trackNeededDillLibraries;
208
211
options.packagesFileUri = packagesFile;
209
212
options.fileSystem = fileSystem;
210
213
processedOpts.clearFileSystemCache ();
@@ -215,6 +218,10 @@ Future<InitializedCompilerState> initializeIncrementalCompiler(
215
218
incrementalCompiler: incrementalCompiler);
216
219
217
220
CanonicalName nameRoot = cachedSdkInput.component.root;
221
+ Map <Uri , Uri > libraryToInputDill;
222
+ if (trackNeededDillLibraries) {
223
+ libraryToInputDill = new Map <Uri , Uri >();
224
+ }
218
225
List <int > loadFromDillIndexes = new List <int >();
219
226
220
227
// Notice that the ordering of the input summaries matter, so we need to
@@ -238,6 +245,9 @@ Future<InitializedCompilerState> initializeIncrementalCompiler(
238
245
var component = cachedInput.component;
239
246
for (var lib in component.libraries) {
240
247
lib.isExternal = cachedInput.externalLibs.contains (lib.importUri);
248
+ if (trackNeededDillLibraries) {
249
+ libraryToInputDill[lib.importUri] = inputSummary;
250
+ }
241
251
}
242
252
component.computeCanonicalNames ();
243
253
doneInputSummaries[i] = component;
@@ -258,13 +268,19 @@ Future<InitializedCompilerState> initializeIncrementalCompiler(
258
268
.loadComponent (bytes, nameRoot, alwaysCreateNewNamedNodes: true ));
259
269
workerInputCache[summary] = cachedInput;
260
270
doneInputSummaries[index] = cachedInput.component;
271
+ if (trackNeededDillLibraries) {
272
+ for (var lib in cachedInput.component.libraries) {
273
+ libraryToInputDill[lib.importUri] = summary;
274
+ }
275
+ }
261
276
}
262
277
263
278
incrementalCompiler.setModulesToLoadOnNextComputeDelta (doneInputSummaries);
264
279
265
280
return new InitializedCompilerState (options, processedOpts,
266
281
workerInputCache: workerInputCache,
267
- incrementalCompiler: incrementalCompiler);
282
+ incrementalCompiler: incrementalCompiler,
283
+ libraryToInputDill: libraryToInputDill);
268
284
}
269
285
270
286
Future <DdcResult > compile (InitializedCompilerState compilerState,
0 commit comments