Call task from another task without dependency

I have a build system which is nothing but standard… the system builds our mobile applications and shared libraries. we want to move to gradle, right now we’re on bash and ant. each project contains a file that hold properties like projects in the svn we need to build it, revisions etc, mail list for failures etc…

I guess i can figure out how to make most of what i need (copy from the svn to a temp dir, or export from the svn if i need specific revision, call ant to compile the application or call the gradle java plugin if i want to compile the .jar if it’s a shared lib, what i can’t figure out is this. We ahve for each project several targets (release,debug, debugExtraLogs etc…) and we want to build all of them in the same build, we don’t want to add extra build files since we have, right now centralized system. since in gradle a single task is called in each run, and only if dependency kicks in other tasks are called, i can’t figure out how to build all of the targets in the same run.

the sequance i need is something like: 1. clean env. 2. copy needed files to temp build space 3. for every target:

3.1 copy from temp build space to build space

3.2 build for target X.

3.3 copy result to build result dir.

3.4 clean build dir. 4. finalize build and cleanup.

I CAN use groovy to make a simple look inside my task, but then i need to build and base my build on groovy, not gradle since i can’t call a task from groovy…

Any ideas ? anybody has faced similar issue ?

One option is to declare a separate clean, copy, etc. task per target. If you want the same for the tasks added by the Java plugin, you can declare multiple source sets.

what do you mean, declare multiple sources set ?

For each source set you declare, the Java plugin gives you a ‘processResources’, ‘compileJava’, and ‘classes’ task. For more information, see the Gradle User Guide.