Skip to content

Commit

Permalink
Fix JENKINS-30292 - Not visible in Conditional BuildStep Plugin
Browse files Browse the repository at this point in the history
Builder descriptor now inherit BuildStepDescriptor so it will	 be visible in conditional BuildStep plugin
  • Loading branch information
Ido Ran committed Sep 12, 2015
1 parent 5ac4d7e commit 85bd0df
Showing 1 changed file with 15 additions and 7 deletions.
22 changes: 15 additions & 7 deletions src/main/java/org/jenkinsci/plugins/MsTestBuilder.java
Expand Up @@ -10,6 +10,9 @@
import hudson.model.AbstractBuild;
import hudson.model.Computer;
import hudson.model.Descriptor;
import hudson.model.AbstractBuild;
import hudson.model.AbstractProject;
import hudson.tasks.BuildStepDescriptor;
import hudson.tasks.Builder;
import hudson.tools.ToolInstallation;

Expand Down Expand Up @@ -82,7 +85,7 @@ public String getResultFile() {
public String getMsTestName() {
return msTestName;
}

@SuppressWarnings("unused")
public boolean getcontinueOnFail() {
return continueOnFail;
Expand Down Expand Up @@ -131,12 +134,12 @@ public boolean perform(AbstractBuild<?, ?> build, Launcher launcher, BuildListen
args.addAll(Arrays.asList(Util.tokenize(installation.getDefaultArgs())));
}
}

if (resultFile == null || resultFile.trim().length() == 0) {
listener.fatalError("Result file name was not specified");
return false;
}

// Delete old result file
FilePath resultFilePath = workspace.child(resultFile);
if (!resultFilePath.exists()) {
Expand All @@ -153,10 +156,10 @@ public boolean perform(AbstractBuild<?, ?> build, Launcher launcher, BuildListen
return false;
}
}

// Add result file argument
args.add("/resultsfile:" + resultFile);

// Checks to use noisolation flag
if (installation != null && !installation.getOmitNoIsolation()){
args.add("/noisolation");
Expand Down Expand Up @@ -225,7 +228,7 @@ public boolean perform(AbstractBuild<?, ?> build, Launcher launcher, BuildListen

try {
int r = launcher.launch().cmds(args).envs(env).stdout(listener).pwd(workspace).join();

// If continueOnFail is set we always report success.
// If not we report success if MSTest return 0 and exit value.
return continueOnFail || (r == 0);
Expand All @@ -246,7 +249,7 @@ public Descriptor<Builder> getDescriptor() {
@Extension
public static final DescriptorImpl DESCRIPTOR = new DescriptorImpl();

public static final class DescriptorImpl extends Descriptor<Builder> {
public static final class DescriptorImpl extends BuildStepDescriptor<Builder> {

@CopyOnWrite
private volatile MsTestInstallation[] installations = new MsTestInstallation[0];
Expand All @@ -260,6 +263,11 @@ public String getDisplayName() {
return "Run unit tests with MSTest";
}

@Override
public boolean isApplicable(@SuppressWarnings("rawtypes") final Class<? extends AbstractProject> jobType) {
return true;
}

public MsTestInstallation[] getInstallations() {
return installations;
}
Expand Down

0 comments on commit 85bd0df

Please sign in to comment.