|
1 <project name="web4j-jar" default='all' basedir="." > |
|
2 |
|
3 <!-- |
|
4 This is a courtesy build script provided for your use. |
|
5 Please edit to suit your needs. |
|
6 |
|
7 You can use whatever compiler suits your needs. |
|
8 The 'official' web4j.jar uses JDK 1.5, in order to remain compatible |
|
9 with older environments. But you can use more modern JDK's if you wish. |
|
10 --> |
|
11 |
|
12 <description> |
|
13 Web4j.jar |
|
14 </description> |
|
15 |
|
16 <!-- Override default property values with an external properties file, if present. --> |
|
17 <property file='build.properties'/> |
|
18 |
|
19 <!-- Default property values, if not overridden elsewhere: --> |
|
20 <property name='build' location='build' /> |
|
21 <property name='app.version' value='1.0.0'/> |
|
22 <property name='app.name' value='web4j'/> |
|
23 <property name='distro-name' value='web4j'/> |
|
24 <tstamp><format property='build.time' pattern='yyyy-MM-dd HH:mm:ss'/></tstamp> |
|
25 |
|
26 <path id='compile.classpath'> |
|
27 <fileset dir='lib'> |
|
28 <include name='*.jar'/> |
|
29 </fileset> |
|
30 </path> |
|
31 |
|
32 <!-- Simply extends the compile.classpath with your own compiled classes. --> |
|
33 <path id='run.classpath'> |
|
34 <path refid='compile.classpath'/> |
|
35 <path location='classes'/> |
|
36 </path> |
|
37 |
|
38 <fileset id='class.files' dir='classes'> |
|
39 <include name='**/*.class'/> |
|
40 </fileset> |
|
41 |
|
42 <fileset id='files.for.jar' dir='classes'> |
|
43 <exclude name='**/*.java'/> |
|
44 <exclude name='**/doc-files/'/> |
|
45 </fileset> |
|
46 |
|
47 <fileset id='test.classes' dir='classes'> |
|
48 <include name='**/TEST*.java'/> |
|
49 </fileset> |
|
50 |
|
51 <!-- A connection to this URL is used when building javadoc. --> |
|
52 <condition property='jdk.javadoc.visible' value='true' else='false'> |
|
53 <http url='http://docs.oracle.com/javase/6/docs/api/' /> |
|
54 </condition> |
|
55 |
|
56 <echo> |
|
57 Application: ${app.name} ${app.version} |
|
58 Build File : ${ant.file} |
|
59 Run Date : ${build.time} |
|
60 Run by : ${user.name} |
|
61 Build Dir : ${build} |
|
62 Base Dir : ${basedir} |
|
63 Java Home : ${java.home} |
|
64 Connected to the web : ${jdk.javadoc.visible} |
|
65 </echo> |
|
66 |
|
67 <echo message='Create build directory, and its subdirectories.'/> |
|
68 <mkdir dir="${build}/javadoc"/> |
|
69 <mkdir dir="${build}/dist"/> |
|
70 |
|
71 <!-- Now define the targets, which use the properties and datatypes defined above. --> |
|
72 |
|
73 <target name='clean' description="Delete all build artifacts." > |
|
74 <delete dir='${build}'/> |
|
75 <delete> |
|
76 <fileset refid='class.files'/> |
|
77 </delete> |
|
78 <mkdir dir="${build}/javadoc"/> |
|
79 <mkdir dir="${build}/dist"/> |
|
80 </target> |
|
81 |
|
82 <target name='compile' description='Compile source files and place beside source.'> |
|
83 <javac srcdir="classes"> |
|
84 <classpath refid='compile.classpath'/> |
|
85 </javac> |
|
86 <!-- Here's a simple way of debugging a path, fileset, or patternset, using its refid: --> |
|
87 <echo>Classpath: ${toString:compile.classpath}</echo> |
|
88 </target> |
|
89 |
|
90 <target name='jar' description='Create a jar file for distribution.' depends='compile'> |
|
91 <jar destfile='${build}/dist/${distro-name}.jar' duplicate='preserve'> |
|
92 <fileset refid='files.for.jar'/> |
|
93 <manifest> |
|
94 <attribute name='Specification-Version' value='${app.version}'/> |
|
95 <attribute name='Specification-Title' value='${app.name}' /> |
|
96 <attribute name='Implementation-Version' value='${app.version}'/> |
|
97 <attribute name='Implementation-Title' value='${app.name}' /> |
|
98 </manifest> |
|
99 </jar> |
|
100 </target> |
|
101 |
|
102 <target name='javadoc' description='Generate javadoc.' > |
|
103 <javadoc |
|
104 use='true' author='true' version='true' |
|
105 overview='classes\overview.html' |
|
106 access='package' |
|
107 sourcepath='classes' |
|
108 packagenames='*.*' |
|
109 destdir='${build}/javadoc' |
|
110 windowtitle='${app.name} ${app.version}' |
|
111 noqualifier='java.*:javax.*:com.sun.*' |
|
112 linksource='true' |
|
113 > |
|
114 <classpath refid='compile.classpath'/> |
|
115 <link href='http://docs.oracle.com/javase/6/docs/api/'/> |
|
116 <header><![CDATA[<h1>${app.name} ${app.version}</h1>]]></header> |
|
117 </javadoc> |
|
118 </target> |
|
119 |
|
120 <target name='distro-binary' description='Create zip file with executable jar, docs.' depends='jar, javadoc'> |
|
121 <zip destfile='${build}/dist/${distro-name}-binary.zip' duplicate='preserve'> |
|
122 <zipfileset dir='${build}/dist/' includes='${distro-name}.jar'/> |
|
123 <zipfileset dir='${build}/javadoc' prefix='javadoc' /> |
|
124 </zip> |
|
125 </target> |
|
126 |
|
127 <target name='distro-source' description='Create zip file with project source code.'> |
|
128 <zip destfile='${build}/dist/${distro-name}-src.zip' duplicate='preserve' > |
|
129 <!-- exclude items specific to the author's IDE setup: --> |
|
130 <zipfileset dir='.' excludes='.classpath, .project'/> |
|
131 </zip> |
|
132 </target> |
|
133 |
|
134 <target name='all' description='Create all build artifacts.' depends='clean, compile, jar, javadoc, distro-binary, distro-source'> |
|
135 <echo>Finished creating all build artifacts.</echo> |
|
136 </target> |
|
137 |
|
138 </project> |