You are on page 1of 5

<?xml version="1.0"?

>

<project name="doc" default="doc" basedir=".">

<description>
Build documentation - XDocs and Javadoc.
For building XDocs, edit xdocs/**/*.xml first.

XXX for no apparent reason, your CWD must be the main Ant source dir, or
this will fail:
.../docs.xml:64: org.apache.velocity.exception.ResourceNotFoundException:
Unable to find resource './site.vsl'
</description>

<property name="velocity.dir" location="lib/ext"/>


<!-- Initialization properties -->
<property name="project.name" value="ejbca"/>
<property name="docs.tools.dest" location="tmp/docs-tools"/>
<property name="docs.src" location="doc/xdocs/docs"/>
<property name="docs.dest" location="tmp/htdocs/docs"/>
<property name="docs.nojs.dest" location="tmp/htdocs/docsnojs"/>
<property name="docs.dest.ws" location="tmp/htdocs/docs/ws"/>
<property name="docs.dest.logtypes" location="tmp/htdocs/docs/logtypes"/>
<property name="site.src" location="doc/xdocs/site"/>
<property name="site.dest" location="tmp/htdocs"/>
<property name="jdocs.ws.tmp" location="tmp/jdocswstmp"/>
<property name="ws.client.gen.relative-path"
value="org/ejbca/core/protocol/ws/client/gen"/>
<property name="client.ws.class" value="EjbcaWS"/>
<property name="es.iface.dir" location="modules/edition-specific/src-
interface/org/ejbca/core/protocol/ws/objects"/>
<property name="ws.objects.dir"
location="modules/ejbca-ws/src/org/ejbca/core/protocol/ws/objects"/>
<property name="ws.common.dir"
location="modules/ejbca-ws/src/org/ejbca/core/protocol/ws/common"/>
<property name="ws.client.gen.src" location="modules/ejbca-ws-cli/src-gen"/>
<property name="ws.master.file" location="${ws.common.dir}/IEjbcaWS.java"/>
<property name="project.file" value="stylesheets/project.xml" />
<property name="docs.templ.path" location="${docs.src}/stylesheets" />
<property name="site.templ.path" location="${site.src}/stylesheets" />
<property name="docs.velocity.props"
location="${docs.src}/velocity.properties" />
<property name="site.velocity.props"
location="${site.src}/velocity.properties" />
<property name="include.xml" value="**/*.xml" />

<path id="jdoc.classpath">
<path location="dist/ejbca-common.jar" />
<path location="modules/dist/ejbca-ejb.jar" />
<path location="modules/dist/cesecore-common.jar"/>
<path location="modules/dist/cesecore-entity.jar"/>
<path location="modules/dist/cesecore-ejb-interface.jar"/>
<path location="lib/bcprov-jdk15on-154.jar" />
<path location="lib/bcpkix-jdk15on-154.jar" />
</path>

<!-- =================================================================== -->


<!-- Build doc part
-->
<!-- =================================================================== -->
<target name="doc.war" if="doc.war.enabled">
<delete dir="${docs.dest}" />
<antcall target="doc" />

<war destfile="${dist.dir}/doc.war"
webxml="${ejbca.home}/src/publicweb/empty_webxml.xml">
<fileset dir="${docs.dest}" />
</war>
</target>

<target name="doc-build-tool">
<mkdir dir="${docs.tools.dest}"/>
<javac srcdir="${ejbca.home}/modules/ejbca-common/src/" destdir="$
{docs.tools.dest}" debug="on" includeantruntime="no" encoding="UTF-8"
includes="org/ejbca/util/JAXWSDocAndConvTools.java"/>
</target>

<target name="prepare">
<path id="anakia.classpath">
<fileset dir="${velocity.dir}">
<include name="*.jar"/>
</fileset>
</path>
<available classname="org.apache.velocity.anakia.AnakiaTask"
property="AnakiaTask.present">
<classpath refid="anakia.classpath"/>
</available>
<available file="${site.velocity.props}"
property="site.present">
</available>
</target>

<target name="prepare-error" depends="prepare" unless="AnakiaTask.present">


<echo>
AnakiaTask is not present! Please check to make sure that
velocity.jar is in your classpath.
</echo>
<mkdir dir="${docs.dest}"/>
</target>

<target name="doc-external-deps" unless="external-deps-satfisfied"><antcall


target="ejbca-common.jar"/></target>
<target name="site" if="site.present">
<taskdef name="anakia" classname="org.apache.velocity.anakia.AnakiaTask">
<classpath refid="anakia.classpath"/>
</taskdef>

<anakia basedir="${site.src}" destdir="${site.dest}"


extension=".html" style="./site.vsl"
projectFile="${project.file}"
excludes="**/stylesheets/**"
includes="${include.xml}"
lastModifiedCheck="true"
templatePath="${site.templ.path}"
velocityPropertiesFile="${site.velocity.props}">
</anakia>

<copy todir="${site.dest}">
<fileset dir="${site.src}"
includes="**/*.css,**/*.png,**/*.jpg,**/*.gif,**/*.pdf"/>
<fileset dir="${site.src}" includes="sensornet/**/*"/>
</copy>
</target>
<target name="doc" if="AnakiaTask.present" depends="prepare-error, doc-build-
tool, doc-external-deps, site" description="Build EJBCA inline ear file docs.">
<taskdef name="anakia" classname="org.apache.velocity.anakia.AnakiaTask">
<classpath refid="anakia.classpath"/>
</taskdef>
<echo file="${docs.templ.path}/VERSION" append="false" message="$
{app.version}"/>
<anakia basedir="${docs.src}" destdir="${docs.dest}"
extension=".html" style="./site.vsl"
projectFile="${project.file}"
excludes="**/stylesheets/**"
includes="${include.xml}"
lastModifiedCheck="true"
templatePath="${docs.templ.path}"
velocityPropertiesFile="${docs.velocity.props}">
</anakia>
<delete file="${docs.templ.path}/VERSION"/>

<copy todir="${docs.dest}">
<fileset dir="${docs.src}"
includes="**/*.css,**/*.png,**/*.jpg,**/*.gif,**/*.pdf"/>
</copy>

<echo message="WS=${ws.objects.dir}"/>
<mkdir dir="${jdocs.ws.tmp}"/>
<mkdir dir="${docs.dest.ws}"/>
<copy overwrite="yes" todir="${jdocs.ws.tmp}">
<fileset dir="${ws.client.gen.src}">
<exclude name="**/${client.ws.class}.java"/>
<exclude name="**/ObjectFactory.java"/>
</fileset>
</copy>
<copy overwrite="yes" file="${ws.objects.dir}/package.html" todir="$
{jdocs.ws.tmp}/${ws.client.gen.relative-path}"/>
<java classname="org.ejbca.util.JAXWSDocAndConvTools" classpath="$
{docs.tools.dest}" failonerror="yes" fork="true" inputstring="">
<arg value="${ws.master.file}"/>
<arg value="${ws.client.gen.src}/${ws.client.gen.relative-path}/$
{client.ws.class}.java"/>
<arg value="${jdocs.ws.tmp}"/>
</java>
<javadoc destdir="${docs.dest.ws}"
author="true"
version="true"
Package="false"
Use="false"
nodeprecated="true"
nodeprecatedlist="true"
classpathref="jdoc.classpath"
windowtitle="EJBCA WS">
<packageset dir="${jdocs.ws.tmp}"/>
<fileset dir="modules/cesecore-common/src" defaultexcludes="yes">
<include name="**/AlgorithmConstants.java"/>
</fileset>
<fileset dir="${es.iface.dir}" defaultexcludes="yes">
<include name="**/*ConstantsWS.java"/>
</fileset>
<fileset dir="${ws.common.dir}" defaultexcludes="yes">
<include name="**/CertificateHelper.java"/>
<include name="**/KeyStoreHelper.java"/>
</fileset>
<link offline="true" href="http://docs.oracle.com/javase/7/docs/api/"
packagelistLoc="${env.JAVA_HOME}/docs/api"/>
<doctitle><![CDATA[<h1>EJBCA WS Support</h1>]]></doctitle>
<bottom><![CDATA[<i>2015 PrimeKey Solutions AB.</i>]]></bottom>
</javadoc>
<mkdir dir="${docs.dest.logtypes}"/>
<javadoc destdir="${docs.dest.logtypes}"
author="false"
notree="true"
nohelp="true"
version="false"
Package="false"
Use="false"
nodeprecated="true"
nodeprecatedlist="true"
classpathref="jdoc.classpath"
windowtitle="EJBCA and CESeCore Audit Log types">
<fileset dir="modules/cesecore-common/src" defaultexcludes="yes">
<include name="org/cesecore/audit/enums/*Types.java"/>
<include name="org/cesecore/audit/enums/EventStatus.java"/>
</fileset>
<fileset dir="modules/ejbca-ejb-interface/src" defaultexcludes="yes">
<include name="org/ejbca/core/ejb/audit/enums/*Types.java"/>
</fileset>
<link offline="true" href="http://docs.oracle.com/javase/7/docs/api/"
packagelistLoc="${env.JAVA_HOME}/docs/api"/>
<doctitle><![CDATA[<h1>EJBCA and CESeCore Audit Log
types</h1>]]></doctitle>
<bottom><![CDATA[<i>2015 PrimeKey Solutions AB.</i>]]></bottom>
</javadoc>

<echo message="Local documentation is now available in file://$


{docs.dest}/index.html"/>
</target>

<target name="docpiwik" depends="doc" description="Build EJBCA site docs


including piwik webstats">
<!-- Replaced the token for Piwik tracking script in the built documentation.
This is excluded in the doc included in ejbca.ear, but included for the
doc built for the website.
Must use ISO-8859-1 encoding, otherwise items like &#174; will be replaced
by UTF-8 mumbo jumbo -->
<replace dir="${docs.dest}" token="!--Piwik--" encoding="ISO-8859-1">
<replacevalue><![CDATA[script type="text/javascript">
var pkBaseURL = (("https:" == document.location.protocol) ?
"https://stat.primekey.se/piwik/" : "http://stat.primekey.se/piwik/");
document.write(unescape("%3Cscript src='" + pkBaseURL + "piwik.js'
type='text/javascript'%3E%3C/script%3E"));
</script><script type="text/javascript">
try {
var piwikTracker = Piwik.getTracker(pkBaseURL + "piwik.php", 5);
piwikTracker.trackPageView();
piwikTracker.enableLinkTracking();
} catch( err ) {}
</script><noscript><p><img src="//stat.primekey.se/piwik/piwik.php?idsite=5"
style="border:0" alt=""></p></noscript]]>
</replacevalue>
</replace>
</target>

<target name="gen-depgraph" depends="ejbca.ear" description="Generate EJB


dependecy graph using external 'dot' application">
<condition property="isjboss" value="isset"><equals arg1="jboss" arg2="$
{appserver.type}"/></condition>
<fail unless="isjboss" message="This target only works for JBoss AS."/>
<property name="gen-depgraph.dir" value="${ejbca.home}/tmp/gen-dep"/>
<mkdir dir="${gen-depgraph.dir}"/>
<path id="gen-dep.classpath">
<!-- for javax.ejb.Stateless, Local and EJB-->
<fileset dir="${ejbca.home}/lib/jee" includes="javaee-api-6.0-*.jar"/>
<fileset dir="${ejbca.home}/lib" includes="log4j*.jar" />
</path>
<javac srcdir="${ejbca.home}/modules/ejbca-ejb/src" destdir="${gen-
depgraph.dir}" classpathref="gen-dep.classpath" encoding="UTF-8" debug="on"
includeantruntime="false"
includes="org/ejbca/util/EjbDependencyGraphTool.java"/>
<path id="gen-dep.classpath.run">
<path refid="gen-dep.classpath"/>
<path location="${gen-depgraph.dir}"/>
</path>
<java classname="org.ejbca.util.EjbDependencyGraphTool" classpathref="gen-
dep.classpath.run" failonerror="true">
<arg line="${ejbca.home}/dist/ejbca.ear ${gen-depgraph.dir}/ejbca_$
{app.version.number}.dot"/>
</java>
<echo message="file://${gen-depgraph.dir}/ejbca_${app.version.number}.dot was
written."/>
<echo message="file://${gen-depgraph.dir}/ejbca_${app.version.number}.dot was
written."/>
<exec executable="dot" failonerror="true">
<arg line="-Tpng -o ${gen-depgraph.dir}/ejbca_${app.version.number}.png
${gen-depgraph.dir}/ejbca_${app.version.number}.dot"/>
</exec>
<echo message="file://${gen-depgraph.dir}/ejbca_${app.version.number}.png was
created."/>
</target>

</project>

You might also like