apply plugin: AsciidoctorGradleModuleVersions

ext {
    readAsciidoctorjExtVersion = { itemName = null ->
        itemName ? moduleVersions."asciidoctorj.${itemName}" : moduleVersions.asciidoctorj
    }

    compileOnlyAsciidoctorJVersion = readAsciidoctorjExtVersion()
    compileOnlyGroovyDslVersion = readAsciidoctorjExtVersion('groovydsl')
    downloadOnlyPdfVersion = readAsciidoctorjExtVersion('pdf')
    downloadOnlyEpubVersion = readAsciidoctorjExtVersion('epub')
    downloadOnlyLeanpubVersion = readAsciidoctorjExtVersion('leanpub')

    asciidoctorjTestVersion = [
        series20: readAsciidoctorjExtVersion(),
    ]

    groovyDslTestVersion = [
        series20: readAsciidoctorjExtVersion('groovydsl'),
    ]

    diagramTestVersion = [
        series20: readAsciidoctorjExtVersion('diagram'),
    ]

    leanpubTestVersion = [
        series20: readAsciidoctorjExtVersion('leanpub')
    ]

}

asciidoctorjTestVersion.keySet().each {
    def config = "intTestOfflineAsciidoctorJ_${it}"
    configurations.create(config)
    dependencies.add(config, "org.asciidoctor:asciidoctorj:${asciidoctorjTestVersion[it]}")
    dependencies.add(config, "org.asciidoctor:asciidoctorj-api:${asciidoctorjTestVersion[it]}")
    dependencies.add(config, "org.asciidoctor:asciidoctorj-groovy-dsl:${groovyDslTestVersion[it]}")
    dependencies.add(config, "org.asciidoctor:asciidoctorj-diagram:${diagramTestVersion[it]}")
}
