Importing Third Party project (ant based) into a Gradle multi-project build (Android)

I am developing gradle based build infrastructure for our android projects. The project consists of multiple android apps, which depend on libraries developed in-house as well as third party libraries.

We compile the source code for the third party libraries, but we can’t modify any of the third party files.

I don’t have the option to add gradle support to the third party library.

The third party libraries are built using the standard ant build commands

ant debug
 ant release

The first approach I took was defining the sub-projects in the settings.gradle file. Then at the top level build.gradle I defined a task which imported the thirdparty libraries

task buildTP << {
  ant.importBuild ' <PATH_TO_LIBRARY_SOURCE>/build.xml'

In the apps which depend on the Third Party library, I was planning on adding a dependency on buildTP.

Does this approach sound reasonable? Also, how do I build the source in the


example above?

‘ant.importBuild’ belongs at the top level outside a task. It will create a Gradle task for every Ant target, which can then be called and depended upon as usual. For more information on Ant integration, check the Gradle User Guide.

Thank you for the information.