- About Scala
- Documentation
- Code Examples
- Software
- Scala Developers
Ant fsc task fails
Tue, 2011-11-08, 13:40
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)
Tue, 2011-11-08, 16:27
#2
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?
Tue, 2011-11-08, 17:27
#3
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:
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?
Tue, 2011-11-08, 17:57
#4
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.
Tue, 2011-11-08, 18:27
#5
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:
--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.
Thu, 2011-11-10, 11:17
#6
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
--Rex
On Tue, Nov 8, 2011 at 7:40 AM, Alan Burlison <alan.burlison@gmail.com> wrote: