ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Peter Reilly <peter.rei...@corvil.com>
Subject Re: Moving to Ant 1.6.1 => UnknownElements galor!
Date Wed, 18 Feb 2004 09:35:16 GMT
The objects added in TaskContainer.addTask(Task task)
have changed from  Tasks to UnknownElements.

There was a number of valid reasons for this change.

Your container class will need to check if the Task is
an UnknownElement and call perform on it to
convert it to a Task and to execute it.
(see apache.tools.ant.taskdefs.Sequential)

If you want to do more processing on the task,
you need to use the techniques in apache.tools.ant.taskdefs.Antlib#execute()
This does make use of one 1.6 method call (UE#getRealObject()),
you need to use UE#getTask() instread - this will
return null for non tasks (types like fileset id=x).

So.. interate over the tasks, if they are UEs, convert them to
tasks, using UE#maybeConfigure and UE#getTask()

This approach should work for ant1.5 and ant1.6.

Peter

Wascally Wabbit wrote:

> Ant Developers,
>
> I just did a quick Ant 1.5.4 -> 1.6.1 library switch. Ran our own
> Ant task test suites and got lots of fireworks mostly caused
> by the "mysterious" mapping of many of our task objects to the
> "UnknownElement". Needless to say our task containers do not
> recognize unknown elements and promptly die.
>
> Upgrading is my job for tomorrow. Sooo I'm wondering if there's
> an easy explanation for this or...I'm looking at hours of crawling
> through the Ant 1.6.1 source x-|
>
> Any pointers would be greatly appreciated. I've not seen anything
> on the Ant 1.6 developers list about this (i don't think).
>
> Here's a typical stack trace (FYI). The task to be added is an
> unknownElement eventhough the XML seez it's one of my taskdefs.
>
> Thread [main] (Suspended (breakpoint at line 393 in SwitchTask))
>         SwitchTask.includeTask(Task) line: 393 <<-- incoming 
> UnknownElement
>         SwitchTask(TaskSet).addTask(Task) line: 183
>         SwitchTask.addTask(Task) line: 423
>         UnknownElement.handleChildren(Object, RuntimeConfigurable) 
> line: 329
>         UnknownElement.configure(Object) line: 176
>         UnknownElement.maybeConfigure() line: 152
>         UnknownElement(Task).perform() line: 363
>         Target.execute() line: 301
>         Target.performTasks() line: 328
>         Project.executeTarget(String) line: 1215
>         SwitchTaskTest(BuildFileTest).executeTarget(String) line: 232
>         SwitchTaskTest(HTC).runTarget(String) line: 956
>         SwitchTaskTest.testDefaultAlwaysMatches() line: 153
>         Method.invoke(Object, Object[]) line: not available [native 
> method]
>         SwitchTaskTest(TestCase).runTest() line: 154
>         SwitchTaskTest(HTC).runBare() line: 398
>         TestResult$1.protect() line: 106
>         TestResult.runProtected(Test, Protectable) line: 124
>         TestResult.run(TestCase) line: 109
>         SwitchTaskTest(TestCase).run(TestResult) line: 118
>         RemoteTestRunner.runTests(String[], String) line: 392
>         RemoteTestRunner.run() line: 276
>         RemoteTestRunner.main(String[]) line: 167
>
>
> The Wabbit
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
> For additional commands, e-mail: dev-help@ant.apache.org
>
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org


Mime
View raw message