-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.xml
187 lines (166 loc) · 8.02 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
<?xml version="1.0" encoding="UTF-8"?>
<!-- ====================================================================== -->
<!-- Ant build file (http://ant.apache.org/) for Ant 1.6.2 or above. -->
<!-- ====================================================================== -->
<project name="jupload" default="eclipse_package" basedir=".">
<!-- Let's load the system properties -->
<property environment="env" />
<!-- Definition of the classpath for ant-contrib tasks -->
<path id="ant.tasks.ant-contrib.classpath">
<fileset dir="lib/ant">
<include name="ant-contrib.jar" />
</fileset>
</path>
<taskdef resource="net/sf/antcontrib/antcontrib.properties"
classpathref="ant.tasks.ant-contrib.classpath" />
<!-- ====================================================================== -->
<!-- Import maven-build.xml into the current project -->
<!-- ====================================================================== -->
<import file="maven-build.xml" />
<!-- ====================================================================== -->
<!-- Help target -->
<!-- ====================================================================== -->
<target name="help">
<echo message="Please run: $ant -projecthelp" />
</target>
<!-- ====================================================================== -->
<!-- prepare_resources target - allows action before simulated maven build -->
<!-- ====================================================================== -->
<target name="prepare_resources">
<!-- Default value for the svn.properties properties. You should
override by setting them before calling the ant build -->
<property name="pom.version" value="pom.version undefined" />
<property name="timestamp" value="1" />
<property name="svn.revision" value="" />
<!-- Let's calculate an ant build number -->
<mkdir dir="${maven.build.outputDir}" />
<buildnumber file="target/build.number" />
<property name="buildNumber" value="${build.number}" />
<property name="pom.version" value="pom.version undefined" />
<!-- Let's copy and update properties in the svn.properties file -->
<copy file="${maven.build.resourceDir.0}/conf/svn.properties"
todir="${maven.build.outputDir}/conf"
filtering="true"
overwrite="true">
<filterset id="myFilterSet" begintoken="{" endtoken="}">
<filter token="pom.version" value="${pom.version}" />
<filter token="timestamp" value="${timestamp}" />
<filter token="buildNumber" value="${buildNumber}" />
</filterset>
<filterset id="myFilterSet" begintoken="=" endtoken="$">
<filter token=" " value="= " />
</filterset>
</copy>
</target>
<!-- ====================================================================== -->
<!-- Specific eclipse target, to create the classpath allowing eclipse -->
<!-- compiler to run without error -->
<!-- ====================================================================== -->
<!-- Copy one jar file to the ./lib folder, and add it to the eclipse classpath -->
<target name="add_one_jar_to_eclipse_classpath">
<echo message="Adding ${jarFile} to eclipse classpath" level="info" />
<!-- Copy the given jar file, useless ? -->
<!-- copy file="${jarFile}" todir="./lib" / -->
<!--
Add the copied file to the eclipse classpath. We must do that by copying to a new file (to have an actual replacement),
with a new placeholder (to avoid an infinite loop).
-->
<copy file=".classpath"
tofile=".classpath.tmp"
verbose="true"
overwrite="true">
<filterset begintoken="#" endtoken="#">
<filter token="dependencyJarFile"
value="<classpathentry kind="lib" path="${jarFile}"/>
#dependencyJarFile2#" />
</filterset>
</copy>
<copy file=".classpath.tmp"
tofile=".classpath"
verbose="true"
overwrite="true">
<filterset begintoken="#" endtoken="#">
<filter token="dependencyJarFile2"
value="#dependencyJarFile#" />
</filterset>
</copy>
<delete file=".classpath.tmp" />
</target>
<target name="create_eclipse_classpath">
<!-- Let's override the .classpath, by the relevant template -->
<copy file=".classpath_template_for_and_build"
tofile=".classpath"
overwrite="true" />
<!-- We add all dependency jar files, to the classpath, so that eclipse internal compiler works -->
<delete file=".classpath.tmp" />
<foreach target="add_one_jar_to_eclipse_classpath"
param="jarFile"
trim="true">
<path refid="build.test.classpath" />
</foreach>
<!-- Let's remove the placeholder -->
<copy file=".classpath" tofile=".classpath.tmp" overwrite="true">
<filterset begintoken="#" endtoken="#">
<filter token="dependencyJarFile" value="" />
</filterset>
</copy>
<move file=".classpath.tmp" tofile=".classpath" overwrite="true" />
</target>
<target name="refresh_if_eclipse" if="eclipse.running">
<eclipse.refreshLocal resource="jupload" depth="infinite" />
</target>
<!-- =================================================================================
Start of Signing applet jar
Various targets to sign the applet, depending on the given parameters
================================================================================== -->
<target name="sign_jar"
depends="sign_jar_without_keypass, sign_jar_with_keypass" />
<target name="sign_jar_without_keypass" unless="jupload.keystore.keypass">
<echo message="Jar: ${maven.build.dir}/${maven.build.finalName}.jar"
level="info" />
<echo message="Keystore: ${jupload.keystore.filename}" level="info" />
<echo message="Alias: ${jupload.keystore.alias}" level="info" />
<signjar jar="${maven.build.dir}/${maven.build.finalName}.jar"
alias="${jupload.keystore.alias}"
storepass="${jupload.keystore.storepass}"
keystore="${jupload.keystore.filename}" />
</target>
<target name="sign_jar_with_keypass" if="jupload.keystore.keypass">
<signjar jar="${maven.build.dir}/${maven.build.finalName}.jar"
alias="${jupload.keystore.alias}"
storepass="${jupload.keystore.storepass}"
keystore="${jupload.keystore.filename}"
keypass="${jupload.keystore.keypass}"
verbose="true" />
</target>
<!-- =================================================================================
End of Signing applet jar
================================================================================== -->
<!-- =================================================================================
Start of post compile actions
Copy of the applet jar file to the /site and /target/site/ folders, if they exist
================================================================================== -->
<target name="post_compile_action"
depends="check_site_folders,copy_jar_to_site, copy_jar_to_target_site" />
<target name="check_site_folders">
<available file="site" property="jupload.available.site" />
<available file="target/site"
property="jupload.available.target.site" />
</target>
<target name="copy_jar_to_site" if="jupload.available.site">
<copy file="${maven.build.dir}/${maven.build.finalName}.jar"
todir="site" />
</target>
<target name="copy_jar_to_target_site" if="jupload.available.target.site">
<copy file="${maven.build.dir}/${maven.build.finalName}.jar"
todir="target/site" />
</target>
<!-- =================================================================================
End of post compile actions
================================================================================== -->
<!-- =================================================================================
The main goal !
================================================================================== -->
<target name="eclipse_package"
depends="get-deps, create_eclipse_classpath, prepare_resources, package, refresh_if_eclipse, sign_jar, post_compile_action" />
</project>