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

给你一囗甜甜゛ 提交于 2019-12-03 11:43:10

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.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!