/**
  * Populates {@link GradleModule#getContentRoots() content roots} of the given intellij module on
  * the basis of the information contained at the given gradle module.
  *
  * @param gradleModule holder of the module information received from the gradle tooling api
  * @param intellijModule corresponding module from intellij gradle plugin domain
  * @throws IllegalArgumentException if given gradle module contains invalid data
  */
 private static void populateContentRoots(
     @NotNull IdeaModule gradleModule, @NotNull GradleModule intellijModule)
     throws IllegalArgumentException {
   DomainObjectSet<? extends IdeaContentRoot> contentRoots = gradleModule.getContentRoots();
   if (contentRoots == null) {
     return;
   }
   for (IdeaContentRoot gradleContentRoot : contentRoots) {
     if (gradleContentRoot == null) {
       continue;
     }
     File rootDirectory = gradleContentRoot.getRootDirectory();
     if (rootDirectory == null) {
       continue;
     }
     GradleContentRoot intellijContentRoot =
         new GradleContentRoot(intellijModule, rootDirectory.getAbsolutePath());
     populateContentRoot(
         intellijContentRoot, SourceType.SOURCE, gradleContentRoot.getSourceDirectories());
     populateContentRoot(
         intellijContentRoot, SourceType.TEST, gradleContentRoot.getTestDirectories());
     Set<File> excluded = gradleContentRoot.getExcludeDirectories();
     if (excluded != null) {
       for (File file : excluded) {
         intellijContentRoot.storePath(SourceType.EXCLUDED, file.getAbsolutePath());
       }
     }
     intellijModule.addContentRoot(intellijContentRoot);
   }
 }