Skip to content
Permalink
Browse files
[JENKINS-34565][JENKINS-34623] Upgrade to 2.x parent pom. Increase te…
…st coverage
  • Loading branch information
armfergom committed May 9, 2016
1 parent 52591c7 commit 9f6c00a7c07dd51878c78a7f7b9d7d0b846f8a52
40 pom.xml
@@ -3,7 +3,7 @@
<parent>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>plugin</artifactId>
<version>1.532.1</version>
<version>2.7</version>
</parent>

<artifactId>ant</artifactId>
@@ -18,6 +18,32 @@
<developerConnection>scm:git:git@github.com:jenkinsci/${project.artifactId}-plugin.git</developerConnection>
</scm>

<properties>
<jenkins.version>1.596.1</jenkins.version>
<java.level>6</java.level>
</properties>

<dependencies>
<dependency>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>matrix-project</artifactId>
<version>1.6</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jenkins-ci.main</groupId>
<artifactId>jenkins-test-harness-tools</artifactId>
<version>2.0</version>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>ant</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>

<repositories>
<repository>
<id>repo.jenkins-ci.org</id>
@@ -33,10 +59,10 @@
</license>
</licenses>

<pluginRepositories>
<pluginRepository>
<id>repo.jenkins-ci.org</id>
<url>http://repo.jenkins-ci.org/public/</url>
</pluginRepository>
</pluginRepositories>
<pluginRepositories>
<pluginRepository>
<id>repo.jenkins-ci.org</id>
<url>http://repo.jenkins-ci.org/public/</url>
</pluginRepository>
</pluginRepositories>
</project>
@@ -23,6 +23,7 @@
*/
package hudson.tasks;

import hudson.AbortException;
import hudson.CopyOnWrite;
import hudson.EnvVars;
import hudson.Extension;
@@ -36,9 +37,9 @@
import hudson.model.Computer;
import hudson.model.EnvironmentSpecific;
import jenkins.model.Jenkins;
import jenkins.security.MasterToSlaveCallable;
import hudson.model.Node;
import hudson.model.TaskListener;
import hudson.remoting.Callable;
import hudson.slaves.NodeSpecific;
import hudson.tasks._ant.Messages;
import hudson.tasks._ant.AntConsoleAnnotator;
@@ -51,14 +52,16 @@
import hudson.util.VariableResolver;
import hudson.util.FormValidation;
import hudson.util.XStream2;
import net.sf.json.JSONObject;

import org.kohsuke.stapler.DataBoundConstructor;
import org.kohsuke.stapler.StaplerRequest;
import org.kohsuke.stapler.QueryParameter;

import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;

import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Properties;
import java.util.List;
import java.util.Collections;
@@ -148,12 +151,15 @@ public boolean perform(AbstractBuild<?,?> build, Launcher launcher, BuildListene
if(ai==null) {
args.add(launcher.isUnix() ? "ant" : "ant.bat");
} else {
ai = ai.forNode(Computer.currentComputer().getNode(), listener);
Node node = Computer.currentComputer().getNode();
if (node == null) {
throw new AbortException(Messages.Ant_NodeOffline());
}
ai = ai.forNode(node, listener);
ai = ai.forEnvironment(env);
String exe = ai.getExecutable(launcher);
if (exe==null) {
listener.fatalError(Messages.Ant_ExecutableNotFound(ai.getName()));
return false;
throw new AbortException(Messages.Ant_ExecutableNotFound(ai.getName()));
}
args.add(exe);
}
@@ -171,14 +177,18 @@ public boolean perform(AbstractBuild<?,?> build, Launcher launcher, BuildListene
// and diagnosing it nicely. See HUDSON-1782

// first check if this appears to be a valid relative path from workspace root
FilePath buildFilePath2 = buildFilePath(build.getWorkspace(), buildFile, targets);
if(buildFilePath2.exists()) {
// This must be what the user meant. Let it continue.
buildFilePath = buildFilePath2;
FilePath workspaceFilePath = build.getWorkspace();
if (workspaceFilePath != null) {
FilePath buildFilePath2 = buildFilePath(workspaceFilePath, buildFile, targets);
if(buildFilePath2.exists()) {
// This must be what the user meant. Let it continue.
buildFilePath = buildFilePath2;
} else {
// neither file exists. So this now really does look like an error.
throw new AbortException("Unable to find build script at "+ buildFilePath);
}
} else {
// neither file exists. So this now really does look like an error.
listener.fatalError("Unable to find build script at "+buildFilePath);
return false;
throw new AbortException("Workspace is not available. Agent may be disconnected.");
}
}

@@ -231,8 +241,7 @@ public boolean perform(AbstractBuild<?,?> build, Launcher launcher, BuildListene
// There are Ant installations configured but the project didn't pick it
errorMessage += Messages.Ant_ProjectConfigNeeded();
}
e.printStackTrace( listener.fatalError(errorMessage) );
return false;
throw new AbortException(errorMessage);
}
}

@@ -283,7 +292,7 @@ public String getDisplayName() {
}

public AntInstallation[] getInstallations() {
return installations;
return Arrays.copyOf(installations, installations.length);
}

public void setInstallations(AntInstallation... antInstallations) {
@@ -341,7 +350,8 @@ public void buildEnvVars(EnvVars env) {
* Gets the executable path of this Ant on the given target system.
*/
public String getExecutable(Launcher launcher) throws IOException, InterruptedException {
return launcher.getChannel().call(new Callable<String,IOException>() {
return launcher.getChannel().call(new MasterToSlaveCallable<String,IOException>() {
private static final long serialVersionUID = 906341330603832653L;
public String call() throws IOException {
File exe = getExeFile();
if(exe.exists())
@@ -376,6 +386,7 @@ public AntInstallation forNode(Node node, TaskListener log) throws IOException,
}

@Extension
@SuppressFBWarnings(value="NP_NULL_ON_SOME_PATH_FROM_RETURN_VALUE", justification="https://github.com/jenkinsci/jenkins/pull/2094")
public static class DescriptorImpl extends ToolDescriptor<AntInstallation> {

@Override
@@ -445,7 +456,7 @@ public AntInstaller(String id) {
@Extension
public static final class DescriptorImpl extends DownloadFromUrlInstaller.DescriptorImpl<AntInstaller> {
public String getDisplayName() {
return Messages.InstallFromApache();
return Messages.Ant_InstallFromApache();
}

@Override
@@ -34,7 +34,7 @@
* Filter {@link OutputStream} that places an annotation that marks Ant target execution.
*
* @author Kohsuke Kawaguchi
* @sine 1.349
* @since 1.349
*/
public class AntConsoleAnnotator extends LineTransformationOutputStream {
private final OutputStream out;
@@ -31,9 +31,13 @@

import java.util.regex.Pattern;

import com.google.common.annotations.VisibleForTesting;

import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;

/**
* Marks the log line "TARGET:" that Ant uses to mark the beginning of the new target.
* @sine 1.349
* @since 1.349
*/
public final class AntTargetNote extends ConsoleNote {
public AntTargetNote() {
@@ -57,5 +61,7 @@ public String getDisplayName() {
}
}

@VisibleForTesting
@SuppressFBWarnings(value="MS_SHOULD_BE_FINAL", justification="Visible for testing")
public static boolean ENABLED = !Boolean.getBoolean(AntTargetNote.class.getName()+".disabled");
}
@@ -23,9 +23,10 @@
Ant.DisplayName=Invoke Ant
Ant.ExecFailed=command execution failed.
Ant.ExecutableNotFound=Cannot find executable from the chosen Ant installation "{0}"
Ant.NodeOffline=Cannot get installation for node, since it is not online
Ant.GlobalConfigNeeded= Maybe you need to configure where your Ant installations are?
Ant.NotADirectory={0} is not a directory
Ant.NotAntDirectory={0} doesn''t look like an Ant directory
Ant.ProjectConfigNeeded= Maybe you need to configure the job to choose one of your Ant installations?

InstallFromApache=Install from Apache
Ant.InstallFromApache=Install from Apache
@@ -22,7 +22,7 @@

Ant.NotADirectory={0} er ikke et direktorie
Ant.GlobalConfigNeeded=M\u00e5ske mangler du at konfigurere hvor dine Ant installationer er?
InstallFromApache=Installer fra Apache
Ant.InstallFromApache=Installer fra Apache
Ant.ProjectConfigNeeded=M\u00e5ske mangler du at konfigurere jobbet til at v\u00e6lge en af dine Ant installationer?
Ant.NotAntDirectory={0} ligner ikke et Ant direktorie
Ant.ExecFailed=Kommandoeksekvering fejlede
@@ -28,4 +28,4 @@ Ant.NotADirectory={0} ist kein Verzeichnis
Ant.NotAntDirectory={0} sieht nicht wie ein Ant-Verzeichnis aus.
Ant.ProjectConfigNeeded=Eventuell müssen Sie für den Job noch eine Ihrer Ant-Installationen auswählen.

InstallFromApache=Installiere von Apache
Ant.InstallFromApache=Installiere von Apache
@@ -23,9 +23,10 @@
Ant.DisplayName=Ejecutar Ant
Ant.ExecFailed=Falló la ejecución del comando
Ant.ExecutableNotFound=No se encuentra el archivo ejecutable para la instalación de ant seleccionada "{0}"
Ant.NodeOffline=No se puede generar la instalación de Ant para el nodo actual ya que este no se encuentra disponible.
Ant.GlobalConfigNeeded= Posiblemente tengas que configurar dónde se encuentra tu instalación de ''ant''
Ant.NotADirectory={0} no es un directorio
Ant.NotAntDirectory={0} no parece un directorio de ''ant''
Ant.ProjectConfigNeeded= Es posible que tengas que configurar la tarea para que utilice una de tus instalaciones de ''ant''

InstallFromApache=Instalar desde Apache
Ant.InstallFromApache=Instalar desde Apache
@@ -28,4 +28,4 @@ Ant.NotADirectory={0}\u306f\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u3067\u306f\u304
Ant.NotAntDirectory={0}\u306b\u306fAnt\u304c\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3055\u308c\u3066\u3044\u306a\u3044\u3088\u3046\u3067\u3059
Ant.ProjectConfigNeeded=\u3069\u306eAnt\u3092\u4f7f\u3046\u304b\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u3067\u8a2d\u5b9a\u3059\u308b\u5fc5\u8981\u304c\u3042\u308b\u306e\u3067\u306f\uff1f

InstallFromApache=Apache\u304b\u3089\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb
Ant.InstallFromApache=Apache\u304b\u3089\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb
@@ -28,4 +28,4 @@ Ant.NotAntDirectory={0} n\u00e3o parece ser um diret\u00f3rio Ant
Ant.ProjectConfigNeeded= Talvez voc\u00ea precise configurar a tarefa para escolher uma de suas instala\u00e7\u00f5es do Ant.

# Install from Apache
InstallFromApache=Instalar a partir do Apache
Ant.InstallFromApache=Instalar a partir do Apache
@@ -28,4 +28,4 @@ Ant.NotADirectory={0} \u4e0d\u662f\u76ee\u9304
Ant.NotAntDirectory={0} \u4e0d\u50cf\u662f Ant \u76ee\u9304
Ant.ProjectConfigNeeded= \u4e5f\u8a31\u60a8\u8a72\u8a2d\u5b9a\u4f5c\u696d\uff0c\u7531\u5b89\u88dd\u7684 Ant \u4e2d\u6311\u4e00\u500b?

InstallFromApache=\u5f9e Apache \u5b89\u88dd
Ant.InstallFromApache=\u5f9e Apache \u5b89\u88dd

0 comments on commit 9f6c00a

Please sign in to comment.