Example #1
0
 /** Returns the {@link MavenModule}s that are in the queue. */
 public List<Queue.Item> getQueueItems() {
   List<Queue.Item> r = new ArrayList<hudson.model.Queue.Item>();
   for (Queue.Item item : Hudson.getInstance().getQueue().getItems()) {
     Task t = item.task;
     if ((t instanceof MavenModule && ((MavenModule) t).getParent() == this) || t == this)
       r.add(item);
   }
   return r;
 }
Example #2
0
  /**
   * Possibly empty list of all disabled modules (if disabled==true) or all enabeld modules (if
   * disabled==false)
   */
  public List<MavenModule> getDisabledModules(boolean disabled) {
    if (!disabled && sortedActiveModules != null) return sortedActiveModules;

    List<MavenModule> r = new ArrayList<MavenModule>();
    for (MavenModule m : modules.values()) {
      if (m.isDisabled() == disabled) r.add(m);
    }
    return r;
  }
Example #3
0
 private List<String> getMavenArgument(String shortForm, String longForm) {
   List<String> args = new ArrayList<String>();
   boolean switchFound = false;
   for (String t : Util.tokenize(getGoals())) {
     if (switchFound) {
       args.add(t);
       switchFound = false;
     } else if (t.equals(shortForm) || t.equals(longForm)) switchFound = true;
     else if (t.startsWith(shortForm)) {
       args.add(t.substring(shortForm.length()));
     } else if (t.startsWith(longForm)) {
       args.add(t.substring(longForm.length()));
     }
   }
   return args;
 }
Example #4
0
  public void onLoad(ItemGroup<? extends Item> parent, String name) throws IOException {
    modules = Collections.emptyMap(); // needed during load
    super.onLoad(parent, name);

    modules =
        loadChildren(
            this,
            getModulesDir(),
            new Function1<ModuleName, MavenModule>() {
              public ModuleName call(MavenModule module) {
                return module.getModuleName();
              }
            });
    // update the transient nest level field.
    MavenModule root = getRootModule();
    if (root != null && root.getChildren() != null) {
      List<MavenModule> sortedList = new ArrayList<MavenModule>();
      Stack<MavenModule> q = new Stack<MavenModule>();
      root.nestLevel = 0;
      q.push(root);
      while (!q.isEmpty()) {
        MavenModule p = q.pop();
        sortedList.add(p);
        List<MavenModule> children = p.getChildren();
        if (children != null) {
          for (MavenModule m : children) m.nestLevel = p.nestLevel + 1;
          for (int i = children.size() - 1; i >= 0; i--) // add them in the reverse order
          q.push(children.get(i));
        }
      }
      this.sortedActiveModules = sortedList;
    } else {
      this.sortedActiveModules = getDisabledModules(false);
    }

    if (reporters == null)
      reporters = new DescribableList<MavenReporter, Descriptor<MavenReporter>>(this);
    reporters.setOwner(this);
    if (publishers == null)
      publishers = new DescribableList<Publisher, Descriptor<Publisher>>(this);
    publishers.setOwner(this);
    if (buildWrappers == null)
      buildWrappers = new DescribableList<BuildWrapper, Descriptor<BuildWrapper>>(this);
    buildWrappers.setOwner(this);

    updateTransientActions();
  }
Example #5
0
  protected void addTransientActionsFromBuild(
      MavenModuleSetBuild build, List<Action> collection, Set<Class> added) {
    if (build == null) return;

    for (Action a : build.getActions())
      if (a instanceof MavenAggregatedReport)
        if (added.add(a.getClass()))
          collection.add(((MavenAggregatedReport) a).getProjectAction(this));

    List<MavenReporter> list = build.projectActionReporters;
    if (list == null) return;

    for (MavenReporter step : list) {
      if (!added.add(step.getClass())) continue; // already added
      Action a = step.getAggregatedProjectAction(this);
      if (a != null) collection.add(a);
    }
  }
Example #6
0
  protected List<Action> createTransientActions() {
    List<Action> r = super.createTransientActions();

    // Fix for ISSUE-1149
    for (MavenModule module : modules.values()) {
      module.updateTransientActions();
    }

    if (publishers
        != null) // this method can be loaded from within the onLoad method, where this might be
      // null
      for (BuildStep step : publishers) r.addAll(step.getProjectActions(this));

    if (buildWrappers != null)
      for (BuildWrapper step : buildWrappers) r.addAll(step.getProjectActions(this));

    return r;
  }