提交 1941f098 编写于 作者: K Kohsuke Kawaguchi

Merge remote-tracking branch 'origin/BuildStep-Job'

This really merges pull request #1330
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
package hudson.model; package hudson.model;
import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableList;
import com.infradna.tool.bridge_method_injector.WithBridgeMethods;
import com.thoughtworks.xstream.XStream; import com.thoughtworks.xstream.XStream;
import com.thoughtworks.xstream.converters.Converter; import com.thoughtworks.xstream.converters.Converter;
import com.thoughtworks.xstream.converters.MarshallingContext; import com.thoughtworks.xstream.converters.MarshallingContext;
...@@ -119,8 +120,9 @@ public class Fingerprint implements ModelObject, Saveable { ...@@ -119,8 +120,9 @@ public class Fingerprint implements ModelObject, Saveable {
* Gets the {@link Job} that this pointer points to, * Gets the {@link Job} that this pointer points to,
* or null if such a job no longer exists. * or null if such a job no longer exists.
*/ */
public AbstractProject getJob() { // TODO add variant returning Job @WithBridgeMethods(value=AbstractProject.class, castRequired=true)
return Jenkins.getInstance().getItemByFullName(name,AbstractProject.class); public Job<?,?> getJob() {
return Jenkins.getInstance().getItemByFullName(name, Job.class);
} }
/** /**
......
...@@ -39,6 +39,7 @@ import hudson.model.DependencyGraph.Dependency; ...@@ -39,6 +39,7 @@ import hudson.model.DependencyGraph.Dependency;
import hudson.model.Fingerprint; import hudson.model.Fingerprint;
import hudson.model.Fingerprint.BuildPtr; import hudson.model.Fingerprint.BuildPtr;
import hudson.model.FingerprintMap; import hudson.model.FingerprintMap;
import hudson.model.Job;
import jenkins.model.Jenkins; import jenkins.model.Jenkins;
import hudson.model.Result; import hudson.model.Result;
import hudson.model.Run; import hudson.model.Run;
...@@ -432,8 +433,13 @@ public class Fingerprinter extends Recorder implements Serializable, DependencyD ...@@ -432,8 +433,13 @@ public class Fingerprinter extends Recorder implements Serializable, DependencyD
if(bp.is(build)) continue; // we are the owner if(bp.is(build)) continue; // we are the owner
try { try {
AbstractProject job = bp.getJob(); Job job = bp.getJob();
if (job==null) continue; // project no longer exists if (job==null) continue; // project no longer exists
if (!(job instanceof AbstractProject)) {
// Ignoring this for now. In the future we may want a dependency map function not limited to AbstractProject.
// (Could be used by getDependencyChanges if pulled up from AbstractBuild into Run, for example.)
continue;
}
if (job.getParent()==build.getParent()) if (job.getParent()==build.getParent())
continue; // we are the parent of the build owner, that is almost like we are the owner continue; // we are the parent of the build owner, that is almost like we are the owner
if(!includeMissing && job.getBuildByNumber(bp.getNumber())==null) if(!includeMissing && job.getBuildByNumber(bp.getNumber())==null)
...@@ -442,7 +448,7 @@ public class Fingerprinter extends Recorder implements Serializable, DependencyD ...@@ -442,7 +448,7 @@ public class Fingerprinter extends Recorder implements Serializable, DependencyD
Integer existing = r.get(job); Integer existing = r.get(job);
if(existing!=null && existing>bp.getNumber()) if(existing!=null && existing>bp.getNumber())
continue; // the record in the map is already up to date continue; // the record in the map is already up to date
r.put(job, bp.getNumber()); r.put((AbstractProject) job, bp.getNumber());
} catch (AccessDeniedException e) { } catch (AccessDeniedException e) {
// Need to log in to access this job, so ignore // Need to log in to access this job, so ignore
continue; continue;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册