1 18 23 24 package org.apache.tools.ant.taskdefs.optional.perforce; 25 26 import org.apache.tools.ant.BuildException; 27 import org.apache.tools.ant.Project; 28 import org.apache.tools.ant.util.StringUtils; 29 30 43 public class P4Labelsync extends P4Base { 44 45 protected String name; 47 private boolean add; 48 private boolean delete; 49 private boolean simulationmode; 50 59 public boolean isAdd() { 60 return add; 61 } 62 69 public void setAdd(boolean add) { 70 this.add = add; 71 } 72 77 public boolean isDelete() { 78 return delete; 79 } 80 81 87 public void setDelete(boolean delete) { 88 this.delete = delete; 89 } 90 91 92 96 public void setName(String name) { 97 this.name = name; 98 } 99 103 public boolean isSimulationmode() { 104 return simulationmode; 105 } 106 110 public void setSimulationmode(boolean simulationmode) { 111 this.simulationmode = simulationmode; 112 } 113 114 115 119 public void execute() throws BuildException { 120 log("P4Labelsync exec:", Project.MSG_INFO); 121 122 if (P4View != null && P4View.length() >= 1) { 123 P4View = StringUtils.replace(P4View, ":", "\n\t"); 124 P4View = StringUtils.replace(P4View, ";", "\n\t"); 125 } 126 if (P4View == null) { 127 P4View = ""; 128 } 129 130 if (name == null || name.length() < 1) { 131 throw new BuildException("name attribute is compulsory for labelsync"); 132 } 133 134 if (this.isSimulationmode()) { 135 P4CmdOpts = P4CmdOpts + " -n"; 136 } 137 if (this.isDelete()) { 138 P4CmdOpts = P4CmdOpts + " -d"; 139 } 140 if (this.isAdd()) { 141 P4CmdOpts = P4CmdOpts + " -a"; 142 } 143 144 execP4Command("-s labelsync -l " + name + " " + P4CmdOpts + " " + P4View, 145 new SimpleP4OutputHandler(this)); 146 147 148 } 149 } 150 151 | Popular Tags |