本文整理了Java中hudson.model.AbstractBuild.getDownstreamRelationship()
方法的一些代码示例,展示了AbstractBuild.getDownstreamRelationship()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。AbstractBuild.getDownstreamRelationship()
方法的具体详情如下:
包路径:hudson.model.AbstractBuild
类名称:AbstractBuild
方法名:getDownstreamRelationship
[英]Gets the dependency relationship from this build (as the source) and that project (as the sink.)
[中]获取此生成(作为源)和该项目(作为接收器)的依赖关系
代码示例来源:origin: jenkinsci/jenkins
/**
* Works like {@link #getDownstreamRelationship(AbstractProject)} but returns
* the actual build objects, in ascending order.
* @since 1.150
*/
public Iterable<AbstractBuild<?,?>> getDownstreamBuilds(final AbstractProject<?,?> that) {
final Iterable<Integer> nums = getDownstreamRelationship(that).listNumbers();
return new Iterable<AbstractBuild<?, ?>>() {
public Iterator<AbstractBuild<?, ?>> iterator() {
return Iterators.removeNull(
new AdaptedIterator<Integer,AbstractBuild<?,?>>(nums) {
protected AbstractBuild<?, ?> adapt(Integer item) {
return that.getBuildByNumber(item);
}
});
}
};
}
代码示例来源: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
/**
* Helper method for getDownstreamRelationship.
*
* For each given build, find the build number range of the given project and put that into the map.
*/
private void checkAndRecord(AbstractProject that, TreeMap<Integer, RangeSet> r, Collection<R> builds) {
for (R build : builds) {
RangeSet rs = build.getDownstreamRelationship(that);
if(rs==null || rs.isEmpty())
continue;
int n = build.getNumber();
RangeSet value = r.get(n);
if(value==null)
r.put(n,rs);
else
value.add(rs);
}
}
代码示例来源: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: org.jvnet.hudson.main/hudson-core
/**
* Works like {@link #getDownstreamRelationship(AbstractProject)} but returns
* the actual build objects, in ascending order.
* @since 1.150
*/
public Iterable<AbstractBuild<?,?>> getDownstreamBuilds(final AbstractProject<?,?> that) {
final Iterable<Integer> nums = getDownstreamRelationship(that).listNumbers();
return new Iterable<AbstractBuild<?, ?>>() {
public Iterator<AbstractBuild<?, ?>> iterator() {
return Iterators.removeNull(
new AdaptedIterator<Integer,AbstractBuild<?,?>>(nums) {
protected AbstractBuild<?, ?> adapt(Integer item) {
return that.getBuildByNumber(item);
}
});
}
};
}
代码示例来源:origin: hudson/hudson-2.x
/**
* Works like {@link #getDownstreamRelationship(AbstractProject)} but returns
* the actual build objects, in ascending order.
* @since 1.150
*/
public Iterable<AbstractBuild<?,?>> getDownstreamBuilds(final AbstractProject<?,?> that) {
final Iterable<Integer> nums = getDownstreamRelationship(that).listNumbers();
return new Iterable<AbstractBuild<?, ?>>() {
public Iterator<AbstractBuild<?, ?>> iterator() {
return Iterators.removeNull(
new AdaptedIterator<Integer,AbstractBuild<?,?>>(nums) {
protected AbstractBuild<?, ?> adapt(Integer item) {
return that.getBuildByNumber(item);
}
});
}
};
}
代码示例来源:origin: org.eclipse.hudson/hudson-core
/**
* Works like {@link #getDownstreamRelationship(AbstractProject)} but
* returns the actual build objects, in ascending order.
*
* @since 1.150
*/
public Iterable<AbstractBuild<?, ?>> getDownstreamBuilds(final AbstractProject<?, ?> that) {
final Iterable<Integer> nums = getDownstreamRelationship(that).listNumbers();
return new Iterable<AbstractBuild<?, ?>>() {
public Iterator<AbstractBuild<?, ?>> iterator() {
return Iterators.removeNull(
new AdaptedIterator<Integer, AbstractBuild<?, ?>>(nums) {
protected AbstractBuild<?, ?> adapt(Integer item) {
return that.getBuildByNumber(item);
}
});
}
};
}
代码示例来源:origin: org.jenkins-ci.main/jenkins-core
/**
* Works like {@link #getDownstreamRelationship(AbstractProject)} but returns
* the actual build objects, in ascending order.
* @since 1.150
*/
public Iterable<AbstractBuild<?,?>> getDownstreamBuilds(final AbstractProject<?,?> that) {
final Iterable<Integer> nums = getDownstreamRelationship(that).listNumbers();
return new Iterable<AbstractBuild<?, ?>>() {
public Iterator<AbstractBuild<?, ?>> iterator() {
return Iterators.removeNull(
new AdaptedIterator<Integer,AbstractBuild<?,?>>(nums) {
protected AbstractBuild<?, ?> adapt(Integer item) {
return that.getBuildByNumber(item);
}
});
}
};
}
代码示例来源: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: hudson/hudson-2.x
/**
* Helper method for getDownstreamRelationship.
*
* For each given build, find the build number range of the given project and put that into the map.
*/
private void checkAndRecord(AbstractProject that, TreeMap<Integer, RangeSet> r, Collection<R> builds) {
for (R build : builds) {
RangeSet rs = build.getDownstreamRelationship(that);
if(rs==null || rs.isEmpty())
continue;
int n = build.getNumber();
RangeSet value = r.get(n);
if(value==null)
r.put(n,rs);
else
value.add(rs);
}
}
代码示例来源: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.eclipse.hudson/hudson-core
@Override
public Fingerprint.RangeSet getDownstreamRelationship(AbstractProject that) {
Fingerprint.RangeSet rs = super.getDownstreamRelationship(that);
for (MatrixRun run : getRuns()) {
rs.add(run.getDownstreamRelationship(that));
}
return rs;
}
代码示例来源:origin: org.jvnet.hudson.main/hudson-core
@Override
public Fingerprint.RangeSet getDownstreamRelationship(AbstractProject that) {
Fingerprint.RangeSet rs = super.getDownstreamRelationship(that);
for (MatrixRun run : getRuns()) {
rs.add(run.getDownstreamRelationship(that));
}
return rs;
}
代码示例来源:origin: org.jenkins-ci.plugins/matrix-project
@Override
public Fingerprint.RangeSet getDownstreamRelationship(AbstractProject that) {
Fingerprint.RangeSet rs = super.getDownstreamRelationship(that);
for(MatrixRun run : getRuns())
rs.add(run.getDownstreamRelationship(that));
return rs;
}
代码示例来源:origin: org.eclipse.hudson.main/hudson-core
@Override
public Fingerprint.RangeSet getDownstreamRelationship(AbstractProject that) {
Fingerprint.RangeSet rs = super.getDownstreamRelationship(that);
for (MatrixRun run : getRuns()) {
rs.add(run.getDownstreamRelationship(that));
}
return rs;
}
代码示例来源:origin: hudson/hudson-2.x
@Override
public Fingerprint.RangeSet getDownstreamRelationship(AbstractProject that) {
Fingerprint.RangeSet rs = super.getDownstreamRelationship(that);
for (MatrixRun run : getRuns()) {
rs.add(run.getDownstreamRelationship(that));
}
return rs;
}
代码示例来源:origin: jenkinsci/instant-messaging-plugin
/**
* Determines if downstreamBuild is the 1st build of the downstream project
* which has a dependency to the upstreamBuild.
*/
//@Bug(6712)
private boolean downstreamIsFirstInRangeTriggeredByUpstream(
AbstractBuild<?, ?> upstreamBuild, AbstractBuild<?, ?> downstreamBuild) {
RangeSet rangeSet = upstreamBuild.getDownstreamRelationship(downstreamBuild.getProject());
if (rangeSet.isEmpty()) {
// should not happen
LOGGER.warning("Range set is empty. Upstream " + upstreamBuild + ", downstream " + downstreamBuild);
return false;
}
if (rangeSet.min() == downstreamBuild.getNumber()) {
return true;
}
return false;
}
内容来源于网络,如有侵权,请联系作者删除!