/** @param env Environment variables from which to expand project names; Might be {@code null}. */
  public List<AbstractProject> getProjectList(EnvVars env) {
    if (projectList == null) {
      projectList = new ArrayList<AbstractProject>();

      // expand variables if applicable
      StringBuilder projectNames = new StringBuilder();
      StringTokenizer tokens = new StringTokenizer(projects, ",");
      while (tokens.hasMoreTokens()) {
        if (projectNames.length() > 0) {
          projectNames.append(',');
        }
        projectNames.append(
            env != null ? env.expand(tokens.nextToken().trim()) : tokens.nextToken().trim());
      }

      projectList.addAll(Items.fromNameList(projectNames.toString(), AbstractProject.class));
    }
    return projectList;
  }
示例#2
0
  public synchronized void checkPendingDownstream(
      AbstractBuild<?, ?> owner, TaskListener listener) {
    if (pendingDownstreamProjects.isEmpty()) {
      listener.getLogger().println("All downstream projects complete!");
      Result threshold = this.evenIfDownstreamUnstable ? Result.UNSTABLE : Result.SUCCESS;
      if (this.overallResult.isWorseThan(threshold)) {
        listener.getLogger().println("Minimum result threshold not met for join project");
      } else {
        // Construct a launcher since CopyArchiver wants to get the
        // channel from it. We use the channel of the node where the
        // splitProject was built on.
        final Launcher launcher = new NoopLauncher(listener, owner);

        for (Publisher pub : this.joinPublishers) {
          try {
            pub.perform(owner, launcher, (BuildListener) listener);
          } catch (InterruptedException e) {
            e.printStackTrace();
          } catch (IOException e) {
            e.printStackTrace();
          }
        }
        if (!JoinTrigger.canDeclare(owner.getProject())) {
          List<AbstractProject> projects = Items.fromNameList(joinProjects, AbstractProject.class);
          for (AbstractProject project : projects) {
            listener.getLogger().println("Scheduling join project: " + project.getName());
            project.scheduleBuild(new JoinCause(owner));
          }
        }
      }
    } else {
      listener
          .getLogger()
          .println(
              "Project "
                  + owner.getProject().getName()
                  + " still waiting for "
                  + pendingDownstreamProjects.size()
                  + " builds to complete");
    }
  }
 public List<AbstractProject> getChildProjects() {
   return Items.fromNameList(childProjects, AbstractProject.class);
 }
 public List<AbstractProject> getProjectList() {
   return Items.fromNameList(projects, AbstractProject.class);
 }