bodewig 2002/09/26 01:15:18
Modified: src/main/org/apache/tools/ant/taskdefs/optional Tag:
ANT_15_BRANCH Cab.java
Log:
Merge Jesse's patch from CVS HEAD.
PR: 12468
Revision Changes Path
No revision
No revision
1.18.2.2 +25 -33
jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/Cab.java
Index: Cab.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/Cab.java,v
retrieving revision 1.18.2.1
retrieving revision 1.18.2.2
diff -u -r1.18.2.1 -r1.18.2.2
--- Cab.java 19 Jun 2002 20:15:25 -0000 1.18.2.1
+++ Cab.java 26 Sep 2002 08:15:18 -0000 1.18.2.2
@@ -80,6 +80,7 @@
* Create a CAB archive.
*
* @author Roger Vaughn <a href="mailto:[EMAIL PROTECTED]">[EMAIL
PROTECTED]</a>
+ * @author Jesse Stockall
*/
public class Cab extends MatchingTask {
@@ -144,13 +145,13 @@
*/
protected void checkConfiguration() throws BuildException {
if (baseDir == null) {
- throw new BuildException("basedir attribute must be set!");
+ throw new BuildException("basedir attribute must be set!",
getLocation());
}
if (!baseDir.exists()) {
- throw new BuildException("basedir does not exist!");
+ throw new BuildException("basedir does not exist!",
getLocation());
}
if (cabFile == null) {
- throw new BuildException("cabfile attribute must be set!");
+ throw new BuildException("cabfile attribute must be set!" ,
getLocation());
}
}
@@ -184,31 +185,6 @@
}
/**
- * Create the cabarc command line to use.
- */
- protected Commandline createCommand(File listFile) {
- Commandline command = new Commandline();
- command.setExecutable("cabarc");
- command.createArgument().setValue("-r");
- command.createArgument().setValue("-p");
-
- if (!doCompress) {
- command.createArgument().setValue("-m");
- command.createArgument().setValue("none");
- }
-
- if (cmdOptions != null) {
- command.createArgument().setLine(cmdOptions);
- }
-
- command.createArgument().setValue("n");
- command.createArgument().setFile(cabFile);
- command.createArgument().setValue("@" + listFile.getAbsolutePath());
-
- return command;
- }
-
- /**
* Creates a list file. This temporary file contains a list of all files
* to be included in the cab, one file per line.
*/
@@ -287,7 +263,7 @@
sb.append("\n").append(cabFile.getAbsolutePath()).append("\n");
try {
- Process p = Execute.launch(getProject(),
+ Process p = Execute.launch(getProject(),
new String[] {"listcab"}, null,
baseDir, true);
OutputStream out = p.getOutputStream();
@@ -302,7 +278,7 @@
LogOutputStream errLog = new LogOutputStream(this,
Project.MSG_ERR);
StreamPumper outPump = new
StreamPumper(p.getInputStream(), outLog);
StreamPumper errPump = new
StreamPumper(p.getErrorStream(), errLog);
-
+
// Pump streams asynchronously
(new Thread(outPump)).start();
(new Thread(errPump)).start();
@@ -328,7 +304,7 @@
}
} catch (IOException ex) {
String msg = "Problem creating " + cabFile + " " +
ex.getMessage();
- throw new BuildException(msg);
+ throw new BuildException(msg, getLocation());
}
} else {
try {
@@ -345,7 +321,23 @@
exec.setOutput(outFile);
}
- exec.setCommand(createCommand(listFile));
+ exec.setExecutable("cabarc");
+ exec.createArg().setValue("-r");
+ exec.createArg().setValue("-p");
+
+ if (!doCompress) {
+ exec.createArg().setValue("-m");
+ exec.createArg().setValue("none");
+ }
+
+ if (cmdOptions != null) {
+ exec.createArg().setLine(cmdOptions);
+ }
+
+ exec.createArg().setValue("n");
+ exec.createArg().setFile(cabFile);
+ exec.createArg().setValue("@" + listFile.getAbsolutePath());
+
exec.execute();
if (outFile != null) {
@@ -355,7 +347,7 @@
listFile.delete();
} catch (IOException ioe) {
String msg = "Problem creating " + cabFile + " " +
ioe.getMessage();
- throw new BuildException(msg);
+ throw new BuildException(msg, getLocation());
}
}
}
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>