@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); } }
@Override public void apply(Settings settings) { Gradle gradle = settings.getGradle(); final WorkspaceExtension workspaceExtension = addWorkspaceExtension(settings); for (ProjectConfigurator projectConfigurator : workspaceExtension.getProjectConfigurators()) { for (File rootDir : projectConfigurator.getDefaultRootDirs()) { for (File projectDir : projectConfigurator.getProjectDirs(rootDir)) { String projectPath = GradleUtil.getProjectPath(projectDir, settings.getRootDir()); settings.include(new String[] {projectPath}); _projectConfiguratorsMap.put(projectPath, projectConfigurator); } } } gradle.beforeProject( new Closure<Void>(null) { @SuppressWarnings("unused") public void doCall(Project project) { Plugin<Project> plugin = null; if (project.getParent() == null) { plugin = workspaceExtension.getRootProjectConfigurator(); } else { plugin = _projectConfiguratorsMap.get(project.getPath()); } if (plugin != null) { plugin.apply(project); } } }); }