Skip to content

Commit

Permalink
minor follow up and changelog for JENKINS-8383
Browse files Browse the repository at this point in the history
Originally-Committed-As: 38e5d115c9beece378082542c55ddbc5013caf57
  • Loading branch information
kutzi committed Sep 6, 2011
1 parent ee60a84 commit 6cfc8b9
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions src/main/java/hudson/maven/reporters/MavenFingerprinter.java
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -81,7 +81,8 @@ public boolean preBuild(MavenBuildProxy build, MavenProject pom, BuildListener l
* Mojos perform different dependency resolution, so we need to check this for each mojo. * Mojos perform different dependency resolution, so we need to check this for each mojo.
*/ */
public boolean postExecute(MavenBuildProxy build, MavenProject pom, MojoInfo mojo, BuildListener listener, Throwable error) throws InterruptedException, IOException { public boolean postExecute(MavenBuildProxy build, MavenProject pom, MojoInfo mojo, BuildListener listener, Throwable error) throws InterruptedException, IOException {
recordParents(pom); // TODO (kutzi, 2011/09/06): it should be perfectly save to move all these records to the
// postBuild method as artifacts should only be added by mojos, but never removed/modified.
record(pom.getArtifacts(),used); record(pom.getArtifacts(),used);
record(pom.getArtifact(),produced); record(pom.getArtifact(),produced);
record(pom.getAttachedArtifacts(),produced); record(pom.getAttachedArtifacts(),produced);
Expand All @@ -94,7 +95,11 @@ public boolean postExecute(MavenBuildProxy build, MavenProject pom, MojoInfo moj
* Sends the collected fingerprints over to the master and record them. * Sends the collected fingerprints over to the master and record them.
*/ */
public boolean postBuild(MavenBuildProxy build, MavenProject pom, BuildListener listener) throws InterruptedException, IOException { public boolean postBuild(MavenBuildProxy build, MavenProject pom, BuildListener listener) throws InterruptedException, IOException {

recordParents(pom);

build.executeAsync(new BuildCallable<Void,IOException>() { build.executeAsync(new BuildCallable<Void,IOException>() {
private static final long serialVersionUID = -1360161848504044869L;
// record is transient, so needs to make a copy first // record is transient, so needs to make a copy first
private final Map<String,String> u = used; private final Map<String,String> u = used;
private final Map<String,String> p = produced; private final Map<String,String> p = produced;
Expand Down Expand Up @@ -125,7 +130,7 @@ private void recordParents(MavenProject pom) throws IOException, InterruptedExce
while (parent != null) { while (parent != null) {
File parentFile = parent.getFile(); File parentFile = parent.getFile();
if (parentFile == null) { if (parentFile == null) {
// Parent Artifact contains no acual file, so we resolve against // Parent artifact contains no actual file, so we resolve against
// the local repository // the local repository
parentFile = parent.getProjectBuildingRequest() parentFile = parent.getProjectBuildingRequest()
.getLocalRepository().find(parent.getArtifact()) .getLocalRepository().find(parent.getArtifact())
Expand Down Expand Up @@ -161,14 +166,14 @@ private void record(Artifact a, Map<String,String> record) throws IOException, I
* This method contains the logic to avoid doubly recording the fingerprint * This method contains the logic to avoid doubly recording the fingerprint
* of the same file. * of the same file.
*/ */
private void record(String groupId, File f, Map<String, String> record) throws IOException, InterruptedException { private void record(String fileNamePrefix, File f, Map<String, String> record) throws IOException, InterruptedException {
if(f==null || files.contains(f) || !f.isFile()) if(f==null || files.contains(f) || !f.isFile())
return; return;


// new file // new file
files.add(f); files.add(f);
String digest = new FilePath(f).digest(); String digest = new FilePath(f).digest();
record.put(groupId+':'+f.getName(),digest); record.put(fileNamePrefix+':'+f.getName(),digest);
} }


@Extension @Extension
Expand Down

0 comments on commit 6cfc8b9

Please sign in to comment.