On 03/08/2011, at 7:29 PM, enrico wrote:

> Hi all,
> 
> I'm using gradle for a multi-project (java + grails + android).
> Usually I run a "main build" which builds all projects, but sometimes,
> (ie when I'm working on a pc without android sdk installed), I'd like
> to skip the android project from the build.
> Which is (if any) the best practice to achieve this?
> 
> At the moment, I'm thinking to use something like:
> 
> if (hasProperty("skip.android")) {
>   // skip android project
> } else {
>   // ok, full build with android
> }
> 
> but I don't know how tell gradle to skip a project.
> Tried with allprojects.remove(project('my-android-proj') with no luck.

it depends on what you really want to happen if you can't build your android 
project.

If it's as simple as just not having a task in the android project run, then…

project("my-android-proj").someTask.onlyIf { 
!project.hasProperty("skip.android") }

http://gradle.org/current/docs/javadoc/org/gradle/api/Task.html#onlyIf(groovy.lang.Closure)

Without seeing your project it's difficult to advise the best way as I don't 
know what the side affects of the task being skipped are.

-- 
Luke Daley
Principal Engineer, Gradleware 
http://gradleware.com


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

    http://xircles.codehaus.org/manage_email


Reply via email to