Difference between Gradle's terms evaluation and execution

I am new to Gradle build tool and now I am reading the User Guide, but can't understand fully the difference between evaluation and execution phases.

In configuration phase project objects are configured and DAG is created, but we have afterEvaluate, so what is evaluate here? Evaluation of the tasks dependencies or ..?

Answers


As you have seen in documentation, there are three phases: Initialization, Configuration and Execution. Each step is traversed from root project down to subprojects for multi project builds. The afterEvaluate is useful in the root gradle file of a multi project build when you want to configure specific items based on the configuration made in subprojects.

Say you want to add a task for all subprojects that have a specific plugin defined. If you add to your root project:

subprojects {subProject ->
  if ( subProject.plugins.hasPlugin('myplugin')){
    subProject.task('newTask')<<{
      println "This is a new task"
    }
  }
}

This task will never be added since the root project is configured before the subprojects. Adding afterEvaluate will solve this for you:

subprojects {subProject ->
  afterEvaluate{
    if ( subProject.plugins.hasPlugin('myplugin')){
      subProject.task('newTask')<<{
        println "This is a new task"
      }
    }
  }
}

Need Your Help

Restrict/Force only some view controllers to specific orientations when using UITabBarController and/or UINavigationController

ios objective-c uiviewcontroller uiinterfaceorientation landscape-portrait

I searched the web high and low, but couldn't find a definitive answer on this. What's the best way to have only one UIViewController support landscape mode when it's embedded in a

create a css badge with multiple borders

html css css3

I need to replicate this in css:

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.