public static ImmutableSet<Path> createPackageLookupPathSet(IjModuleGraph moduleGraph) {
    ImmutableSet.Builder<Path> builder = ImmutableSet.builder();

    for (IjModule module : moduleGraph.getModuleNodes()) {
      for (IjFolder folder : module.getFolders()) {
        if (!folder.getWantsPackagePrefix()) {
          continue;
        }
        Optional<Path> firstJavaFile =
            FluentIterable.from(folder.getInputs())
                .filter(
                    new Predicate<Path>() {
                      @Override
                      public boolean apply(Path input) {
                        return input.getFileName().toString().endsWith(".java");
                      }
                    })
                .first();
        if (firstJavaFile.isPresent()) {
          builder.add(firstJavaFile.get());
        }
      }
    }

    return builder.build();
  }
  private static ImmutableSet<IjModule> createModulesToBeWritten(IjModuleGraph graph) {
    Path rootModuleBasePath = Paths.get("");
    boolean hasRootModule =
        FluentIterable.from(graph.getModuleNodes())
            .transform(IjModule.TO_MODULE_BASE_PATH)
            .contains(rootModuleBasePath);

    ImmutableSet<IjModule> supplementalModules = ImmutableSet.of();
    if (!hasRootModule) {
      supplementalModules =
          ImmutableSet.of(
              IjModule.builder()
                  .setModuleBasePath(rootModuleBasePath)
                  .setTargets(ImmutableSet.<TargetNode<?>>of())
                  .build());
    }

    return FluentIterable.from(graph.getModuleNodes()).append(supplementalModules).toSet();
  }