@Override
  public void apply(Settings settings) {
    File rootDir = settings.getRootDir();

    Path rootDirPath = rootDir.toPath();

    String projectPathPrefix =
        GradleUtil.getProperty(settings, PROJECT_PATH_PREFIX_PROPERTY_NAME, "");

    if (Validator.isNotNull(projectPathPrefix)) {
      if (projectPathPrefix.charAt(0) != ':') {
        projectPathPrefix = ":" + projectPathPrefix;
      }

      if (projectPathPrefix.charAt(projectPathPrefix.length() - 1) == ':') {

        projectPathPrefix = projectPathPrefix.substring(0, projectPathPrefix.length() - 1);
      }
    }

    try {
      _includeProjects(settings, rootDirPath, rootDirPath, projectPathPrefix);
    } catch (IOException ioe) {
      throw new UncheckedIOException(ioe);
    }
  }
  private void _configureAppTLDDocBuilder(Project project, Project privateProject) {

    if (privateProject == null) {
      return;
    }

    AppTLDDocBuilderExtension appTLDDocBuilderExtension =
        GradleUtil.getExtension(project, AppTLDDocBuilderExtension.class);

    appTLDDocBuilderExtension.subprojects(privateProject.getSubprojects());
  }
  private void _configureTaskAppJavadoc(Project project, String appTitle, String appVersion) {

    Javadoc javadoc =
        (Javadoc) GradleUtil.getTask(project, AppJavadocBuilderPlugin.APP_JAVADOC_TASK_NAME);

    File portalRootDir = GradleUtil.getRootDir(project.getRootProject(), "portal-impl");

    if (portalRootDir != null) {
      File stylesheetFile = new File(portalRootDir, "tools/styles/javadoc.css");

      if (stylesheetFile.exists()) {
        StandardJavadocDocletOptions standardJavadocDocletOptions =
            (StandardJavadocDocletOptions) javadoc.getOptions();

        standardJavadocDocletOptions.setStylesheetFile(stylesheetFile);
      }
    }

    if (Validator.isNotNull(appTitle) && Validator.isNotNull(appVersion)) {
      String title = String.format("%s %s API", appTitle, appVersion);

      javadoc.setTitle(title);
    }
  }
  private void _configureAppJavadocBuilder(Project project, Project privateProject) {

    AppJavadocBuilderExtension appJavadocBuilderExtension =
        GradleUtil.getExtension(project, AppJavadocBuilderExtension.class);

    appJavadocBuilderExtension.onlyIf(
        new Spec<Project>() {

          @Override
          public boolean isSatisfiedBy(Project project) {
            TaskContainer taskContainer = project.getTasks();

            WritePropertiesTask recordArtifactTask =
                (WritePropertiesTask)
                    taskContainer.findByName(LiferayRelengPlugin.RECORD_ARTIFACT_TASK_NAME);

            if (recordArtifactTask != null) {
              File artifactPropertiesFile = recordArtifactTask.getOutputFile();

              if (artifactPropertiesFile.exists()) {
                return true;
              }
            }

            return false;
          }
        });

    appJavadocBuilderExtension.setGroupNameClosure(
        new Closure<String>(project) {

          @SuppressWarnings("unused")
          public String doCall(Project subproject) {
            return _getAppJavadocGroupName(subproject);
          }
        });

    if (privateProject != null) {
      appJavadocBuilderExtension.subprojects(privateProject.getSubprojects());
    }
  }
 private void _applyPlugins(Project project) {
   GradleUtil.applyPlugin(project, AppJavadocBuilderPlugin.class);
   GradleUtil.applyPlugin(project, AppTLDDocBuilderPlugin.class);
 }