提交 e4846732 编写于 作者: J Jesse Glick

Merge branch 'master' of github.com:jenkinsci/jenkins

......@@ -55,7 +55,8 @@ Upcoming changes</a>
<!-- Record your changes in the trunk here. -->
<div id="trunk" style="display:none"><!--=TRUNK-BEGIN=-->
<ul class=image>
<li class=>
<li class=rfe>
Support failsafe the same way as surefire in maven2 jobs
</ul>
</div><!--=TRUNK-END=-->
......
......@@ -74,10 +74,8 @@ public class SurefireArchiver extends MavenReporter {
private transient ConcurrentMap<File, FileSet> fileSets = new ConcurrentHashMap<File,FileSet>();
public boolean preExecute(MavenBuildProxy build, MavenProject pom, MojoInfo mojo, BuildListener listener) throws InterruptedException, IOException {
if (isSurefireTest(mojo)) {
if ((!mojo.is("org.apache.maven.plugins", "maven-failsafe-plugin", "integration-test"))
&& (!mojo.is("eviware", "maven-soapui-plugin", "test"))
&& (!mojo.is("eviware", "maven-soapui-pro-plugin", "test"))) {
if (isTestMojo(mojo)) {
if (!isSoapUiMojo(mojo)) {
// tell surefire:test to keep going even if there was a failure,
// so that we can record this as yellow.
// note that because of the way Maven works, just updating system property at this point is too late
......@@ -103,13 +101,12 @@ public class SurefireArchiver extends MavenReporter {
}
public boolean postExecute(MavenBuildProxy build, MavenProject pom, MojoInfo mojo, final BuildListener listener, Throwable error) throws InterruptedException, IOException {
if (!isSurefireTest(mojo)) return true;
if (!isTestMojo(mojo)) return true;
listener.getLogger().println(Messages.SurefireArchiver_Recording());
File reportsDir;
if (mojo.is("org.apache.maven.plugins", "maven-surefire-plugin", "test") ||
mojo.is("org.apache.maven.plugins", "maven-failsafe-plugin", "integration-test")) {
if (isSurefireOrFailsafeMojo(mojo)) {
try {
reportsDir = mojo.getConfigurationValue("reportsDirectory", File.class);
} catch (ComponentConfigurationException e) {
......@@ -233,23 +230,20 @@ public class SurefireArchiver extends MavenReporter {
}
}
private boolean isSurefireTest(MojoInfo mojo) {
private boolean isTestMojo(MojoInfo mojo) {
if ((!mojo.is("com.sun.maven", "maven-junit-plugin", "test"))
&& (!mojo.is("org.sonatype.flexmojos", "flexmojos-maven-plugin", "test-run"))
&& (!mojo.is("org.eclipse.tycho", "tycho-surefire-plugin", "test"))
&& (!mojo.is("org.sonatype.tycho", "maven-osgi-test-plugin", "test"))
&& (!mojo.is("org.codehaus.mojo", "gwt-maven-plugin", "test"))
&& (!mojo.is("com.jayway.maven.plugins.android.generation2", "maven-android-plugin", "internal-integration-test"))
&& (!mojo.is("com.jayway.maven.plugins.android.generation2", "android-maven-plugin", "internal-integration-test"))
&& (!mojo.is("org.apache.maven.plugins", "maven-surefire-plugin", "test"))
&& (!mojo.is("org.apache.maven.plugins", "maven-failsafe-plugin", "integration-test"))
&& (!mojo.is("eviware", "maven-soapui-plugin", "test"))
&& (!mojo.is("eviware", "maven-soapui-pro-plugin", "test")))
&& (!isAndroidMojo(mojo))
&& (!isSurefireOrFailsafeMojo(mojo))
&& (!isSoapUiMojo(mojo)))
return false;
try {
if (mojo.is("org.apache.maven.plugins", "maven-surefire-plugin", "test")) {
Boolean skip = mojo.getConfigurationValue("skip", Boolean.class);
if (isSurefireOrFailsafeMojo(mojo)) {
Boolean skip = mojo.getConfigurationValue("skip", Boolean.class);
if (((skip != null) && (skip))) {
return false;
}
......@@ -292,12 +286,7 @@ public class SurefireArchiver extends MavenReporter {
if (((skipTests != null) && (skipTests))) {
return false;
}
} else if (mojo.is("com.jayway.maven.plugins.android.generation2", "android-maven-plugin", "internal-integration-test")) {
Boolean skipTests = mojo.getConfigurationValue("skipTests", Boolean.class);
if (((skipTests != null) && (skipTests))) {
return false;
}
} else if (mojo.is("com.jayway.maven.plugins.android.generation2", "maven-android-plugin", "internal-integration-test")) {
} else if (isAndroidMojo(mojo)) {
if (mojo.pluginName.version.compareTo("3.0.0-alpha-6") < 0) {
// Earlier versions do not support tests
return false;
......@@ -310,12 +299,7 @@ public class SurefireArchiver extends MavenReporter {
} else if (mojo.is("org.codehaus.mojo", "gwt-maven-plugin", "test") && mojo.pluginName.version.compareTo("1.2") < 0) {
// gwt-maven-plugin < 1.2 does not implement required Surefire option
return false;
} else if (mojo.is("eviware", "maven-soapui-plugin", "test")) {
Boolean skipTests = mojo.getConfigurationValue("skip", Boolean.class);
if (((skipTests != null) && (skipTests))) {
return false;
}
} else if (mojo.is("eviware", "maven-soapui-pro-plugin", "test")) {
} else if (isSoapUiMojo(mojo)) {
Boolean skipTests = mojo.getConfigurationValue("skip", Boolean.class);
if (((skipTests != null) && (skipTests))) {
return false;
......@@ -327,6 +311,22 @@ public class SurefireArchiver extends MavenReporter {
return true;
}
private boolean isAndroidMojo(MojoInfo mojo) {
return mojo.is("com.jayway.maven.plugins.android.generation2", "maven-android-plugin", "internal-integration-test")
|| mojo.is("com.jayway.maven.plugins.android.generation2", "android-maven-plugin", "internal-integration-test");
}
private boolean isSurefireOrFailsafeMojo(MojoInfo mojo) {
return mojo.is("org.apache.maven.plugins", "maven-surefire-plugin", "test")
|| mojo.is("org.apache.maven.plugins", "maven-failsafe-plugin", "integration-test")
|| mojo.is("org.apache.maven.plugins", "maven-failsafe-plugin", "verify");
}
private boolean isSoapUiMojo(MojoInfo mojo) {
return mojo.is("eviware", "maven-soapui-plugin", "test")
|| mojo.is("eviware", "maven-soapui-pro-plugin", "test");
}
// I'm not sure if SurefireArchiver is actually ever (de-)serialized,
// but just to be sure, set fileSets here
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册