Setting the custom extension is easier than I made it seem, still has some quirks, but you don't need to setup a whole separate project.
I build an example:
https://github.com/abelsromero/buildSrc-asciidoctor-extension-exampleThis uses the `buildSrc`feature of Gradle to add the extension to the build classpath without having to set up another project.
1. Create the buildSrc directory at the root. If you have a multi-module project, you can only have one at the parent root.
2. Set up the dependencies for the build code on its own build.gradle. Here we define AsciidoctorJ 1.6.0
https://github.com/abelsromero/buildSrc-asciidoctor-extension-example/blob/master/buildSrc/build.gradle3. Write the extension
4. This is the tricky part...To enable it, you have to use the SPI inteface, for that, define the service file
https://github.com/abelsromero/buildSrc-asciidoctor-extension-example/tree/master/buildSrc/src/main/resources/META-INF/services, and the Registry
https://github.com/abelsromero/buildSrc-asciidoctor-extension-example/blob/master/buildSrc/src/main/groovy/org/asciidoctor/extensions/MyExtensionRegistry.groovy.
5. Finally, tell the plugin to also use AsciidoctorJ
https://github.com/abelsromero/buildSrc-asciidoctor-extension-example/blob/master/build.gradle#L11Btw, I could circumvent the lack of a `setStyle` method, using the `setString` method of the parent object. That's not something we want to encourage, but you can use it as a workarround.
I confirmed that the setStyle method is not present in 1.6.0 either, apologies for the confusion. @gregopet, feel free to open an issue to add the method in the issues sectionhttps://github.com/asciidoctor/asciidoctorj/issues.