提交 85b9c503 编写于 作者: S Stephan Pauxberger

[JENKINS-8383] recreated changes

上级 1d653b10
...@@ -190,6 +190,9 @@ Upcoming changes</a> ...@@ -190,6 +190,9 @@ Upcoming changes</a>
Bundling <a href="https://wiki.jenkins-ci.org/display/JENKINS/Translation+Assistance+Plugin">the translation assistance plugin</a> in the hope of increasing the contribution. Bundling <a href="https://wiki.jenkins-ci.org/display/JENKINS/Translation+Assistance+Plugin">the translation assistance plugin</a> in the hope of increasing the contribution.
<li class=rfe> <li class=rfe>
Introduce a fine-grained permission to control who is allowed to run the Groovy Console. Introduce a fine-grained permission to control who is allowed to run the Groovy Console.
<li class=rfe>
Maven jobs should include fingerprints of their parent POMs
(<a href="https://issues.jenkins-ci.org/browse/JENKINS-8383">issue 8383</a>)
<li class=rfe> <li class=rfe>
Add support for maven-android-plugin integration test reports Add support for maven-android-plugin integration test reports
(<a href="https://issues.jenkins-ci.org/browse/JENKINS-10913">issue 10913</a>) (<a href="https://issues.jenkins-ci.org/browse/JENKINS-10913">issue 10913</a>)
......
...@@ -81,10 +81,12 @@ public class MavenFingerprinter extends MavenReporter { ...@@ -81,10 +81,12 @@ public class MavenFingerprinter extends MavenReporter {
* 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 {
record(pom.getArtifacts(),used); // 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.getArtifact(),produced); record(pom.getArtifact(),produced);
record(pom.getAttachedArtifacts(),produced); record(pom.getAttachedArtifacts(),produced);
record(pom.getGroupId(),pom.getFile(),produced); record(pom.getGroupId() + ":" + pom.getArtifactId(),pom.getFile(),produced);
return true; return true;
} }
...@@ -93,9 +95,12 @@ public class MavenFingerprinter extends MavenReporter { ...@@ -93,9 +95,12 @@ public class MavenFingerprinter extends MavenReporter {
* 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; 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;
...@@ -121,6 +126,27 @@ public class MavenFingerprinter extends MavenReporter { ...@@ -121,6 +126,27 @@ public class MavenFingerprinter extends MavenReporter {
return true; return true;
} }
private void recordParents(MavenProject pom) throws IOException, InterruptedException {
MavenProject parent = pom.getParent();
while (parent != null) {
File parentFile = parent.getFile();
if (parentFile == null) {
// Parent artifact contains no actual file, so we resolve against
// the local repository
parentFile = parent.getProjectBuildingRequest()
.getLocalRepository().find(parent.getArtifact())
.getFile();
}
// we need to include the artifact Id for poms as well, otherwise a
// project with the same groupId would override its parent's
// fingerprint
record(parent.getGroupId() + ":" + parent.getArtifactId(),
parentFile, used);
parent = parent.getParent();
}
}
private void record(Collection<Artifact> artifacts, Map<String,String> record) throws IOException, InterruptedException { private void record(Collection<Artifact> artifacts, Map<String,String> record) throws IOException, InterruptedException {
for (Artifact a : artifacts) for (Artifact a : artifacts)
record(a,record); record(a,record);
...@@ -141,14 +167,14 @@ public class MavenFingerprinter extends MavenReporter { ...@@ -141,14 +167,14 @@ public class MavenFingerprinter extends MavenReporter {
* 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
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册