Unable to create custom component in new software model

I’ve created custom component, binary and language types for the Asciidoctor Gradle plugin and I’m starting to understand some of the restrictions and behaviour. But I’m currently stuck with this error whenever I try to define a new component, either through a rule or the model DSL:

org.gradle.testkit.runner.UnexpectedBuildFailure: Unexpected build execution failure in /var/folders/m9/8mytmfqn3vn0s7n78992nj5h0000gn/T/junit4674160024509786079 with arguments [asciidoctor]

Output:

FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring root project 'junit4674160024509786079'.
> Exception thrown while executing model rule: ComponentRules#addSourcesSetsToProjectSourceSet
   > Attempt to mutate closed view of model of type 'org.gradle.model.ModelMap<org.gradle.language.base.LanguageSourceSet>' given to rule 'ComponentRules#addSourcesSetsToProjectSourceSet'

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

This is one of Gradle’s internal rules! I can’t control what it does. Any ideas why this is happening?

On another note, I’ve seen that master branch no longer has this class. And I see the addition of @Each, which looks nice.