On Jun 3, 2009, at 2:21 AM, Adam Murdoch wrote:

Hi,

I've added an Ant plugin, which allows a build script to import an Ant build, so that the targets of the Ant build become usable as tasks in the Gradle project. Some things you can do:
- Gradle tasks can depend on Ant targets
- Ant targets can depend on Gradle tasks
- You can add behaviour to Ant targets, using doFirst() or doLast() (or pretty much any other method of Task)
- You can enable/disable Ant targets or add dependencies

I'm excited. This is an extremely useful and important feature.


Here's how you use the plugin:

usePlugin 'ant'
importAntBuild 'some-build-file.xml'

You can see some examples at: 
http://gradle.org/latest/docs/userguide/ant.html#N10C8E

Some questions and loose ends:

I'm not sure about the method name importAntBuild(). Perhaps it should be something declarative, like extendsAntBuild()?

Conceptually we might not necessarily want to extend the Ant build, but just use it. So importAntBuild I think is OK. What about useAntBuild?


Or should the ant build file be something more fundamental to the project, such that it is specified when the project is declared, just like the Gradle build file is? Would a maven plugin work the same way? Could you mix the Ant and Maven plugins in the same project? Perhaps projects should be typed, so that a given project is either a Gradle project, or an Ant project, or a Maven project?

I like the approach of having different project types with different sources of input. This would also make for expressive project declarations in a multi-project build. An open issue is how to enable the declaration of artifact dependencies to an Ant project. Such an Ant project would have two sources of input. A build.xml and an optional build.gradle. We might even allow for any combination of project types.

Right now the Maven plugin does not do anything comparable to the Ant plugin. It is just for generating a pom and deploying to Maven repositories. So right now there is no reason not to mix them. Integrating Maven projects is an interesting use case. One question is how deeply we want and will be able to integrate. With Maven 3.0 they have improved the way to use Maven in an embedded way. That might offer some opportunities.


Also, should we provide a DSL for accessing the properties of the Ant project? Currently you set and get properties using:

ant.project.setProperty('someProp', 'value')
println ant.project.properties.someProp

Maybe something like this would be better?

ant.someProp = 'value'
println ant.someProp

That would be much nicer. Specially that now with the Ant plugin this will be a common use case.


It might be possible to also have the Ant properties synchronised with the Gradle properties, so that you can set it in Gradle or Ant and it is available in the other context.

That might be valuable although I don't have any use cases in mind. We probably should offer an option to switch it off.

- Hans

--
Hans Dockter
Gradle Project Manager
http://www.gradle.org


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

   http://xircles.codehaus.org/manage_email


Reply via email to