File: build.xml

package info (click to toggle)
jftp 1.52+dfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 1,852 kB
  • ctags: 2,972
  • sloc: java: 22,890; xml: 186; sh: 26; makefile: 19
file content (227 lines) | stat: -rwxr-xr-x 8,745 bytes parent folder | download | duplicates (3)
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
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
<project name="J-FTP" default="jars" basedir=".">

  <!-- Load any local properties -->
  <property file="${user.home}/.ant.properties"/> 
  <property file="local.properties"/>

<!-- ========== Compiler Defaults ========================================= -->

  <!-- CVSROOT used by cruise control can checkout source code -->
  <property name="cvs.repository" value=":pserver:anonymous@cvs.j-ftp.sourceforge.net:/cvsroot/j-ftp"/>

  <!-- CVS Project for cruise control to check out --> 
  <property name="cvs.package" value="j-ftp"/>

  <!-- Should Java compilations set the 'debug' compiler option? -->
  <property name="compile.debug"           value="true"/>

  <!-- Should Java compilations set the 'deprecation' compiler option? -->
  <property name="compile.deprecation"     value="false"/>

  <!-- Should Java compilations set the 'optimize' compiler option? -->
  <property name="compile.optimize"        value="true"/>

  <!-- define this in local.properties to set it to a different value -->
  <property name="jftp.version"            value="0.00"/>

  <property name="junit.lib"               value="lib"/>
  <property name="junit.jar"               value="${junit.lib}/junit.jar"/>
  <property name="log4j.lib"               value="lib"/>
  <property name="log4j.jar"               value="${log4j.lib}/log4j.jar"/>

  <!-- Construct compile classpath -->
  <path id="compile.classpath">
    <pathelement location="build/classes"/>
    <pathelement location="${log4j.jar}"/>
    <pathelement location="lib/"/>
    <fileset dir="lib">
        <include name="*.jar"/>
    </fileset>
  </path>

    <!-- Construct doc compile classpath -->
  <path id="compile.docclasspath">
    <pathelement location="build/jars/jftp.jar"/>
    <pathelement location="${log4j.jar}"/>
    <pathelement location="lib/"/>
    <fileset dir="lib">
        <include name="*.jar"/>
    </fileset>
  </path>

<!-- ========== Executable Targets ======================================== -->

  <target name="prepare" depends="detect" description="Prepare build directory">
    <mkdir dir="build"/>
    <mkdir dir="doc"/>
    <mkdir dir="doc/javadoc"/>
    <mkdir dir="build/classes"/>
    <mkdir dir="build/jars"/>
  </target>

  <target name="compile" depends="prepare" description="Compile shareable components">
    <javac  srcdir="src/java"
           destdir="build/classes"
	     debug="${compile.debug}"
       deprecation="${compile.deprecation}"
          optimize="${compile.optimize}"
	  nowarn="true">
      <classpath refid="compile.classpath"/>
      <exclude name="**/Log4JLogger.java" unless="log4j.present"/>
  </javac>
      <copy todir="build/classes">
      <fileset dir="lib">
        <include name="**/*"/>
      </fileset>
      </copy>
  </target>
  
  <target name="panel" depends="prepare" description="Compile Custom">
    <javac  srcdir="src/java/net/sf/jftp/gui"
	   destdir="build/classes"
             debug="${compile.debug}"
       deprecation="${compile.deprecation}"
          optimize="${compile.optimize}">
      <classpath refid="compile.classpath"/>
      <include name="**/LocalDir.java"/>
  </javac>       
  </target>
  
  <target name="compiledoc" depends="prepare" description="Compile doc components">
    <javac  srcdir="doc/"
           destdir="build/classes"
             debug="${compile.debug}"
     deprecation="${compile.deprecation}"
          optimize="${compile.optimize}">
      <classpath refid="compile.docclasspath"/>
      <exclude name="**/Log4JLogger.java" unless="log4j.present"/>
    </javac>       
  </target>

  <target name="javadoc" description="Generate JavaDoc" depends="prepare">
    <javadoc packagenames="net.sf.jftp.*" sourcepath="src/java"
            defaultexcludes="yes" destdir="doc/javadoc" author="true"
            version="true" windowtitle="JFtp"/>
  </target>

  <target name="run" description="Run the JFTP Command" depends="compile,jars">
      <!-- this will execute the jtfp program in the build directory
      I figured this would be best because we could execute from the
      classes or the jar and still get our host list -->
    <java dir="build" jar="build/jars/jftp.jar" fork="true"/>
  </target>

  <target name="clean" description="Clean build and distribution directories">
    <!-- Delete the two directories for compiled code
        the cfg settings are in the build/cfg directory
        so they won't be lost -->
    <delete dir="build/jars"/>
    <delete dir="build/classes"/>
  </target>

  <target name="jars" depends="compile" description="Create Executable Jar">
    <jar compress="true" jarfile="build/jars/jftp.jar"
            basedir="build/classes"
            manifest="debian/manifest.mf">
      <zipfileset dir="src/images/" prefix="images">
        <include name="**"/>
      </zipfileset>
      <zipfileset dir="." prefix="docs">
        <include name="readme"/>
        <include name="CHANGELOG"/>
        <include name="TODO"/>
        <include name="doc/nfsinfo"/>
      </zipfileset>
      <zipfileset dir="src/xml/" prefix="JESKTOP-INF">
        <include name="*.xml"/>
      </zipfileset>
      <zipfileset dir="src/resources/">
        <include name="*.properties"/>
      </zipfileset>
    </jar>
  </target>

  <target name="signjar">
    <signjar alias="cdemon" jar="build/jars/jftp.jar"
     keystore="../cdemon" storepass="keytool!"/>
    <delete dir="build/classes"/>
  </target>
  
  <!-- Completely build all dists -->
  <target name="dist" depends="jars, signjar" description="Generates J-Ftp downloadables">
    <mkdir dir="dist"/>

    <copy todir="dist">
      <fileset dir="build/jars">
        <include name="*.jar"/>
      </fileset>
    </copy>

    <patternset id="jftp.source">
       <include name="src/**"/>
       <include name="lib/*"/>
       <include name="build.xml"/>
       <include name="readme"/>
    </patternset>

    <zip zipfile="dist/jftp-${jftp.version}-src.zip">
      <fileset dir=".">
        <patternset refid="jftp.source"/> 
      </fileset>
    </zip>         

    <tar longfile="gnu" tarfile="dist/jftp-${jftp.version}-src.tar" >
      <tarfileset dir="." username="jftp" group="jftp">
        <patternset refid="jftp.source"/> 
      </tarfileset>
    </tar>

    <gzip zipfile="dist/jftp-${jftp.version}-src.tar.gz"
          src="dist/jftp-${jftp.version}-src.tar"/>
    <delete file="dist/jftp-${jftp.version}-src.tar"/>
  </target>

  <target name="detect" depends="detect.display"
   description="Display configuration and conditional compilation flags">
  </target>

  <target name="detect.display">
    <available property="log4j.present" classname="org.apache.log4j.Category" classpath="${log4j.jar}" />
    <available property="junit.present" classname="junit.framework.TestCase" classpath="${junit.jar}" />
    <echo message="+-------------------------------------------------------" />
    <echo message="| Build environment for ${ant.project.name} ${jftp.version}" />
    <echo message="| " />
    <echo message="| Note: " />
    <echo message="|   If ${property.name} is displayed for a library " />
    <echo message="|   instead of 'true', that library is not present." />
    <echo message="+-------------------------------------------------------" />
    <echo message="" />
    <echo message="Environment:" />
    <echo message="  Java home                     ${java.home}" />
    <echo message="  Java version                  ${ant.java.version}" />
    <echo message="  Ant version                   ${ant.version}" />
    <echo message="  Compiler type                 ${build.compiler}" />
    <echo message="" />
    <echo message="Build options:" />
    <echo message="  Generate debugging info       ${compile.debug}" />
    <echo message="  Display deprecation info      ${compile.deprecation}" />
    <echo message="  Optimize                      ${compile.optimize}" />
    <echo message="" />
    <echo message="Optional libraries:" />
    <echo message="  JUnit                         ${junit.present}" />
    <echo message="  Log4J                         ${log4j.present}" />
    <echo message="" />
    <echo message="Library locations:" />
    <echo message="  JUnit jar                     ${junit.jar}" />
    <echo message="  Log4J jar                     ${log4j.jar}" />
  </target>

<!-- ========== Cruise Control (Continuous Integration) tasks ============= -->
  <target name="checkout" description="Update package from CVS">
    <cvs cvsroot="${cvs.repository}" package="${cvs.package}" dest=".."/>
  </target>

  <target name="masterbuild" depends="checkout, compile, jars, javadoc" description="Cruise control master build"/>

  <target name="cleanbuild" depends="clean, masterbuild" description="Cruise control clean build"/>
</project>