~ubuntu-branches/ubuntu/raring/accessodf/raring

« back to all changes in this revision

Viewing changes to build.xml

  • Committer: Package Import Robot
  • Author(s): Sebastian Humenda
  • Date: 2012-04-09 11:21:13 UTC
  • Revision ID: package-import@ubuntu.com-20120409112113-v0kmfdj1ks80xoj8
Tags: upstream-0.1
ImportĀ upstreamĀ versionĀ 0.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<?xml version="1.0" encoding="UTF-8"?>
 
2
<project name="AccessODF" default="jar" basedir="."
 
3
         xmlns:j2seproject3="http://www.netbeans.org/ns/j2se-project/3">
 
4
         
 
5
    <description>Builds, tests, and runs the project extension project.</description>
 
6
 
 
7
    <fail message="Please build using Ant 1.8.0 or higher.">
 
8
        <condition><not><antversion atleast="1.8.0"/></not></condition>
 
9
    </fail>
 
10
 
 
11
    <tstamp><format property="ISO-TODAY" pattern="yyyy-MM-dd"/></tstamp>
 
12
    
 
13
    <property name="project-name" value="AccessODF"/>
 
14
    <property name="release-version" value="0.1.0"/>
 
15
        
 
16
        <property name="on-debian" value="false"/>
 
17
        
 
18
<!--
 
19
  /- ===========================================================================
 
20
  /- MAIN TARGETS                                                           
 
21
  /- ===========================================================================
 
22
  /-->
 
23
  
 
24
  
 
25
    <target name="uno-package"
 
26
            description="Create UNO extension package"
 
27
            depends="addon-jar,images,registry,-delete-uno-package,-pre-uno-package,-do-uno-package,-post-uno-package"/>
 
28
    
 
29
    <target name="uno-run"
 
30
                description="Run UNO extension package in OpenOffice.org"
 
31
                depends="uno-package,-run-oo"/>
 
32
    
 
33
    <target name="addon-jar"
 
34
            description="Build Addon jar"
 
35
            depends="-uno-project-init,uno-idl-compile,-jar-idl-types,core-jar,compile,-pre-jar,-do-openoffice-manifest,-post-jar,-do-addon-jar" />
 
36
            
 
37
    <target name="core-jar"
 
38
            description="Build Core jar"
 
39
                        depends="init,-build-core" />
 
40
        
 
41
        <target name="jar"
 
42
                        description="Default target: Build Core jar"
 
43
                depends="core-jar" />
 
44
        
 
45
    <target name="javadoc"
 
46
            description="Build Javadoc"
 
47
            depends="init,-javadoc-build" />
 
48
 
 
49
    <target name="compile"
 
50
            description="Compile project"
 
51
            depends="init,deps-jar,-verify-automatic-build,-pre-pre-compile,-pre-compile,-do-compile,-post-compile" />
 
52
                        
 
53
        <target name="l10n"
 
54
                        description="Re-encode localisation files">
 
55
                <ant dir="l10n" inheritAll="false" />
 
56
        </target>
 
57
        
 
58
        <target name="licenses"
 
59
                        description="Add license headers">
 
60
                <ant dir="licenses" inheritAll="false" />
 
61
        </target>
 
62
        
 
63
                        
 
64
<!--
 
65
  /- ===========================================================================
 
66
  /- OVERRIDE TARGETS                                                           
 
67
  /- ===========================================================================
 
68
  /-->
 
69
  
 
70
  
 
71
    <target name="-pre-init" depends="-init-build,-copy-external-jars"/>
 
72
    <target name="-pre-compile"/>
 
73
    <target name="-post-uno-package"/>
 
74
    <target name="-profile-post-init"/>
 
75
    <target name="-profile-pre-init"/>
 
76
    <target name="-post-init"/>
 
77
    <target name="-pre-uno-package"/>
 
78
    <target name="-post-compile"/>
 
79
    <target name="-post-jar"/>
 
80
    <target name="-pre-jar"/>
 
81
    <target name="-post-compile-test"/>
 
82
    <target name="-pre-compile-test"/>
 
83
    <target name="-post-clean"/>
 
84
  
 
85
  
 
86
<!-- =========================================================================== -->
 
87
  
 
88
  
 
89
    <!-- initialise -->
 
90
    <target name="-init-build"
 
91
            depends="-windows-properties,-macosx-properties,-linux-properties,-debian-properties">
 
92
 
 
93
        <property file="build.properties"/>
 
94
                
 
95
        <pathconvert property="project.home">
 
96
            <path path="."/>
 
97
        </pathconvert>
 
98
 
 
99
        <pathconvert property="core.deploy.dir">
 
100
            <path path="${dist.dir}/${external.jar.dir}"/>
 
101
        </pathconvert>
 
102
                
 
103
        <pathconvert property="core.classpath.attribute" pathsep=" " dirsep="/">
 
104
            <path path="${javac.core.classpath}"/>
 
105
            <firstmatchmapper>
 
106
                <chainedmapper>
 
107
                    <globmapper from="${project.home}/*" to="*" handledirsep="yes" />
 
108
                    <flattenmapper/>
 
109
                </chainedmapper>
 
110
                <globmapper from="${core.deploy.dir}/*" to="*"/>
 
111
                <globmapper from="/*" to="file:///*"/>
 
112
                <globmapper from="*" to="file:///*"/>
 
113
            </firstmatchmapper>
 
114
        </pathconvert>
 
115
                
 
116
        <pathconvert property="addon.classpath.attribute" pathsep=" " dirsep="/">
 
117
            <path path="${core.deploy.dir}/${core.jar}"/>
 
118
            <firstmatchmapper>
 
119
                <globmapper from="${project.home}/${dist.dir}/*" to="*" handledirsep="yes" />
 
120
                <globmapper from="/*" to="file:///*"/>
 
121
                <globmapper from="*" to="file:///*"/>
 
122
            </firstmatchmapper>
 
123
        </pathconvert>
 
124
        
 
125
        <pathconvert property="tools.classpath.attribute" pathsep=" " dirsep="/">
 
126
            <path path="${core.deploy.dir}/${core.jar}"/>
 
127
            <firstmatchmapper>
 
128
                <globmapper from="${project.home}/${dist.dir}/*" to="*" handledirsep="yes" />
 
129
                <globmapper from="/*" to="file:///*"/>
 
130
                <globmapper from="*" to="file:///*"/>
 
131
            </firstmatchmapper>
 
132
        </pathconvert>
 
133
 
 
134
        <available file="${dist.dir}${file.separator}${external.jar.dir}"
 
135
                   property="external.jar.dir.exists"/>
 
136
    </target>
 
137
        
 
138
    <!-- load platform dependent properties -->
 
139
    <target name="-windows-properties" if="is.windows" depends="-detect-os">
 
140
        <property file="build.windows.properties"/>
 
141
    </target>
 
142
 
 
143
    <target name="-macosx-properties" if="is.macosx" depends="-detect-os">
 
144
        <property file="build.macosx.properties"/>
 
145
    </target>
 
146
 
 
147
    <target name="-linux-properties" if="is.linux" depends="-detect-os">
 
148
        <property file="build.linux.properties"/>
 
149
    </target>
 
150
 
 
151
    <target name="-debian-properties" if="is.debian" depends="-detect-os">
 
152
        <property file="build.debian.properties"/>
 
153
    </target>
 
154
        
 
155
        
 
156
    <!-- detect os -->
 
157
    <target name="-detect-os">
 
158
        <condition property="is.windows">
 
159
            <os family="windows"/>
 
160
        </condition>
 
161
        <condition property="is.macosx">
 
162
           <and>
 
163
               <os family="mac"/>
 
164
               <os family="unix"/>
 
165
           </and>
 
166
        </condition>
 
167
        <condition property="is.linux">
 
168
            <and>
 
169
                <os family="unix"/>
 
170
                <not><os family="mac"/></not>
 
171
                <not><istrue value="${on-debian}"/></not>
 
172
            </and>
 
173
        </condition>
 
174
        <condition property="is.debian">
 
175
            <and>
 
176
                <os family="unix"/>
 
177
                <not><os family="mac"/></not>
 
178
                <istrue value="${on-debian}"/>
 
179
            </and>
 
180
        </condition>
 
181
    </target>
 
182
        
 
183
        
 
184
    <!-- make external jars folder -->
 
185
    <target name="-copy-external-jars" depends="-init-build" unless="external.jar.dir.exists">
 
186
        <pathconvert property="core.classpath.space.sep" pathsep=" ">
 
187
            <path path="${javac.core.classpath}"/>
 
188
            <map from="${project.home}${file.separator}" to=""/>
 
189
        </pathconvert>
 
190
        <mkdir dir="${dist.dir}${file.separator}${external.jar.dir}" />
 
191
        <copy todir="${dist.dir}${file.separator}${external.jar.dir}" flatten="true">
 
192
            <fileset dir="." includes="${core.classpath.space.sep}"/>
 
193
        </copy>
 
194
    </target>
 
195
        
 
196
        <!-- compile core -->
 
197
    <target name="-compile-core" depends="-init-build">
 
198
        <delete dir="${build.core.classes.dir}"/>
 
199
        <mkdir dir="${build.core.classes.dir}"/>
 
200
        <javac srcdir="${src.core.dir}" destdir="${build.core.classes.dir}"
 
201
               includeantruntime="false" debug="true" encoding="UTF-8"
 
202
               source="${javac.source}" target="${javac.target}"
 
203
               includes="**" excludes="">
 
204
            <classpath>
 
205
                <path path="${javac.core.classpath}"/>
 
206
            </classpath>
 
207
        </javac>
 
208
                <copy todir="${build.core.classes.dir}">
 
209
            <fileset dir="${src.core.dir}">
 
210
                <patternset>
 
211
                    <include name="META-INF/**/*.*"/>
 
212
                    <include name="**/*.properties"/>
 
213
                    <include name="**/*.xsl"/>
 
214
                    <include name="**/*.xml"/>
 
215
                    <include name="**/*.rng"/>
 
216
                    <exclude name="**/*.java"/>
 
217
                </patternset>
 
218
            </fileset>
 
219
        </copy>
 
220
    </target>
 
221
    
 
222
    <!-- build core jar -->
 
223
    <target name="-build-core" depends="-compile-core">
 
224
                <delete file="${dist.core.jar}"/>
 
225
        <jar destfile="${dist.core.jar}">
 
226
            <fileset dir="${build.core.classes.dir}"/>
 
227
            <manifest>
 
228
                <attribute name="Built-By" value="${user.name}"/>
 
229
                <attribute name="Built-On" value="${ISO-TODAY}"/>
 
230
                <attribute name="Implementation-Title" value="${project.name}"/>
 
231
                <attribute name="Implementation-Version" value="${release-version}"/>
 
232
                <attribute name="Implementation-URL" value="http://accessodf.sourceforge.net"/>
 
233
                <attribute name="Class-Path" value="${core.classpath.attribute}"/>
 
234
            </manifest>
 
235
        </jar>
 
236
    </target>
 
237
        
 
238
        
 
239
<!--
 
240
  /- ===========================================================================
 
241
  /- BUILD_UNO_IMPL.XML                                                       
 
242
  /- ===========================================================================
 
243
  /-->
 
244
 
 
245
    
 
246
    <target name="-uno-project-init" depends="-do-init">
 
247
    
 
248
        <property name="build.uno.version" value="2.0.6"/>
 
249
      
 
250
        <property name="office.unopkg" value="${office.program.dir}${file.separator}unopkg"/>
 
251
        <property name="office.soffice" value="${office.program.dir}${file.separator}soffice"/>
 
252
        
 
253
        <property name="sdk.idl.dir" location="${oo.sdk.dir}${file.separator}idl"/> 
 
254
        <property name="sdk.idlc" value="${sdk.bin.dir}${file.separator}idlc"/>
 
255
        <property name="sdk.regmerge" value="${ure.bin.dir}${file.separator}regmerge"/>
 
256
        <property name="sdk.javamaker" value="${sdk.bin.dir}${file.separator}javamaker"/>
 
257
 
 
258
        <dirname property="project.dir" file="build.xml"/>       
 
259
        <property name="uno.package.name" value="${project.dir}${file.separator}${dist.dir}${file.separator}${project.name}.oxt"/>
 
260
        <property name="src.addon.dir.absolute" value="${project.dir}${file.separator}${src.addon.dir}"/>
 
261
 
 
262
        <property name="idl.out" value="${project.dir}${file.separator}${build.dir}${file.separator}idl"/>
 
263
        <property name="idl.classes.dir" value="${project.dir}${file.separator}${build.addon.classes.dir}"/>
 
264
        <property name="idl.out.urd" value="${idl.out}/urd"/>
 
265
        <property name="idl.out.rdb" value="${idl.out}/rdb"/>
 
266
        <property name="idl.rdb.name" value="types.rdb"/>
 
267
        <property name="idl.rdb.fullpath" value="${idl.out.rdb}/${idl.rdb.name}"/>
 
268
                
 
269
        <property name="images.base.dir" value="${build.dir}/img"/>
 
270
        <property name="build.registry.dir" value="${build.dir}/cpreg"/>
 
271
        
 
272
        <mkdir dir="${idl.out}"/>
 
273
        <mkdir dir="${idl.out.urd}"/>
 
274
        <mkdir dir="${idl.out.rdb}"/>
 
275
        <mkdir dir="${images.base.dir}"/>
 
276
        <mkdir dir="${build.registry.dir}"/>
 
277
                
 
278
        <condition property="oo.version.three">
 
279
            <equals arg1="${oo.version.number}" arg2="three"/>
 
280
        </condition>
 
281
    </target>
 
282
 
 
283
    <!-- handle images -->
 
284
    <target name="-uno-images-condition" description="check images" depends="-uno-project-init">
 
285
        <available file="${images.dir}" type="dir" property="images.required"/>
 
286
    </target>    
 
287
    
 
288
    <target name="images" description="copy images" depends="-uno-images-condition" if="images.required">
 
289
        <mkdir dir="${images.base.dir}/${images.dir}"/>
 
290
        <copy todir="${images.base.dir}/${images.dir}">
 
291
            <fileset dir="${images.dir}"/>
 
292
        </copy>
 
293
    </target>
 
294
 
 
295
    <!-- handle xcu/xcs files with package names -->    
 
296
    <target name="-uno-registryfiles-condition" description="check xcu and xcs files" depends="-uno-project-init">
 
297
        <available file="${registry.dir}" type="dir" property="xcuxcs.required"/>
 
298
    </target>    
 
299
    
 
300
    <target name="registry" description="copy registry files" depends="-uno-registryfiles-condition" if="xcuxcs.required">
 
301
        <mkdir dir="${build.registry.dir}/${registry.dir}"/>
 
302
        <copy todir="${build.registry.dir}/${registry.dir}">
 
303
            <fileset dir="${registry.dir}" includes="**/*.xcu,**/*.xcs"/>
 
304
        </copy>
 
305
    </target>
 
306
    
 
307
    <target name="-uno-idl-idlc-condition" description="check idlc dependencies" depends="-uno-project-init">
 
308
        <uptodate property="idlc.notRequired" targetfile ="${build.dir}/idlc.compile">
 
309
           <srcfiles dir= "${src.addon.dir}" includes="**/*.idl"/>
 
310
        </uptodate>
 
311
    </target>    
 
312
   
 
313
    <!-- compile UNO idl files: execution -->
 
314
    <target name="-uno-idl-idlc" description="Compile the IDL Conditionally" depends="-uno-idl-idlc-condition" unless="idlc.notRequired">
 
315
        <apply executable="${sdk.idlc}" dir="${office.program.dir}" failonerror="true">
 
316
            <env key="PATH" path="${office.tool.path}"/>
 
317
            <env key="LD_LIBRARY_PATH" path="${office.tool.path}"/> 
 
318
            <env key="DYLD_LIBRARY_PATH" path="${office.tool.path}"/>
 
319
            <arg value="-C"/>
 
320
            <arg value="-O"/>
 
321
            <arg value="${idl.out.urd}"/>
 
322
            <arg value="-I"/>
 
323
            <arg value="${src.addon.dir.absolute}"/>
 
324
            <arg value="-I"/> 
 
325
            <arg value="${sdk.idl.dir}"/> 
 
326
            <fileset dir="${src.addon.dir}" includes="**/*.idl" casesensitive="yes" id="idl.list.id"/>
 
327
        </apply>
 
328
        <!-- list for copying idl files in own jar -->
 
329
        <property name="idl.file" refid="idl.list.id"/>
 
330
        <propertyfile file="${idl.out}/idl_list.properties">
 
331
            <entry key="idl.file.list" value="${idl.file}"/>
 
332
        </propertyfile>
 
333
        <replace file="${idl.out}/idl_list.properties" token=".idl" value=".class"/>
 
334
        <replace file="${idl.out}/idl_list.properties" token=";" value=","/>
 
335
    </target>
 
336
 
 
337
    <!-- merge urd files: execution -->
 
338
    <target name="-uno-idl-regmerge" description="Merge urd Files Conditionally" depends="-uno-idl-idlc,-uno-idl-idlc-condition" unless="idlc.notRequired">
 
339
        <!-- to only extract the new files, delete the old rdb -->
 
340
        <delete file="${idl.rdb.fullpath}"/>        
 
341
        <apply executable="${sdk.regmerge}" dir="${office.program.dir}" failonerror="true">
 
342
            <env key="PATH" path="${office.tool.path}"/>
 
343
            <env key="LD_LIBRARY_PATH" path="${office.tool.path}"/>
 
344
            <env key="DYLD_LIBRARY_PATH" path="${office.tool.path}"/> 
 
345
            <arg file="${idl.rdb.fullpath}"/>
 
346
            <arg value="/UCR"/>
 
347
            <fileset dir="${idl.out.urd}" includes="**/*.urd" casesensitive="yes"/>
 
348
        </apply>
 
349
    </target>
 
350
 
 
351
    <!-- should javamaker be executed -->
 
352
    <target name="-uno-idl-javamaker-condition" description="check if rdb was created" depends="-uno-idl-regmerge,-uno-idl-idlc-condition">
 
353
        <available file="${idl.rdb.name}" filepath="${idl.out.rdb}" property="javamaker.Required"/>
 
354
    </target>
 
355
    
 
356
    <!-- generate Java class files from type library: execution -->
 
357
    <target name="-uno-idl-javamaker" depends="-uno-idl-regmerge,-uno-idl-idlc-condition,-uno-idl-javamaker-condition" if="javamaker.Required" unless="idlc.notRequired">
 
358
        <echo message="generating java class files from rdb..."/>
 
359
        <exec executable="${sdk.javamaker}" dir="${office.program.dir}" failonerror="true">
 
360
            <env key="PATH" path="${office.tool.path}"/>                
 
361
            <env key="LD_LIBRARY_PATH" path="${office.tool.path}"/>
 
362
            <env key="DYLD_LIBRARY_PATH" path="${office.tool.path}"/> 
 
363
            <arg value="-BUCR"/>
 
364
            <arg value="-O"/>
 
365
            <arg value="${idl.classes.dir}"/>
 
366
            <arg file="${idl.rdb.fullpath}"/>
 
367
            <arg value="${oo.unotypes.rdb}"/>
 
368
            <arg value="${oo.offapi.rdb}"/>
 
369
        </exec>
 
370
    </target>
 
371
 
 
372
    <target name="-uno-idl-result" depends="-uno-idl-javamaker">
 
373
        <touch file="${build.dir}/idlc.compile"/>
 
374
        <echo message="build UNO idl files finished"/>
 
375
    </target>
 
376
 
 
377
    <!-- the main target, called in recursive builds -->
 
378
    <target name="uno-idl-compile" description="Compiles UNO idl files" depends="-uno-idl-result"/>
 
379
 
 
380
    <target name="-jar-idl-types" depends="-do-uno-types" unless="no.idl.files">
 
381
        <mkdir dir="${dist.dir}"/>
 
382
        <jar basedir="${build.addon.classes.dir}" compress="true" jarfile="${dist.dir}/${idl_types.jar}" includes="${idl.file.list}">
 
383
            <manifest>
 
384
                <attribute name="UNO-Type-Path" value="&lt;&gt;"/>
 
385
            </manifest>
 
386
        </jar>
 
387
    </target>
 
388
 
 
389
        <target name="-do-addon-jar">
 
390
        <jar basedir="${build.addon.classes.dir}"
 
391
             compress="true"
 
392
             filesonly="true"
 
393
             manifest="${build.dir}/MANIFEST.MF"
 
394
             jarfile="${dist.addon.jar}"
 
395
             excludes="**/*.xml,**/*.txt,${idl.file.list},${build.classes.excludes}"/>
 
396
    </target>
 
397
        
 
398
    <target name="-do-openoffice-manifest" depends="-do-registration,-do-class-path"/>
 
399
    
 
400
    <!-- enter the class path with external jars -->
 
401
    <target name="-do-class-path">
 
402
        <manifest file="${build.dir}/MANIFEST.MF" mode="update">
 
403
            <attribute name="Class-Path" value="${addon.classpath.attribute}"/>
 
404
        </manifest>
 
405
    </target>
 
406
    
 
407
    <!-- enter idl type definitions -->
 
408
    <target name="-do-uno-types" depends="-do-empty-unopath,-do-idl-unopath"/>
 
409
    <target name="-do-idl-unopath" depends="-check-uno-types" if="own.idl.files">
 
410
        <manifest file="${build.dir}/MANIFEST.MF" mode="update">
 
411
            <attribute name="UNO-Type-Path" value="${idl_types.jar}"/> 
 
412
        </manifest>            
 
413
    </target>
 
414
    <target name="-do-empty-unopath" depends="-check-uno-types" if="no.idl.files">
 
415
        <manifest file="${build.dir}/MANIFEST.MF" mode="update">
 
416
            <attribute name="UNO-Type-Path" value=""/> 
 
417
        </manifest>            
 
418
    </target>
 
419
    <target name="-check-uno-types">
 
420
        <property file="${idl.out}/idl_list.properties"/>
 
421
        <condition property="no.idl.files">
 
422
            <equals arg1="${idl.file.list}" arg2="" trim="true"/>
 
423
        </condition>
 
424
        <condition property="own.idl.files">
 
425
            <not>
 
426
                <istrue value="${no.idl.files}"/>
 
427
            </not>
 
428
        </condition>
 
429
    </target>
 
430
    
 
431
    <!-- enter the registration classes. Do nothing when the project is old -->
 
432
    <target name="-do-registration" depends="-do-central-registration" 
 
433
                if="new.project.registration">
 
434
        <manifest file="${build.dir}/MANIFEST.MF" mode="update">
 
435
            <section name="${slash.registration.class}"> 
 
436
                <attribute name="RegistrationClasses" value="${registration.classname}"/>
 
437
            </section>
 
438
        </manifest>
 
439
    </target>
 
440
    
 
441
    <!-- enter the registration class name. Do nothing when the project is old -->
 
442
    <target name="-do-central-registration" depends="-do-old-project-registration" if="new.project.registration">
 
443
        <property name="regclass.properties" value="${build.dir}/regclass.properties"/>
 
444
        <propertyfile file="${regclass.properties}">
 
445
            <entry key="dot.registration" value="${slash.registration.class}"/>
 
446
        </propertyfile>
 
447
        <replace file="${regclass.properties}" token=".class" value=""/>
 
448
        <replace file="${regclass.properties}" token="/" value="."/>
 
449
        <property file="${regclass.properties}"/>
 
450
        <manifest file="${build.dir}/MANIFEST.MF" mode="update">
 
451
            <attribute name="RegistrationClassName" value="${dot.registration}"/>
 
452
        </manifest>
 
453
    </target>
 
454
    
 
455
    <!-- Do the registration for older projects without a central registration class -->
 
456
    <target name="-do-old-project-registration" depends="-check-for-old-project" if="old.project.registration">
 
457
        <manifest file="${build.dir}/MANIFEST.MF" mode="update">
 
458
            <attribute name="RegistrationClassName" value="${registration.classname}"/>
 
459
        </manifest>
 
460
    </target>
 
461
    <target name="-check-for-old-project">
 
462
        <!-- central registration class in project -->
 
463
        <fileset id="registration.class.name" dir="${build.addon.classes.dir}">
 
464
            <patternset>
 
465
                <include name="**/CentralRegistrationClass.class"/>
 
466
            </patternset>
 
467
        </fileset>
 
468
        <property name="systemslash.registration.class" refid="registration.class.name"/>
 
469
        <!-- make forward slash from backslash on Windows -->
 
470
        <property name="regclass.properties" value="${build.dir}/regclass.properties"/>
 
471
        <propertyfile file="${regclass.properties}">
 
472
            <entry key="slash.registration.class" value="${systemslash.registration.class}"/>
 
473
        </propertyfile>
 
474
        <replace file="${regclass.properties}" token="\\" value="/"/>
 
475
        <property file="${regclass.properties}"/>
 
476
        <!-- now slash is ok -->
 
477
        <condition property="old.project.registration">
 
478
            <equals trim="true" arg1="${slash.registration.class}" arg2=""/>
 
479
        </condition>
 
480
        <condition property="new.project.registration">
 
481
            <isfalse value="${old.project.registration}"/>
 
482
        </condition>
 
483
    </target>
 
484
    
 
485
    <target name="-delete-uno-package">
 
486
        <delete failonerror="false" file="${uno.package.name}"/>
 
487
    </target>
 
488
 
 
489
    <target name="-license-exists">
 
490
        <available file="${project.dir}/${licenses.dir}" type="dir" property="do.license"/>
 
491
    </target>
 
492
    
 
493
    <!-- test for licenses dir is necessary because zipfileset fails if dir not there -->
 
494
    <target name="-uno-package-with-license" depends="-license-exists" if="do.license">
 
495
        <zip update="true" destfile="${uno.package.name}">
 
496
            <zipfileset dir="${project.dir}/${licenses.dir}" includes="**" casesensitive="yes" prefix="${licenses.dir}"/>
 
497
        </zip>
 
498
    </target>
 
499
 
 
500
    <target name="-description-exists">
 
501
        <available file="${project.dir}/${description.dir}" type="dir" property="do.description"/>
 
502
    </target>
 
503
    
 
504
    <!-- test for description dir is necessary because zipfileset fails if dir not there -->
 
505
    <target name="-uno-package-with-description" depends="-description-exists" if="do.description">
 
506
        <zip update="true" destfile="${uno.package.name}">
 
507
            <zipfileset dir="${project.dir}/${description.dir}" includes="**" casesensitive="yes" prefix="${description.dir}"/>
 
508
        </zip>
 
509
    </target>
 
510
 
 
511
    <target name="-help-exists">
 
512
        <available file="${project.dir}/${help.dir}" type="dir" property="do.help"/>
 
513
    </target>
 
514
    
 
515
    <!-- test for help dir is necessary because zipfileset fails if dir not there -->
 
516
    <target name="-uno-package-with-help" depends="-help-exists" if="do.help">
 
517
        <zip update="true" destfile="${uno.package.name}">
 
518
            <zipfileset dir="${help.dir}" includes="${help.content.extensions}" prefix="${help.dir}"/>
 
519
        </zip>
 
520
    </target>    
 
521
 
 
522
    <target name="-dialogs-exists">
 
523
        <available file="${project.dir}/${dialogs.dir}" type="dir" property="do.dialogs"/>
 
524
    </target>
 
525
    
 
526
    <!-- test for dialogs dir is necessary because zipfileset fails if dir not there -->
 
527
    <target name="-uno-package-with-dialogs" depends="-dialogs-exists" if="do.dialogs">
 
528
        <zip update="true" destfile="${uno.package.name}">
 
529
            <zipfileset dir="${dialogs.dir}" includes="${dialog.content.extensions}" prefix="dialogs"/>
 
530
        </zip>
 
531
    </target>   
 
532
    
 
533
    <target name="-do-uno-package"
 
534
                description="Creates UNO extension pacakge"
 
535
                        depends="-uno-package-with-license,-uno-package-with-help,-uno-package-with-dialogs,-uno-package-with-description">
 
536
        <zip update="true" destfile="${uno.package.name}">
 
537
            <fileset dir="${src.addon.dir}" includes="${manifest.package.extensions}" casesensitive="yes"/>
 
538
            <fileset dir="${build.registry.dir}" casesensitive="yes"/>
 
539
            <fileset dir="${src.addon.dir}" includes="description.xml" casesensitive="yes"/>
 
540
            <fileset dir="${dist.dir}" includes="**/*.jar" casesensitive="yes"/>
 
541
            <fileset dir="${images.base.dir}" includes="**" casesensitive="yes"/>
 
542
            <fileset dir="${idl.out.rdb}" includes="**/*.rdb" casesensitive="yes"/>
 
543
            <zipfileset dir="${src.addon.dir}" includes="uno-extension-manifest.xml" fullpath="META-INF/manifest.xml"/>
 
544
        </zip>
 
545
    </target>
 
546
 
 
547
    <!-- subtargets for different office versions -->
 
548
    <target name="-run-oo">
 
549
        <echo message="${office.unopkg} gui -f ${uno.package.name}"/>
 
550
        <exec dir="${office.program.dir}" executable="${office.unopkg}" failonerror="true">
 
551
            <arg value="gui"/>
 
552
            <arg value="-f"/>
 
553
            <arg file="${uno.package.name}"/>
 
554
        </exec>
 
555
        <echo message="${office.soffice}"/>
 
556
        <exec executable="${office.soffice}" dir="${office.program.dir}" failonerror="true">
 
557
            <arg value="${office.startup.options}"/>
 
558
        </exec>
 
559
    </target>
 
560
    
 
561
    
 
562
<!--
 
563
  /- ===========================================================================
 
564
  /- BUILD_IMPL.XML                                                             
 
565
  /- ===========================================================================
 
566
  /-->
 
567
 
 
568
    
 
569
    <target depends="-pre-init" name="-do-init">
 
570
       
 
571
        <property name="run.jvmargs" value=""/>
 
572
        <property name="javac.compilerargs" value=""/>
 
573
        <property name="work.dir" value="${basedir}"/>
 
574
        <condition property="no.deps">
 
575
            <and>
 
576
                <istrue value="${no.dependencies}"/>
 
577
            </and>
 
578
        </condition>
 
579
        <property name="javac.debug" value="true"/>
 
580
        <property name="application.args" value=""/>
 
581
        <property name="source.encoding" value="${file.encoding}"/>
 
582
        <property name="runtime.encoding" value="${source.encoding}"/>
 
583
        <condition property="javadoc.encoding.used" value="${javadoc.encoding}">
 
584
            <and>
 
585
                <isset property="javadoc.encoding"/>
 
586
                <not>
 
587
                    <equals arg1="${javadoc.encoding}" arg2=""/>
 
588
                </not>
 
589
            </and>
 
590
        </condition>
 
591
        <property name="javadoc.encoding.used" value="${source.encoding}"/>
 
592
        <property name="includes" value="**"/>
 
593
        <property name="excludes" value=""/>
 
594
        <property name="do.depend" value="false"/>
 
595
        <condition property="do.depend.true">
 
596
            <istrue value="${do.depend}"/>
 
597
        </condition>
 
598
        <path id="endorsed.classpath.path" path="${endorsed.classpath}"/>
 
599
        <condition else="" property="endorsed.classpath.cmd.line.arg" value="-Xbootclasspath/p:'${toString:endorsed.classpath.path}'">
 
600
            <length length="0" string="${endorsed.classpath}" when="greater"/>
 
601
        </condition>
 
602
        <condition else="false" property="jdkBug6558476">
 
603
            <and>
 
604
                <matches pattern="1\.[56]" string="${java.specification.version}"/>
 
605
                <not>
 
606
                    <os family="unix"/>
 
607
                </not>
 
608
            </and>
 
609
        </condition>
 
610
        <property name="javac.fork" value="${jdkBug6558476}"/>
 
611
        <property name="jar.index" value="false"/>
 
612
        <property name="jar.index.metainf" value="${jar.index}"/>
 
613
        <available file="${meta.inf.dir}/persistence.xml" property="has.persistence.xml"/>
 
614
    </target>
 
615
    
 
616
    <target depends="-pre-init,-do-init" name="-init-check">
 
617
        <fail unless="src.addon.dir">Must set src.addon.dir</fail>
 
618
        <fail unless="test.src.dir">Must set test.src.dir</fail>
 
619
        <fail unless="build.dir">Must set build.dir</fail>
 
620
        <fail unless="dist.dir">Must set dist.dir</fail>
 
621
        <fail unless="build.addon.classes.dir">Must set build.addon.classes.dir</fail>
 
622
        <fail unless="dist.javadoc.dir">Must set dist.javadoc.dir</fail>
 
623
        <fail unless="build.test.classes.dir">Must set build.test.classes.dir</fail>
 
624
        <fail unless="build.test.results.dir">Must set build.test.results.dir</fail>
 
625
        <fail unless="build.classes.excludes">Must set build.classes.excludes</fail>
 
626
        <fail unless="dist.addon.jar">Must set dist.addon.jar</fail>
 
627
    </target>
 
628
    
 
629
    <target name="-init-macrodef-javac">
 
630
        
 
631
        <macrodef name="javac" uri="http://www.netbeans.org/ns/j2se-project/3">
 
632
            <attribute default="${src.addon.dir}" name="srcdir"/>
 
633
            <attribute default="${build.addon.classes.dir}" name="destdir"/>
 
634
            <attribute default="${javac.addon.classpath}" name="classpath"/>
 
635
            <attribute default="${includes}" name="includes"/>
 
636
            <attribute default="${excludes}" name="excludes"/>
 
637
            <attribute default="${javac.debug}" name="debug"/>
 
638
            <attribute default="${empty.dir}" name="sourcepath"/>
 
639
            <attribute default="${empty.dir}" name="gensrcdir"/>
 
640
            <element name="customize" optional="true"/>
 
641
            <sequential>
 
642
                <property location="${build.dir}/empty" name="empty.dir"/>
 
643
                <mkdir dir="${empty.dir}"/>
 
644
                <javac debug="@{debug}" deprecation="${javac.deprecation}" destdir="@{destdir}" encoding="${source.encoding}" excludes="@{excludes}" fork="${javac.fork}" includeantruntime="false" includes="@{includes}" source="${javac.source}" sourcepath="@{sourcepath}" srcdir="@{srcdir}" target="${javac.target}" tempdir="${java.io.tmpdir}">
 
645
                    <src>
 
646
                        <dirset dir="@{gensrcdir}" erroronmissingdir="false">
 
647
                            <include name="*"/>
 
648
                        </dirset>
 
649
                    </src>
 
650
                    <classpath>
 
651
                        <path path="@{classpath}"/>
 
652
                    </classpath>
 
653
                    <compilerarg line="${endorsed.classpath.cmd.line.arg}"/>
 
654
                    <compilerarg line="${javac.compilerargs}"/>
 
655
                    <customize/>
 
656
                </javac>
 
657
            </sequential>
 
658
        </macrodef>
 
659
        
 
660
        <macrodef name="depend" uri="http://www.netbeans.org/ns/j2se-project/3">
 
661
            <attribute default="${src.addon.dir}" name="srcdir"/>
 
662
            <attribute default="${build.addon.classes.dir}" name="destdir"/>
 
663
            <attribute default="${javac.addon.classpath}" name="classpath"/>
 
664
            <sequential>
 
665
                <depend cache="${build.dir}/depcache" destdir="@{destdir}" excludes="${excludes}" includes="${includes}" srcdir="@{srcdir}">
 
666
                    <classpath>
 
667
                        <path path="@{classpath}"/>
 
668
                    </classpath>
 
669
                </depend>
 
670
            </sequential>
 
671
        </macrodef>
 
672
        
 
673
        <macrodef name="force-recompile" uri="http://www.netbeans.org/ns/j2se-project/3">
 
674
            <attribute default="${build.addon.classes.dir}" name="destdir"/>
 
675
            <sequential>
 
676
                <fail unless="javac.includes">Must set javac.includes</fail>
 
677
                <pathconvert pathsep="${line.separator}" property="javac.includes.binary">
 
678
                    <path>
 
679
                        <filelist dir="@{destdir}" files="${javac.includes}"/>
 
680
                    </path>
 
681
                    <globmapper from="*.java" to="*.class"/>
 
682
                </pathconvert>
 
683
                <tempfile deleteonexit="true" property="javac.includesfile.binary"/>
 
684
                <echo file="${javac.includesfile.binary}" message="${javac.includes.binary}"/>
 
685
                <delete>
 
686
                    <files includesfile="${javac.includesfile.binary}"/>
 
687
                </delete>
 
688
                <delete>
 
689
                    <fileset file="${javac.includesfile.binary}"/>
 
690
                </delete>
 
691
            </sequential>
 
692
        </macrodef>
 
693
    </target>
 
694
    
 
695
    <target name="-init-macrodef-junit">
 
696
        <macrodef name="junit" uri="http://www.netbeans.org/ns/j2se-project/3">
 
697
            <attribute default="${includes}" name="includes"/>
 
698
            <attribute default="${excludes}" name="excludes"/>
 
699
            <attribute default="**" name="testincludes"/>
 
700
            <sequential>
 
701
                <property name="junit.forkmode" value="perTest"/>
 
702
                <junit dir="${work.dir}" errorproperty="tests.failed" failureproperty="tests.failed" fork="true" forkmode="${junit.forkmode}" showoutput="true" tempdir="${build.dir}">
 
703
                    <batchtest todir="${build.test.results.dir}">
 
704
                        <fileset dir="${test.src.dir}" excludes="@{excludes},${excludes}" includes="@{includes}">
 
705
                            <filename name="@{testincludes}"/>
 
706
                        </fileset>
 
707
                    </batchtest>
 
708
                    <classpath>
 
709
                        <path path="${run.test.classpath}"/>
 
710
                    </classpath>
 
711
                    <syspropertyset>
 
712
                        <propertyref prefix="test-sys-prop."/>
 
713
                        <mapper from="test-sys-prop.*" to="*" type="glob"/>
 
714
                    </syspropertyset>
 
715
                    <formatter type="brief" usefile="false"/>
 
716
                    <formatter type="xml"/>
 
717
                    <jvmarg line="${endorsed.classpath.cmd.line.arg}"/>
 
718
                    <jvmarg value="-ea"/>
 
719
                    <jvmarg line="${run.jvmargs}"/>
 
720
                </junit>
 
721
            </sequential>
 
722
        </macrodef>
 
723
    </target>
 
724
   
 
725
    <target name="init" depends="-pre-init,-do-init,-post-init,-init-check,-init-macrodef-javac,-init-macrodef-junit"/>
 
726
 
 
727
    <!--
 
728
                ===================
 
729
                COMPILATION SECTION
 
730
                ===================
 
731
            -->
 
732
 
 
733
    <target name="-deps-jar-init" unless="built-jar.properties">
 
734
        <property location="${build.dir}/built-jar.properties" name="built-jar.properties"/>
 
735
        <delete file="${built-jar.properties}" quiet="true"/>
 
736
    </target>
 
737
    <target if="already.built.jar.${basedir}" name="-warn-already-built-jar">
 
738
        <echo level="warn" message="Cycle detected: AccessODFAddOn was already built"/>
 
739
    </target>
 
740
    <target depends="init,-deps-jar-init" name="deps-jar" unless="no.deps">
 
741
        <mkdir dir="${build.dir}"/>
 
742
        <touch file="${built-jar.properties}" verbose="false"/>
 
743
        <property file="${built-jar.properties}" prefix="already.built.jar."/>
 
744
        <antcall target="-warn-already-built-jar"/>
 
745
        <propertyfile file="${built-jar.properties}">
 
746
            <entry key="${basedir}" value=""/>
 
747
        </propertyfile>
 
748
    </target>
 
749
    <target depends="init,-check-automatic-build,-clean-after-automatic-build" name="-verify-automatic-build"/>
 
750
    <target depends="init" name="-check-automatic-build">
 
751
        <available file="${build.addon.classes.dir}/.netbeans_automatic_build" property="netbeans.automatic.build"/>
 
752
    </target>
 
753
    <target depends="init" if="netbeans.automatic.build" name="-clean-after-automatic-build">
 
754
        <antcall target="clean"/>
 
755
    </target>
 
756
    <target depends="init,deps-jar" name="-pre-pre-compile">
 
757
        <mkdir dir="${build.addon.classes.dir}"/>
 
758
    </target>
 
759
 
 
760
    <target if="do.depend.true" name="-compile-depend">
 
761
        <pathconvert property="build.generated.subdirs">
 
762
            <dirset dir="${build.generated.sources.dir}" erroronmissingdir="false">
 
763
                <include name="*"/>
 
764
            </dirset>
 
765
        </pathconvert>
 
766
        <j2seproject3:depend srcdir="${src.addon.dir}:${build.generated.subdirs}"/>
 
767
    </target>
 
768
    <target depends="init,deps-jar,-pre-pre-compile,-pre-compile, -copy-persistence-xml,-compile-depend" name="-do-compile">
 
769
        <j2seproject3:javac gensrcdir="${build.generated.sources.dir}"/>
 
770
        <copy todir="${build.addon.classes.dir}">
 
771
            <fileset dir="${src.addon.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
 
772
        </copy>
 
773
    </target>
 
774
    <target if="has.persistence.xml" name="-copy-persistence-xml">
 
775
        <mkdir dir="${build.addon.classes.dir}/META-INF"/>
 
776
        <copy todir="${build.addon.classes.dir}/META-INF">
 
777
            <fileset dir="${meta.inf.dir}" includes="persistence.xml"/>
 
778
        </copy>
 
779
    </target>
 
780
 
 
781
    <!--
 
782
                ===============
 
783
                JAVADOC SECTION
 
784
                ===============
 
785
            -->
 
786
 
 
787
    <target depends="init" name="-javadoc-build">
 
788
        <mkdir dir="${dist.javadoc.dir}"/>
 
789
        <javadoc additionalparam="${javadoc.additionalparam}" author="${javadoc.author}" charset="UTF-8" destdir="${dist.javadoc.dir}" docencoding="UTF-8" encoding="${javadoc.encoding.used}" failonerror="true" noindex="${javadoc.noindex}" nonavbar="${javadoc.nonavbar}" notree="${javadoc.notree}" private="${javadoc.private}" source="${javac.source}" splitindex="${javadoc.splitindex}" use="${javadoc.use}" useexternalfile="true" version="${javadoc.version}" windowtitle="${javadoc.windowtitle}">
 
790
            <classpath>
 
791
                <path path="${javac.addon.classpath}"/>
 
792
            </classpath>
 
793
            <fileset dir="${src.addon.dir}" excludes="${excludes}" includes="${includes}">
 
794
                <filename name="**/*.java"/>
 
795
            </fileset>
 
796
            <fileset dir="${src.core.dir}" excludes="${excludes}" includes="${includes}">
 
797
                <filename name="**/*.java"/>
 
798
            </fileset>
 
799
            <fileset dir="${src.tools.dir}" excludes="${excludes}" includes="${includes}">
 
800
                <filename name="**/*.java"/>
 
801
            </fileset>
 
802
            <fileset dir="${build.generated.sources.dir}" erroronmissingdir="false">
 
803
                <include name="**/*.java"/>
 
804
            </fileset>
 
805
        </javadoc>
 
806
        <copy todir="${dist.javadoc.dir}">
 
807
            <fileset dir="${src.addon.dir}" excludes="${excludes}" includes="${includes}">
 
808
                <filename name="**/doc-files/**"/>
 
809
            </fileset>
 
810
            <fileset dir="${src.core.dir}" excludes="${excludes}" includes="${includes}">
 
811
                <filename name="**/doc-files/**"/>
 
812
            </fileset>
 
813
            <fileset dir="${src.tools.dir}" excludes="${excludes}" includes="${includes}">
 
814
                <filename name="**/*.java"/>
 
815
            </fileset>
 
816
            <fileset dir="${build.generated.sources.dir}" erroronmissingdir="false">
 
817
                <include name="**/doc-files/**"/>
 
818
            </fileset>
 
819
        </copy>
 
820
    </target>
 
821
    
 
822
    <!--
 
823
                =========================
 
824
                JUNIT COMPILATION SECTION
 
825
                =========================
 
826
            -->
 
827
 
 
828
    <target depends="init,-compile-core" name="-pre-pre-compile-test">
 
829
        <mkdir dir="${build.test.classes.dir}"/>
 
830
    </target>
 
831
 
 
832
    <target if="do.depend.true" name="-compile-test-depend">
 
833
        <j2seproject3:depend classpath="${javac.test.classpath}" destdir="${build.test.classes.dir}" srcdir="${test.src.dir}"/>
 
834
    </target>
 
835
    <target depends="init,-compile-core,-pre-pre-compile-test,-pre-compile-test,-compile-test-depend" name="-do-compile-test">
 
836
        <j2seproject3:javac classpath="${javac.test.classpath}" debug="true" destdir="${build.test.classes.dir}" srcdir="${test.src.dir}"/>
 
837
        <copy todir="${build.test.classes.dir}">
 
838
            <fileset dir="${test.src.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
 
839
        </copy>
 
840
    </target>
 
841
 
 
842
    <target depends="init,-compile-core,-pre-pre-compile-test,-pre-compile-test,-do-compile-test,-post-compile-test" name="compile-test"/>
 
843
 
 
844
    <!--
 
845
                =======================
 
846
                JUNIT EXECUTION SECTION
 
847
                =======================
 
848
            -->
 
849
 
 
850
    <target depends="init" name="-pre-test-run">
 
851
        <mkdir dir="${build.test.results.dir}"/>
 
852
    </target>
 
853
    <target depends="init,compile-test,-pre-test-run" name="-do-test-run">
 
854
        <j2seproject3:junit testincludes="**/*Test.java"/>
 
855
    </target>
 
856
    <target depends="init,compile-test,-pre-test-run,-do-test-run" name="-post-test-run">
 
857
        <fail if="tests.failed" unless="ignore.failing.tests">Some tests failed; see details above.</fail>
 
858
    </target>
 
859
    
 
860
    <!-- make html report from test results -->
 
861
    <target depends="init" name="-test-report">
 
862
        <delete dir="${build.test.report.dir}"/>
 
863
        <mkdir dir="${build.test.report.dir}"/>
 
864
        <junitreport todir="${build.test.report.dir}">
 
865
            <fileset dir="${build.test.results.dir}">
 
866
                <include name="TEST-*.xml" />
 
867
            </fileset>
 
868
            <report todir="${build.test.report.dir}" />
 
869
        </junitreport>  
 
870
    </target>
 
871
 
 
872
    <!--
 
873
                ===============
 
874
                CLEANUP SECTION
 
875
                ===============
 
876
            -->
 
877
            
 
878
    <target name="-deps-clean-init" unless="built-clean.properties">
 
879
        <property location="${build.dir}/built-clean.properties" name="built-clean.properties"/>
 
880
        <delete file="${built-clean.properties}" quiet="true"/>
 
881
    </target>
 
882
    <target if="already.built.clean.${basedir}" name="-warn-already-built-clean">
 
883
        <echo level="warn" message="Cycle detected: AccessODFAddOn was already built"/>
 
884
    </target>
 
885
    <target depends="init,-deps-clean-init" name="deps-clean" unless="no.deps">
 
886
        <mkdir dir="${build.dir}"/>
 
887
        <touch file="${built-clean.properties}" verbose="false"/>
 
888
        <property file="${built-clean.properties}" prefix="already.built.clean."/>
 
889
        <antcall target="-warn-already-built-clean"/>
 
890
        <propertyfile file="${built-clean.properties}">
 
891
            <entry key="${basedir}" value=""/>
 
892
        </propertyfile>
 
893
    </target>
 
894
    <target depends="init" name="-do-clean">
 
895
        <delete dir="${build.dir}"/>
 
896
        <delete dir="${dist.dir}" followsymlinks="false" includeemptydirs="true"/>
 
897
    </target>
 
898
 
 
899
    <target depends="init,deps-clean,-do-clean,-post-clean" description="Clean build products." name="clean"/>
 
900
    <target name="-check-call-dep">
 
901
        <property file="${call.built.properties}" prefix="already.built."/>
 
902
        <condition property="should.call.dep">
 
903
            <not>
 
904
                <isset property="already.built.${call.subproject}"/>
 
905
            </not>
 
906
        </condition>
 
907
    </target>
 
908
    <target depends="-check-call-dep" if="should.call.dep" name="-maybe-call-dep">
 
909
        <ant antfile="${call.script}" inheritall="false" target="${call.target}">
 
910
            <propertyset>
 
911
                <propertyref prefix="transfer."/>
 
912
                <mapper from="transfer.*" to="*" type="glob"/>
 
913
            </propertyset>
 
914
        </ant>
 
915
    </target>
 
916
        
 
917
</project>