|
1 <!--**************************************************************************** |
|
2 * Configuration tool plugin build template |
|
3 * This ant pluging-build-template.xml will contain the common targets |
|
4 * to build a eclipse plugin |
|
5 ****************************************************************************--> |
|
6 |
|
7 <project name="${pluginName}" default="all"> |
|
8 <property file="../common.properties"/> |
|
9 <property file="../${common.buildproperties}"/> |
|
10 <property file="build.properties"/> |
|
11 <property file="plugin.properties"/> |
|
12 <fileset id="plugin-resources" dir="." includes="${bin.includes}"/> |
|
13 |
|
14 |
|
15 <path id="project.class.path"> |
|
16 <!-- add lib jars to classpath --> |
|
17 <fileset dir="${common.plugin-lib}" casesensitive="yes"> |
|
18 <include name="**/*.jar"/> |
|
19 </fileset> |
|
20 <!-- add also the generated Configuration Tool jars to classpath --> |
|
21 <fileset dir="${common.plugin-dist}" casesensitive="yes"> |
|
22 <include name="**/*.jar"/> |
|
23 </fileset> |
|
24 </path> |
|
25 |
|
26 <!-- Gets the svnversion with the svnversion command and stores the output to svnrevision. |
|
27 The target is executed only if the svnrevision has not been set. |
|
28 --> |
|
29 <target name="get-svnversion" unless="common.svnversion"> |
|
30 <exec dir="." executable="svnversion" outputproperty="common.svnversion" /> |
|
31 <echo message="svnversion from svn command = ${common.svnversion}" /> |
|
32 </target> |
|
33 <!-- Sets the buildate property if it has not been set by the common property file --> |
|
34 <target name="get-builddate" unless="common.builddate"> |
|
35 <tstamp prefix="build"/> |
|
36 <property name="common.builddate" value="${build.DSTAMP}"/> |
|
37 </target> |
|
38 |
|
39 <!-- generate a build property file --> |
|
40 <target name="update-properties" depends="get-svnversion"> |
|
41 <tstamp prefix="build"/> |
|
42 <echo file="${common.buildproperties}"> |
|
43 common.svnversion =${svnrevision} |
|
44 </echo> |
|
45 <!-- replace the possible : characters because the do not work in filenames--> |
|
46 <replace file="${common.buildproperties}" token=":"/> |
|
47 <property file="${common.buildproperties}"/> |
|
48 </target> |
|
49 |
|
50 |
|
51 <!-- All target will clean and then commit all the build steps--> |
|
52 <target name="all" depends="clean, build"/> |
|
53 |
|
54 <!-- Build target will commit all the build steps and can be used for incremental |
|
55 building, because ant recognized changed files --> |
|
56 <target name="build" depends="init, resource, compile, jar"/> |
|
57 |
|
58 <target name="clean"> |
|
59 <delete dir="${common.plugin-target}" quiet="true" /> |
|
60 </target> |
|
61 |
|
62 <target name="info"> |
|
63 <echoproperties/> |
|
64 </target> |
|
65 |
|
66 <target name="init" depends="get-svnversion,get-builddate"> |
|
67 <mkdir dir="${common.plugin-target}/bin" /> |
|
68 <mkdir dir="${common.plugin-dist}" /> |
|
69 </target> |
|
70 |
|
71 <target name="resource" depends="init"> |
|
72 <copy todir="${common.plugin-target}/bin/"> |
|
73 <fileset refid="plugin-resources" /> |
|
74 </copy> |
|
75 <manifest file="${common.plugin-target}/bin/META-INF/MANIFEST.MF" mode="update"> |
|
76 <attribute name="Bundle-FOO" value="${common.plugin-version}"/> |
|
77 <attribute name="Bundle-Version" value="${common.plugin-version}"/> |
|
78 <attribute name="Bundle-Date" value="${common.builddate}"/> |
|
79 <attribute name="Bundle-RepositoryVersion" value="${common.svnversion}"/> |
|
80 </manifest> |
|
81 |
|
82 </target> |
|
83 |
|
84 <target name="compile" depends="init" |
|
85 description="compile the source"> |
|
86 <!-- Compile the java code from ${src} into ${build} --> |
|
87 <javac srcdir="${source..}" destdir="${common.plugin-target}/bin"> |
|
88 <classpath refid="project.class.path"/> |
|
89 </javac> |
|
90 </target> |
|
91 |
|
92 <target name="jar" depends="compile,resource"> |
|
93 <jar jarfile="${common.plugin-dist}/${pluginName}_${common.plugin-version}.jar" |
|
94 basedir="${common.plugin-target}/bin" |
|
95 manifest="${common.plugin-target}/bin/META-INF/MANIFEST.MF"> |
|
96 </jar> |
|
97 </target> |
|
98 |
|
99 </project> |