1 | <?xml version="1.0" encoding="UTF-8"?> |
---|
2 | <project |
---|
3 | name="WebAuthn" |
---|
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="webauthn" /> |
---|
12 | <property name="version" value="1.0-beta2" /> |
---|
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.release" value="11" /> |
---|
21 | <property name="javac.encoding" value="UTF-8" /> |
---|
22 | <property name="depend.base-version" |
---|
23 | value="3.19.3" |
---|
24 | description="The BASE version that this project depends on." |
---|
25 | /> |
---|
26 | <property name="depend.jars" |
---|
27 | value="https://base.thep.lu.se/chrome/site/files/base/jars/${depend.base-version}" |
---|
28 | description="The location of the BASE core JARs that this project depends on." |
---|
29 | /> |
---|
30 | |
---|
31 | <!-- set up classpath for compiling --> |
---|
32 | <path id="classpath"> |
---|
33 | <fileset dir="lib"> |
---|
34 | <include name="**/*.jar" /> |
---|
35 | </fileset> |
---|
36 | <fileset dir="META-INF/lib"> |
---|
37 | <include name="**/*.jar" /> |
---|
38 | </fileset> |
---|
39 | </path> |
---|
40 | |
---|
41 | <target name="init"> |
---|
42 | <mkdir dir="${build}" /> |
---|
43 | <mkdir dir="${dist}" /> |
---|
44 | </target> |
---|
45 | |
---|
46 | <target name="clean"> |
---|
47 | <delete failonerror="false" includeemptydirs="true"> |
---|
48 | <fileset dir="${build}" defaultexcludes="no" /> |
---|
49 | <fileset dir="${dist}" defaultexcludes="no" /> |
---|
50 | <fileset dir="lib" includes="base-*.jar" /> |
---|
51 | <fileset file="${jar.name}" /> |
---|
52 | <fileset file="${tar.name}" /> |
---|
53 | </delete> |
---|
54 | </target> |
---|
55 | |
---|
56 | <target |
---|
57 | name="dist" |
---|
58 | depends="clean,download-lib,build" |
---|
59 | > |
---|
60 | <copy todir="${dist}"> |
---|
61 | <fileset dir="." includes="README,LICENSE,webauthn.properties,webauthn-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 | |
---|
106 | <target |
---|
107 | name="build" |
---|
108 | depends="init,checkjar" |
---|
109 | description="Compiles the plugin and put in jar" |
---|
110 | > |
---|
111 | <mkdir dir="${build}" /> |
---|
112 | <javac |
---|
113 | encoding="${javac.encoding}" |
---|
114 | srcdir="${src}" |
---|
115 | destdir="${build}" |
---|
116 | debug="true" |
---|
117 | includeantruntime="false" |
---|
118 | classpathref="classpath" |
---|
119 | release="${javac.release}" |
---|
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 required BASE JAR files 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 | <fail unless="base-core" message="Can't find base-core-${depend.base-version}.jar in ./lib. Try 'ant download-lib' to download the missing file." /> |
---|
142 | <fail unless="base-web" message="Can't find base-webclient-${depend.base-version}.jar in ./lib. Try 'ant download-lib' to download the missing file." /> |
---|
143 | <echo>Found all requried BASE core JAR files.</echo> |
---|
144 | </target> |
---|
145 | |
---|
146 | <target |
---|
147 | name="download-lib" |
---|
148 | description="Download required BASE core jar files" |
---|
149 | > |
---|
150 | <echo> |
---|
151 | ------------------------------------------------------- |
---|
152 | NOTE! You may specifiy a different download location by |
---|
153 | creating the file './build.properties' and |
---|
154 | setting 'depend.jars' to the URL to download from. |
---|
155 | ------------------------------------------------------- |
---|
156 | </echo> |
---|
157 | <download-lib file="base-core-${depend.base-version}.jar" /> |
---|
158 | <download-lib file="base-webclient-${depend.base-version}.jar" /> |
---|
159 | </target> |
---|
160 | |
---|
161 | <macrodef name="download-lib" description="Download BASE core JAR files"> |
---|
162 | <attribute name="file" /> |
---|
163 | <sequential> |
---|
164 | <get |
---|
165 | dest="lib/@{file}" |
---|
166 | src="${depend.jars}/@{file}" |
---|
167 | usetimestamp="true" |
---|
168 | verbose="true" |
---|
169 | ignoreerrors="true" |
---|
170 | /> |
---|
171 | </sequential> |
---|
172 | </macrodef> |
---|
173 | |
---|
174 | <target name="update-version"> |
---|
175 | <echo>Setting version to: ${version}</echo> |
---|
176 | |
---|
177 | <echo>WebAuthn.java</echo> |
---|
178 | <replaceregexp |
---|
179 | file="${src}/net/sf/basedb/webauthn/WebAuthn.java" |
---|
180 | match="public static final String VERSION = ".*";" |
---|
181 | replace="public static final String VERSION = "${version}";" |
---|
182 | encoding="UTF-8" |
---|
183 | /> |
---|
184 | |
---|
185 | <echo>extensions.xml</echo> |
---|
186 | <replaceregexp |
---|
187 | file="META-INF/extensions.xml" |
---|
188 | match="<version>.*</version>" |
---|
189 | replace="<version>${version}</version>" |
---|
190 | encoding="UTF-8" |
---|
191 | /> |
---|
192 | <replaceregexp |
---|
193 | file="META-INF/extensions.xml" |
---|
194 | match="<min-base-version>.*</min-base-version>" |
---|
195 | replace="<min-base-version>${depend.base-version}</min-base-version>" |
---|
196 | encoding="UTF-8" |
---|
197 | /> |
---|
198 | |
---|
199 | <echo>.classpath</echo> |
---|
200 | <replaceregexp |
---|
201 | file=".classpath" |
---|
202 | match="base-(\w+)-[0-9.]+jar" |
---|
203 | replace="base-\1-${depend.base-version}.jar" |
---|
204 | encoding="UTF-8" |
---|
205 | byline="true" |
---|
206 | /> |
---|
207 | |
---|
208 | <echo>Don't forget to commit the changes to the subversion repository!</echo> |
---|
209 | </target> |
---|
210 | |
---|
211 | </project> |
---|