public static @NotNull Map<File, String> getSourceRootsWithDependents(ModuleChunk chunk) {
    final boolean includeTests = chunk.containsTests();
    final Map<File, String> result = new LinkedHashMap<>();
    processModulesRecursively(chunk, JpsJavaClasspathKind.compile(includeTests), module -> {
      for (JpsModuleSourceRoot root : module.getSourceRoots()) {
        if (root.getRootType().equals(JavaSourceRootType.SOURCE) ||
            includeTests && root.getRootType().equals(JavaSourceRootType.TEST_SOURCE)) {
          String prefix = ((JavaSourceRootProperties)root.getProperties()).getPackagePrefix();
          if (!prefix.isEmpty()) {
            prefix = prefix.replace('.', '/');
            if (!prefix.endsWith("/")) {
              prefix += "/";
            }
          }
          else {
            prefix = null;
          }
          result.put(JpsPathUtil.urlToFile(root.getUrl()), prefix);
        }
      }
    });
    return result;
  }
public static @NotNull Map<File, String> getSourceRootsWithDependents(ModuleChunk chunk)