eerohele / dita-ot-gradle

A Gradle plugin for running DITA Open Toolkit
https://github.com/eerohele/dita-ot-gradle/
Apache License 2.0
13 stars 6 forks source link

Get ditamap and referenced resources #9

Closed lionelmoi closed 7 years ago

lionelmoi commented 7 years ago

Hi Eero!

My understanding is that, since gradle can detect changes in a ditamap or its resources, the path to these objects must be stored somewhere.

I would like to be able to get the path of the ditamap and all its referenced resources (topic, images, etc.) in order to copy and zip them for archival. The same way I am able to get the path of a result zip of a Zip task with the archivePath property.

Do you think it would be possible?

eerohele commented 7 years ago

Probably not quite the way you'd like. The plugin actually doesn't parse any DITA files because that might make the plugin too slow and prone to memory leaks, particularly for large documents.

The plugin includes every file in the directory where your root DITA map file is in in the up-to-date check. So, for instance, if your root DITA map is in /srv/dita/root.ditamap, the plugin will watch for changes in every file under /srv/dita -- even those that aren't referenced by a DITA file.

It does exclude a couple of things from that set of files: the .gradle directory, the output directory you specify, and a couple of other files.

You can get at those files if you need to by doing something like this:

task printDitaTaskInputs(dependsOn: dita) {
    dita.inputs.files.each {
        println(it)
    }
}

However, it's naturally simpler just to archive the whole input directory instead. You could use the include/exclude features that Gradle has to exclude any files you don't need.

lionelmoi commented 7 years ago

The oxygenXML team has a nice plugin for it : https://github.com/oxygenxml/dita-export-map

eerohele commented 7 years ago

That plugin does indeed seem to do the trick. I'll close this one.