Adding Properties to JavaPlugin's SourceSets

We’re trying to draft a plugin to work with our modelling language, Umple. We want to make it as “ergonomic” as possible and allow for specifying properties at the “sourceSet” level.

For example,

sourceSets {
  main { 
    umple {
      foo = 'bar'

umple { // defaults
  foo = 'baz'

We have tried adding extensions to the source sets and tried to model the approach after how the Scala and Antlr plugins work. However, we can not figure out how to add extra properties to the sourceSet closure application. Any help is appreciated.

Found results thanks to StackOverflow here: