[GRADLE-1102] dependencies from ant depends="..." via ant.importBuild("...") processed in incorrect order Created: 10/Aug/10  Updated: 10/Apr/14  Resolved: 19/Feb/14

Status: Resolved
Project: Gradle
Affects Version/s: 0.9.1
Fix Version/s: 1.12-rc-1

Type: Bug
Reporter: Julian Kelsey Assignee: Luke Daley
Resolution: Fixed Votes: 7

Issue Links:
Related
Related to GRADLE-427 dependsOn doesn't respect dependency ... Resolved

 Description   

give build.xsl:
<?xml version="1.0" encoding="UTF-8"?>
<project default="build" name="TestApp" basedir="." xmlns:build="build">
<target name="W"> <echo>WWWWW</echo> </target>
<target name="X"> <echo>XXXXX</echo> </target>
<target name="Y"> <echo>YYYYY</echo> </target>
<target name="Z" depends="X,W,Y"> <echo>ZZZZZ</echo> </target>
</project>

and build.gradle:
ant.importBuild 'build.xml'

running "ant Z"
X:
[echo] XXXXX
W:
[echo] WWWWW
Y:
[echo] YYYYY
Z:
[echo] ZZZZZ

running "gradle Z"
:W
[ant:echo] WWWWW
:X
[ant:echo] XXXXX
:Y
[ant:echo] YYYYY
:Z
[ant:echo] ZZZZZ

The Ant documentation explicitly defines that the dependency list should be processed in left to right order if there is not an explicit dependency topology: http://ant.apache.org/manual/targets.html#targets

It appears that Gradle is processing the list in alphabetical order.



 Comments   
Comment by Sergey Kadaner [ 28/Feb/12 ]

Gradle documentation says it is possible to execute Ant scripts from Gradle, but this bug completely negates it.

Comment by Taylor Brown [ 07/Mar/13 ]

I just got bitten by this one too. Since GRADLE-427 looks like it's about to be resolved for Gradle 1.6 (discussion here: http://gradle.1045684.n5.nabble.com/Must-run-after-ordering-td5710924.html), does this mean that this dependency order could be automatically respected?

Comment by Adam Cath [ 09/Apr/14 ]

Sorry, I'm new to the gradle bugbase. This is marked fixed but there is no information about the fix. Does that mean that in 1.12, ant dependencies order will be respected?

Comment by Luke Daley [ 09/Apr/14 ]

That's correct.

Comment by Adam Cath [ 10/Apr/14 ]

Great!

Generated at Wed Jun 30 11:46:56 CDT 2021 using Jira 8.4.2#804003-sha1:d21414fc212e3af190e92c2d2ac41299b89402cf.