How to configure a groovy plugin with custom sourceSet extension in Kotlin DSL using AndroidSourceSet

I kind of found an answer here: How to access `extensions` on any DSL object statically?

It shows how to access the groovy extensions for any object, which was the biggest part of my problem.