1 18 19 package org.apache.tools.ant.taskdefs.optional.ccm; 20 21 import org.apache.tools.ant.BuildException; 22 import org.apache.tools.ant.Project; 23 import org.apache.tools.ant.Task; 24 import org.apache.tools.ant.taskdefs.Execute; 25 import org.apache.tools.ant.taskdefs.ExecuteStreamHandler; 26 import org.apache.tools.ant.taskdefs.LogStreamHandler; 27 import org.apache.tools.ant.types.Commandline; 28 import org.apache.tools.ant.util.FileUtils; 29 30 31 41 public abstract class Continuus extends Task { 42 43 private String ccmDir = ""; 44 private String ccmAction = ""; 45 46 50 public String getCcmAction() { 51 return ccmAction; 52 } 53 54 59 public void setCcmAction(String v) { 60 this.ccmAction = v; 61 } 62 63 64 69 public final void setCcmDir(String dir) { 70 ccmDir = FileUtils.translatePath(dir); 71 } 72 73 77 protected final String getCcmCommand() { 78 String toReturn = ccmDir; 79 if (!toReturn.equals("") && !toReturn.endsWith("/")) { 80 toReturn += "/"; 81 } 82 83 toReturn += CCM_EXE; 84 85 return toReturn; 86 } 87 88 89 95 protected int run(Commandline cmd, ExecuteStreamHandler handler) { 96 try { 97 Execute exe = new Execute(handler); 98 exe.setAntRun(getProject()); 99 exe.setWorkingDirectory(getProject().getBaseDir()); 100 exe.setCommandline(cmd.getCommandline()); 101 return exe.execute(); 102 } catch (java.io.IOException e) { 103 throw new BuildException(e, getLocation()); 104 } 105 } 106 107 112 protected int run(Commandline cmd) { 113 return run(cmd, new LogStreamHandler(this, Project.MSG_VERBOSE, Project.MSG_WARN)); 114 } 115 116 119 private static final String CCM_EXE = "ccm"; 120 121 124 public static final String COMMAND_CREATE_TASK = "create_task"; 125 128 public static final String COMMAND_CHECKOUT = "co"; 129 132 public static final String COMMAND_CHECKIN = "ci"; 133 136 public static final String COMMAND_RECONFIGURE = "reconfigure"; 137 138 141 public static final String COMMAND_DEFAULT_TASK = "default_task"; 142 143 144 } 145 | Popular Tags |