From e6ad5066a8e81c9a75abbcb009141da264b1da71 Mon Sep 17 00:00:00 2001 From: buraq Date: Mon, 2 Feb 2004 13:01:45 +0000 Subject: teset whether fjbg is in classpath --- sources/scala/tools/scala4ant/AntTask.scala | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) (limited to 'sources') diff --git a/sources/scala/tools/scala4ant/AntTask.scala b/sources/scala/tools/scala4ant/AntTask.scala index 45808a0eef..11381176c7 100644 --- a/sources/scala/tools/scala4ant/AntTask.scala +++ b/sources/scala/tools/scala4ant/AntTask.scala @@ -13,6 +13,8 @@ import java.util._; * adapted from package jaco.framework.ant.AntCompilerTask * (part of Matthias Zenger's jaco framework) * + * @todo deduce path to scala sources using path to tools.jar (brittle) + * * @author Burak Emir * @version 1.5 * $Id$ @@ -27,14 +29,22 @@ class AntTask extends Javac { private val fileUtils:FileUtils = FileUtils.newFileUtils(); override def execute():unit = { - val project = getProject(); - //val old = project.getProperty("build.compiler"); - project.setProperty("build.compiler", "scala.tools.scala4ant.AntAdaptor$class"); - super.execute(); - //if (old == null) - // project.setProperty("build.compiler", "modern"); - //else - // project.setProperty("build.compiler", old); + try{ + Class.forName("ch.epfl.lamp.fjbg.JFieldOrMethod"); // simple check + + val project = getProject(); + //val old = project.getProperty("build.compiler"); + project.setProperty("build.compiler", "scala.tools.scala4ant.AntAdaptor$class"); + super.execute(); + //if (old == null) + // project.setProperty("build.compiler", "modern"); + //else + // project.setProperty("build.compiler", old); + } catch { + case e:ClassNotFoundException => + throw new BuildException("Cannot run scala4ant. It seems fjbg.jar is not in your CLASSPATH."); + } + } def setForce( fc:boolean ) = { -- cgit v1.2.3