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 34 public class SimpleP4OutputHandler extends P4HandlerAdapter { 35 36 P4Base parent; 38 40 44 public SimpleP4OutputHandler(P4Base parent) { 45 this.parent = parent; 46 } 47 48 55 public void process(String line) throws BuildException { 56 if (parent.util.match("/^exit/", line)) { 57 return; 58 } 59 60 73 if (parent.util.match("/^error:/", line) 74 || parent.util.match("/^Perforce client error:/", line)) { 75 if (!parent.util.match("/label in sync/", line) 80 && !parent.util.match("/up-to-date/", line)) { 81 parent.setInError(true); 82 } else { 83 line = parent.util.substitute("s/^[^:]*: //", line); 85 } 86 } else if (parent.util.match("/^info.*?:/", line)) { 87 line = parent.util.substitute("s/^[^:]*: //", line); 89 } 90 parent.log(line, parent.getInError() ? Project.MSG_ERR : Project.MSG_INFO); 91 92 if (parent.getInError()) { 93 parent.setErrorMessage(parent.getErrorMessage() + line + StringUtils.LINE_SEP); 94 } 95 } 96 } 97 | Popular Tags |