private static void collectDependencies(RuntimeModuleDescriptor descriptor,
                                          Set<RuntimeModuleDescriptor> rootModules,
                                          Set<RuntimeModuleDescriptor> visited,
                                          List<IncludedRuntimeModule> result) {
    for (RuntimeModuleDescriptor dependency : descriptor.getDependencies()) {
      if (!visited.add(dependency)) continue;
      if (!rootModules.contains(dependency)) {
        result.add(new IncludedRuntimeModuleImpl(dependency, ModuleImportance.SERVICE));
      }
      collectDependencies(dependency, rootModules, visited, result);
    }
  }
private static void collectDependencies(RuntimeModuleDescriptor descriptor,
                                          Set<RuntimeModuleDescriptor> rootModules,
                                          Set<RuntimeModuleDescriptor> visited,
                                          List<IncludedRuntimeModule> result)