Java Code Examples for org.gradle.api.Project#getAllprojects()

The following examples show how to use org.gradle.api.Project#getAllprojects() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: BasePlugin.java    From javaide with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Check the sub-projects structure :
 * So far, checks that 2 modules do not have the same identification (group+name).
 */
private void checkModulesForErrors() {
    Project rootProject = project.getRootProject();
    Map<String, Project> subProjectsById = new HashMap<String, Project>();
    for (Project subProject : rootProject.getAllprojects()) {
        String id = subProject.getGroup().toString() + ":" + subProject.getName();
        if (subProjectsById.containsKey(id)) {
            String message = String.format(
                    "Your project contains 2 or more modules with the same " +
                            "identification %1$s\n" +
                            "at \"%2$s\" and \"%3$s\".\n" +
                            "You must use different identification (either name or group) for " +
                            "each modules.",
                    id,
                    subProjectsById.get(id).getPath(),
                    subProject.getPath());
            throw new StopExecutionException(message);
        } else {
            subProjectsById.put(id, subProject);
        }
    }
}
 
Example 2
Source File: IdeaModelBuilder.java    From pushfish-android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
private void applyIdeaPlugin(Project root) {
    Set<Project> allProjects = root.getAllprojects();
    for (Project p : allProjects) {
        p.getPlugins().apply(IdeaPlugin.class);
    }
    root.getPlugins().getPlugin(IdeaPlugin.class).makeSureModuleNamesAreUnique();
}
 
Example 3
Source File: EclipseModelBuilder.java    From pushfish-android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
private void applyEclipsePlugin(Project root) {
    Set<Project> allProjects = root.getAllprojects();
    for (Project p : allProjects) {
        p.getPlugins().apply(EclipsePlugin.class);
    }
    root.getPlugins().getPlugin(EclipsePlugin.class).makeSureProjectNamesAreUnique();
}
 
Example 4
Source File: IdeaModelBuilder.java    From pushfish-android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
private void applyIdeaPlugin(Project root) {
    Set<Project> allProjects = root.getAllprojects();
    for (Project p : allProjects) {
        p.getPlugins().apply(IdeaPlugin.class);
    }
    root.getPlugins().getPlugin(IdeaPlugin.class).makeSureModuleNamesAreUnique();
}
 
Example 5
Source File: EclipseModelBuilder.java    From pushfish-android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
private void applyEclipsePlugin(Project root) {
    Set<Project> allProjects = root.getAllprojects();
    for (Project p : allProjects) {
        p.getPlugins().apply(EclipsePlugin.class);
    }
    root.getPlugins().getPlugin(EclipsePlugin.class).makeSureProjectNamesAreUnique();
}
 
Example 6
Source File: CurioGenericCiPlugin.java    From curiostack with MIT License 5 votes vote down vote up
private static Set<Project> computeAffectedProjects(Project project) {
  if (!Files.exists(project.getRootDir().toPath().resolve(".git"))) {
    project.getLogger().warn("No .git directory, building all projects.");
    return project.getAllprojects();
  }

  final Set<String> affectedRelativeFilePaths;
  try (Git git = Git.open(project.getRootDir())) {
    // TODO(choko): Validate the remote of the branch, which matters if there are forks.
    String branch = git.getRepository().getBranch();

    if (branch.equals("master")) {
      affectedRelativeFilePaths = computeAffectedFilesForMaster(git, project);
    } else {
      affectedRelativeFilePaths = computeAffectedFilesForBranch(git, branch, project);
    }
  } catch (IOException e) {
    throw new UncheckedIOException(e);
  }

  Set<Path> affectedPaths =
      affectedRelativeFilePaths.stream()
          .map(p -> Paths.get(project.getRootDir().getAbsolutePath(), p))
          .collect(Collectors.toSet());

  Map<Path, Project> projectsByPath =
      Collections.unmodifiableMap(
          project.getAllprojects().stream()
              .collect(
                  Collectors.toMap(
                      p -> Paths.get(p.getProjectDir().getAbsolutePath()), Function.identity())));

  project.getLogger().info("CI found affected paths {}", affectedPaths);
  project.getLogger().info("CI found affected projects {}", projectsByPath);

  return affectedPaths.stream()
      .map(f -> getProjectForFile(f, projectsByPath))
      .collect(Collectors.toSet());
}
 
Example 7
Source File: ReportUploader.java    From nomulus with Apache License 2.0 5 votes vote down vote up
void setProject(Project project) {
  this.project = project;

  for (Project subProject : project.getAllprojects()) {
    subProject.getTasks().all(this::addTask);
  }
}
 
Example 8
Source File: IdeaModelBuilder.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
private void applyIdeaPlugin(Project root) {
    Set<Project> allProjects = root.getAllprojects();
    for (Project p : allProjects) {
        p.getPlugins().apply(IdeaPlugin.class);
    }
    root.getPlugins().getPlugin(IdeaPlugin.class).makeSureModuleNamesAreUnique();
}
 
Example 9
Source File: EclipseModelBuilder.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
private void applyEclipsePlugin(Project root) {
    Set<Project> allProjects = root.getAllprojects();
    for (Project p : allProjects) {
        p.getPlugins().apply(EclipsePlugin.class);
    }
    root.getPlugins().getPlugin(EclipsePlugin.class).makeSureProjectNamesAreUnique();
}
 
Example 10
Source File: IdeaModelBuilder.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
private void applyIdeaPlugin(Project root) {
    Set<Project> allProjects = root.getAllprojects();
    for (Project p : allProjects) {
        p.getPlugins().apply(IdeaPlugin.class);
    }
    root.getPlugins().getPlugin(IdeaPlugin.class).makeSureModuleNamesAreUnique();
}
 
Example 11
Source File: EclipseModelBuilder.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
private void applyEclipsePlugin(Project root) {
    Set<Project> allProjects = root.getAllprojects();
    for (Project p : allProjects) {
        p.getPlugins().apply(EclipsePlugin.class);
    }
    root.getPlugins().getPlugin(EclipsePlugin.class).makeSureProjectNamesAreUnique();
}
 
Example 12
Source File: TaskDetailsFactory.java    From pushfish-android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public TaskDetailsFactory(Project project) {
    this.project = project;
    this.projects = project.getAllprojects();
}
 
Example 13
Source File: TaskDetailsFactory.java    From pushfish-android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public TaskDetailsFactory(Project project) {
    this.project = project;
    this.projects = project.getAllprojects();
}
 
Example 14
Source File: TaskDetailsFactory.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public TaskDetailsFactory(Project project) {
    this.project = project;
    this.projects = project.getAllprojects();
}
 
Example 15
Source File: TaskDetailsFactory.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public TaskDetailsFactory(Project project) {
    this.project = project;
    this.projects = project.getAllprojects();
}