/**
  * @param chunk
  * @return mapping "sourceRoot" -> "package prefix" Package prefix uses slashes instead of dots
  *     and ends with trailing slash
  */
 public static Map<File, String> getSourceRootsWithDependents(ModuleChunk chunk) {
   final boolean includeTests = chunk.containsTests();
   final Map<File, String> result = new LinkedHashMap<File, String>();
   processModulesRecursively(
       chunk,
       JpsJavaClasspathKind.compile(includeTests),
       new Consumer<JpsModule>() {
         @Override
         public void consume(JpsModule module) {
           for (JpsModuleSourceRoot root : module.getSourceRoots()) {
             if (root.getRootType().equals(JavaSourceRootType.SOURCE)
                 || includeTests && root.getRootType().equals(JavaSourceRootType.TEST_SOURCE)) {
               JavaSourceRootProperties properties =
                   (JavaSourceRootProperties)
                       ((JpsSimpleElement<?>) root.getProperties()).getData();
               String prefix = properties.getPackagePrefix();
               if (!prefix.isEmpty()) {
                 prefix = prefix.replace('.', '/');
                 if (!prefix.endsWith("/")) {
                   prefix += "/";
                 }
               } else {
                 prefix = null;
               }
               result.put(JpsPathUtil.urlToFile(root.getUrl()), prefix);
             }
           }
         }
       });
   return result;
 }
 public Collection<File> getCompilationClasspath(
     ModuleChunk chunk, boolean excludeMainModuleOutput) {
   return getClasspathFiles(
       chunk,
       JpsJavaClasspathKind.compile(chunk.containsTests()),
       excludeMainModuleOutput,
       ClasspathPart.AFTER_JDK,
       true);
 }
 public static Collection<File> getOutputPathsWithDependents(final ModuleChunk chunk) {
   final boolean forTests = chunk.containsTests();
   final Set<File> sourcePaths = new LinkedHashSet<File>();
   processModulesRecursively(
       chunk,
       JpsJavaClasspathKind.compile(forTests),
       new Consumer<JpsModule>() {
         @Override
         public void consume(JpsModule module) {
           addFile(
               sourcePaths, JpsJavaExtensionService.getInstance().getOutputUrl(module, forTests));
         }
       });
   return sourcePaths;
 }