@Adam

Thank you for the explanation!

minor.dagNeutral = true

indeed caused the doFirsts to be called, but the
if(dag.hasTask(':minor')) still doesn't work (no surprise).  Is there
a way besides a global variable to check from the patch task if the
minor task was run? A gradle way?

@Phil
Thank you for taking the time to explain your solution to me!

Since I'm not using *any* plugins at all but still mostly recreating a
gant script this is still way too advanced for me at the current point
where I'm still struggling with the more basic concepts of Gradle as
it seems. What I'm looking for is probably a Gant++ ;-) right now.
Your solution seems more like an inspiration for the future.

Regards

Martin








On Thu, Oct 30, 2008 at 11:50 PM, Phil Messenger <[EMAIL PROTECTED]> wrote:
>
> Hello,
>
>
> Martin Stephan wrote:
>>
>> So I'm trying to do automated version numbering and again, I guess,
>> there are much better ways but I'm trying to understand why the code
>> below is not working when I call 'gradle minor jar'.
>>
>
> Adam has already addressed your DAG related points/questions, but I thought
> I'd explain how I'm handling version numbering.
>
> I've got a "release" plugin, which is responsible for tagging code and
> uploading artifacts to the right place. I've created my own Version class
> which has methods for incrementing the build number (with understanding of
> "SNAPSHOT").
>
> Release tweaks the init task in the Release tasks constructor:
>
>                Task initTask = project.getTasksByName("init",
> false).iterator().next();
>
>                initTask.doFirst(new TaskAction() {
>                        @Override
>                        public void execute(Task task)
>                        {
>
> if(task.getProject().getBuild().getTaskGraph().hasTask(":release"))
>                                {
>                                        configureVersion(task);
>                                }
>                        }
>                });
>
> "configureVersion({})" increments the build number.
>
> Release also depends upon the dist task, so if "release" is invoked
>
>                gradle release -Dsome_arguments
>
> 1) the task added to the initTasks pre-execution (doFirst) step is executed,
> incrementing the build number
> 2) the jar/dists/lib tasks are executed. These use the version number that
> has been incremented in the initTask.doFirst method
> 3) if everything finished OK, the release plugin saves the new version do
> disk and commits it to SCM.
>
> This is obviously done in an external plugin, but you can achieve the same
> thing directly in the build.gradle file.
>
> Phil.
>
>
>
> --
> View this message in context: 
> http://www.nabble.com/DAG%2C-doFirst%28%29-tp20255970p20257021.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


Reply via email to