generateDocbook

Jody Winter Jeremie Bresson Ralf D. Müller

1 minute to read

At a Glance

generateDocBook

About This Task

A helper task, generateDocbook generates the intermediate format for convertToDocx<<>> and convertToEpub.

Source

AsciiDocBasics.gradle
task generateDocbook (
        type: AsciidoctorTask,
        group: 'docToolchain',
        description: 'use docbook as asciidoc backend') {

    def sourceFilesDOCBOOK = sourceFiles.findAll {
        'docbook' in it.formats
    }
//    onlyIf {
//        sourceFilesDOCBOOK
//    }

    sources {
        sourceFilesDOCBOOK.each {
            include it.file
            logger.info it.file

            File useFile = new File(srcDir, it.file)
            if (!useFile.exists()) {
                throw new Exception ("""
                The file $useFile in DOCBOOK config does not exist!
                Please check the configuration 'inputFiles' in $mainConfigFile.""")
            }
        }
    }

    backends = ['docbook']
    doFirst {
        if (sourceFilesDOCBOOK.size()==0) {
            throw new Exception ("""

    >> No source files defined for type docbook.
    >> Please specify at least one inputFile in your docToolchainConfig.groovy
    """)
        }

    }
}