import - Ant task imported from build.xml in Gradle script is running automatically -
i have java project there import ant build.xml file tasks, this:
ant.importbuild 'build.xml' task mytaska(dependson: ':modules:mymodule:assemble') << { // stuff here... } compilejava.dependson(mytaska) configure(jar) { include 'classes.dex' } jar.dependson(antcompile)
the task antcompile
comes ant build.xml script. however, reason, task being called @ start when invoke gradlew assemble
, it doesn't wait jar
task start.
also, antcompile
task defined following target in build.xml:
<target name="antcompile" depends="-setup"> </target>
that ant target, -compile
always first task executed when invoke gradlew assemble
. doesn't make sense. task never invoked anywhere, it's dependency of antcompile
. why being executed?
this is, obviously, not want... how can prevent such behaviors?
seems work expected. build script makes jar
depend on antcompile
, according words depends on -compile
. assemble
depends on jar
, executing gradle assembmle
should run -compile
first.
in case, should said ant.importbuild
has known limitations, , can result in differences in behavior compared running ant build directly. you'll lose many of gradle's advantages when not describing build in terms of gradle's own abstractions. therefore recommend port build gradle, rather using ant.importbuild
(which isn't used in real world). note it's fine reuse ant tasks in cases gradle doesn't provide equivalent.
Comments
Post a Comment