Gradle
  1. Gradle
  2. GRADLE-427

dependsOn doesn't respect dependency order

    Details

    • Type: Bug Bug
    • Status: Resolved Resolved
    • Resolution: Fixed
    • Affects Version/s: 0.5.2
    • Fix Version/s: 0.7, 1.6-rc-1

      Description

      Using following:
      //-----------------------------------------------
      createTask("A1", dependsOn: ["B", "C"]) {
      println "A1"
      }

      createTask("A2", dependsOn: ["C", "B"]) {
      println "A2"
      }

      createTask("B")

      { println "B" }

      createTask("C")

      { println "C" }

      //-----------------------------------------------

      gradle A1 and gradle A2 give the same result:
      :B
      B
      :C
      C
      :A2
      A2

      which means that the order of the dependencies in the dependsOn list is not respected.

        Issue Links

          Activity

          Hide
          M. Chelfi
          added a comment -

          Matias, I did read the previous posts and I agree with you it's a philosophical view on the question. I do not exactly know how the internals of gradle would handle the implication of looking at the dependsOn as ordered but having the impression that at some point it decides to iterate through the dependent tasks I thought replacing the underlying Set structure with List would do the trick without compromising the DAG, that is why also I started my post by saying a naive suggestion.

          Show
          M. Chelfi
          added a comment - Matias, I did read the previous posts and I agree with you it's a philosophical view on the question. I do not exactly know how the internals of gradle would handle the implication of looking at the dependsOn as ordered but having the impression that at some point it decides to iterate through the dependent tasks I thought replacing the underlying Set structure with List would do the trick without compromising the DAG, that is why also I started my post by saying a naive suggestion.
          Hide
          Paul Jimenez
          added a comment -

          @Matias: actually, the question is how to implement an ordered dependency notation. It's fairly well agreed that the current bug title "dependsOn doesn't respect dependency order" isn't the real bug. The real bug is that there's currently not a good way to notate ordered dependencies. It's not the philosophical question of "should the graph be ordered or not" because the dependency graph is ordered, there's just not an easy way to express this additionally desired ordering (intermediate 'throwaway' tasks would do it, but that's not easy.)

          I put up one strawman solution last February, Carus Kyle put up another in August that Adam Murdoch of gradleware indicated was kind of favored and then expanded on some of the higher level issues in September. M. Chelfi's suggestion for said syntax is as valid as the other proposals.

          Show
          Paul Jimenez
          added a comment - @Matias: actually, the question is how to implement an ordered dependency notation. It's fairly well agreed that the current bug title "dependsOn doesn't respect dependency order" isn't the real bug. The real bug is that there's currently not a good way to notate ordered dependencies. It's not the philosophical question of "should the graph be ordered or not" because the dependency graph is ordered, there's just not an easy way to express this additionally desired ordering (intermediate 'throwaway' tasks would do it, but that's not easy .) I put up one strawman solution last February, Carus Kyle put up another in August that Adam Murdoch of gradleware indicated was kind of favored and then expanded on some of the higher level issues in September. M. Chelfi 's suggestion for said syntax is as valid as the other proposals.
          Hide
          Adam Murdoch
          added a comment -

          For those who are interested, there has been some recent discussion of this on the dev mailing list, in this thread:

          http://gradle.1045684.n5.nabble.com/Gradle-reporting-improvements-tt5710408.html

          The relevant stuff is a little way into the thread, starting at:

          http://gradle.1045684.n5.nabble.com/Gradle-reporting-improvements-tp5710408p5710802.html

          Everyone is welcome to join in the discussion there.

          Show
          Adam Murdoch
          added a comment - For those who are interested, there has been some recent discussion of this on the dev mailing list, in this thread: http://gradle.1045684.n5.nabble.com/Gradle-reporting-improvements-tt5710408.html The relevant stuff is a little way into the thread, starting at: http://gradle.1045684.n5.nabble.com/Gradle-reporting-improvements-tp5710408p5710802.html Everyone is welcome to join in the discussion there.
          Hide
          Nathan Wells
          added a comment -

          See GRADLE-2721 for a possible improvement that would solve this.

          Show
          Nathan Wells
          added a comment - See GRADLE-2721 for a possible improvement that would solve this.
          Hide
          Adam Murdoch
          added a comment -

          Gradle 1.6 adds support for task ordering rules, which solve many of the use cases listed in this issue.

          We're not finished with task ordering and we haven't yet solved all the use cases here, but I've marked this issue as 'fixed'. If you find problems or want to suggest improvements for task ordering and execution, please feel free to raise new issues via the forums.

          Please note that we're very unlikely to change dependsOn to run tasks in the order listed, as requested in the title of this issue.

          Show
          Adam Murdoch
          added a comment - Gradle 1.6 adds support for task ordering rules, which solve many of the use cases listed in this issue. We're not finished with task ordering and we haven't yet solved all the use cases here, but I've marked this issue as 'fixed'. If you find problems or want to suggest improvements for task ordering and execution, please feel free to raise new issues via the forums. Please note that we're very unlikely to change dependsOn to run tasks in the order listed, as requested in the title of this issue.

            People

            • Assignee:
              Unassigned
              Reporter:
              Marc Guillemot
            • Votes:
              59 Vote for this issue
              Watchers:
              51 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: