1 | <?xml version="1.0" encoding="UTF-8"?> |
---|
2 | |
---|
3 | <!-- ====================================================================== --> |
---|
4 | <!-- Ant build file (http://ant.apache.org/) for Ant 1.6.2 or above. --> |
---|
5 | <!-- ====================================================================== --> |
---|
6 | |
---|
7 | <project name="jupload" default="eclipse_package" basedir="."> |
---|
8 | |
---|
9 | <!-- Let's load the system properties --> |
---|
10 | <property environment="env" /> |
---|
11 | |
---|
12 | <!-- Definition of the classpath for ant-contrib tasks --> |
---|
13 | <path id="ant.tasks.ant-contrib.classpath"> |
---|
14 | <fileset dir="lib/ant"> |
---|
15 | <include name="ant-contrib.jar" /> |
---|
16 | </fileset> |
---|
17 | </path> |
---|
18 | <taskdef resource="net/sf/antcontrib/antcontrib.properties" |
---|
19 | classpathref="ant.tasks.ant-contrib.classpath" /> |
---|
20 | |
---|
21 | <!-- ====================================================================== --> |
---|
22 | <!-- Import maven-build.xml into the current project --> |
---|
23 | <!-- ====================================================================== --> |
---|
24 | |
---|
25 | <import file="maven-build.xml" /> |
---|
26 | |
---|
27 | <!-- ====================================================================== --> |
---|
28 | <!-- Help target --> |
---|
29 | <!-- ====================================================================== --> |
---|
30 | |
---|
31 | <target name="help"> |
---|
32 | <echo message="Please run: $ant -projecthelp" /> |
---|
33 | </target> |
---|
34 | |
---|
35 | <!-- ====================================================================== --> |
---|
36 | <!-- prepare_resources target - allows action before simulated maven build --> |
---|
37 | <!-- ====================================================================== --> |
---|
38 | |
---|
39 | <target name="prepare_resources"> |
---|
40 | <!-- Default value for the svn.properties properties. You should |
---|
41 | override by setting them before calling the ant build --> |
---|
42 | <property name="pom.version" value="pom.version undefined" /> |
---|
43 | <property name="timestamp" value="1" /> |
---|
44 | <property name="svn.revision" value="" /> |
---|
45 | <!-- Let's calculate an ant build number --> |
---|
46 | <mkdir dir="${maven.build.outputDir}" /> |
---|
47 | <buildnumber file="target/build.number" /> |
---|
48 | <property name="buildNumber" value="${build.number}" /> |
---|
49 | <property name="pom.version" value="pom.version undefined" /> |
---|
50 | <!-- Let's copy and update properties in the svn.properties file --> |
---|
51 | <copy file="${maven.build.resourceDir.0}/conf/svn.properties" |
---|
52 | todir="${maven.build.outputDir}/conf" |
---|
53 | filtering="true" |
---|
54 | overwrite="true"> |
---|
55 | <filterset id="myFilterSet" begintoken="{" endtoken="}"> |
---|
56 | <filter token="pom.version" value="${pom.version}" /> |
---|
57 | <filter token="timestamp" value="${timestamp}" /> |
---|
58 | <filter token="buildNumber" value="${buildNumber}" /> |
---|
59 | </filterset> |
---|
60 | <filterset id="myFilterSet" begintoken="=" endtoken="$"> |
---|
61 | <filter token=" " value="= " /> |
---|
62 | </filterset> |
---|
63 | </copy> |
---|
64 | </target> |
---|
65 | |
---|
66 | <!-- ====================================================================== --> |
---|
67 | <!-- Specific eclipse target, to create the classpath allowing eclipse --> |
---|
68 | <!-- compiler to run without error --> |
---|
69 | <!-- ====================================================================== --> |
---|
70 | |
---|
71 | <!-- Copy one jar file to the ./lib folder, and add it to the eclipse classpath --> |
---|
72 | <target name="add_one_jar_to_eclipse_classpath"> |
---|
73 | <echo message="Adding ${jarFile} to eclipse classpath" level="info" /> |
---|
74 | <!-- Copy the given jar file, useless ? --> |
---|
75 | <!-- copy file="${jarFile}" todir="./lib" / --> |
---|
76 | <!-- |
---|
77 | Add the copied file to the eclipse classpath. We must do that by copying to a new file (to have an actual replacement), |
---|
78 | with a new placeholder (to avoid an infinite loop). |
---|
79 | --> |
---|
80 | <copy file=".classpath" |
---|
81 | tofile=".classpath.tmp" |
---|
82 | verbose="true" |
---|
83 | overwrite="true"> |
---|
84 | <filterset begintoken="#" endtoken="#"> |
---|
85 | <filter token="dependencyJarFile" |
---|
86 | value="<classpathentry kind="lib" path="${jarFile}"/> |
---|
87 | #dependencyJarFile2#" /> |
---|
88 | </filterset> |
---|
89 | </copy> |
---|
90 | <copy file=".classpath.tmp" |
---|
91 | tofile=".classpath" |
---|
92 | verbose="true" |
---|
93 | overwrite="true"> |
---|
94 | <filterset begintoken="#" endtoken="#"> |
---|
95 | <filter token="dependencyJarFile2" |
---|
96 | value="#dependencyJarFile#" /> |
---|
97 | </filterset> |
---|
98 | </copy> |
---|
99 | <delete file=".classpath.tmp" /> |
---|
100 | </target> |
---|
101 | |
---|
102 | <target name="create_eclipse_classpath"> |
---|
103 | <!-- Let's override the .classpath, by the relevant template --> |
---|
104 | <copy file=".classpath_template_for_and_build" |
---|
105 | tofile=".classpath" |
---|
106 | overwrite="true" /> |
---|
107 | |
---|
108 | <!-- We add all dependency jar files, to the classpath, so that eclipse internal compiler works --> |
---|
109 | <delete file=".classpath.tmp" /> |
---|
110 | <foreach target="add_one_jar_to_eclipse_classpath" |
---|
111 | param="jarFile" |
---|
112 | trim="true"> |
---|
113 | <path refid="build.test.classpath" /> |
---|
114 | </foreach> |
---|
115 | <!-- Let's remove the placeholder --> |
---|
116 | |
---|
117 | <copy file=".classpath" tofile=".classpath.tmp" overwrite="true"> |
---|
118 | <filterset begintoken="#" endtoken="#"> |
---|
119 | <filter token="dependencyJarFile" value="" /> |
---|
120 | </filterset> |
---|
121 | </copy> |
---|
122 | <move file=".classpath.tmp" tofile=".classpath" overwrite="true" /> |
---|
123 | </target> |
---|
124 | |
---|
125 | <target name="refresh_if_eclipse" if="eclipse.running"> |
---|
126 | <eclipse.refreshLocal resource="jupload" depth="infinite" /> |
---|
127 | </target> |
---|
128 | |
---|
129 | <!-- ================================================================================= |
---|
130 | Start of Signing applet jar |
---|
131 | Various targets to sign the applet, depending on the given parameters |
---|
132 | ================================================================================== --> |
---|
133 | <target name="sign_jar" |
---|
134 | depends="sign_jar_without_keypass, sign_jar_with_keypass" /> |
---|
135 | <target name="sign_jar_without_keypass" unless="jupload.keystore.keypass"> |
---|
136 | <echo message="Jar: ${maven.build.dir}/${maven.build.finalName}.jar" |
---|
137 | level="info" /> |
---|
138 | <echo message="Keystore: ${jupload.keystore.filename}" level="info" /> |
---|
139 | <echo message="Alias: ${jupload.keystore.alias}" level="info" /> |
---|
140 | <signjar jar="${maven.build.dir}/${maven.build.finalName}.jar" |
---|
141 | alias="${jupload.keystore.alias}" |
---|
142 | storepass="${jupload.keystore.storepass}" |
---|
143 | keystore="${jupload.keystore.filename}" /> |
---|
144 | </target> |
---|
145 | <target name="sign_jar_with_keypass" if="jupload.keystore.keypass"> |
---|
146 | <signjar jar="${maven.build.dir}/${maven.build.finalName}.jar" |
---|
147 | alias="${jupload.keystore.alias}" |
---|
148 | storepass="${jupload.keystore.storepass}" |
---|
149 | keystore="${jupload.keystore.filename}" |
---|
150 | keypass="${jupload.keystore.keypass}" |
---|
151 | verbose="true" /> |
---|
152 | </target> |
---|
153 | <!-- ================================================================================= |
---|
154 | End of Signing applet jar |
---|
155 | ================================================================================== --> |
---|
156 | |
---|
157 | <!-- ================================================================================= |
---|
158 | Start of post compile actions |
---|
159 | Copy of the applet jar file to the /site and /target/site/ folders, if they exist |
---|
160 | ================================================================================== --> |
---|
161 | <target name="post_compile_action" |
---|
162 | depends="check_site_folders,copy_jar_to_site, copy_jar_to_target_site" /> |
---|
163 | <target name="check_site_folders"> |
---|
164 | <available file="site" property="jupload.available.site" /> |
---|
165 | <available file="target/site" |
---|
166 | property="jupload.available.target.site" /> |
---|
167 | </target> |
---|
168 | <target name="copy_jar_to_site" if="jupload.available.site"> |
---|
169 | <copy file="${maven.build.dir}/${maven.build.finalName}.jar" |
---|
170 | todir="site" /> |
---|
171 | </target> |
---|
172 | <target name="copy_jar_to_target_site" if="jupload.available.target.site"> |
---|
173 | <copy file="${maven.build.dir}/${maven.build.finalName}.jar" |
---|
174 | todir="target/site" /> |
---|
175 | </target> |
---|
176 | <!-- ================================================================================= |
---|
177 | End of post compile actions |
---|
178 | ================================================================================== --> |
---|
179 | |
---|
180 | |
---|
181 | <!-- ================================================================================= |
---|
182 | The main goal ! |
---|
183 | ================================================================================== --> |
---|
184 | <target name="eclipse_package" |
---|
185 | depends="get-deps, create_eclipse_classpath, prepare_resources, package, refresh_if_eclipse, post_compile_action" /> |
---|
186 | |
---|
187 | </project> |
---|