summaryrefslogtreecommitdiff
path: root/docs.xml
blob: 1e62f510da7a30628758b4807beb0404cbb26484 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
<?xml version="1.0"?>
<!--
   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="build-site" default="docs" basedir=".">

    <description>
        Build documentation - XDocs and Javadoc.
        For building XDocs, edit xdocs/**/*.xml first.
        If ../jakarta-site2 does not exist, set -Dsite.dir=... for it,
        or just use -Dvelocity.dir=.../velocity-4.x if you have downloaded Velocity somewhere.

        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>

    <!-- Initialization properties -->
    <property name="project.name" value="ant"/>
    <property name="docs.src"     location="xdocs"/>
    <property name="docs.dest"    location="docs"/>
    <property name="project.file" value="stylesheets/project.xml" />
    <property name="templ.path"   location="xdocs/stylesheets" />
    <property name="velocity.props"   location="${docs.src}/velocity.properties" />
    <property name="include.xml"  value="**/*.xml" />

    <target name="setup-explicit-classpath" if="velocity.dir">
        <path id="anakia.classpath">
            <fileset dir="${velocity.dir}">
                <include name="velocity-dep-*.jar"/>
                <!-- XXX why is this needed separately? -->
                <include name="build/lib/jdom-*.jar"/>
            </fileset>
        </path>
    </target>

    <target name="setup-implicit-classpath" unless="velocity.dir">
        <property name="site.dir" location="../jakarta-site2"/>
        <path id="anakia.classpath">
            <fileset dir="${site.dir}/lib">
                <include name="*.jar"/>
            </fileset>
        </path>
    </target>

    <target name="prepare" depends="setup-explicit-classpath,setup-implicit-classpath">
        <available classname="org.apache.velocity.anakia.AnakiaTask"
                   property="AnakiaTask.present">
            <classpath refid="anakia.classpath"/>
        </available>
        <condition property="onwindows">
            <os family="windows"/>
        </condition>
    </target>

    <target depends="prepare" name="prepare-error" unless="AnakiaTask.present">
        <echo>
            AnakiaTask is not present! Please check to make sure that
            velocity.jar is in your classpath.
        </echo>
    </target>

    <target name="anakia" if="AnakiaTask.present" depends="prepare-error">
        <taskdef name="anakia" classname="org.apache.velocity.anakia.AnakiaTask">
            <classpath refid="anakia.classpath"/>
        </taskdef>

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

    <target name="fixcrlf" if="onwindows">
        <fixcrlf srcDir="${docs.dest}" eol="dos" includes="*.html"/>
    </target>

    <target name="docs" if="AnakiaTask.present" depends="anakia,fixcrlf" description="Create XDocs.">
    </target>
    <target name="javadocs" description="Create Javadoc.">
      <ant antfile="build.xml" target="dist_javadocs">
        <property name="dist.javadocs" value="${docs.dest}/manual/api" />
      </ant>
    </target>

    <target name="all" depends="docs,javadocs" description="Create both XDocs and Javadoc."/>

</project>