Task property annotation for closure

Hi all,
I’m quite new to Gradle and I’m writing a plugin (https://github.com/jpragey/commonmark-gradle-plugin ) that transtale Common Markdown to HTML. The commonmark-java library it uses creates only HTML fragments, so it needs to be included in some template page, to get proper html/head/body tags.
The task currently delegates this formatting to a Closure<String> htmlBuilder property, for maximum flexibility. Delegating to a real templating engine (and a real template file) requires only a few lines of code, that can be included in the gradle build file.
All this is perfectly fine, until I tried to add Input/Output annotations to task properties. A Closure<String> is probably not really an input, but may refer to an input template file…
So I don’t know how to annotate this property.
Any thought ?

You’d do that with the new public Provider API. You can find an example in the release notes or in the canonical plugin example.

Please also check out the following guides for more information on plugin development: