@VisibleForTesting
  protected static void cleanAndCheckProjectDefinitions(ProjectDefinition project) {
    if (project.getSubProjects().isEmpty()) {
      cleanAndCheckModuleProperties(project);
    } else {
      cleanAndCheckAggregatorProjectProperties(project);

      // clean modules properties as well
      for (ProjectDefinition module : project.getSubProjects()) {
        cleanAndCheckProjectDefinitions(module);
      }
    }
  }
 /** Populates list of projects from hierarchy. */
 private void collectProjects(ProjectDefinition def) {
   if (byKey.containsKey(def.getKeyWithBranch())) {
     throw new IllegalStateException("Duplicate module key in reactor: " + def.getKeyWithBranch());
   }
   byKey.put(def.getKeyWithBranch(), def);
   for (ProjectDefinition child : def.getSubProjects()) {
     collectProjects(child);
   }
 }
 @VisibleForTesting
 protected static void checkUniquenessOfChildKey(
     ProjectDefinition childProject, ProjectDefinition parentProject) {
   for (ProjectDefinition definition : parentProject.getSubProjects()) {
     if (definition.getKey().equals(childProject.getKey())) {
       throw new IllegalStateException(
           "Project '"
               + parentProject.getKey()
               + "' can't have 2 modules with the following key: "
               + childProject.getKey());
     }
   }
 }
예제 #4
0
  void doStart(List<ProjectDefinition> definitions) {
    projects = Lists.newArrayList();
    projectsByDef = Maps.newHashMap();

    for (ProjectDefinition def : definitions) {
      Project project = configurator.create(def);
      projectsByDef.put(def, project);
      projects.add(project);
    }

    for (Map.Entry<ProjectDefinition, Project> entry : projectsByDef.entrySet()) {
      ProjectDefinition def = entry.getKey();
      Project project = entry.getValue();
      for (ProjectDefinition module : def.getSubProjects()) {
        projectsByDef.get(module).setParent(project);
      }
    }

    // Configure
    for (Project project : projects) {
      configurator.configure(project);
    }
  }