Common base task?

Hi there,

I’m wondering if there’s a common base task that exists early in the chain. I have a multi-project build, but within each module I have a checkEnvironment task like the following:

task checkEnvironment {
  doFirst {
    if(gradle.gradleVersion != gradleVersion) {
      throw new GradleException("Configured version of Gradle (${gradleVersion}) is different than the one used in the build (${gradle.gradleVersion})")
    }

    println "Gradle: ${gradle.gradleVersion}"
  }
}

???.dependsOn checkEnvironment

I’m trying to find a ‘root’ task to depend on, one that’s essentially the first task to run, and one that is also executed when other plugins such as the ‘java’ plugin are used. Any thoughts?

And the example above is simplified, I know for a multiproject build I can hoist this into the root build.gradle file.

You could make all tasks who’s name is NOT “checkEnvironment” depend on “checkEnvironment”