1 | <?xml version="1.0" encoding="UTF-8"?> |
---|
2 | <project |
---|
3 | name="ExtensionExamples" |
---|
4 | default="build" |
---|
5 | basedir="."> |
---|
6 | |
---|
7 | <!--create this file if you need to override values from properties below --> |
---|
8 | <property file="build.properties" /> |
---|
9 | |
---|
10 | <!-- variables used --> |
---|
11 | <property name="name" value="extension-examples" /> |
---|
12 | <property name="version" value="1.0" /> |
---|
13 | <property name="src" location="src" description="Location of source files" /> |
---|
14 | <property name="build" location="build" description="Location of compiled files" /> |
---|
15 | <property name="dist" location="dist" description="Directory where distribution should be created" /> |
---|
16 | <property name="jar.name" value="${name}.jar" description="Name of JAR file with the extensions." /> |
---|
17 | <property name="tar.prefix" value="${name}-${version}" description="Prefix of .tar.gz file for download." /> |
---|
18 | <property name="tar.name" value="${tar.prefix}.tar.gz" description="Full name of .tar.gz file for download." /> |
---|
19 | <property name="javac.arg" value="-Xlint:unchecked" /> |
---|
20 | <property name="javac.source" value="1.5" /> |
---|
21 | <property name="javac.target" value="1.5" /> |
---|
22 | <property name="javac.encoding" value="ISO-8859-1" /> |
---|
23 | <property name="depend.jars" |
---|
24 | value="http://base2.thep.lu.se/base/jars/2.7.0" |
---|
25 | description="The location of the BASE core JARs that we depend on" |
---|
26 | /> |
---|
27 | |
---|
28 | <!-- set up classpath for compiling --> |
---|
29 | <path id="classpath"> |
---|
30 | <fileset dir="lib"> |
---|
31 | <include name="**/*.jar" /> |
---|
32 | </fileset> |
---|
33 | </path> |
---|
34 | |
---|
35 | <target name="init"> |
---|
36 | <mkdir dir="${build}" /> |
---|
37 | <mkdir dir="${dist}" /> |
---|
38 | </target> |
---|
39 | |
---|
40 | <target name="clean"> |
---|
41 | <delete failonerror="false" includeemptydirs="true"> |
---|
42 | <fileset dir="${build}" defaultexcludes="no" /> |
---|
43 | <fileset dir="${dist}" defaultexcludes="no" /> |
---|
44 | <fileset file="${jar.name}" /> |
---|
45 | <fileset file="${tar.name}" /> |
---|
46 | </delete> |
---|
47 | </target> |
---|
48 | |
---|
49 | <target |
---|
50 | name="dist" |
---|
51 | depends="clean,build" |
---|
52 | > |
---|
53 | <copy todir="${dist}"> |
---|
54 | <fileset dir="." includes="README,LICENSE,RELEASE,build.xml" /> |
---|
55 | <fileset dir="." includes="src/**,resources/**,META-INF/**" /> |
---|
56 | <fileset dir="." includes="lib/compile/readme.txt" /> |
---|
57 | <fileset file="${jar.name}" /> |
---|
58 | </copy> |
---|
59 | </target> |
---|
60 | |
---|
61 | <target |
---|
62 | name="package" |
---|
63 | depends="dist" |
---|
64 | description="Create binary distribution package" |
---|
65 | > |
---|
66 | <tar |
---|
67 | destfile="${tar.name}" |
---|
68 | longfile="gnu" |
---|
69 | compression="gzip" |
---|
70 | > |
---|
71 | <tarfileset |
---|
72 | dir="${dist}" |
---|
73 | mode="755" |
---|
74 | prefix="${tar.prefix}" |
---|
75 | preserveLeadingSlashes="true" |
---|
76 | > |
---|
77 | <include name="**/*.sh" /> |
---|
78 | </tarfileset> |
---|
79 | <tarfileset |
---|
80 | dir="${dist}" |
---|
81 | prefix="${tar.prefix}" |
---|
82 | preserveLeadingSlashes="true" |
---|
83 | > |
---|
84 | <exclude name="**/*.sh" /> |
---|
85 | </tarfileset> |
---|
86 | </tar> |
---|
87 | </target> |
---|
88 | |
---|
89 | <target |
---|
90 | name="build" |
---|
91 | depends="init,checkjar" |
---|
92 | description="Compiles the plugin and put in jar" |
---|
93 | > |
---|
94 | <mkdir dir="${build}" /> |
---|
95 | <javac |
---|
96 | encoding="${javac.encoding}" |
---|
97 | srcdir="${src}" |
---|
98 | destdir="${build}" |
---|
99 | debug="true" |
---|
100 | classpathref="classpath" |
---|
101 | source="${javac.source}" |
---|
102 | target="${javac.target}" |
---|
103 | > |
---|
104 | <compilerarg value="${javac.arg}" /> |
---|
105 | </javac> |
---|
106 | <copy todir="${build}"> |
---|
107 | <fileset dir="." includes="META-INF/*" /> |
---|
108 | <fileset dir="." includes="resources/**" /> |
---|
109 | </copy> |
---|
110 | <jar |
---|
111 | jarfile="${jar.name}" |
---|
112 | basedir="${build}" |
---|
113 | > |
---|
114 | </jar> |
---|
115 | </target> |
---|
116 | |
---|
117 | <target |
---|
118 | name="checkjar" |
---|
119 | description="Checks that the BASE2Core.jar and BASE2Webclient.jar exists." |
---|
120 | > |
---|
121 | <available classname="net.sf.basedb.core.Application" |
---|
122 | classpathref="classpath" property="base2core" /> |
---|
123 | <available classname="net.sf.basedb.clients.web.Base" |
---|
124 | classpathref="classpath" property="base2web" /> |
---|
125 | <fail unless="base2core" message="Can't find BASE2Core.jar in ./lib/compile. Try 'ant download-lib' to download the missing file." /> |
---|
126 | <fail unless="base2web" message="Can't find BASE2Webclient.jar in ./lib/compile. Try 'ant download-lib' to download the missing file." /> |
---|
127 | <echo>Found BASE2Core.jar and BASE2Webclient.jar.</echo> |
---|
128 | </target> |
---|
129 | |
---|
130 | <target |
---|
131 | name="download-lib" |
---|
132 | description="Download BASE2Core.jar, BASE2Webclient.jar and BASE2CorePlugins.jar." |
---|
133 | > |
---|
134 | <echo> |
---|
135 | ------------------------------------------------------- |
---|
136 | NOTE! You may specifiy a different download location by |
---|
137 | creating the file './build.properties' and |
---|
138 | setting 'depend.jars' to the URL to download from. |
---|
139 | ------------------------------------------------------- |
---|
140 | </echo> |
---|
141 | <download-lib file="BASE2Core.jar" /> |
---|
142 | <download-lib file="BASE2Webclient.jar" /> |
---|
143 | </target> |
---|
144 | |
---|
145 | <macrodef name="download-lib" description="Download BASE core JAR files"> |
---|
146 | <attribute name="file" /> |
---|
147 | <sequential> |
---|
148 | <get |
---|
149 | dest="lib/compile/@{file}" |
---|
150 | src="${depend.jars}/@{file}" |
---|
151 | usetimestamp="true" |
---|
152 | verbose="true" |
---|
153 | ignoreerrors="true" |
---|
154 | /> |
---|
155 | </sequential> |
---|
156 | </macrodef> |
---|
157 | </project> |
---|