[GRADLE-2632] Incorrect UP-TO-DATE for subproject task Created: 14/Jan/13  Updated: 23/Jan/17  Resolved: 23/Jan/17

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

Type: Bug
Reporter: Vitaliy Garnashevich Assignee: Unassigned
Resolution: Not A Bug Votes: 0

Attachments: Zip Archive build-scripts.zip    
Known Issue Of:
1.3

 Description   

settings.gradle:

include("subproj")

build.gradle:

evaluationDependsOnChildren()

task mainTask(dependsOn: task(":subproj:subprojTask")) << {
    println "!!! mainTask action!"
}

subproj\build.gradle:

task subprojTask << {
    println "!!! subprojTask action!"
}

Expected output of "gradle :mainTask":

:subproj:subprojTask
!!! subprojTask action!
:mainTask
!!! mainTask action!

BUILD SUCCESSFUL

Total time: ... secs

Output of "gradle :mainTask":

:subproj:subprojTask UP-TO-DATE
:mainTask
!!! mainTask action!

BUILD SUCCESSFUL

Total time: 1.911 secs

Output of "gradle -d :mainTask":

...
15:11:55.562 [LIFECYCLE] [org.gradle.TaskExecutionLogger] :subproj:subprojTask
15:11:55.563 [DEBUG] [org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter] Starting to execute task ':subproj:subprojTask'
15:11:55.563 [INFO] [org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter] Skipping task ':subproj:subprojTask' as it has no actions.
15:11:55.564 [DEBUG] [org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter] Finished executing task ':subproj:subprojTask'
15:11:55.564 [LIFECYCLE] [org.gradle.TaskExecutionLogger] :subproj:subprojTask UP-TO-DATE
...


 Comments   
Comment by Vitaliy Garnashevich [ 14/Jan/13 ]

Works as expected, when the dependency is specified as:

task mainTask(dependsOn: ":subproj:subprojTask") << {
...
Comment by Vitaliy Garnashevich [ 14/Jan/13 ]

Aha! project.task() method does not just find a task, but creates a new task.

But why did it allow to create another task with same path?

Comment by Adam Murdoch [ 16/Jan/13 ]

It shouldn't. That's a bug.

Comment by Benjamin Muschko [ 15/Nov/16 ]

As announced on the Gradle blog we are planning to completely migrate issues from JIRA to GitHub.

We intend to prioritize issues that are actionable and impactful while working more closely with the community. Many of our JIRA issues are inactionable or irrelevant. We would like to request your help to ensure we can appropriately prioritize JIRA issues you’ve contributed to.

Please confirm that you still advocate for your JIRA issue before December 10th, 2016 by:

  • Checking that your issues contain requisite context, impact, behaviors, and examples as described in our published guidelines.
  • Leave a comment on the JIRA issue or open a new GitHub issue confirming that the above is complete.

We look forward to collaborating with you more closely on GitHub. Thank you for your contribution to Gradle!

Comment by Benjamin Muschko [ 23/Jan/17 ]

You should use tasks.getByPath(":subproj:subprojTask") to reference an existing task here when declaring the task dependency. We haven't heard from your in the meantime so I am closing the issue. Please create an issue on GitHub if you still think there's an issue that needs fixing.

BTW: In your code you are creating a new task from the root project but not the sub project and then use that one as task dependency. It simply has the name :subproj:subprojTask.

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