From 7a7b3a6a11ccdd5fc851ec91f3358d05ad90fc2b Mon Sep 17 00:00:00 2001 From: kohsuke Date: Sun, 6 Apr 2008 01:48:04 +0000 Subject: [PATCH] Record fingerprints for MavenModuleSetBuild as well so that the dependencies can be tracked among MMSBs, not just among MavenBuilds. git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@8300 71c3de6d-444a-0410-be80-ed276b4c234a --- .../hudson/maven/MavenModuleSetBuild.java | 9 ++++++++ .../maven/reporters/MavenFingerprinter.java | 23 +++++++++++++++++++ .../main/java/hudson/tasks/Fingerprinter.java | 14 +++++++++-- 3 files changed, 44 insertions(+), 2 deletions(-) diff --git a/core/src/main/java/hudson/maven/MavenModuleSetBuild.java b/core/src/main/java/hudson/maven/MavenModuleSetBuild.java index 1e61fe7ac1..c80fe1421c 100644 --- a/core/src/main/java/hudson/maven/MavenModuleSetBuild.java +++ b/core/src/main/java/hudson/maven/MavenModuleSetBuild.java @@ -6,6 +6,7 @@ import hudson.FilePath.FileCallable; import hudson.Launcher; import hudson.Util; import hudson.maven.MavenBuild.ProxyImpl2; +import hudson.maven.reporters.MavenFingerprinter; import hudson.model.AbstractBuild; import hudson.model.AbstractProject; import hudson.model.Action; @@ -393,6 +394,14 @@ public final class MavenModuleSetBuild extends AbstractBuild records = new HashMap(); + for (List builds : mmsb.getModuleBuilds().values()) { + for (MavenBuild build : builds) { + FingerprintAction fa = build.getAction(FingerprintAction.class); + if(fa!=null) + records.putAll(fa.getRecords()); + } + } + if(!records.isEmpty()) { + FingerprintMap map = Hudson.getInstance().getFingerprintMap(); + for (Entry e : records.entrySet()) + map.getOrCreate(null, e.getKey(), e.getValue()).add(mmsb); + mmsb.addAction(new FingerprintAction(mmsb,records)); + } + } + private static final long serialVersionUID = 1L; } diff --git a/core/src/main/java/hudson/tasks/Fingerprinter.java b/core/src/main/java/hudson/tasks/Fingerprinter.java index bb3adb948d..dbb45db335 100644 --- a/core/src/main/java/hudson/tasks/Fingerprinter.java +++ b/core/src/main/java/hudson/tasks/Fingerprinter.java @@ -244,6 +244,13 @@ public class Fingerprinter extends Publisher implements Serializable { return build; } + /** + * Obtains the raw data. + */ + public Map getRecords() { + return Collections.unmodifiableMap(record); + } + /** * Map from file names of the fingerprinted file to its fingerprint record. */ @@ -283,11 +290,14 @@ public class Fingerprinter extends Publisher implements Serializable { BuildPtr bp = fp.getOriginal(); if(bp==null) continue; // outside Hudson if(bp.is(build)) continue; // we are the owner + AbstractProject job = bp.getJob(); + if(job!=null && job.getParent()==build.getParent()) + continue; // we are the parent of the build owner, that is almost like we are the owner - Integer existing = r.get(bp.getJob()); + Integer existing = r.get(job); if(existing!=null && existing>bp.getNumber()) continue; // the record in the map is already up to date - r.put(bp.getJob(),bp.getNumber()); + r.put(job,bp.getNumber()); } return r; -- GitLab