Delivering Docs
DocAsCode embed an Ant runner and exposes custom targets, tasks, types and macros. The build file is restricted to be delivery.xml
at root of the repository. To use DocAsCode Tasks and Type, use the antlib namespace antlib:org.docascode.ant
:
<project name="my-project" default="delivery" basedir="."
xmlns:docascode="antlib:org.docascode.ant">
<!-- define your build here -->
</project>
DocAsCode uses two directory for build process:
-
${build}
the working directory -
${bin}
the final directory
For readability reasons, it is recommended to define those properties in delivery.mml
.
Targets
DocAsCode provide predefined targets for easy build process. To load DocAsCode targets, you need to declare <docascode:targets/>
in delivery.xml. Some properties
clean
target
Clean-up delivery directories
Ant Property |
Description |
Mandatory |
bin |
The final directory |
Yes |
build |
The working directory |
Yes |
copy
target
Copy files designated by their id into the working directory. All attached files are also copied.
Ant Property |
Description |
Mandotory (default value) |
copy.list |
Comma-separated list of ids |
Yes |
build |
The working directory |
Yes |
output |
The naming rule to apply |
No ("default") |
convert
target
Convert all files located in ${build}
into PDF format. Only .docx
source files are supported.
Ant Property |
Description |
Mandatory |
build |
The working directory |
Yes |
diff
target
Compute a comparison of .docx
files against their LATEST
Maven version.
Hence, the files must be registered as DocAsCode artifacts in chrono.xml and remote server must be registered in settings.xml
.
The generated files are located in ${build}/DIFF
.
Ant Property |
Description |
Mandatory (default value) |
diff.list |
Comma-separated of artifact id to diff |
Yes |
build |
The working directory |
Yes |
output |
The naming rule to apply |
No ("default") |
acid
target
Encrypt the files in ${build} into ${bin}/${acid.basename}.acidcsa. Public keys are taken from the ${acid.keys.dir} directory.
The full path of acidcmd.exe must be set in the $PATH variable.
|
Ant Property | Dexcription | Mandatory |
---|---|---|
build |
The working directory |
Yes |
bin |
The directory containing the generated archive |
Yes |
acid.keys.dir |
Public keys directory |
Yes |
acid.basename |
Basename of the generated archive |
Yes |
Ant Tasks, Types & Macros
DocAsCode offers many Ant tasks,types and macros which are automatically loaded by adding namespace antlib:org.docascode.ant
into your project declaration.
Tasks
update
task
Update properties of OpenXml files.
Parameter | Description | Type |
---|---|---|
file |
The file to act on |
XML Attribute |
property |
A property to set |
Nested Property |
properties
task
Load properties of OpenXML files into Ant properties
Parameter | Description | Type |
---|---|---|
file |
The file to read |
XML Attribute |
prefix |
The prefix to prepend to all read property |
XML Attribute |
For instance, if myDoc.docx
contains the custom property myProperty
with value myValue
, then the following ant script:
<docascode:properties file='myDoc.docx' prefix='myPrefix'/>
will create the Ant property myPrefix.myProperty
with value myValue
.
convert
task
Convert all selected files to PDF format. Only .docx
files are supported.
Parameter | Description | Type |
---|---|---|
destDir |
The target directory |
XML Attribute |
fileset |
The selected files |
Ant FileSet |
mapper |
A mapper for renaming |
Ant FileNameMapper |
diff
task
Compute a comparison of .docx
files given files against their LATEST
Maven version.
Hence, the files must be registered as DocAsCode artifacts in chrono.xml and remote server must be registered in settings.xml
.
The generated files are located in ${build}/DIFF
.
Parameter |
Description |
Type |
toDir |
Target directory |
XML Attribute |
fileset |
The selected files |
Ant FileSet |
mapper |
The naming rule to apply |
Ant FileNameMapper |
Without a specified mapper
, the files are renamed from myFile.docx
to DIFF/myFile.docx
.
acid
task
Encrypt the selected files into a signed archive with specified public keys.
The full path of acidcmd.exe must be set in the $PATH variable.
|
Parameter | Description | Type |
---|---|---|
destDir |
The target directory |
XML Attribute |
basename |
The archive basename |
XML Attribute |
pubkeydir |
The public keys directory |
XML Attribute |
dir |
The directory containing the files to encrypt |
XML Attribute |
deploy
task
Deploy the selected artifacts to remote server.
Parameter | Description | Type |
---|---|---|
ids |
Comma-separated list of registered artifacts to deploy |
XML Attribute |
profile |
Maven profile to activate for deployment |
XML Attribute |
artifacts |
Comma-separated list of registered artifacts to deploy |
DocAsCode artifacts |
process
task
Allow to execute any nested task while scanning chrono.xml
.
Parameter | Description | Type |
---|---|---|
ids |
Comma-separated list of registered artifacts to process |
XML Attribute |
name |
Selected hard-coded output naming rule |
XML Attribute |
actions |
The actions to perform |
Actions |
Types
property
type
A key-value pair to set OpenXML file properties.
Attribute | Description | name |
---|---|---|
The property name |
value |
The property value |
propertymapper
type
A filename mapper converting all occurence of @my-property@
by its value in the specified OpenXMl file.
Attribute | Description |
---|---|
file |
The file to read for resolving properties |
from |
The string to evaluate |
chainedmapper
type
This mapper implementation act as Ant chainedmapper, but it keeps OpenXML properties along.
Attribute | Description |
---|---|
file |
The file to read for resolving properties |
chronomapper
type
This mapper implementation return the hard-coded naming rule specified in chrono.xml
.
Attribute | Description |
---|---|
ids |
Comma-separated list of identifiers |
chronoselector
type
This selector implementation allow to filter filesets w.r.t. files given in chrono.xml
.
Attribute | Description |
---|---|
ids |
Comma-separated list of identifiers |
artifacts
and artifact
type
artifacts
type allow ta aggregate mutiple artifact. An artifact
a declaration of Maven artifact via its coordinates groupId:artifactId:version
Attribute | Description |
---|---|
file |
The fiel location |
groupId |
The groupId, can be resolved with |
artifactId |
The artifactId, can be resolved with |
version |
The verion, can be resolved with |
classifier |
The classifier, can be resolved with |
extension |
The file extension. Its default value corresponds to the file extension. |
Plugins
You may need to share some targets and/or custom macros. DocAsCode allow to use project plugins you can easily duplicate in other DocAsCode repositories. A plugin is structured as follow:
-
A plugin is located in a directory inside
.docascode/plugins
-
A plugin is declared in the mandatory file
.docascode/plugins/my-awesome-plugin/tasks.xml
-
You can use any DocAsCode tasks provided you declare the antlib namespace
antlib:org.docascode.ant
-
You can use any resource file located in
.docascode/plugins/my-awesome-plugin
-
To load the plugins you need to set <docascode:plugins/>
in delivery.xml
.