Multiple dependencies for the same configuration shortcut notation


(Crazyjavahacking) #1

I was trying to figure out how exactly is the following Gradle code transformed into Gradle method calls:

dependencies {
    configurationName dependencyNotation1, dependencyNotation2, ...
}

From JavaDocs it does not look like there is a method taking an array or warargs.

So how does it actually work? How exactly is it compiled into bytecode?

Is there a compile time AST transformation to multiple calls of Dependency.add(String, Object)?


(Mark Vieira) #2

It’s not an AST transformation, it’s actually just leveraging Groovy’s methodMissing(). Here’s where the magic happens.