-
Notifications
You must be signed in to change notification settings - Fork 11
/
build.xml
236 lines (223 loc) · 9.16 KB
/
build.xml
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
223
224
225
226
227
228
229
230
231
232
233
234
235
236
<?xml version="1.0"?>
<project name="ConfDB" default="all" basedir=".">
<description>Build ConfDB project.</description>
<!--load additional ant tasks-->
<taskdef resource="net/sf/antcontrib/antlib.xml">
<classpath>
<pathelement location="antlib/ant-contrib-1.0b3.jar"/>
</classpath>
</taskdef>
<property environment="env"/>
<property name="build.compiler" value="modern"/>
<property name="dir.src" location="src"/>
<property name="dir.ext" location="ext"/>
<property name="dir.signed" location="ext/signed"/>
<property name="dir.build" location="classes"/>
<property name="dir.icons" location="icons"/>
<property name="dir.lib" location="lib"/>
<property name="dir.python" location="python"/>
<property name="sign.store" value="/afs/cern.ch/user/c/confdb/private/certificate/certificate.p12"/>
<property name="sign.alias" value="cms confdb's id"/>
<property name="sign.pass" value="confdb"/>
<!-- currently not working
<property name="sign.tsa" value="https://timestamp.geotrust.com/tsa"/>
-->
<!-- alternative tsa url -->
<property name="sign.tsa" value="http://time.certum.pl/"/>
<!-- initialize variables, make directories, check what needs to be rebuilt -->
<target name="init">
<mkdir dir="${dir.build}"/>
<mkdir dir="${dir.build}/JNLP-INF"/>
<mkdir dir="${dir.lib}"/>
<mkdir dir="${dir.signed}"/>
<uptodate property="python.uptodate" targetfile="${dir.lib}/cmssw-python.jar">
<srcfiles dir="${dir.python}" includes="**/*.py"/>
</uptodate>
<resourcecount property="python.files">
<fileset dir="${dir.python}" includes="**/*.py"/>
</resourcecount>
<uptodate property="gui.uptodate" targetfile="${dir.lib}/cmssw-evf-confdb-gui.jar">
<srcfiles dir="${dir.src}"/>
<srcfiles dir="${dir.icons}"/>
</uptodate>
<available file="${sign.store}" property="sign.available"/>
</target>
<!-- compile all *.py files under python/ to *$py.class files -->
<target name="python" depends="init" unless="python.uptodate">
<echo message="Python: compile ${python.files} python files to python bytecode"/>
<exec executable="python2.7">
<arg value="-m"/>
<arg value="compileall"/>
<arg value="-q"/>
<arg value="${dir.python}"/>
</exec>
<echo message="Jython: compile ${python.files} python files to java bytecode"/>
<java jar="${dir.ext}/jython.jar" fork="true">
<arg value="-m"/>
<arg value="compileall"/>
<arg value="-q"/>
<arg value="${dir.python}"/>
</java>
<jar jarfile="${dir.lib}/cmssw-python.jar">
<fileset dir="${dir.python}"/>
<manifest>
<attribute name="Application-Name" value="CMSSW python library"/>
<attribute name="Vendor" value="CMS ConfDB"/>
<attribute name="Codebase" value="*"/>
<attribute name="Application-Library-Allowable-Codebase" value="*"/>
<attribute name="Permissions" value="all-permissions"/>
<attribute name="Trusted-Only" value="true"/>
</manifest>
</jar>
<if>
<istrue value="${sign.available}"/>
<then>
<signjar keystore="${sign.store}" storepass="${sign.pass}" alias="${sign.alias}" lazy="true" preservelastmodified="false" tsaurl="${sign.tsa}">
<fileset file="${dir.lib}/cmssw-python.jar"/>
</signjar>
</then>
<else>
<echo message=""/>
<echo message="Warning:"/>
<echo message="The keystore is not available, the .jar files will not be signed."/>
</else>
</if>
</target>
<!-- compile all *.java files in src/** to *.class files in classes/** -->
<target name="compile" depends="init">
<javac srcdir="${dir.src}" destdir="${dir.build}" debug="true" target="1.8" source="1.8" bootclasspath="/usr/lib/jvm/jre-1.8.0/lib/rt.jar" includeantruntime="false">
<compilerarg line="-Xmaxerrs 0"/>
<compilerarg line="-Xmaxwarns 0"/>
<classpath>
<fileset dir="${dir.ext}" includes="*.jar"/>
</classpath>
</javac>
</target>
<!-- combine all classes into jar file -->
<target name="gui" depends="compile" unless="gui.uptodate">
<jar jarfile="${dir.lib}/cmssw-evf-confdb-gui.jar">
<fileset dir="${dir.build}"/>
<fileset dir="${dir.icons}"/>
<fileset dir="${dir.src}">
<include name="conf/*"/>
</fileset>
<manifest>
<attribute name="Application-Name" value="CMS ConfDB GUI" />
<attribute name="Vendor" value="CMS ConfDB"/>
<attribute name="Main-Class" value="confdb.gui.ConfDbGUI"/>
<attribute name="Codebase" value="*"/>
<attribute name="Application-Library-Allowable-Codebase" value="*"/>
<attribute name="Permissions" value="all-permissions"/>
<attribute name="Trusted-Only" value="true"/>
</manifest>
</jar>
<if>
<istrue value="${sign.available}"/>
<then>
<signjar keystore="${sign.store}" storepass="${sign.pass}" alias="${sign.alias}" lazy="true" preservelastmodified="false" tsaurl="${sign.tsa}">
<fileset file="${dir.lib}/cmssw-evf-confdb-gui.jar"/>
</signjar>
</then>
<else>
<echo message=""/>
<echo message="Warning:"/>
<echo message="The keystore is not available, the .jar files will not be signed."/>
</else>
</if>
</target>
<!-- combine converter-relevant classes into jar file -->
<target name="converter" depends="compile" unless="gui.uptodate">
<jar jarfile="${dir.lib}/cmssw-evf-confdb-converter.jar">
<fileset dir="${dir.build}">
<exclude name="confdb/gui/**"/>
<exclude name="confdb/parser/**"/>
</fileset>
<fileset dir="${dir.src}">
<include name="conf/*"/>
</fileset>
<manifest>
<attribute name="Main-Class" value="confdb.converter.Converter" />
</manifest>
</jar>
<if>
<istrue value="${sign.available}"/>
<then>
<signjar keystore="${sign.store}" storepass="${sign.pass}" alias="${sign.alias}" lazy="true" preservelastmodified="false" tsaurl="${sign.tsa}">
<fileset file="${dir.lib}/cmssw-evf-confdb-converter.jar"/>
</signjar>
</then>
<else>
<echo message=""/>
<echo message="Warning:"/>
<echo message="The keystore is not available, the .jar files will not be signed."/>
</else>
</if>
</target>
<!-- combine parser-relevant classes into jar file -->
<target name="parser" depends="compile" unless="gui.uptodate">
<jar jarfile="${dir.lib}/cmssw-evf-confdb-parser.jar">
<fileset dir="${dir.build}">
<exclude name="confdb/gui/**"/>
</fileset>
<fileset dir="${dir.src}">
<include name="conf/*"/>
</fileset>
<manifest>
<attribute name="Main-Class" value="confdb.parser.PythonParser" />
</manifest>
</jar>
<if>
<istrue value="${sign.available}"/>
<then>
<signjar keystore="${sign.store}" storepass="${sign.pass}" alias="${sign.alias}" lazy="true" preservelastmodified="false" tsaurl="${sign.tsa}">
<fileset file="${dir.lib}/cmssw-evf-confdb-parser.jar"/>
</signjar>
</then>
<else>
<echo message=""/>
<echo message="Warning:"/>
<echo message="The keystore is not available, the .jar files will not be signed."/>
</else>
</if>
</target>
<!-- sign all external jar files -->
<target name="signext" depends="init">
<if>
<istrue value="${sign.available}"/>
<then>
<signjar keystore="${sign.store}" storepass="${sign.pass}" alias="${sign.alias}" lazy="true" preservelastmodified="false" tsaurl="${sign.tsa}" destdir="${dir.signed}">
<fileset dir="${dir.ext}" includes="*.jar"/>
</signjar>
</then>
<else>
<echo message=""/>
<echo message="Warning:"/>
<echo message="The keystore is not available, the .jar files will not be signed."/>
</else>
</if>
</target>
<!-- build all targets -->
<target name="all" depends="compile,python,gui,parser,converter,signext"/>
<!-- run the ConfDB GUI -->
<target name="run" depends="gui,python,signext" description="Start the ConfDB GUI.">
<java classname="confdb.gui.ConfDbGUI" fork="true">
<classpath>
<pathelement location="${dir.lib}/cmssw-evf-confdb-gui.jar"/>
<pathelement location="${dir.lib}/cmssw-python.jar"/>
<pathelement location="${dir.signed}/ojdbc6.jar"/>
<pathelement location="${dir.signed}/jython.jar"/>
</classpath>
</java>
</target>
<!-- delete all class files -->
<target name="clean">
<delete includeemptydirs="true" quiet="true">
<fileset dir="${dir.build}"/>
<fileset dir="${dir.lib}"/>
<fileset dir="${dir.signed}"/>
<fileset dir="${dir.python}" includes="**/*.pyc"/>
<fileset dir="${dir.python}" includes="**/*.class"/>
</delete>
<echo message="clean successful"/>
</target>
</project>