summaryrefslogtreecommitdiff
blob: c2803acc5bab1e2aab0c60512327c2e4811f2aef (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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
<!--
  Common Target which could be reused by other projects later.
-->

<!-- COMMON PROPERTIES -->

  <property name="debug" value="true"/>
  <property name="optimize" value="false"/>

  <!-- Java Related -->
  <property name="java.src.dir" value="src"/>
  <property name="javac.compiler" value="modern"/>

  <!-- Destination Directory for the build -->
  <property name="build.dir" value="build"/>
  <property name="build.classes" value="${build.dir}/classes"/>
  <property name="build.src" value="${build.dir}/src"/>
  <property name="build.dist.dir" value="${project}-${version}"/>
  <property name="build.dist.src" value="${build.dist.dir}/src"/>
  <property name="build.dist.lib" value="${build.dist.dir}/lib"/>
  <property name="build.dist.bin" value="${build.dist.dir}/bin"/>
  <property name="build.www.dir" value="${build.dir}/www"/>

<!-- COMMON TARGETS -->

  <target name="init.properties">
    <tstamp>
      <format property="build.time" pattern="MM/dd/yyyy hh:mm aa" locale="en"/>
      <format property="build.version" pattern="yyyyMMdd" locale="en"/>
    </tstamp>
    <filter token="VERSION" value="${version}"/>
    <filter token="PROJECT.FULLNAME" value="${project.fullname}"/>
    <filter token="DATE" value="${build.time}"/>
    <filter token="YEAR" value="${year}"/>
  </target>

  <target name="init.directories">
    <mkdir dir="${build.dir}"/>
    <mkdir dir="${build.classes}"/>
    <mkdir dir="${build.dist.dir}"/>
    <mkdir dir="${build.dist.src}"/>
    <mkdir dir="${build.dist.lib}"/>
    <mkdir dir="${build.dist.bin}"/>
  </target>

  <target name="init" depends="init.properties,init.directories">
  </target>

  <target name="clean">
    <delete dir="${build.dir}"/>
    <delete dir="${build.dist.dir}"/>
  </target>

  <target name="fixcrlf">
    <fixcrlf srcdir="${basedir}" eol="cr">
      <include name="AUTHORS,LICENSE*,README,THANKS" />
      <include name="**/*.java" />
    </fixcrlf>
  </target>

<!-- Java Related Targets -->

  <target name="compile.java" depends="init">
    <depend srcdir="${java.src.dir}"
            destdir="${build.classes}"
            cache="${build.dir}/dependcache"
            closure="yes"/>

    <copy todir="${build.src}" filtering="yes">
      <fileset dir="${java.src.dir}">
        <include name="**/*.java"/>
      </fileset>
    </copy>
    <javac srcdir="${build.src}"
           destdir="${build.classes}"
           classpathref="classpath"
           compiler="${javac.compiler}"
           includeAntRuntime="false"
           includeJavaRuntime="false"
           debug="${debug}"
           optimize="${optimize}"
           target="1.3" source="1.3">
    </javac>
  </target>

<!-- Distribution Target -->

  <target name="dist" depends="jar,dist.pre">
    <!-- project.jar -->
    <copy todir="${build.dist.lib}"
          file="${build.dir}/${project}.jar"
          preservelastmodified="yes"/>
    <!-- source code -->
    <copy todir="${build.dist.src}"
          preservelastmodified="yes">
      <fileset dir="${build.src}" includes="**/*.java"/>
      <fileset dir="${java.src.dir}" includes="**/*.properties"/>
    </copy>
    <!-- regular files -->
    <copy todir="${build.dist.dir}"
          filtering="yes"
          preservelastmodified="yes">
      <fileset dir="${basedir}">
        <include name="AUTHORS"/>
        <include name="INSTALL"/>
        <include name="README"/>
        <include name="THANKS"/>
        <include name="LICENSE"/>
        <include name="LICENSE_*"/>
      </fileset>
    </copy>
    <xslt in="xdocs/CHANGES.xml"
          out="${build.dist.dir}/CHANGES"
          style="xdocs/xsl/text.xsl"/>
    <!-- zip file -->
    <zip destfile="${project}-${version}-${build.version}.zip">
      <zipfileset dir="${build.dist.dir}"
                  prefix="${project}-${version}" />
    </zip>
  </target>

<!-- Source code formatting -->

  <target name="jalopy" depends="init">
  </target>

<!-- Project Web Documentation -->

  <target name="www" depends="init">
    <mkdir dir="${build.www.dir}"/>
    <xslt in="xdocs/www.xml"
          out="${build.www.dir}/empty.html"
          style="xdocs/xsl/tohtml.xsl">
      <param name="output.dir" expression="${build.www.dir}"/>
      <param name="timestamp" expression="${build.time}"/>
    </xslt>
    <copy todir="${build.www.dir}">
      <fileset dir="xdocs">
        <include name="images/**"/>
        <include name="**.java"/>
      </fileset>
    </copy>
    <mkdir dir="${build.www.dir}/javadoc"/>
    <javadoc sourcepath="${java.src.dir}"
             classpath="${classpath}"
             destdir="${build.www.dir}/javadoc"
             packagenames="${javadoc.packagenames}"
             private="false" protected="true"
             windowtitle="${project.fullname} ${version} API"
             doctitle="${project.fullname} ${version}"
             version="false" author="false" use="false"
             stylesheetfile="xdocs/javadoc.css"
             splitindex="true"
             bottom="Copyright &#169; ${year} L2FProd.com. All Rights Reserved."/>
    <delete file="${build.www.dir}/empty.html"/>
  </target>

  <target name="www.sync" depends="init">
    <ftp server="${build.www.server}"
	 userid="${build.www.userid}"
	 password="${build.www.password}"
	 remotedir="${build.www.remotedir}"
	 action="put"
	 verbose="yes"
	 depends="yes">
      <fileset dir="${build.www.dir}">
        <include name="**/**"/>
      </fileset>
    </ftp>
  </target>