Kotlin DSL: Lazy initialization of certain classes/functions (dependency(...) and finishBuildTrigger(...))

Hey guys,

in order to reference buildTypes between subprojects (i.e to setup dependencies or trigger) we use Id's. The order of the initialization of the subprojects (and their buildTypes) is normally important in order to have a valid reference/object.

One interesting thing I realized is that you can reference so far uninitialized Id's in the dependency(...) and finishBuildTrigger(...) functions. So with that the order of how you initalize the subprojects (buildTypes) doesn't really matter.

What is the technical reason for that? Is the Dependencies and  Triggers class somehow lazy initialized itself?

I created a small repro repository to showcase the point a bit better.

Thanks,

Florian

0

Please sign in to leave a comment.