anchor.diff:            ? data.userLoadedUriMain
             : componentWithDill.mainMethod;
   
  +      List<Library> outputLibraries;
         if (data.includeUserLoadedLibraries || fullComponent) {
  -        addReusedLibraries(
  -            libraries, mainMethod, entryPoint, reusedLibraries, data);
  +        outputLibraries = computeTransitiveClosure(
  +            compiledLibraries, mainMethod, entryPoint, reusedLibraries, data);
  +      } else {
  +        outputLibraries = compiledLibraries;
         }
   
         // Clean up.
         userCode.loader.releaseAncillaryResources();
   
         // This is the incremental component.
  -      return new Component(libraries: libraries, uriToSource: uriToSource)
  +      return new Component(libraries: outputLibraries, uriToSource: uriToSource)
           ..mainMethod = mainMethod;
       });
     }
   
  -  void addReusedLibraries(
  -      List<Library> libraries,
  +  List<Library> computeTransitiveClosure(
  +      List<Library> inputLibraries,
         Procedure mainMethod,
         Uri entry,
         List<LibraryBuilder> reusedLibraries,
         IncrementalCompilerData data) {
  +    List<Library> result = new List<Library>.from(inputLibraries);
       Map<Uri, Library> libraryMap = <Uri, Library>{};
  -    for (Library library in libraries) {
  +    for (Library library in inputLibraries) {
         libraryMap[library.importUri] = library;
       }
       List<Uri> worklist = new List<Uri>.from(libraryMap.keys);
  
positive.code:       if (bOrder != null) return 1;
        return 0;
      });
    }
  
    int prepareSummary(List<int> summaryBytes, UriTranslator uriTranslator,
  
negative.code:             await userCode.buildComponent(verify: c.options.verify);
        } on KernelIncrementalTargetErroneousComponent {
          List<Library> librariesWithSdk = userCode.component.libraries;
          List<Library> compiledLibraries = <Library>[];
          for (Library lib in librariesWithSdk) {
            if (lib.importUri.scheme == "dart") continue;
            compiledLibraries.add(lib);
            break;
          }
          userCode.loader.builders.clear();
          userCode = userCodeOld;
          return new Component(
              libraries: compiledLibraries, uriToSource: <Uri, Source>{});
        }
        userCodeOld?.loader?.builders?.clear();
        userCodeOld = null;
  
        List<Library> compiledLibraries =
            new List<Library>.from(userCode.loader.libraries);
        Map<Uri, Source> uriToSource =
            new Map<Uri, Source>.from(dillLoadedDataUriToSource);
  