1 package hudson.tasks; 2 3 import hudson.FilePath; 4 import hudson.Launcher; 5 import hudson.Util; 6 import hudson.model.Build; 7 import hudson.model.BuildListener; 8 import hudson.model.Descriptor; 9 import hudson.model.Project; 10 import org.kohsuke.stapler.StaplerRequest; 11 12 import java.io.IOException ; 13 14 19 public class BatchFile extends CommandInterpreter { 20 public BatchFile(String command) { 21 super(command); 22 } 23 24 protected String [] buildCommandLine(FilePath script) { 25 return new String [] {script.getRemote()}; 26 } 27 28 protected String getContents() { 29 return command+"\r\nexit %ERRORLEVEL%"; 30 } 31 32 protected String getFileExtension() { 33 return ".bat"; 34 } 35 36 public Descriptor<Builder> getDescriptor() { 37 return DESCRIPTOR; 38 } 39 40 public static final DescriptorImpl DESCRIPTOR = new DescriptorImpl(); 41 42 public static final class DescriptorImpl extends Descriptor<Builder> { 43 private DescriptorImpl() { 44 super(BatchFile.class); 45 } 46 47 public String getHelpFile() { 48 return "/help/project-config/batch.html"; 49 } 50 51 public String getDisplayName() { 52 return "Execute Windows batch command"; 53 } 54 55 public Builder newInstance(StaplerRequest req) { 56 return new BatchFile(req.getParameter("batchFile")); 57 } 58 } 59 } 60 | Popular Tags |