1 | <?xml version="1.0" encoding="ISO-8859-1"?> |
---|
2 | <project name="susidns" default="all" basedir="."> |
---|
3 | <property name="jetty" value="../../jetty/" /> |
---|
4 | <property name="project" value="susidns" /> |
---|
5 | <property name="src" value="java/src" /> |
---|
6 | <property name="bin" value="./WEB-INF/classes" /> |
---|
7 | <property name="lib" value="${jetty}/jettylib" /> |
---|
8 | <property name="tmp" value="./tmp" /> |
---|
9 | <property name="jsp" value="./jsp" /> |
---|
10 | <path id="cp"> |
---|
11 | <pathelement path="${classpath}" /> |
---|
12 | <pathelement location="${bin}" /> |
---|
13 | <!-- commons-el MUST be first to ensure we get the right (2.2) version |
---|
14 | - otherwise: |
---|
15 | - Exception in thread "main" java.lang.NoSuchMethodError: javax.el.ExpressionFactory.newInstance()Ljavax/el/ExpressionFactory; |
---|
16 | --> |
---|
17 | <pathelement location="${lib}/commons-el.jar" /> |
---|
18 | <pathelement location="${lib}/javax.servlet.jar"/> |
---|
19 | |
---|
20 | <!-- following jars only present for debian builds --> |
---|
21 | <pathelement location="${lib}/commons-logging.jar" /> |
---|
22 | <pathelement location="${lib}/jsp-api.jar" /> |
---|
23 | <pathelement location="${lib}/tomcat-api.jar" /> |
---|
24 | <pathelement location="${lib}/tomcat-util.jar" /> |
---|
25 | <pathelement location="${lib}/tomcat-util-scan.jar" /> |
---|
26 | <pathelement location="${lib}/jasper-el.jar" /> |
---|
27 | <pathelement location="lib/jstlel.jar" /> |
---|
28 | |
---|
29 | <pathelement location="lib/jstl.jar" /> |
---|
30 | <pathelement location="lib/standard.jar" /> |
---|
31 | <pathelement location="${lib}/jasper-runtime.jar" /> |
---|
32 | <pathelement location="${lib}/jetty-util.jar" /> |
---|
33 | <pathelement location="${ant.home}/lib/ant.jar" /> |
---|
34 | <pathelement location="../../../core/java/build/i2p.jar" /> |
---|
35 | <pathelement location="../../addressbook/dist/addressbook.jar" /> |
---|
36 | </path> |
---|
37 | |
---|
38 | <property name="javac.compilerargs" value="" /> |
---|
39 | <property name="javac.version" value="1.7" /> |
---|
40 | <property name="require.gettext" value="true" /> |
---|
41 | |
---|
42 | <condition property="no.bundle"> |
---|
43 | <isfalse value="${require.gettext}" /> |
---|
44 | </condition> |
---|
45 | |
---|
46 | <target name="compile"> |
---|
47 | <mkdir dir="${bin}" /> |
---|
48 | <javac debug="true" deprecation="on" source="${javac.version}" target="${javac.version}" |
---|
49 | includeAntRuntime="false" |
---|
50 | classpathref="cp" destdir="${bin}" srcdir="${src}" includes="**/*.java" > |
---|
51 | <compilerarg line="${javac.compilerargs}" /> |
---|
52 | </javac> |
---|
53 | </target> |
---|
54 | |
---|
55 | <target name="verifylibtaglibs" if="${with-libtaglibs-standard}" > |
---|
56 | <!-- lib/jstlel.jar should be a symlink to the package jar. |
---|
57 | - If the package jar is not there, we will still compile fine but it won't run, |
---|
58 | - so catch it here. |
---|
59 | --> |
---|
60 | <fail message="libtaglibs-standard-jstlel-java package must be installed for debian builds"> |
---|
61 | <condition> |
---|
62 | <not><available file="lib/jstlel.jar" type="file"/></not> |
---|
63 | </condition> |
---|
64 | </fail> |
---|
65 | </target> |
---|
66 | |
---|
67 | <target name="precompilejsp" depends="verifylibtaglibs" unless="precompilejsp.uptodate"> |
---|
68 | <delete file="WEB-INF/web-fragment.xml" /> |
---|
69 | <delete file="WEB-INF/web-out.xml" /> |
---|
70 | <mkdir dir="${tmp}" /> |
---|
71 | <echo message="Ignore any warning about /WEB-INF/web.xml not found" /> |
---|
72 | <java classname="org.apache.jasper.JspC" fork="true" classpathref="cp" failonerror="true"> |
---|
73 | <arg value="-d" /> |
---|
74 | <arg value="${tmp}" /> |
---|
75 | <arg value="-v" /> |
---|
76 | <arg value="-p" /> |
---|
77 | <arg value="i2p.susi.dns.jsp" /> |
---|
78 | <arg value="-webinc" /> |
---|
79 | <arg value="WEB-INF/web-fragment.xml" /> |
---|
80 | <arg value="-webapp" /> |
---|
81 | <arg value="./jsp" /> |
---|
82 | </java> |
---|
83 | <javac debug="true" deprecation="on" source="${javac.version}" target="${javac.version}" |
---|
84 | includeAntRuntime="false" |
---|
85 | destdir="${bin}" srcdir="${tmp}" includes="**/*.java" classpathref="cp"> |
---|
86 | <compilerarg line="${javac.compilerargs}" /> |
---|
87 | </javac> |
---|
88 | <copy file="WEB-INF/web-template.xml" tofile="WEB-INF/web-out.xml" /> |
---|
89 | <loadfile property="jspc.web.fragment" srcfile="WEB-INF/web-fragment.xml" /> |
---|
90 | <replace file="WEB-INF/web-out.xml"> |
---|
91 | <replacefilter token="<!-- precompiled servlets -->" value="${jspc.web.fragment}" /> |
---|
92 | </replace> |
---|
93 | </target> |
---|
94 | |
---|
95 | <uptodate property="precompilejsp.uptodate" targetfile="WEB-INF/web-out.xml"> |
---|
96 | <srcfiles dir= "." includes="jsp/*.jsp, WEB-INF/web-template.xml"/> |
---|
97 | </uptodate> |
---|
98 | |
---|
99 | <target name="all" depends="war"/> |
---|
100 | |
---|
101 | <target name="listChangedFiles" depends="warUpToDate" if="shouldListChanges" > |
---|
102 | <exec executable="mtn" outputproperty="workspace.changes" errorproperty="mtn.error2" failifexecutionfails="false" > |
---|
103 | <arg value="list" /> |
---|
104 | <arg value="changed" /> |
---|
105 | <arg value="." /> |
---|
106 | </exec> |
---|
107 | <!-- \n in an attribute value generates an invalid manifest --> |
---|
108 | <exec executable="tr" inputstring="${workspace.changes}" outputproperty="workspace.changes.tr" errorproperty="mtn.error2" failifexecutionfails="false" > |
---|
109 | <arg value="-s" /> |
---|
110 | <arg value="[:space:]" /> |
---|
111 | <arg value="," /> |
---|
112 | </exec> |
---|
113 | </target> |
---|
114 | |
---|
115 | <target name="war" depends="compile, precompilejsp, bundle, warUpToDate" unless="war.uptodate" > |
---|
116 | <!-- set if unset --> |
---|
117 | <property name="workspace.changes.tr" value="" /> |
---|
118 | <war destfile="${project}.war" webxml="WEB-INF/web-out.xml"> |
---|
119 | <fileset dir="."> |
---|
120 | <include name="WEB-INF/**/*.class"/> |
---|
121 | <include name="svg/*"/> |
---|
122 | </fileset> |
---|
123 | <manifest> |
---|
124 | <attribute name="Implementation-Version" value="${full.version}" /> |
---|
125 | <attribute name="Built-By" value="${build.built-by}" /> |
---|
126 | <attribute name="Build-Date" value="${build.timestamp}" /> |
---|
127 | <attribute name="Base-Revision" value="${workspace.version}" /> |
---|
128 | <attribute name="Workspace-Changes" value="${workspace.changes.tr}" /> |
---|
129 | <attribute name="X-Compile-Source-JDK" value="${javac.version}" /> |
---|
130 | <attribute name="X-Compile-Target-JDK" value="${javac.version}" /> |
---|
131 | </manifest> |
---|
132 | </war> |
---|
133 | </target> |
---|
134 | |
---|
135 | <target name="warUpToDate"> |
---|
136 | <uptodate property="war.uptodate" targetfile="${project}.war"> |
---|
137 | <srcfiles dir= "." includes="WEB-INF/web-out.xml WEB-INF/**/*.class svg/*" /> |
---|
138 | </uptodate> |
---|
139 | <condition property="shouldListChanges" > |
---|
140 | <and> |
---|
141 | <not> |
---|
142 | <isset property="war.uptodate" /> |
---|
143 | </not> |
---|
144 | <isset property="mtn.available" /> |
---|
145 | </and> |
---|
146 | </condition> |
---|
147 | </target> |
---|
148 | |
---|
149 | <target name="bundle" depends="compile, precompilejsp" unless="no.bundle"> |
---|
150 | <mkdir dir="build/messages-src" /> |
---|
151 | <!-- Update the messages_*.po files. |
---|
152 | We need to supply the bat file for windows, and then change the fail property to true --> |
---|
153 | <exec executable="sh" osfamily="unix" failifexecutionfails="true" failonerror="${require.gettext}" > |
---|
154 | <env key="JAVA_HOME" value="${java.home}" /> |
---|
155 | <arg value="./bundle-messages.sh" /> |
---|
156 | </exec> |
---|
157 | <exec executable="sh" osfamily="mac" failifexecutionfails="true" failonerror="${require.gettext}" > |
---|
158 | <arg value="./bundle-messages.sh" /> |
---|
159 | </exec> |
---|
160 | <!-- multi-lang is optional --> |
---|
161 | <exec executable="sh" osfamily="windows" failifexecutionfails="false" > |
---|
162 | <arg value="./bundle-messages.sh" /> |
---|
163 | </exec> |
---|
164 | <javac source="${javac.version}" target="${javac.version}" |
---|
165 | includeAntRuntime="false" |
---|
166 | srcdir="build/messages-src" destdir="${bin}"> |
---|
167 | <compilerarg line="${javac.compilerargs}" /> |
---|
168 | </javac> |
---|
169 | </target> |
---|
170 | |
---|
171 | <target name="extractSVGTags"> |
---|
172 | <mkdir dir="build/" /> |
---|
173 | <java classname="net.i2p.util.TranslateReader" fork="true" failonerror="true"> |
---|
174 | <classpath> |
---|
175 | <pathelement location="../../../build/i2p.jar" /> |
---|
176 | </classpath> |
---|
177 | <arg value="tag" /> |
---|
178 | <arg value="svg/" /> |
---|
179 | <arg value="build/HowSVG.java" /> |
---|
180 | </java> |
---|
181 | </target> |
---|
182 | |
---|
183 | <target name="poupdate" depends="compile, precompilejsp, extractSVGTags"> |
---|
184 | <!-- Update the messages_*.po files. --> |
---|
185 | <!-- set if unset --> |
---|
186 | <property name="lg2" value="" /> |
---|
187 | <exec executable="sh" osfamily="unix" failifexecutionfails="true" failonerror="true" > |
---|
188 | <env key="LG2" value="${lg2}" /> |
---|
189 | <arg value="./bundle-messages.sh" /> |
---|
190 | <arg value="-p" /> |
---|
191 | </exec> |
---|
192 | <exec executable="sh" osfamily="mac" failifexecutionfails="true" failonerror="true" > |
---|
193 | <env key="LG2" value="${lg2}" /> |
---|
194 | <arg value="./bundle-messages.sh" /> |
---|
195 | <arg value="-p" /> |
---|
196 | </exec> |
---|
197 | <exec executable="sh" osfamily="windows" failifexecutionfails="true" failonerror="true" > |
---|
198 | <env key="LG2" value="${lg2}" /> |
---|
199 | <arg value="./bundle-messages.sh" /> |
---|
200 | <arg value="-p" /> |
---|
201 | </exec> |
---|
202 | </target> |
---|
203 | |
---|
204 | <target name="clean"> |
---|
205 | <delete file="susidns.war" /> |
---|
206 | <delete> |
---|
207 | <fileset dir="." includes="**/*.class" /> |
---|
208 | <fileset dir="." includes="tmp, build" /> |
---|
209 | <fileset dir="WEB-INF" includes="web-fragment.xml, web-out.xml" /> |
---|
210 | </delete> |
---|
211 | <delete dir="${bin}" /> |
---|
212 | <delete dir="${tmp}" /> |
---|
213 | <delete dir="build" /> |
---|
214 | </target> |
---|
215 | <target name="distclean" depends="clean" /> |
---|
216 | </project> |
---|