[GRADLE-1623] task depends on should execute tasks in order specified Created: 18/Jun/11  Updated: 04/Jan/13  Resolved: 21/Jun/11

Status: Resolved
Project: Gradle
Affects Version/s: None
Fix Version/s: None

Type: Improvement
Reporter: phil swenson Assignee: Unassigned
Resolution: Duplicate Votes: 0


 Description   

buildLanguagePackTask.dependsOn(["localeExportMessages","localeGenerateResources", "localeGenerateArchives"])

This code executed the localeGenerateArchives before localeGenerateResources. In my case I need fine grain control on on my tasks as they are expensive and it require a human judgement call on whether to execute them or not. So I want to be able to run localeExportMessages, localeGenerateResources, and localeGenerateArchives individually. And have a task that executes them all in the correct order.



 Comments   
Comment by Mathias Kalb [ 20/Jun/11 ]

Look at this issue:
http://issues.gradle.org/browse/GRADLE-427

Comment by Szczepan Faber [ 21/Jun/11 ]

Duplicate of GRADLE-427

Comment by Adam Murdoch [ 21/Jun/11 ]

An alternative approach is to make the tasks incremental, by declaring their inputs and outputs. Then, you can add the actual dependencies between the tasks, and a human doesn't need to care whether they should be executed or not: If the output from a given task is required, and does not exist, then Gradle will run the task. If the output is required and does exist, then Gradle will skip the task.

Comment by phil swenson [ 21/Jun/11 ]

The approach I settled on was:

buildLanguagePackTask.doFirst() {
["localeExportMessages", "localeGenerateResources", "localeGenerateArchives"].each

{ taskName -> DefaultTask task = project.tasks.findByName(taskName) as DefaultTask task.execute() }

}

Generated at Wed Jun 30 12:00:17 CDT 2021 using Jira 8.4.2#804003-sha1:d21414fc212e3af190e92c2d2ac41299b89402cf.