holtdl 02/03/28 14:39:19
Modified: src/main/org/apache/tools/ant/taskdefs/optional/perforce
P4Base.java
Log:
Add failOnError attribute (submitted by Steven Tamm -- PR #7549).
Revision Changes Path
1.12 +18 -1
jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/perforce/P4Base.java
Index: P4Base.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/perforce/P4Base.java,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- P4Base.java 25 Feb 2002 17:38:16 -0000 1.11
+++ P4Base.java 28 Mar 2002 22:39:19 -0000 1.12
@@ -95,6 +95,10 @@
/** Perforce view for commands. (eg //projects/foobar/main/source/... )*/
protected String P4View = "";
+ // Perforce task directives
+ /** Keep going or fail on error - defaults to fail. */
+ protected boolean failOnError = true;
+
//P4 g-opts and cmd opts (rtfm)
/** Perforce 'global' opts.
* Forms half of low level API */
@@ -124,6 +128,13 @@
this.P4CmdOpts = P4CmdOpts;
}
+ /**
+ * Optionally throw a BuildException if p4 command fails
+ */
+ public void setFailonerror(boolean fail) {
+ failOnError = fail;
+ }
+
public void init() {
util = new Perl5Util();
@@ -201,7 +212,13 @@
} catch (Exception e) {
- throw new BuildException("Problem exec'ing P4 command: " +
e.getMessage());
+ String failMsg = "Problem exec'ing P4 command: " +
e.getMessage();
+ if (failOnError) {
+ throw new BuildException(failMsg);
+ } else {
+ log(failMsg, Project.MSG_ERR);
+ }
+
}
}
}
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>