Autocompletion works in buildSrc but not in Composite Build


(Alex Decker) #1

Recently I came across this article https://handstandsam.com/2018/02/11/kotlin-buildsrc-for-better-gradle-dependency-management/ which promises autocompletion support in Android Studio for classes defined in the buildSrc project.
I tried it out and everything works as promised, but I wanted to see if the same thing worked as a composite build so I could share these dependencies to multiple projects. To test that out I renamed my buildSrc folder to “dependencies” and added the following to my gradle files.

build.gradle:

buildscript {
    dependencies {
         classpath "org.foo:dependencies:0"
    }
}

settings.gradle:

includeBuild("dependencies")

I was surprised that everything still works and compiles just fine, but autocomplete no longer works. It was my understanding that the buildSrc project is just built and added to the buildscript classpath and that it would eventually be replaced by an includedBuild anyway.

So does anyone know what extra magic is happening to let Android Studio get autocompletion info, but only on buildSrc?