Child build.gradle not evaluating at afterEvaluate event

I have a project with 21 subprojects. one of those subprojects has its own build.gradle file because its a little obscure.

Now, i have a configuration setting in the build that is needed during the config phase. So, in my plugin i have

project.afterEvaluate {
  if (project == project.rootProject) {
        project.allprojects.each { proj ->
    MetaExtension config = proj.getExtensions().getByType(MetaExtension)
      if (config.inventoryHash == null){
        throw new ProjectHashNotSetException(proj.name)
      }
    }
  }
}

Now, if i have everything in one build.gradle file, it all works perfectly. but, as soon as i broke the 21st subproject into its own build.gradle file, it now always comes back as null. copy and past back into one build.gradle file, works fine, 2 gradle files, fails.

Why would this be?

1 Like