summaryrefslogtreecommitdiff
path: root/src/compiler/scala/tools/ant/Pack200Task.scala
diff options
context:
space:
mode:
authorPaul Phillips <paulp@improving.org>2010-12-05 02:56:08 +0000
committerPaul Phillips <paulp@improving.org>2010-12-05 02:56:08 +0000
commit77eb8fefec3e62ead95c7d409ec5a28f30289ec3 (patch)
tree5e035714a7e6363d1ae7f712d5b1f73c1d27d79e /src/compiler/scala/tools/ant/Pack200Task.scala
parent626e38940b72f5e8445ecbece4d41996b5e2842e (diff)
downloadscala-77eb8fefec3e62ead95c7d409ec5a28f30289ec3.tar.gz
scala-77eb8fefec3e62ead95c7d409ec5a28f30289ec3.tar.bz2
scala-77eb8fefec3e62ead95c7d409ec5a28f30289ec3.zip
Mopping up after the deprecation of exit and er...
Mopping up after the deprecation of exit and error. It is decidedly non-trivial (at least for the IDE-impaired) to be completely sure of which error function was being called when there were about twenty with the same signature in trunk and they are being variously inherited, imported, shadowed, etc. So although I was careful, the possibility exists that something is now calling a different "error" function than before. Caveat programmer. (And let's all make it our policy not to name anything "error" or "exit" from here on out....) No review.
Diffstat (limited to 'src/compiler/scala/tools/ant/Pack200Task.scala')
-rw-r--r--src/compiler/scala/tools/ant/Pack200Task.scala20
1 files changed, 6 insertions, 14 deletions
diff --git a/src/compiler/scala/tools/ant/Pack200Task.scala b/src/compiler/scala/tools/ant/Pack200Task.scala
index 12a8706a1c..c15e1f04f5 100644
--- a/src/compiler/scala/tools/ant/Pack200Task.scala
+++ b/src/compiler/scala/tools/ant/Pack200Task.scala
@@ -16,7 +16,6 @@ import java.util.jar.{JarFile, JarInputStream, JarOutputStream, Pack200}
import java.util.jar.Pack200.Packer._
import org.apache.tools.ant.{BuildException, DirectoryScanner}
-import org.apache.tools.ant.taskdefs.MatchingTask
import org.apache.tools.ant.types.FileSet
/** <p>
@@ -34,7 +33,7 @@ import org.apache.tools.ant.types.FileSet
*
* @author James Matlik
*/
-class Pack200Task extends MatchingTask {
+class Pack200Task extends ScalaMatchingTask {
/*============================================================================*\
** Ant user-properties **
@@ -58,13 +57,13 @@ class Pack200Task extends MatchingTask {
def setDir(dir: File) {
if (dir.exists && dir.isDirectory) srcdir = Some(dir)
- else error("Please specify a valid directory with Jar files for packing.")
+ else buildError("Please specify a valid directory with Jar files for packing.")
}
/** A level from 0 (none) to 9 (max) of effort for applying Pack200 */
def setEffort(x: Int) {
if (effort < 10 && effort > -1) effort = x
- else error("The effort level must be a value from 0 to 9")
+ else buildError("The effort level must be a value from 0 to 9")
}
/** Set the flag to specify if file reordering should be performed. Reordering
@@ -89,7 +88,7 @@ class Pack200Task extends MatchingTask {
/** Set the output directory */
def setDestdir(file: File) {
if (file != null && file.exists && file.isDirectory) destdir = Some(file)
- else error("The destination directory is invalid: " + file.getAbsolutePath)
+ else buildError("The destination directory is invalid: " + file.getAbsolutePath)
}
def setSuffix(s: String) { packFileSuffix = s }
@@ -117,13 +116,6 @@ class Pack200Task extends MatchingTask {
** Compilation and support methods **
\*============================================================================*/
-/** Generates a build error. Error location will be the current task in the
- * ant file.
- * @param message A message describing the error.
- * @throws BuildException A build error exception thrown in every case. */
- private def error(message: String): Nothing =
- throw new BuildException(message, getLocation())
-
private def makeJarOutputStream(file: File) =
new JarOutputStream(makeOutputStream(file))
@@ -137,13 +129,13 @@ class Pack200Task extends MatchingTask {
/** Performs the tool creation. */
override def execute() = {
// Audits
- val packDir = destdir.getOrElse(error("No output directory specified"))
+ val packDir = destdir.getOrElse(buildError("No output directory specified"))
// Setup the inherited fileset for further processing
fileset.setDir(srcdir.getOrElse(getProject.getBaseDir))
val files = getFileList
- if (files.isEmpty) error("No JAR files were selected for packing.")
+ if (files.isEmpty) buildError("No JAR files were selected for packing.")
// Setup the packer
val packer = Pack200.newPacker