blob: 3c9369a9f6e4f0a499c4e7833291d07c216a4412 [file] [log] [blame]
<?xml version="1.0"?>
<project name="site" default="docs" basedir="." xmlns:rat='antlib:org.apache.rat.scan'>
<!-- Initialization properties -->
<property name="project.name" value="site"/>
<!-- The source directory for our XML source documents which are
to be sytlized and transformed into XHTML. -->
<property name="docs.src" value="content"/>
<!-- The destination directory for content generated from our XML
sources. -->
<property name="docs.dest" value="target/site"/>
<!-- Allow override of Anakia default -->
<property name="anakia.lastModifiedCheck" value="true"/>
<path id="classpath">
<fileset dir="./lib">
<include name="**/*.jar"/>
</fileset>
</path>
<target name="prepare">
<available classname="org.apache.anakia.AnakiaTask"
property="AnakiaTask.present">
<classpath refid="classpath"/>
</available>
</target>
<target name="prepare-error" depends="prepare" unless="AnakiaTask.present">
<echo>
AnakiaTask is not present! Please check to make sure that
anakia-1.x.jar is in your classpath.
</echo>
</target>
<target name="docs" depends="prepare-error,generate-site-map,generate-menu,generate-index,report-groups,report-next-month,history"
if="AnakiaTask.present"
description="Build all the documents">
<taskdef name="anakia" classname="org.apache.anakia.AnakiaTask">
<classpath refid="classpath"/>
</taskdef>
<!-- Always process index (uses ent file which is not part of update check) -->
<anakia basedir="${docs.src}" destdir="${docs.dest}/"
extension=".html" style="./site.vsl"
projectFile="stylesheets/project.xml"
includes="index.xml"
lastModifiedCheck="false"
templatePath="${docs.src}/stylesheets"
velocityPropertiesFile="build.props"/>
<!-- Always process projects/index (uses ent file which is not part of update check) -->
<anakia basedir="${docs.src}" destdir="${docs.dest}/"
extension=".html" style="./site.vsl"
projectFile="stylesheets/project.xml"
includes="projects/index.xml"
lastModifiedCheck="false"
templatePath="${docs.src}/stylesheets"
velocityPropertiesFile="build.props"/>
<!-- Always process clutch (uses ent file which is not part of update check) -->
<anakia basedir="${docs.src}" destdir="${docs.dest}/"
extension=".html" style="./site.vsl"
projectFile="stylesheets/project.xml"
includes="clutch.xml"
lastModifiedCheck="false"
templatePath="${docs.src}/stylesheets"
velocityPropertiesFile="build.props"/>
<!-- process everything else -->
<anakia basedir="${docs.src}" destdir="${docs.dest}/"
extension=".html" style="./site.vsl"
projectFile="stylesheets/project.xml"
excludes="**/stylesheets/** index.xml projects/index.xml clutch.xml empty.xml podlings.xml **/projects/activemq/** **/projects/servicemix/**"
includes="**/*.xml"
lastModifiedCheck="${anakia.lastModifiedCheck}"
templatePath="${docs.src}/stylesheets"
velocityPropertiesFile="build.props"/>
<!-- Always copy the file, even if older (may happen if parts of WC are reverted) -->
<copy overwrite="true" todir="${docs.dest}/" filtering="no">
<fileset dir="${docs.src}/">
<!-- Ignore the Anakia style sheet used for processing
of the xdocs, and the unprocessed xdocs themselves,
but copy all other content to the directory which is
checked out on the server. -->
<exclude name="**/*.xml"/>
<exclude name="**/build.props"/>
<exclude name="**/stylesheets/**"/>
<exclude name="**/*.tmp"/>
<!-- don't want clutch entities published -->
<exclude name="clutch*.ent"/>
<!-- Editor-specific ignores. -->
<exclude name="**/*~"/>
<exclude name="**/.#*"/>
</fileset>
</copy>
<!-- Always copy the file, even if older (may happen if parts of WC are reverted) -->
<copy overwrite="true" file="${docs.src}/podlings.xml" tofile="${docs.dest}/podlings.xml"/>
<antcall target="FixEOL"></antcall>
</target>
<target name="checkOS">
<condition property="os.windows">
<os family="windows"/>
</condition>
</target>
<!--
Anakia seems to get confused about line-endings in some generated html files.
This target can be used to restore the line endings.
-->
<target name="FixEOL" description="Fix inconsistent line endings in generated documents">
<echo level="info" message="Fixing inconsistent line endings in generated documents."/>
<fixcrlf encoding="UTF-8" srcdir="${docs.dest}" includes="**/*.html"/>
</target>
<!--
Site map generation
-->
<property name="sitemap.work" value="target/texen"/>
<property name="sitemap.src" value="${docs.src}/stylesheets/sitemap"/>
<target name="_prepare-texen">
<available classname="org.apache.texen.ant.TexenTask"
property="TexenTask.present">
<classpath refid="classpath"/>
</available>
</target>
<target name='generate-site-map' depends='_prepare-texen' if='TexenTask.present'>
<delete quiet="true" dir="${sitemap.work}"/>
<mkdir dir='${sitemap.work}'/>
<taskdef
name="texen"
classname="org.apache.texen.ant.TexenTask"
classpathref='classpath' />
<!-- Use XSLT to extract indexes from development documents -->
<xslt
processor="trax"
basedir='${docs.src}'
destdir='${sitemap.work}'
extension='.xml'
style='${sitemap.src}/index.xsl'>
<exclude name='navigation.xml' />
<exclude name='sitemap.xml' />
<exclude name='podlings.xml' />
<exclude name='index.xml' />
<include name='*.xml' />
<include name='guides/**/*.xml' />
<include name='official/**/*.xml' />
<include name='learn/**/*.xml' />
<include name='incubation/**/*.xml' />
</xslt>
<!-- Use Texen to combine indexes into final document -->
<texen
controlTemplate='control.vsl'
outputDirectory='${docs.src}'
templatePath='${sitemap.src}'
outputFile='../${sitemap.work}/generation.report' />
</target>
<!-- Generate the menu file entity from podlings.xml -->
<target name="generate-menu">
<xslt
in="${docs.src}/podlings.xml"
out='target/project-menu.ent'
style='${docs.src}/stylesheets/project-menu.xsl'>
</xslt>
</target>
<!--
Generate the project index files
Output is written to the target/ directory:
- index.tmp - dummy file, ignored
- (current|graduated|retired).ent
-->
<target name="generate-index">
<!--
Delete the output file to force it to be recreated.
This is necessary because there is no direct dependency on podlings.xml (or the stylesheet).
It's simpler just to recreate the file.
-->
<delete file="${docs.dest}/projects/index.html"/>
<!-- Need to use force, to ensure that .ent files are always created -->
<xslt
force="true"
in="${docs.src}/podlings.xml"
out='target/index.tmp'
style='${docs.src}/stylesheets/project-index.xsl'>
<param name="outputdir" expression="target/"/>
</xslt>
</target>
<!--
Generate podling summary files
- (current|graduated|retired|podlings).txt
- summary.tmp - dummy output file, removed after generation
-->
<target name="generate-summary">
<!-- Need to use force, to ensure that .txt files are always created -->
<xslt
force="true"
in="${docs.src}/podlings.xml"
out='target/summary.tmp'
style='${docs.src}/stylesheets/project-summary.xsl'>
<!-- TODO move somewhere under site ? -->
<param name="outputdir" expression="target/"/>
</xslt>
<delete file="target/summary.tmp"/>
</target>
<!--
Audit Tasks
===========
-->
<!--
Audit index generation
-->
<property name="audit.index.work" value="target/audit-gen"/>
<property name="audit.index.src" value="${docs.src}/stylesheets/audit"/>
<target name='generate-audit-index' depends='_prepare-texen' if='TexenTask.present'>
<delete quiet="true" dir="${audit.index.work}"/>
<mkdir dir='${audit.index.work}'/>
<taskdef
name="texen"
classname="org.apache.texen.ant.TexenTask"
classpathref='classpath' />
<!-- Use Texen to generate index -->
<texen
controlTemplate='control.vsl'
outputDirectory='${docs.src}'
templatePath='${audit.index.src}'
outputFile='../${sitemap.work}/generation.report' />
</target>
<property name='dir.build' value='target'/>
<property name='dir.audit' value='${docs.src}/audit'/>
<property name='audit.mailinglist.address' value='general@incubator.apache.org'/>
<property name='audit.mailinglist.name' value='Incubator General Mailing List'/>
<target name='__prepare-rat' >
<property name='rat-src' value='rat'/>
<taskdef uri="antlib:org.apache.rat.scan"
resource="org/apache/rat/scan/antlib.xml" classpath="${rat-src}"/>
</target>
<target name='__check-for-changes' depends='__prepare-rat'>
<rat:CheckForChanges
build-dir='${dir.build}'
property='audit.changes'
/>
</target>
<target
name='__prepare-audit-mail'
depends='__check-for-changes'>
<property prefix="audit.mail" file="mail.properties"/>
<condition property='do.audit.mail'>
<and>
<isset property="audit.changes"/>
<istrue value="${audit.mail.enabled}"/>
</and>
</condition>
</target>
<target
name='__no-mail-warning'
depends='__prepare-audit-mail'
unless='audit.mail.enabled'>
<echo>Mail disabled. See EXAMPLE.mail.properties.</echo>
</target>
<target
name='__no-changes-warning'
depends='__prepare-audit-mail'
unless='audit.changes'>
<echo>No changes. No need to send mail.</echo>
</target>
<target
name='__mail-report'
depends='__prepare-rat, __prepare-audit-mail, __no-mail-warning, __no-changes-warning'
if='do.audit.mail'>
<rat:MailAuditReport
host='${audit.mail.mailhost}'
port='${audit.mail.mailport}'
user='${audit.mail.user}'
password='${audit.mail.password}'
from='${audit.mail.from}'
to-address='${audit.mailinglist.address}'
to-name='${audit.mailinglist.name}'
dir='${dir.audit}'/>
</target>
<target
name='mail-report'
depends='__prepare-rat,__mail-report'>
</target>
<target name='audit' depends='__prepare-rat'>
<rat:Audit
src='${rat-src}'
out='${dir.audit}'
build='${dir.build}'/>
<antcall target='generate-audit-index'/>
<antcall target='docs'/>
<antcall target='mail-report'/>
</target>
<target name='ppmc-aliases'
description='Generate a list of PPMCs private email addresses'>
<xslt
processor="trax"
basedir='${docs.src}'
destdir='${dir.build}'
extension='.txt'
style='ppmc-aliases.xsl'>
<include name='podlings.xml' />
</xslt>
</target>
<target name='report-groups'
description='Generate a list of PPMCs report groups'>
<xslt
in="${docs.src}/podlings.xml"
out='${docs.dest}/report-groups.txt'
style='report-groups.xsl'>
</xslt>
</target>
<target name='report-next-month'
description='Generate a list of podlings that need to report next month (and thus prepare report in the current month)'>
<xslt
in="${docs.src}/podlings.xml"
out='${docs.dest}/report-next-month.html'
style='report-next-month.xsl'>
</xslt>
</target>
<target name="__history_current">
<xslt
in="${docs.src}/podlings.xml"
out="${docs.dest}/history/current.txt"
style="current.xsl">
</xslt>
</target>
<target name="__history_entry">
<xslt
in="${docs.src}/podlings.xml"
out="${docs.dest}/history/entry.txt"
style="entry.xsl">
</xslt>
</target>
<target name="history" depends="__history_current,__history_entry"
description="Generate entry.txt and current.txt history files"/>
</project>