root/extensions/MyRapla/build.xml

Revision 1077, 6.1 KB (checked in by kohlhaas, 6 years ago)

Builds for target 1.4

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
Line 
1<?xml version="1.0" encoding="UTF-8"?>
2<!-- file build.xml in your project root directory -->
3<project name="project" default="build" basedir=".">
4
5    <property name="main.dir" value="${basedir}" />
6
7    <target name="properties" if="eclipse.running">
8          <property name="build.compiler" value="org.eclipse.jdt.core.JDTCompilerAdapter"/>
9        </target>
10
11    <target name="init" depends="properties">
12        <property name="rapla.dir" value="../Rapla"/>
13        <property name="raplalib.dir" value="${rapla.dir}/lib"/>
14            <property name="rapla.path" value="${rapla.dir}/build/rapla.jar" />
15
16        <basename property="project.name" file="${main.dir}"/>
17            <property name="main.lib" value="${project.name}.jar"/>
18            <property name="buildjar.path" value="${main.dir}/build/${main.lib}" />
19
20            <!-- All the libraries are used for compilation by default-->
21            <patternset id="default-compile-libraries" >
22               <include name="client/*.jar"/>
23               <include name="common/*.jar"/>
24               <include name="server/*.jar"/>
25            </patternset>
26
27            <!-- Information about the compiler -->
28            <!-- property name="build.compiler" value="javac1.3"/-->
29            <property name="debug"          value="on"/>
30            <property name="optimize"       value="off"/>
31            <property name="deprecation"    value="on"/>
32        <property name="target_vm"         value="1.4"/>
33            <property name="verbose"        value="no"/>
34            <property name="packages"       value="org.*"/>
35
36            <!-- The rapla-directories -->
37            <property name="src.dir" value="${main.dir}/src" />
38            <property name="build.dir" value="${main.dir}/build" />
39            <property name="generated.dir" value="${main.dir}/generated-src"/>
40            <property name="build.dest" value="${build.dir}/classes" />
41    </target>
42
43    <!-- edit the following lines to your needs            -->
44        <target name="prepare" depends="init">
45            <mkdir dir="${generated.dir}" />
46            <mkdir dir="${build.dir}" />
47            <mkdir dir="${build.dest}" />
48            <mkdir dir="${build.dest}/META-INF" />
49   </target>
50
51  <target name="compile" depends="prepare">
52     <echo message="Make sure the file ${rapla.path} exists. Otherwise build one first."/>
53    <!-- Compile the java code from ${src} into ${build.dir} -->
54    <javac srcdir="${src.dir}"
55           destdir="${build.dest}"
56           debug="${debug}"
57                   source="${target_vm}"
58                   target="${target_vm}"
59           optimize="${optimize}"
60           deprecation="${deprecation}"
61               verbose="${verbose}">
62        <classpath>
63          <fileset dir="${raplalib.dir}">
64            <patternset refid="default-compile-libraries" />
65          </fileset>
66          <pathelement path="${rapla.path}"/>
67        </classpath>
68    </javac>
69
70    <!-- The png,license,xsl and rng files must be in the correct classpath  -->
71    <copy todir="${build.dest}">
72        <fileset dir="${src.dir}">
73          <exclude name="**/*.java"/>
74          <exclude name="**/*Resources.xml"/>
75          <exclude name="**/package.html"/>
76        </fileset>
77    </copy>
78
79  </target>
80
81  <!-- Set a variable if plugin meta is already up-to-date.                  -->
82  <target name="pluginmeta-check" depends="prepare">
83    <condition property="pluginmeta.notrequired">
84      <and>
85        <uptodate>
86         <srcfiles dir="${build.dest}" includes="**/*Plugin.class"/>
87         <mapper type="merge" to="${build.dest}/META-INF/rapla-plugin.list"/>
88        </uptodate>
89      </and>
90    </condition>
91  </target>
92
93  <target name="generate-plugin-meta" unless="pluginmeta.notrequired"
94          description="Generate the rapla-plugin.list"
95          depends="pluginmeta-check,compile">
96        <echo message="generating Plugin Metainfo"/>
97    <mkdir dir="${generated.dir}/META-INF"/>
98    <java classname="org.rapla.framework.ServiceListCreator" failonerror="true" fork="yes">
99      <arg value="${build.dest}"/>
100      <arg value="${generated.dir}/META-INF/rapla-plugin.list"/>
101      <classpath>
102        <pathelement path="${rapla.path}"/>
103        <pathelement path="${build.dest}"/>
104        <fileset dir="${raplalib.dir}">
105           <patternset refid="default-compile-libraries" />
106        </fileset>
107      </classpath>
108    </java>
109    <copy file="${generated.dir}/META-INF/rapla-plugin.list" tofile="${build.dest}/META-INF/rapla-plugin.list"/>
110  </target>
111
112  <!-- Set a variable if resources are already up-to-date.                  -->
113  <target name="resources-check" depends="init">
114    <condition property="resources.notrequired">
115      <and>
116        <uptodate>
117         <srcfiles dir="${src.dir}">
118                   <include name="**/*Resources.xml"/>
119                  </srcfiles>
120                  <mapper type="glob" from="*Resources.xml" to="${build.dest}/*Resources.class"/>
121        </uptodate>
122        <uptodate property="test"
123          srcfile="${main.dir}/${doc.properties}"
124          targetfile="${build.dest}/org/rapla/RaplaResources.class"
125        />
126      </and>
127    </condition>
128  </target>
129
130  <target name="compile-resources" unless="resources.notrequired"
131          description="Generate and compile the RaplaResources"
132          depends="resources-check,compile">
133
134    <echo message="generating Resourcefiles"/>
135
136    <java classname="org.rapla.components.xmlbundle.impl.TranslationParser" failonerror="true" fork="yes">
137      <arg value="${src.dir}"/>
138      <arg value="${generated.dir}"/>
139      <classpath>
140        <pathelement path="${rapla.path}"/>
141        <fileset dir="${raplalib.dir}">
142           <patternset refid="default-compile-libraries" />
143        </fileset>
144      </classpath>
145    </java>
146
147    <javac srcdir="${generated.dir}"
148                   source="${target_vm}"
149           target="${target_vm}"
150           destdir="${build.dest}"
151           verbose="${verbose}">
152      <include name="**/*.java" />
153    </javac>
154  </target>
155
156  <target name="build" depends="compile,compile-resources,generate-plugin-meta">
157    <jar jarfile="${build.dir}/${main.lib}">
158         <fileset dir="${build.dest}">
159         </fileset>
160         <manifest>
161           <attribute name="Created-By" value="${user.name}"/>
162           <section name="common">
163                   <attribute name="Implementation-Title" value="common"/>
164               <attribute name="Implementation-Version" value="${TODAY}"/>
165               </section>
166         </manifest>
167    </jar>
168  </target>
169
170</project>
171<!-- end file build.xml -->
Note: See TracBrowser for help on using the browser.