source: extensions/net.sf.basedb.yubikey/trunk/build.xml @ 2485

Last change on this file since 2485 was 2485, checked in by Nicklas Nordborg, 9 years ago

Fixes #599: YubiKey? package is missing yubikey-extended-properties.xml

File size: 6.2 KB
Line 
1<?xml version="1.0" encoding="UTF-8"?>
2<project 
3  name="YubiKey" 
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="yubikey" />
12  <property name="version" value="1.1-dev" />
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.7" />
21  <property name="javac.target" value="1.7" />
22  <property name="javac.encoding" value="UTF-8" />
23  <property name="depend.base-version" 
24    value="3.3.0" 
25    description="The BASE version that this project depends on."
26  />
27  <property name="depend.jars" 
28    value="http://base2.thep.lu.se/base/jars/${depend.base-version}" 
29    description="The location of the BASE core JARs that this project depends on."
30  />
31
32  <!-- set up classpath for compiling -->
33  <path id="classpath">
34    <fileset dir="lib">
35      <include name="**/*.jar" />
36    </fileset>
37    <fileset dir="META-INF/lib">
38      <include name="**/*.jar" />
39    </fileset>
40  </path>
41
42  <target name="init">
43    <mkdir dir="${build}" />
44    <mkdir dir="${dist}" />
45  </target>
46   
47  <target name="clean">
48    <delete failonerror="false" includeemptydirs="true">
49      <fileset dir="${build}" defaultexcludes="no" />
50      <fileset dir="${dist}" defaultexcludes="no" />
51      <fileset file="${jar.name}" />
52      <fileset file="${tar.name}" />
53    </delete>
54  </target>
55 
56  <target 
57    name="dist" 
58    depends="clean,build"
59    >
60    <copy todir="${dist}">
61      <fileset dir="." includes="README,LICENSE,yubikey.properties,yubikey-extended-properties.xml" />
62      <fileset file="${jar.name}" />
63    </copy>
64  </target>
65 
66  <target
67    name="package"
68    depends="dist"
69    description="Create binary distribution package"
70    >
71    <tar
72      destfile="${tar.name}"
73      longfile="gnu"
74      compression="gzip"
75      >
76      <tarfileset
77        dir="${dist}"
78        mode="755"
79        prefix="${tar.prefix}"
80        preserveLeadingSlashes="true"
81        >
82        <include name="**/*.sh" />
83      </tarfileset>
84      <tarfileset
85        dir="${dist}"
86        prefix="${tar.prefix}"
87        preserveLeadingSlashes="true"
88        >
89        <exclude name="**/*.sh" />
90      </tarfileset>
91    </tar>
92  </target>
93 
94  <target 
95    name="install"
96    depends="build"
97    >
98    <fail unless="base.plugins" message="base.plugins is not set to the path of BASE plug-ins directory." />
99    <copy todir="${base.plugins}">
100      <fileset file="${jar.name}" />
101    </copy>
102    <echo>Copied '${jar.name}' to '${base.plugins}'.</echo>
103  </target>
104 
105  <target 
106    name="build"
107    depends="init,checkjar"
108    description="Compiles the plugin and put in jar"
109    >
110    <mkdir dir="${build}" />
111    <javac 
112      encoding="${javac.encoding}" 
113      srcdir="${src}" 
114      destdir="${build}" 
115      debug="true" 
116      includeantruntime="false"
117      classpathref="classpath"
118      source="${javac.source}"
119      target="${javac.target}"
120      >
121      <compilerarg value="${javac.arg}" />
122    </javac>
123    <jar 
124      jarfile="${jar.name}" 
125      manifest="META-INF/MANIFEST.MF"
126      >
127      <fileset dir="${build}" />
128      <fileset dir="." includes="META-INF/**" />
129      <fileset dir="." includes="resources/**" />
130    </jar>
131  </target>
132 
133  <target 
134    name="checkjar"
135    description="Checks that the base-core-${depend.base-version}.jar exists."
136    >
137    <available classname="net.sf.basedb.core.Application" 
138      classpathref="classpath" property="base-core" />
139    <available classname="net.sf.basedb.clients.web.Base" 
140      classpathref="classpath" property="base-web" />
141
142    <fail unless="base-core" message="Can't find base-core-${depend.base-version}.jar in ./lib/compile. Try 'ant download-lib' to download the missing file." />
143    <fail unless="base-web" message="Can't find base-webclient-${depend.base-version}.jar in ./lib/compile. Try 'ant download-lib' to download the missing file." />
144    <echo>Found base-core-${depend.base-version}.jar.</echo>
145    <echo>Found base-webclient-${depend.base-version}.jar.</echo>
146  </target>
147 
148  <target 
149    name="download-lib"
150    description="Download base-core-${depend.base-version}.jar."
151    >
152    <echo>
153-------------------------------------------------------   
154NOTE! You may specifiy a different download location by
155creating the file './build.properties' and
156setting 'depend.jars' to the URL to download from.
157-------------------------------------------------------
158    </echo>
159    <download-lib file="base-core-${depend.base-version}.jar" />
160    <download-lib file="base-webclient-${depend.base-version}.jar" />
161  </target>
162 
163  <macrodef name="download-lib" description="Download BASE core JAR files">
164    <attribute name="file" />
165    <sequential>
166      <get 
167        dest="lib/@{file}" 
168        src="${depend.jars}/@{file}" 
169        usetimestamp="true" 
170        verbose="true"
171        ignoreerrors="true"
172      />
173    </sequential>
174  </macrodef> 
175 
176  <target name="update-version">
177    <echo>Setting version to: ${version}</echo>
178   
179    <echo>YubiKey.java</echo>
180    <replaceregexp 
181      file="${src}/net/sf/basedb/yubikey/YubiKey.java"
182      match="public static final String VERSION = &#34;.*&#34;;"
183      replace="public static final String VERSION = &#34;${version}&#34;;"
184      encoding="UTF-8"
185    />
186
187    <echo>extensions.xml</echo>
188    <replaceregexp 
189      file="META-INF/extensions.xml"
190      match="&lt;version&gt;.*&lt;/version&gt;"
191      replace="&lt;version&gt;${version}&lt;/version&gt;"
192      encoding="UTF-8"
193    />
194    <replaceregexp 
195      file="META-INF/extensions.xml"
196      match="&lt;min-base-version&gt;.*&lt;/min-base-version&gt;"
197      replace="&lt;min-base-version&gt;${depend.base-version}&lt;/min-base-version&gt;"
198      encoding="UTF-8"
199    />
200   
201    <echo>Don't forget to commit the changes to the subversion repository!</echo>
202  </target>
203
204</project>
Note: See TracBrowser for help on using the repository browser.