Better to use task dependencies or task.doLast in Gradle?

前端 未结 1 1977
隐瞒了意图╮
隐瞒了意图╮ 2021-02-13 19:11

After building my final output file with Gradle I want to do 2 things. Update a local version.properties file and copy the final output final to some specific directory for arch

1条回答
  •  误落风尘
    2021-02-13 20:05

    Whenever you can, model new activities as separate tasks. (In your case, you might add two more tasks.) This has many advantages:

    • Better feedback as to which activity is currently executing or failed
    • Ability to declare task inputs and outputs (reaping all benefits that come from this)
    • Ability to reuse existing task types
    • More possibilities for Gradle to execute tasks in parallel
    • Etc.

    Sometimes it isn't easily possible to model an activity as a separate task. (One example is when it's necessary to post-process the outputs of an existing task in-place. Doing this in a separate task would result in the original task never being up-to-date on subsequent runs.) Only then the activity should be attached to an existing task with doLast.

    0 讨论(0)
提交回复
热议问题