When Gradle's hooks are added in build lifecycle?

人走茶凉 提交于 2019-12-03 05:11:48

问题


In Gradle there are plenty of hooks. But I can't understand exactly when they are applied. From the docs I found hooks for the build and for a project:

  • addListener(listener)
  • afterProject(closure)
  • beforeProject(closure)
  • buildFinished(closure)
  • settingsEvaluated(closure)
  • taskGraph.whenReady
  • projectsLoaded
  • For project

  • project.afterEvaluate()
  • project.beforeEvaluate()
  • So I tried to make representation of figure from the book Gradle in Action (Muschko, Benjamin. "Hooking into the Build Lifecycle." Gradle in Action. N.p.: n.p., 2014. 100. Print.) to receive better idea for the whole picture when and where the hooks are apply?

    So when the hook are added and if there other build, project hooks?


    回答1:


    Looks about right. (I assume the question is when callbacks are executed.) gradle.projectsLoaded needs to go between initialization and configuration phase. gradle.beforeProject happens at certain points during the configuration phase. Check out Gradle in the Gradle Build Language Reference for other callbacks.



    来源:https://stackoverflow.com/questions/24638691/when-gradles-hooks-are-added-in-build-lifecycle

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