hudson.model.AbstractProject.getDownstreamProjects()方法的使用及代码示例

x33g5p2x  于2022-01-15 转载在 其他  
字(11.4k)|赞(0)|评价(0)|浏览(70)

本文整理了Java中hudson.model.AbstractProject.getDownstreamProjects()方法的一些代码示例,展示了AbstractProject.getDownstreamProjects()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。AbstractProject.getDownstreamProjects()方法的具体详情如下:
包路径:hudson.model.AbstractProject
类名称:AbstractProject
方法名:getDownstreamProjects

AbstractProject.getDownstreamProjects介绍

[英]Gets the other AbstractProjects that should be built when a build of this project is completed.
[中]获取此项目的生成完成时应生成的其他抽象项目。

代码示例

代码示例来源:origin: jenkinsci/jenkins

private void populate(Collection<? extends AbstractProject> projectList) {
  for (AbstractProject<?,?> p : projectList) {
    if (polledProjects.contains(p)) {
      // Project will be readded at the queue, so that we always use
      // the longest path
      LOGGER.fine("removing project " + p.getName() + " for re-add");
      polledProjects.remove(p);
    }
    LOGGER.fine("adding project " + p.getName());
    polledProjects.add(p);
    // Add all downstream dependencies
    populate(p.getDownstreamProjects());
  }
}

代码示例来源:origin: jenkinsci/jenkins

@Exported(name="downstreamProjects")
@Restricted(DoNotUse.class) // only for exporting
public List<AbstractProject> getDownstreamProjectsForApi() {
  List<AbstractProject> r = new ArrayList<>();
  for (AbstractProject p : getDownstreamProjects()) {
    if (p.hasPermission(Item.READ)) {
      r.add(p);
    }
  }
  return r;
}

代码示例来源:origin: jenkinsci/jenkins

/**
 * Gets the downstream builds of this build, which are the builds of the
 * downstream projects that use artifacts of this build.
 *
 * @return
 *      For each project with fingerprinting enabled, returns the range
 *      of builds (which can be empty if no build uses the artifact from this build or downstream is not {@link AbstractProject#isFingerprintConfigured}.)
 */
public Map<AbstractProject,RangeSet> getDownstreamBuilds() {
  Map<AbstractProject,RangeSet> r = new HashMap<AbstractProject,RangeSet>();
  for (AbstractProject p : getParent().getDownstreamProjects()) {
    if (p.isFingerprintConfigured())
      r.put(p,getDownstreamRelationship(p));
  }
  return r;
}

代码示例来源:origin: jenkinsci/jenkins

@Override
public String getWhyKeepLog() {
  // if any of the downstream project is configured with 'keep dependency component',
  // we need to keep this log
  OUTER:
  for (AbstractProject<?,?> p : getParent().getDownstreamProjects()) {
    if (!p.isKeepDependencies()) continue;
    AbstractBuild<?,?> fb = p.getFirstBuild();
    if (fb==null)        continue; // no active record
    // is there any active build that depends on us?
    for (int i : getDownstreamRelationship(p).listNumbersReverse()) {
      // TODO: this is essentially a "find intersection between two sparse sequences"
      // and we should be able to do much better.
      if (i<fb.getNumber())
        continue OUTER; // all the other records are younger than the first record, so pointless to search.
      AbstractBuild<?,?> b = p.getBuildByNumber(i);
      if (b!=null)
        return Messages.AbstractBuild_KeptBecause(p.hasPermission(Item.READ) ? b.toString() : "?");
    }
  }
  return super.getWhyKeepLog();
}

代码示例来源:origin: Diabol/delivery-pipeline-plugin

@Override
  public List<AbstractProject> getDownstreamProjects(AbstractProject<?, ?>  project) {
    return project.getDownstreamProjects();
  }
}

代码示例来源:origin: org.jenkins-ci.main/jenkins-core

private void populate(Collection<? extends AbstractProject> projectList) {
  for (AbstractProject<?,?> p : projectList) {
    if (polledProjects.contains(p)) {
      // Project will be readded at the queue, so that we always use
      // the longest path
      LOGGER.fine("removing project " + p.getName() + " for re-add");
      polledProjects.remove(p);
    }
    LOGGER.fine("adding project " + p.getName());
    polledProjects.add(p);
    // Add all downstream dependencies
    populate(p.getDownstreamProjects());
  }
}

代码示例来源:origin: org.eclipse.hudson/hudson-core

private void populate(Collection<? extends AbstractProject> projectList) {
  for (AbstractProject<?, ?> p : projectList) {
    if (polledProjects.contains(p)) {
      // Project will be readded at the queue, so that we always use
      // the longest path
      LOGGER.fine("removing project " + p.getName() + " for re-add");
      polledProjects.remove(p);
    }
    LOGGER.fine("adding project " + p.getName());
    polledProjects.add(p);
    // Add all downstream dependencies
    populate(p.getDownstreamProjects());
  }
}

代码示例来源:origin: org.eclipse.hudson.main/hudson-core

private void populate(Collection<? extends AbstractProject> projectList) {
  for (AbstractProject<?,?> p : projectList) {
    if (polledProjects.contains(p)) {
      // Project will be readded at the queue, so that we always use
      // the longest path
      LOGGER.fine("removing project " + p.getName() + " for re-add");
      polledProjects.remove(p);
    }
    LOGGER.fine("adding project " + p.getName());
    polledProjects.add(p);
    // Add all downstream dependencies
    populate(p.getDownstreamProjects());
  }
}

代码示例来源:origin: hudson/hudson-2.x

private void populate(Collection<? extends AbstractProject> projectList) {
  for (AbstractProject<?,?> p : projectList) {
    if (polledProjects.contains(p)) {
      // Project will be readded at the queue, so that we always use
      // the longest path
      LOGGER.fine("removing project " + p.getName() + " for re-add");
      polledProjects.remove(p);
    }
    LOGGER.fine("adding project " + p.getName());
    polledProjects.add(p);
    // Add all downstream dependencies
    populate(p.getDownstreamProjects());
  }
}

代码示例来源:origin: org.jvnet.hudson.main/hudson-core

private void populate(Collection<? extends AbstractProject> projectList) {
  for (AbstractProject<?,?> p : projectList) {
    if (polledProjects.contains(p)) {
      // Project will be readded at the queue, so that we always use
      // the longest path
      LOGGER.fine("removing project " + p.getName() + " for re-add");
      polledProjects.remove(p);
    }
    LOGGER.fine("adding project " + p.getName());
    polledProjects.add(p);
    // Add all downstream dependencies
    populate(p.getDownstreamProjects());
  }
}

代码示例来源:origin: org.jenkins-ci.main/jenkins-core

@Exported(name="downstreamProjects")
@Restricted(DoNotUse.class) // only for exporting
public List<AbstractProject> getDownstreamProjectsForApi() {
  List<AbstractProject> r = new ArrayList<>();
  for (AbstractProject p : getDownstreamProjects()) {
    if (p.hasPermission(Item.READ)) {
      r.add(p);
    }
  }
  return r;
}

代码示例来源:origin: hudson/hudson-2.x

/**
 * Gets the downstream builds of this build, which are the builds of the
 * downstream projects that use artifacts of this build.
 *
 * @return
 *      For each project with fingerprinting enabled, returns the range
 *      of builds (which can be empty if no build uses the artifact from this build.)
 */
public Map<AbstractProject,RangeSet> getDownstreamBuilds() {
  Map<AbstractProject,RangeSet> r = new HashMap<AbstractProject,RangeSet>();
  for (AbstractProject p : getParent().getDownstreamProjects()) {
    if (p.isFingerprintConfigured())
      r.put(p,getDownstreamRelationship(p));
  }
  return r;
}

代码示例来源:origin: org.jenkins-ci.main/jenkins-core

/**
 * Gets the downstream builds of this build, which are the builds of the
 * downstream projects that use artifacts of this build.
 *
 * @return
 *      For each project with fingerprinting enabled, returns the range
 *      of builds (which can be empty if no build uses the artifact from this build or downstream is not {@link AbstractProject#isFingerprintConfigured}.)
 */
public Map<AbstractProject,RangeSet> getDownstreamBuilds() {
  Map<AbstractProject,RangeSet> r = new HashMap<AbstractProject,RangeSet>();
  for (AbstractProject p : getParent().getDownstreamProjects()) {
    if (p.isFingerprintConfigured())
      r.put(p,getDownstreamRelationship(p));
  }
  return r;
}

代码示例来源:origin: org.jvnet.hudson.main/hudson-core

/**
 * Gets the downstream builds of this build, which are the builds of the
 * downstream projects that use artifacts of this build.
 *
 * @return
 *      For each project with fingerprinting enabled, returns the range
 *      of builds (which can be empty if no build uses the artifact from this build.)
 */
public Map<AbstractProject,RangeSet> getDownstreamBuilds() {
  Map<AbstractProject,RangeSet> r = new HashMap<AbstractProject,RangeSet>();
  for (AbstractProject p : getParent().getDownstreamProjects()) {
    if (p.isFingerprintConfigured())
      r.put(p,getDownstreamRelationship(p));
  }
  return r;
}

代码示例来源:origin: org.eclipse.hudson.main/hudson-core

/**
 * Gets the downstream builds of this build, which are the builds of the
 * downstream projects that use artifacts of this build.
 *
 * @return
 *      For each project with fingerprinting enabled, returns the range
 *      of builds (which can be empty if no build uses the artifact from this build.)
 */
public Map<AbstractProject,RangeSet> getDownstreamBuilds() {
  Map<AbstractProject,RangeSet> r = new HashMap<AbstractProject,RangeSet>();
  for (AbstractProject p : getParent().getDownstreamProjects()) {
    if (p.isFingerprintConfigured())
      r.put(p,getDownstreamRelationship(p));
  }
  return r;
}

代码示例来源:origin: org.eclipse.hudson/hudson-core

/**
 * Gets the downstream builds of this build, which are the builds of the
 * downstream projects that use artifacts of this build.
 *
 * @return For each project with fingerprinting enabled, returns the range
 * of builds (which can be empty if no build uses the artifact from this
 * build.)
 */
public Map<AbstractProject, RangeSet> getDownstreamBuilds() {
  Map<AbstractProject, RangeSet> r = new HashMap<AbstractProject, RangeSet>();
  for (AbstractProject p : getParent().getDownstreamProjects()) {
    if (p.isFingerprintConfigured()) {
      r.put(p, getDownstreamRelationship(p));
    }
  }
  return r;
}

代码示例来源:origin: org.jvnet.hudson.main/maven-plugin

private boolean inDownstreamProjects(AbstractProject<?,?> downstreamProject) {
    DependencyGraph graph = Hudson.getInstance().getDependencyGraph();
    Set<AbstractProject> tups = graph.getTransitiveUpstream(downstreamProject);
  
    for (AbstractProject tup : tups) {
      List<AbstractProject<?,?>> downstreamProjects = getUpstreamProject().getDownstreamProjects();
      for (AbstractProject<?,?> dp : downstreamProjects) {
        if(dp!=getUpstreamProject() && dp!=downstreamProject && dp==tup) 
          return true;
      }
    }
    return false;
  }
}

代码示例来源:origin: jenkinsci/maven-plugin

private boolean inDownstreamProjects(AbstractProject<?,?> downstreamProject) {
    DependencyGraph graph = Jenkins.getInstance().getDependencyGraph();
    Set<AbstractProject> tups = graph.getTransitiveUpstream(downstreamProject);
  
    for (AbstractProject tup : tups) {
      List<AbstractProject<?,?>> downstreamProjects = getUpstreamProject().getDownstreamProjects();
      for (AbstractProject<?,?> dp : downstreamProjects) {
        if(dp!=getUpstreamProject() && dp!=downstreamProject && dp==tup) 
          return true;
      }
    }
    return false;
  }
}

代码示例来源:origin: org.eclipse.hudson.main/hudson-core

@Override
public String getWhyKeepLog() {
  // if any of the downstream project is configured with 'keep dependency component',
  // we need to keep this log
  OUTER:
  for (AbstractProject<?,?> p : getParent().getDownstreamProjects()) {
    if (!p.isKeepDependencies()) continue;
    AbstractBuild<?,?> fb = p.getFirstBuild();
    if (fb==null)        continue; // no active record
    // is there any active build that depends on us?
    for (int i : getDownstreamRelationship(p).listNumbersReverse()) {
      // TODO: this is essentially a "find intersection between two sparse sequences"
      // and we should be able to do much better.
      if (i<fb.getNumber())
        continue OUTER; // all the other records are younger than the first record, so pointless to search.
      AbstractBuild<?,?> b = p.getBuildByNumber(i);
      if (b!=null)
        return Messages.AbstractBuild_KeptBecause(b);
    }
  }
  return super.getWhyKeepLog();
}

代码示例来源:origin: hudson/hudson-2.x

@Override
public String getWhyKeepLog() {
  // if any of the downstream project is configured with 'keep dependency component',
  // we need to keep this log
  OUTER:
  for (AbstractProject<?,?> p : getParent().getDownstreamProjects()) {
    if (!p.isKeepDependencies()) continue;
    AbstractBuild<?,?> fb = p.getFirstBuild();
    if (fb==null)        continue; // no active record
    // is there any active build that depends on us?
    for (int i : getDownstreamRelationship(p).listNumbersReverse()) {
      // TODO: this is essentially a "find intersection between two sparse sequences"
      // and we should be able to do much better.
      if (i<fb.getNumber())
        continue OUTER; // all the other records are younger than the first record, so pointless to search.
      AbstractBuild<?,?> b = p.getBuildByNumber(i);
      if (b!=null)
        return Messages.AbstractBuild_KeptBecause(b);
    }
  }
  return super.getWhyKeepLog();
}

相关文章

微信公众号

最新文章

更多

AbstractProject类方法