How do i get the task/s gradle was started with?

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

How do i get the task/s gradle was started with?

k4rn4k
It is possible to retrieve the main task which started gradle ?

This is for example, if I start gradle like this "gradle compileJava"
It is possible from the build.gradle file in configuration time to get the task name called in the command line ? compileJava in this case or a list if they were more.

I want to use this to configure the task graph adding some password request and validations only when the task release is called. Would be something  like "tasks.compileJava dependsOn requestPassword" but only in releases.

I can check if release task is in the graph like this "taskgraph.whenReady{} but adding task dependencies after that point does not have effect.

As workaround for now I'm using an additional argument and checking in config time if a property with the argument name exists.

Thanks
Reply | Threaded
Open this post in threaded view
|

Re: How do i get the task/s gradle was started with?

rnavarette
This post has NOT been accepted by the mailing list yet.
The tasks requested are available from the StartParameters on the gradle object - project.getGradle().

Connected by DROID on Verizon Wireless


-----Original message-----
From: "k4rn4k [via Gradle]" <ml-node+[hidden email]>
To:
Ray Navarette <[hidden email]>
Sent:
Sat, Jul 28, 2012 01:57:54 GMT+00:00
Subject:
How do i get the task/s gradle was started with?

It is possible to retrieve the main task which started gradle ?

This is for example, if I start gradle like this "gradle compileJava"
It is possible from the build.gradle file in configuration time to get the task name called in the command line ? compileJava in this case or a list if they were more.

I want to use this to configure the task graph adding some password request and validations only when the task release is called. Would be something  like "tasks.compileJava dependsOn requestPassword" but only in releases.

I can check if release task is in the graph like this "taskgraph.whenReady{} but adding task dependencies after that point does not have effect.

As workaround for now I'm using an additional argument and checking in config time if a property with the argument name exists.

Thanks


If you reply to this email, your message will be added to the discussion below:
http://gradle.1045684.n5.nabble.com/How-do-i-get-the-task-s-gradle-was-started-with-tp5709971.html
To start a new topic under gradle-user, email ml-node+[hidden email]
To unsubscribe from gradle-user, click here.
NAML



Reply | Threaded
Open this post in threaded view
|

Re: How do i get the task/s gradle was started with?

Luke Daley-3
In reply to this post by k4rn4k




On 28/07/2012, at 2:57 AM, k4rn4k <[hidden email]> wrote:

> It is possible to retrieve the main task which started gradle ?
>
> This is for example, if I start gradle like this "gradle compileJava"
> It is possible from the build.gradle file in configuration time to get the
> task name called in the command line ? compileJava in this case or a list if
> they were more.
>
> I want to use this to configure the task graph adding some password request
> and validations only when the task release is called. Would be something
> like "tasks.compileJava dependsOn requestPassword" but only in releases.
>
> I can check if release task is in the graph like this "taskgraph.whenReady{}
> but adding task dependencies after that point does not have effect.
>
> As workaround for now I'm using an additional argument and checking in
> config time if a property with the argument name exists.

Check gradle.startParameter.taskNames

>
> Thanks
>
>
>
> --
> View this message in context: http://gradle.1045684.n5.nabble.com/How-do-i-get-the-task-s-gradle-was-started-with-tp5709971.html
> Sent from the gradle-user mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
>
>    http://xircles.codehaus.org/manage_email
>
>

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

    http://xircles.codehaus.org/manage_email