private static void verifyLibraryRootsChecksums(@NotNull CompileContext context,
                                                  @NotNull String libraryName,
                                                  @NotNull JpsMavenRepositoryLibraryDescriptor descriptor,
                                                  @NotNull List<File> compiledRoots,
                                                  boolean verifySha256Checksums) throws ArtifactVerificationException {
    // don't verify checksums if the library doesn't have a fixed version or when verification is disabled
    if (!verifySha256Checksums || !isLibraryVersionFixed(descriptor)) {
      return;
    }

    if (!isAllCompiledRootsVerificationPresent(descriptor, compiledRoots)) {
      throw new ArtifactVerificationException(JpsBuildBundle.message("build.message.error.compile.roots.verification.mismatch",
                                                                     libraryName));
    }

    List<Path> allCompiledRoots = ContainerUtil.map(compiledRoots, File::toPath);
    List<Path> missingCompiledRoots = ContainerUtil.filter(allCompiledRoots, rootFile -> !Files.exists(rootFile));

    if (!missingCompiledRoots.isEmpty()) {
      reportMissingCompiledRootArtifacts(context, libraryName, descriptor, allCompiledRoots, missingCompiledRoots);
      throw new ArtifactVerificationException(
        JpsBuildBundle.message("build.message.error.missing.artifacts", libraryName, missingCompiledRoots.toString())
      );
    }

    Map<String, ArtifactVerification> absolutePathToVerificationMetadata = descriptor.getArtifactsVerification()
      .stream()
      .collect(Collectors.toMap(it -> JpsPathUtil.urlToFile(it.getUrl()).getAbsolutePath(), it -> it));

    for (File compiledRoot : compiledRoots) {
      ArtifactVerification verification = absolutePathToVerificationMetadata.get(compiledRoot.getAbsolutePath());
      checkSha256ChecksumValid(context, descriptor, libraryName, verification);
    }
  }
private static void verifyLibraryRootsChecksums(@NotNull CompileContext context,
                                                  @NotNull String libraryName,
                                                  @NotNull JpsMavenRepositoryLibraryDescriptor descriptor,
                                                  @NotNull List<File> compiledRoots,
                                                  boolean verifySha256Checksums)