buildscript {
    repositories {
        mavenCentral()
    }

    dependencies {
        classpath 'org.asciidoctor:asciidoctorj:2.4.2'
    }
}



import org.asciidoctor.Asciidoctor
import org.asciidoctor.Options

import java.nio.file.Paths

group 'org.example'
version '1.0-SNAPSHOT'

tasks.register('buildDocumentation') {
    doLast {
        def asciidoctor = Asciidoctor.Factory.create()
        def entryPath = Paths.get(projectDir.absolutePath, 'src', 'index.adoc')
        println("Entry path ${entryPath} ...")
        def options = new Options()
        buildDir.mkdirs()
        options.setToDir(buildDir.absolutePath)
        asciidoctor.convertFile(entryPath.toFile(), options)
    }
}