summaryrefslogtreecommitdiff
path: root/src/compiler
diff options
context:
space:
mode:
authorGilles Dubochet <gilles.dubochet@epfl.ch>2006-01-09 18:28:11 +0000
committerGilles Dubochet <gilles.dubochet@epfl.ch>2006-01-09 18:28:11 +0000
commit400a4aca0a82efd14ba80c5e82d5a610bfc73b94 (patch)
treef1f559fdb084992a1eea86c4c1a24e4c3a31eedc /src/compiler
parentc1898606197232e0d4199cb5171775924c48b610 (diff)
downloadscala-400a4aca0a82efd14ba80c5e82d5a610bfc73b94.tar.gz
scala-400a4aca0a82efd14ba80c5e82d5a610bfc73b94.tar.bz2
scala-400a4aca0a82efd14ba80c5e82d5a610bfc73b94.zip
The Scalac Ant task now supports a 'addparams' ...
The Scalac Ant task now supports a 'addparams' parameter for passing custom parameters to the compiler. Build script updated to use it too: set nsc.params to add custom parameters.
Diffstat (limited to 'src/compiler')
-rw-r--r--src/compiler/scala/tools/ant/Scalac.scala23
1 files changed, 22 insertions, 1 deletions
diff --git a/src/compiler/scala/tools/ant/Scalac.scala b/src/compiler/scala/tools/ant/Scalac.scala
index 203566c52b..cd67dba06e 100644
--- a/src/compiler/scala/tools/ant/Scalac.scala
+++ b/src/compiler/scala/tools/ant/Scalac.scala
@@ -41,7 +41,8 @@ package scala.tools.ant {
* <li>logging,</li>
* <li>logphase,</li>
* <li>usepredefs,</li>
- * <li>debugcode.</li>
+ * <li>debugcode,</li>
+ * <li>addparams.</li>
* </ul>
* It also takes the following parameters as nested elements:<ul>
* <li>src (for srcdir),</li>
@@ -114,6 +115,8 @@ package scala.tools.ant {
private var usepredefs: Boolean = true;
/** Instruct the compiler to generate debugging information */
private var debugCode: Boolean = false
+ /** Instruct the compiler to generate debugging information */
+ private var addParams: String = ""
/******************************************************************************\
** Properties setters **
@@ -255,6 +258,10 @@ package scala.tools.ant {
def setDebugCode(input: Boolean): Unit =
debugCode = input
+ /** Set the debug info attribute. */
+ def setAddparams(input: String): Unit =
+ addParams = input
+
/******************************************************************************\
** Properties getters **
\******************************************************************************/
@@ -420,6 +427,20 @@ package scala.tools.ant {
settings.nopredefs.value = !usepredefs;
settings.debuginfo.value = debugCode
+ log("Scalac params = '" + addParams + "'", Project.MSG_DEBUG)
+ var args =
+ if (addParams.trim() == "") Nil
+ else List.fromArray(addParams.trim().split(" ")).map(.trim())
+ while(!args.isEmpty) {
+ val argsBuf = args
+ if (args.head.startsWith("-")) {
+ for (val setting <- settings.allSettings)
+ args = setting.tryToSet(args);
+ } else error("Parameter '" + args.head + "' does not start with '-'.")
+ if (argsBuf eq args)
+ error("Parameter '" + args.head + "' is not recognised by Scalac.")
+ }
+
// Compiles the actual code
val compiler = new Global(settings, reporter)
try {