blob: 0317e971865a5aa78089151ce7a58bdd17ea8d60 [file] [log] [blame]
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<project name="org.apache.easyant.plugins#xooki" xmlns:ac="antlib:net.sf.antcontrib" xmlns:ea="antlib:org.apache.easyant"
xmlns:ivy="antlib:org.apache.ivy.ant" xmlns:xooki="antlib:xooki">
<ea:core-version requiredrevision="[0.9,+]" />
<target name="xooki:init">
<ea:parameter property="xooki.checkUpToDate" required="false" default="true"
description="Proxies for the checkUpToDate xooki:generate task. Defaults to true." />
<ea:parameter property="src.documentation.dir" required="false" default="${basedir}/src/documentation"
description="Xooki source documentation." />
<ea:parameter property="documentation.css.dir" default="${src.documentation.dir}/style"
description="path where the css are stored, used for nice looking HTML" />
<ea:parameter property="target.documentation.dir" default="${target}/documentation"
description="directory where the documentation will be generated to" />
<ea:parameter property="xooki.temp.dir" required="false" default="${target}/temp-doc"
description="Temporary directory for xooki use." />
<ea:parameter property="xooki.resources.include.pattern" default="style/**,images/**"
description="Pattern describing files included in xooki documentation generation" />
<ea:parameter property="xooki.resources.exclude.pattern" default=""
description="Pattern describing files excluded in xooki documentation generation" />
<ea:parameter property="xooki.history.dir" default="${src.documentation.dir}/history"
description="directory where documentation history version are stored (used to update config.extra.js)" />
<!-- TODO: should menu context names be inherited from the environment somehow? -->
<ea:parameter property="xooki.menu.contexts" default="buildtypes,plugins"
description="list of documentation menus for which xooki will generate menus" />
<!-- Xooki tasks requires jdk16 -->
<condition property="org.apache.easyant.plugins#xooki.enabled">
<contains substring="1.6" string="${ant.java.version}" />
</condition>
<ac:if>
<istrue value="${org.apache.easyant.plugins#xooki.enabled}" />
<ac:then>
<echo level="verbose">Loading xooki antlib</echo>
<taskdef uri="antlib:xooki" file="${src.documentation.dir}/xooki/antlib.xml" />
</ac:then>
<ac:else>
<echo level="warning">Xooki modules requires JDK 1.6. Xooki module will be disabled.</echo>
</ac:else>
</ac:if>
<condition property="contains.history.dir">
<available file="${xooki.history.dir}" type="dir" />
</condition>
</target>
<target name="xooki:create-skeleton" depends="xooki:init">
<mkdir dir="${xooki.temp.dir}" />
<mkdir dir="${documentation.css.dir}" />
<ivy:retrieve organisation="org.apache.xooki" module="xooki" inline="true" pattern="${xooki.temp.dir}/[artifact].[ext]"
settingsRef="easyant.ivy.instance" />
<unzip src="${xooki.temp.dir}/xooki.jar" dest="${src.documentation.dir}" />
<delete dir="${xooki.temp.dir}" />
</target>
<target name="-xooki:copy-resources" depends="xooki:init">
<available file="${src.documentation.dir}/xooki/antlib.xml" property="xooki.skeleton.present" />
<fail unless="xooki.skeleton.present"
message="Xooki skeleton has not been correctly setup. Run easyant org.apache.easyant.plugins#xooki:create-skeleton to generate a xooki skeleton." />
<echo message="Generating xooki documentation." />
<mkdir dir="${target.documentation.dir}" />
<echo level="verbose" message="copying documentation resources" />
<fileset id="xooki.resources.fileset" dir="${src.documentation.dir}" includes="${xooki.resources.include.pattern}"
excludes="${xooki.resources.exclude.pattern}" />
<copy todir="${target.documentation.dir}">
<fileset refid="xooki.resources.fileset" />
</copy>
<!-- copy to a xooki temp dir this will allow users to generate xooki documentation -->
<copy todir="${xooki.temp.dir}">
<fileset dir="${src.documentation.dir}" id="src.documentation.fileset">
<include name="**/*" />
<exclude name="${xooki.resources.include.pattern}" />
</fileset>
</copy>
</target>
<target name="-xooki:configure-history" if="contains.history.dir">
<ac:for param="doc-version">
<path>
<dirset dir="${xooki.history.dir}" includes="*" />
</path>
<sequential>
<echo>Updating history for @{doc-version}</echo>
<echo file="@{doc-version}/config.extra.js" message="xooki.c.setImportLevel(2);" />
</sequential>
</ac:for>
</target>
<target name="xooki:generate" depends="-xooki:copy-resources,-xooki:configure-history" if="org.apache.easyant.plugins#xooki.enabled">
<echo level="verbose" message="generating target documentation" />
<dirname file="${target.documentation.dir}" property="full.target.documentation.dir" />
<basename file="${target.documentation.dir}" property="basename.target.documentation.dir" />
<fileset dir="${xooki.temp.dir}" id="src.documentation.fileset">
<include name="**/*.html" />
<exclude name="template.html" />
<exclude name="*Template.html" />
<exclude name="xooki/**" />
</fileset>
<xooki:generate destDir="${full.target.documentation.dir}/${basename.target.documentation.dir}"
checkUpToDate="${xooki.checkUpToDate}" xookidir="${src.documentation.dir}/xooki">
<fileset refid="src.documentation.fileset" />
</xooki:generate>
</target>
<target name="xooki:package" depends="xooki:generate" description="package the xooki documentation" if="org.apache.easyant.plugins#xooki.enabled">
<ea:parameter property="target.artifacts" default="${target}/artifacts" description="destination directory for target artifacts" />
<echo message="Packaging generated documentation." />
<mkdir dir="${target.artifacts}" />
<zip destfile="${target.artifacts}/${ivy.module}-docs.zip" basedir="${target.documentation.dir}" />
<ea:registerartifact type="doc" ext="zip" classifier="doc" settingsRef="${project.ivy.instance}" />
</target>
</project>