This page is no longer maintained — Please continue to the home page at www.scala-lang.org

Ant fsc task fails

6 replies
Alan Burlison
Joined: 2011-08-26,
User offline. Last seen 42 years 45 weeks ago.

I'm trying to use the Ant fsc task. I have a target that works fine
with the scalac task but if I switch it over to using fsc it fails, yet
it apparently does actually build the files correctly. Is this a known
problem?

> [running phase dce on ScalaTestClass.scala]
> [running phase dce on TestClass2.scala]
> [running phase dce on JavaTestClass.java]
> [dce in 0ms]
> [running phase jvm on icode]
> [wrote 'TestClass2' to /home/alanbur/scala/web/build/web/WEB-INF/classes/scala/TestClass2.class]
> [wrote 'ScalaTestClass' to /home/alanbur/scala/web/build/web/WEB-INF/classes/scala/ScalaTestClass.class]
> [jvm in 5ms]
> [total in 48ms]
> /home/alanbur/scala/web/build-scala.xml:38: Compile failed; see the compiler error output for details.
> at scala.tools.ant.ScalaTask$class.buildError(ScalaMatchingTask.scala:27)
> at scala.tools.ant.ScalaMatchingTask.buildError(ScalaMatchingTask.scala:30)
> at scala.tools.ant.FastScalac.execute(FastScalac.scala:107)
> at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
> at sun.reflect.GeneratedMethodAccessor198.invoke(Unknown Source)
> at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> at java.lang.reflect.Method.invoke(Method.java:597)
> at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
> at org.apache.tools.ant.Task.perform(Task.java:348)
> at org.apache.tools.ant.Target.execute(Target.java:390)
> at org.apache.tools.ant.Target.performTasks(Target.java:411)
> at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1399)
> at org.apache.tools.ant.Project.executeTarget(Project.java:1368)
> at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
> at org.apache.tools.ant.Project.executeTargets(Project.java:1251)
> at org.apache.tools.ant.module.bridge.impl.BridgeImpl.run(BridgeImpl.java:284)
> at org.apache.tools.ant.module.run.TargetExecutor.run(TargetExecutor.java:539)
> at org.netbeans.core.execution.RunClassThread.run(RunClassThread.java:153)
> /home/alanbur/scala/web/build-scala.xml:38: Compile failed because of an internal compiler error (Compile failed; see the compiler error output for details.); see the error output for details.
> at scala.tools.ant.ScalaTask$class.buildError(ScalaMatchingTask.scala:27)
> at scala.tools.ant.ScalaMatchingTask.buildError(ScalaMatchingTask.scala:30)
> at scala.tools.ant.FastScalac.execute(FastScalac.scala:112)
> at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
> at sun.reflect.GeneratedMethodAccessor198.invoke(Unknown Source)
> at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> at java.lang.reflect.Method.invoke(Method.java:597)
> at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
> at org.apache.tools.ant.Task.perform(Task.java:348)
> at org.apache.tools.ant.Target.execute(Target.java:390)
> at org.apache.tools.ant.Target.performTasks(Target.java:411)
> at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1399)
> at org.apache.tools.ant.Project.executeTarget(Project.java:1368)
> at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
> at org.apache.tools.ant.Project.executeTargets(Project.java:1251)
> at org.apache.tools.ant.module.bridge.impl.BridgeImpl.run(BridgeImpl.java:284)
> at org.apache.tools.ant.module.run.TargetExecutor.run(TargetExecutor.java:539)
> at org.netbeans.core.execution.RunClassThread.run(RunClassThread.java:153)
> BUILD FAILED (total time: 1 second)

ichoran
Joined: 2009-08-14,
User offline. Last seen 2 years 3 weeks ago.
Re: Ant fsc task fails
This happens to me all the time.  As a workaround, I use scalac for the offending file(s), or do a fsc -reset (or fsc -shutdown, which is sometimes necessary) before actually calling the compiler.
  --Rex

On Tue, Nov 8, 2011 at 7:40 AM, Alan Burlison <alan.burlison@gmail.com> wrote:
I'm trying to use the Ant fsc task.  I have a target that works fine with the scalac task but if I switch it over to using fsc it fails, yet it apparently does actually build the files correctly.  Is this a known problem?

[running phase dce on ScalaTestClass.scala]
[running phase dce on TestClass2.scala]
[running phase dce on JavaTestClass.java]
[dce in 0ms]
[running phase jvm on icode]
[wrote 'TestClass2' to /home/alanbur/scala/web/build/web/WEB-INF/classes/scala/TestClass2.class]
[wrote 'ScalaTestClass' to /home/alanbur/scala/web/build/web/WEB-INF/classes/scala/ScalaTestClass.class]
[jvm in 5ms]
[total in 48ms]
/home/alanbur/scala/web/build-scala.xml:38: Compile failed; see the compiler error output for details.
       at scala.tools.ant.ScalaTask$class.buildError(ScalaMatchingTask.scala:27)
       at scala.tools.ant.ScalaMatchingTask.buildError(ScalaMatchingTask.scala:30)
       at scala.tools.ant.FastScalac.execute(FastScalac.scala:107)
       at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
       at sun.reflect.GeneratedMethodAccessor198.invoke(Unknown Source)
       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
       at java.lang.reflect.Method.invoke(Method.java:597)
       at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
       at org.apache.tools.ant.Task.perform(Task.java:348)
       at org.apache.tools.ant.Target.execute(Target.java:390)
       at org.apache.tools.ant.Target.performTasks(Target.java:411)
       at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1399)
       at org.apache.tools.ant.Project.executeTarget(Project.java:1368)
       at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
       at org.apache.tools.ant.Project.executeTargets(Project.java:1251)
       at org.apache.tools.ant.module.bridge.impl.BridgeImpl.run(BridgeImpl.java:284)
       at org.apache.tools.ant.module.run.TargetExecutor.run(TargetExecutor.java:539)
       at org.netbeans.core.execution.RunClassThread.run(RunClassThread.java:153)
/home/alanbur/scala/web/build-scala.xml:38: Compile failed because of an internal compiler error (Compile failed; see the compiler error output for details.); see the error output for details.
       at scala.tools.ant.ScalaTask$class.buildError(ScalaMatchingTask.scala:27)
       at scala.tools.ant.ScalaMatchingTask.buildError(ScalaMatchingTask.scala:30)
       at scala.tools.ant.FastScalac.execute(FastScalac.scala:112)
       at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
       at sun.reflect.GeneratedMethodAccessor198.invoke(Unknown Source)
       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
       at java.lang.reflect.Method.invoke(Method.java:597)
       at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
       at org.apache.tools.ant.Task.perform(Task.java:348)
       at org.apache.tools.ant.Target.execute(Target.java:390)
       at org.apache.tools.ant.Target.performTasks(Target.java:411)
       at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1399)
       at org.apache.tools.ant.Project.executeTarget(Project.java:1368)
       at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
       at org.apache.tools.ant.Project.executeTargets(Project.java:1251)
       at org.apache.tools.ant.module.bridge.impl.BridgeImpl.run(BridgeImpl.java:284)
       at org.apache.tools.ant.module.run.TargetExecutor.run(TargetExecutor.java:539)
       at org.netbeans.core.execution.RunClassThread.run(RunClassThread.java:153)
BUILD FAILED (total time: 1 second)





Alan Burlison
Joined: 2011-08-26,
User offline. Last seen 42 years 45 weeks ago.
Re: Ant fsc task fails

On 08/11/2011 15:03, Rex Kerr wrote:

> This happens to me all the time. As a workaround, I use scalac for the
> offending file(s), or do a fsc -reset (or fsc -shutdown, which is sometimes
> necessary) before actually calling the compiler.

I tried multiple resets & shutdowns, made no difference. Looks to like
the fsc exit status isn't being propagated back properly for some reason
- if I do an immediate rebuild with no code changes, the fsc task
returns a successful exit status.

Should I log a bug?

ichoran
Joined: 2009-08-14,
User offline. Last seen 2 years 3 weeks ago.
Re: Ant fsc task fails
You have to do the shutdown _before compiling the offending file and after compiling the others_ (not before or after calling ant, typically, unless ant only ends up compiling that one file).  fsc is fast because it maintains information about previous compiles and keeps previously used classes loaded.  Unfortunately, it doesn't manage to update this information perfectly.

I can't tell from your message whether you are doing the shutdown the way I would recommend.

  --Rex

On Tue, Nov 8, 2011 at 10:18 AM, Alan Burlison <alan.burlison@gmail.com> wrote:
On 08/11/2011 15:03, Rex Kerr wrote:

This happens to me all the time.  As a workaround, I use scalac for the
offending file(s), or do a fsc -reset (or fsc -shutdown, which is sometimes
necessary) before actually calling the compiler.

I tried multiple resets & shutdowns, made no difference.  Looks to like the fsc exit status isn't being propagated back properly for some reason - if I do an immediate rebuild with no code changes, the fsc task returns a successful exit status.

Should I log a bug?

Alan Burlison
Joined: 2011-08-26,
User offline. Last seen 42 years 45 weeks ago.
Re: Ant fsc task fails

On 08/11/2011 16:23, Rex Kerr wrote:

> You have to do the shutdown _before compiling the offending file and after
> compiling the others_ (not before or after calling ant, typically, unless
> ant only ends up compiling that one file). fsc is fast because it
> maintains information about previous compiles and keeps previously used
> classes loaded. Unfortunately, it doesn't manage to update this
> information perfectly.
>
> I can't tell from your message whether you are doing the shutdown the way I
> would recommend.

Even with only a single Scala file it fails the first time, irrespective
of which combinations of reset and shutdown I use.

ichoran
Joined: 2009-08-14,
User offline. Last seen 2 years 3 weeks ago.
Re: Ant fsc task fails
This is a more peculiar behavior than I've ever found.  Maybe you should report it on the bug tracker?
  --Rex

On Tue, Nov 8, 2011 at 11:42 AM, Alan Burlison <alan.burlison@gmail.com> wrote:
On 08/11/2011 16:23, Rex Kerr wrote:

You have to do the shutdown _before compiling the offending file and after
compiling the others_ (not before or after calling ant, typically, unless
ant only ends up compiling that one file).  fsc is fast because it
maintains information about previous compiles and keeps previously used
classes loaded.  Unfortunately, it doesn't manage to update this
information perfectly.

I can't tell from your message whether you are doing the shutdown the way I
would recommend.

Even with only a single Scala file it fails the first time, irrespective of which combinations of reset and shutdown I use.

Alan Burlison
Joined: 2011-08-26,
User offline. Last seen 42 years 45 weeks ago.
Re: Ant fsc task fails

On 08/11/2011 17:24, Rex Kerr wrote:

> This is a more peculiar behavior than I've ever found. Maybe you should
> report it on the bug tracker?

Done, SI-5174

Copyright © 2012 École Polytechnique Fédérale de Lausanne (EPFL), Lausanne, Switzerland