Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

When Gradle's hooks are added in build lifecycle?

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?

    enter image description here

    like image 832
    Xelian Avatar asked Jul 08 '14 18:07

    Xelian


    People also ask

    What happens during Gradle build?

    Gradle Builds and Android StudioThe build system allows you to define flexible custom build configurations. Each build configuration can define its own set of code and resources while reusing the parts that are common to all versions of your app. Gradle and the Android plugin run independent of Android Studio.

    Which of the following are Gradle build phases?

    Every Gradle build proceeds through three lifecycle phases in precisely the same order. These phases are initialization, configuration, and execution. During the initialization phase, Gradle starts up and locates the build files it must process.

    What is afterEvaluate in Gradle?

    afterEvaluate , which runs after a particular project has been configured, there is also a gradle.

    What are the core components of Gradle build script?

    Every Gradle build consists of three basic building blocks: projects, tasks, and properties.


    1 Answers

    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.

    like image 144
    Peter Niederwieser Avatar answered Sep 19 '22 19:09

    Peter Niederwieser