File: build.xml

package info (click to toggle)
i2p 0.9.38-3.1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 48,992 kB
  • sloc: java: 241,210; xml: 9,493; jsp: 7,441; sh: 4,443; ansic: 2,551; python: 2,354; perl: 765; cs: 344; makefile: 240
file content (222 lines) | stat: -rw-r--r-- 10,008 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
<?xml version="1.0" encoding="ISO-8859-1"?>
<project name="susidns" default="all" basedir=".">
	<property name="jetty" value="../../jetty/" />
	<property name="project" value="susidns" />
	<property name="src" value="java/src" />
	<property name="bin" value="./WEB-INF/classes" />
	<property name="lib" value="${jetty}/jettylib" />
	<property name="tmp" value="./tmp" />
	<property name="jsp" value="./jsp" />
	<path id="cp">
		<pathelement path="${classpath}" />
		<pathelement location="${bin}" />
                <!-- commons-el MUST be first to ensure we get the right (2.2) version
                  -  otherwise:
                  -  Exception in thread "main" java.lang.NoSuchMethodError: javax.el.ExpressionFactory.newInstance()Ljavax/el/ExpressionFactory;
                  -->
		<pathelement location="${lib}/commons-el.jar" />
		<pathelement location="${lib}/javax.servlet.jar"/>

                <!-- following jars only present for debian builds -->
                <pathelement location="${lib}/commons-logging.jar" />
                <pathelement location="${lib}/jsp-api.jar" />
                <pathelement location="${lib}/tomcat-api.jar" />
                <pathelement location="${lib}/tomcat-util.jar" />
                <pathelement location="${lib}/tomcat-util-scan.jar" />
		<pathelement location="${lib}/jasper-el.jar" />
		<pathelement location="lib/jstlel.jar" />

		<pathelement location="lib/jstl.jar" />
		<pathelement location="lib/standard.jar" />
		<pathelement location="${lib}/jasper-runtime.jar" />
		<pathelement location="${lib}/jetty-util.jar" />
		<pathelement location="${lib}/jetty-i2p.jar" />
		<pathelement location="${ant.home}/lib/ant.jar" />
		<pathelement location="../../../core/java/build/i2p.jar" />
		<pathelement location="../../addressbook/dist/addressbook.jar" />
 	</path>

	<property name="javac.compilerargs" value="" />
	<property name="javac.version" value="1.7" />
	<property name="require.gettext" value="true" />

    <condition property="no.bundle">
        <isfalse value="${require.gettext}" />
    </condition>

 	<target name="compile">
		<mkdir dir="${bin}" />
		<javac debug="true" deprecation="on" source="${javac.version}" target="${javac.version}" 
			includeAntRuntime="false"
 			classpathref="cp" destdir="${bin}" srcdir="${src}" includes="**/*.java" >
			<compilerarg line="${javac.compilerargs}" />
		</javac>
	</target>

    <target name="verifylibtaglibs" if="${with-libtaglibs-standard}" >
        <!-- lib/jstlel.jar should be a symlink to the package jar.
           - If the package jar is not there, we will still compile fine but it won't run,
           - so catch it here.
          -->
        <fail message="libtaglibs-standard-jstlel-java package must be installed for debian builds">
            <condition>
                <not><available file="lib/jstlel.jar" type="file"/></not>
            </condition>
        </fail>
    </target>

    <target name="precompilejsp" depends="verifylibtaglibs" unless="precompilejsp.uptodate">
        <delete file="WEB-INF/web-fragment.xml" />
        <delete file="WEB-INF/web-out.xml" />
    	<mkdir dir="${tmp}" />
        <echo message="Ignore any warning about /WEB-INF/web.xml not found" />
        <!-- See apps/routerconsole/java/build.xml for important JspC build documentation -->
        <java classname="net.i2p.servlet.util.JspC" fork="true" classpathref="cp" failonerror="true">
            <!-- these are to detect tomcat version and reproducible build setting -->
            <jvmarg value="-Dbuild.reproducible=${build.reproducible}" />
            <jvmarg value="-Dwith-libtomcat9-java=${with-libtomcat9-java}" />
            <jvmarg value="-Djasper.jar=${lib}/jasper-runtime.jar" />
            <arg value="-d" />
            <arg value="${tmp}" />
            <arg value="-v" />
            <arg value="-p" />
            <arg value="i2p.susi.dns.jsp" />
            <arg value="-webinc" />
            <arg value="WEB-INF/web-fragment.xml" />
            <arg value="-webapp" />
            <arg value="./jsp" />
        </java>
        <javac debug="true" deprecation="on" source="${javac.version}" target="${javac.version}" 
               includeAntRuntime="false"
               destdir="${bin}" srcdir="${tmp}" includes="**/*.java" classpathref="cp">
		<compilerarg line="${javac.compilerargs}" />
         </javac>
        <copy file="WEB-INF/web-template.xml" tofile="WEB-INF/web-out.xml" />
        <loadfile property="jspc.web.fragment" srcfile="WEB-INF/web-fragment.xml" />
        <replace file="WEB-INF/web-out.xml">
            <replacefilter token="&lt;!-- precompiled servlets --&gt;" value="${jspc.web.fragment}" />
        </replace>
    </target>

    <uptodate property="precompilejsp.uptodate" targetfile="WEB-INF/web-out.xml">
        <srcfiles dir= "." includes="jsp/*.jsp, WEB-INF/web-template.xml"/>
    </uptodate>

    <target name="all" depends="war"/> 

    <target name="listChangedFiles" depends="warUpToDate" if="shouldListChanges" >
        <exec executable="mtn" outputproperty="workspace.changes" errorproperty="mtn.error2" failifexecutionfails="false" >
            <arg value="list" />
            <arg value="changed" />
            <arg value="." />
        </exec>
        <!-- \n in an attribute value generates an invalid manifest -->
        <exec executable="tr" inputstring="${workspace.changes}" outputproperty="workspace.changes.tr" errorproperty="mtn.error2" failifexecutionfails="false" >
            <arg value="-s" />
            <arg value="[:space:]" />
            <arg value="," />
        </exec>
    </target>

    <target name="war" depends="compile, precompilejsp, bundle, warUpToDate" unless="war.uptodate" > 
        <!-- set if unset -->
        <property name="workspace.changes.tr" value="" />
        <war destfile="${project}.war" webxml="WEB-INF/web-out.xml">
        	<fileset dir=".">
        		<include name="WEB-INF/**/*.class"/>
        		<include name="svg/*"/>
        	</fileset>
            <manifest>
                <attribute name="Implementation-Version" value="${full.version}" />
                <attribute name="Built-By" value="${build.built-by}" />
                <attribute name="Build-Date" value="${build.timestamp}" />
                <attribute name="Base-Revision" value="${workspace.version}" />
                <attribute name="Workspace-Changes" value="${workspace.changes.tr}" />
                <attribute name="X-Compile-Source-JDK" value="${javac.version}" />
                <attribute name="X-Compile-Target-JDK" value="${javac.version}" />
            </manifest>
        </war>
    </target>

    <target name="warUpToDate">
        <uptodate property="war.uptodate" targetfile="${project}.war">
            <srcfiles dir= "." includes="WEB-INF/web-out.xml WEB-INF/**/*.class svg/*" />
        </uptodate>
        <condition property="shouldListChanges" >
            <and>
                <not>
                    <isset property="war.uptodate" />
                </not>
                <isset property="mtn.available" />
            </and>
        </condition>
    </target>

    <target name="bundle" depends="compile, precompilejsp" unless="no.bundle">
        <mkdir dir="build/messages-src" />
        <!-- Update the messages_*.po files.
             We need to supply the bat file for windows, and then change the fail property to true -->
        <exec executable="sh" osfamily="unix" failifexecutionfails="true" failonerror="${require.gettext}" >
            <env key="JAVA_HOME" value="${java.home}" />
            <arg value="./bundle-messages.sh" />
        </exec>
        <exec executable="sh" osfamily="mac" failifexecutionfails="true" failonerror="${require.gettext}" >
            <arg value="./bundle-messages.sh" />
        </exec>
		<!-- multi-lang is optional -->
        <exec executable="sh" osfamily="windows" failifexecutionfails="false" >
            <arg value="./bundle-messages.sh" />
        </exec>
        <javac source="${javac.version}" target="${javac.version}" 
               includeAntRuntime="false"
               srcdir="build/messages-src" destdir="${bin}">
            <compilerarg line="${javac.compilerargs}" />
        </javac>
    </target>

    <target name="extractSVGTags">
        <mkdir dir="build/" />
        <java classname="net.i2p.util.TranslateReader" fork="true" failonerror="true">
            <classpath>
                <pathelement location="../../../build/i2p.jar" />
            </classpath>
            <arg value="tag" />
            <arg value="svg/" />
            <arg value="build/HowSVG.java" />
        </java>
    </target>

    <target name="poupdate" depends="compile, precompilejsp, extractSVGTags">
        <!-- Update the messages_*.po files.  -->
        <!-- set if unset -->
        <property name="lg2" value="" />
        <exec executable="sh" osfamily="unix" failifexecutionfails="true" failonerror="true" >
            <env key="LG2" value="${lg2}" />
            <arg value="./bundle-messages.sh" />
            <arg value="-p" />
        </exec>
        <exec executable="sh" osfamily="mac" failifexecutionfails="true" failonerror="true" >
            <env key="LG2" value="${lg2}" />
            <arg value="./bundle-messages.sh" />
            <arg value="-p" />
        </exec>
        <exec executable="sh" osfamily="windows" failifexecutionfails="true" failonerror="true" >
            <env key="LG2" value="${lg2}" />
            <arg value="./bundle-messages.sh" />
            <arg value="-p" />
        </exec>
    </target>

    <target name="clean">
      <delete file="susidns.war" />
      <delete>
        <fileset dir="." includes="**/*.class" />
        <fileset dir="." includes="tmp, build" />
        <fileset dir="WEB-INF" includes="web-fragment.xml, web-out.xml" />
      </delete>
      <delete dir="${bin}" />
      <delete dir="${tmp}" />
      <delete dir="build" />
    </target>
    <target name="distclean" depends="clean" />
</project>