Project

General

Profile

p2j.cfg.xml

Marc Braun, 11/20/2018 01:07 PM

Download (30.2 KB)

 
1
<project name="hotel" default="dist" basedir=".">
2

    
3
   <description>boxbuch</description>
4

    
5
   <property name="ant.contrib.dir" value="${basedir}/build/ant.contrib/" />
6
   <property name="ant.contrib.url" value="https://proj.goldencode.com/downloads/ant_contrib/ant-contrib-1.0b5.zip" />
7

    
8
   <!-- ANT-CONTRIB autoinstaller -->
9
   <available property="ant-contrib-exists" file="${ant.contrib.dir}/ant-contrib-1.0b5-SNAPSHOT.jar" />
10
   <target name="download-ant-contrib" unless="ant-contrib-exists">
11
      <mkdir dir="${ant.contrib.dir}" />
12
      <get src="${ant.contrib.url}"
13
           dest="${ant.contrib.dir}/ant-contrib-1.0b5.zip"
14
           username="true" />
15
      <unzip src="${ant.contrib.dir}/ant-contrib-1.0b5.zip"
16
             dest="${ant.contrib.dir}"
17
             overwrite="no" />
18
      <delete file="${ant.contrib.dir}/ant-contrib-1.0b5.zip" />
19
   </target>
20
   
21
   <target name="init-ant-contrib" depends="download-ant-contrib">
22
      <taskdef resource="net/sf/antcontrib/antcontrib.properties">
23
         <classpath>
24
            <fileset dir="${ant.contrib.dir}">
25
               <include name="*.jar"/>
26
            </fileset>
27
            <fileset dir="${ant.library.dir}">
28
               <include name="*.jar"/>
29
            </fileset>
30
         </classpath>
31
      </taskdef>
32
   </target>
33
      
34
   <property file="build.properties"/>
35
   
36
   <!-- a link named "p2j/" to the p2j project location must exist for this to work -->
37
   
38
   <!-- set global properties for this build -->
39
   
40
   <property name="build.home"           value="${basedir}/build" />
41
   <property name="dist.home"            value="${basedir}/distribution" /> 
42
   <property name="data.home"            value="${basedir}/data" />
43
   <property name="src.home"             value="${basedir}/src" />
44
   <property name="srcnew.home"          value="${basedir}/srcnew" />
45
   <property name="lib.home"             value="${basedir}/lib" />
46
   <property name="cfg.home"             value="${basedir}/cfg" />
47
   <property name="manifest.dir"         value="${basedir}/manifest" />
48

    
49
   <property name="p2j.home"             value="." />
50
   <property name="p2j.build.home"       value="${p2j.home}/p2j/build" />
51
   <property name="p2jlib.home"          value="${p2j.home}/p2j/build/lib" />
52
   <property name="p2jsrc.home"          value="${p2j.home}/p2j/src" />
53

    
54
   <property name="appname"              value="hotel" />
55
   <property name="pkgroot"              value="com/goldencode/${appname}" />   
56
   <property name="app.4gl.src"          value="./abl/" />   
57
   <property name="app.4gl.pattern"      value="*.[wp]" />   
58
   <property name="destination.package"  value="${build.home}/classes/${pkgroot}"/>
59
   <property name="deploy.home"          value="${basedir}/deploy" />
60
   <property name="deploy.home.abs"      location="${deploy.home}" />
61
   <property name="rpt.home"             value="${basedir}/rpt" />
62
   <property name="cg.home"              value="${basedir}/callgraph" />
63
   
64
   <!-- enable database type(s) -->
65
   <property name="db.h2"                value="true" />
66
   <property name="db.postgresql"        value="false" />
67
   
68
   <!-- sql global properties  -->
69
   <property name="db.home"              value="${deploy.home}/db" />
70
   <property name="db.host"              value="localhost" />
71
   <property name="db.port"              value="5433" />
72
   <property name="sql.user"             value="fwd_user" />
73
   <property name="sql.admin"            value="fwd_admin" />
74
   <property name="sql.user.pass"        value="user" />
75
   <property name="sql.admin.pass"       value="admin" />
76

    
77
   <condition property="isWindows">
78
      <os family="windows" />
79
   </condition>
80

    
81
   <condition property="isUnix">
82
      <os family="unix" />
83
   </condition>
84

    
85
   <condition property="escaped.quotes" value="&quot;&quot;&quot;" else="&quot;">
86
      <isset property="isWindows"  />
87
   </condition>
88

    
89
   
90
   <!--  ==================== Compilation Control Options ==================== -->
91

    
92
   <!--
93

94
     These properties control option settings on the Javac compiler when it
95
     is invoked using the <javac> task.
96

97
     compile.debug        Should compilation include the debug option?
98
     compile.deprecation  Should compilation include the deprecation option?
99
     compile.optimize     Should compilation include the optimize option?
100

101
   -->
102

    
103
   <property name="compile.debug"       value="true"/>
104
   <property name="compile.deprecation" value="false"/>
105
   <property name="compile.optimize"    value="true"/>
106
   
107
   <!-- path used when compiling Java classes -->
108
   <path id="compile.classpath">
109
      <fileset dir="${p2jlib.home}">
110
        <include name="*.jar"/>
111
     </fileset>
112
   </path>
113
   
114
   <!-- path used when running application related tasks-->
115
   <path id="app.classpath">
116
      <fileset dir="${deploy.home}/lib">
117
         <include name="*.jar"/>
118
      </fileset>
119
   </path>
120
   
121
   <tstamp>
122
      <format property="DSTAMP" pattern="yyyyMMdd" />
123
   </tstamp>
124

    
125
   <tstamp>
126
      <format property="LOG_STAMP" pattern="yyyyMMdd_HHmmss" />
127
   </tstamp>
128

    
129
   <!-- create the time stamp -->
130
   <target name="init">
131
      <tstamp/>
132

    
133
      <!-- copy embedded program code -->
134
      <copy todir="${app.4gl.src}">
135
         <fileset dir="${p2jsrc.home}/4gl/embedded/" includes="**" />
136
      </copy>
137
   </target>
138

    
139
   <!-- generate call graph -->
140
   <target name="callgraph" depends="convert.front, convert.front.list" description="Parse the project and create the call graph.">
141
      <record name="callgraph_${LOG_STAMP}.log" action="start"/>
142
      <java classname="com.goldencode.p2j.uast.CallGraphGenerator"
143
            fork="true"
144
            failonerror="true"
145
            dir="${basedir}" >
146
         <jvmarg value="-server"/>
147
         <jvmarg value="-Xmx2G"/>
148
         <jvmarg value="-XX:-OmitStackTraceInFastThrow"/>
149
         <jvmarg value="-DP2J_HOME=${p2j.home}"/>
150
         <arg value ="-d2"/>
151
         <classpath refid="compile.classpath"/>
152
      </java>
153
      <record name="callgraph_${LOG_STAMP}.log" action="stop"/>
154
   </target>
155

    
156
   <!-- generate call graph, without parsing -->
157
   <target name="callgraph-no-front" depends="init" description="Parse the project and create the call graph.">
158
      <record name="callgraph_${LOG_STAMP}.log" action="start"/>
159
      <java classname="com.goldencode.p2j.uast.CallGraphGenerator"
160
            fork="true"
161
            failonerror="true"
162
            dir="${basedir}" >
163
         <jvmarg value="-server"/>
164
         <jvmarg value="-Xmx8G"/>
165
         <jvmarg value="-XX:-OmitStackTraceInFastThrow"/>
166
         <jvmarg value="-DP2J_HOME=${p2j.home}"/>
167
         <arg value ="-d2"/>
168
         <classpath refid="compile.classpath"/>
169
      </java>
170
      <record name="callgraph_${LOG_STAMP}.log" action="stop"/>
171
   </target>
172

    
173
   <!-- update the call graph, without parsing -->
174
   <target name="callgraph-update" depends="init" description="Parse the project and create the call graph.">
175
      <record name="callgraph_${LOG_STAMP}.log" action="start"/>
176
      <java classname="com.goldencode.p2j.uast.CallGraphGenerator"
177
            fork="true"
178
            failonerror="true"
179
            dir="${basedir}" >
180
         <jvmarg value="-server"/>
181
         <jvmarg value="-Xmx8G"/>
182
         <jvmarg value="-XX:-OmitStackTraceInFastThrow"/>
183
         <jvmarg value="-DP2J_HOME=${p2j.home}"/>
184
         <arg value ="-d2"/>
185
         <arg value ="-u"/>
186
         <classpath refid="compile.classpath"/>
187
      </java>
188
      <record name="callgraph_${LOG_STAMP}.log" action="stop"/>
189
   </target>
190

    
191
   <!-- generate all reports -->
192
   <target name="rpt-no-front"
193
           depends="init, init-ant-contrib"
194
           description="Generate code and schema reports from the already parsed project.">
195
      <record name="rpt_schema_${LOG_STAMP}.log" action="start"/>
196
      <var name="db.schema.files" value=""/>
197
      <for list="${db.names}" param="db.name">
198
         <sequential>
199
            <var name="db.schema.files" value="${db.schema.files} data/namespace/@{db.name}.dict"/>
200
         </sequential>
201
      </for>
202
      
203
      <java classname="com.goldencode.p2j.report.ReportDriver"
204
            fork="true"
205
            failonerror="true"
206
            dir="${basedir}" >
207
         <jvmarg value="-server"/>
208
         <jvmarg value="-Xmx4G"/>
209
         <jvmarg value="-XX:-OmitStackTraceInFastThrow"/>
210
         <jvmarg value="-DP2J_HOME=${p2j.home}"/>
211
         <jvmarg value="-DappAdminPass=${appname}"/>
212
         <arg value="-Td2"/>
213
         <arg value="reports/schema"/>
214
         <arg value="${app.4gl.src}"/>
215
         <arg value="*.dict"/>
216
         <arg line="${db.schema.files}"/>
217
         <classpath refid="compile.classpath"/>
218
      </java>
219
      <record name="rpt_schema_${LOG_STAMP}.log" action="stop"/>
220
      <record name="rpt_code_${LOG_STAMP}.log" action="start"/>
221
      <java classname="com.goldencode.p2j.report.ReportDriver"
222
            fork="true"
223
            failonerror="true"
224
            dir="${basedir}" >
225
         <jvmarg value="-server"/>
226
         <jvmarg value="-Xmx4G"/>
227
         <jvmarg value="-XX:-OmitStackTraceInFastThrow"/>
228
         <jvmarg value="-DP2J_HOME=${p2j.home}"/>
229
         <arg value="-Sd2"/>
230
         <arg value="reports/profile"/>
231
         <arg value="${app.4gl.src}"/>
232
         <arg value="*.ast"/>
233
         <classpath refid="compile.classpath"/>
234
      </java>
235
      <record name="rpt_code_${LOG_STAMP}.log" action="stop"/>
236

    
237
      <echo message="Report generation finished."/>
238
   </target>
239

    
240
   <target name="rpt"
241
           depends="convert.front, convert.front.list, rpt-no-front"
242
           description="Parse the project and generate code and schema reports.">
243
   </target>
244
   
245
   <!-- generate everything that the report server can support -->
246
   <target name="report_server" depends="rpt, callgraph" description="Parse the project, generate schema/code reports and create the call graph." />
247
   
248
   <target name="check-file-cvt-list">
249
      <available file="file-cvt-list.txt" property="file-cvt-list"/>
250
   </target>
251

    
252
   <!-- convert Progress code from ${app.4gl.src} into ${src}, using ${app.4gl.pattern} pattern -->
253
   <target name="convert"
254
           depends="init, check-file-cvt-list"
255
           description="Convert the Progress ABL source code to Java source code, using a pattern as input."
256
           unless="file-cvt-list">
257
      <record name="cvt_${LOG_STAMP}.log" action="start"/>
258
      <java classname="com.goldencode.p2j.convert.ConversionDriver"
259
            fork="true"
260
            failonerror="true"
261
            dir="${basedir}">
262
         <jvmarg value="-server"/>
263
         <jvmarg value="-Xmx4G"/>
264
         <jvmarg value="-XX:-OmitStackTraceInFastThrow"/>
265
         <jvmarg value="-DP2J_HOME=${p2j.home}"/>
266
         <arg value="-Sd2"/>
267
         <arg value="f2+m0+cb"/>
268
         <arg value="${app.4gl.src}"/>
269
         <arg value="${app.4gl.pattern}"/>
270
         <classpath refid="compile.classpath"/>
271
      </java>
272
      <record name="cvt_${LOG_STAMP}.log" action="stop"/>
273
   </target>
274
        
275
   <!-- convert Progress code from ${app.4gl.src} into ${src}, using an explicit file list, in file-cvt-list.txt -->
276
   <target name="convert.list"
277
           depends="init, check-file-cvt-list"
278
           description="Convert the Progress ABL source code to Java source code, using a file-cvt-list.txt as input."
279
           if="file-cvt-list">
280
      <record name="cvt_${LOG_STAMP}.log" action="start"/>
281
      <java classname="com.goldencode.p2j.convert.ConversionDriver"
282
            fork="true"
283
            failonerror="true"
284
            dir="${basedir}">
285
         <jvmarg value="-server"/>
286
         <jvmarg value="-Xmx4G"/>
287
         <jvmarg value="-XX:-OmitStackTraceInFastThrow"/>
288
         <jvmarg value="-DP2J_HOME=${p2j.home}"/>
289
         <arg value="-Fd2"/>
290
         <arg value="f2+m0+cb"/>
291
         <arg value="file-cvt-list.txt"/>
292
         <classpath refid="compile.classpath"/>
293
      </java>
294
      <record name="cvt_${LOG_STAMP}.log" action="stop"/>
295
   </target>
296
   
297
   <target name="convert.front" depends="init, check-file-cvt-list" description="Execute the parse phase of the conversion process, using a pattern as input." unless="file-cvt-list">
298
      <record name="cvt_f2_${LOG_STAMP}.log" action="start"/>
299
      <java classname="com.goldencode.p2j.convert.ConversionDriver"
300
            fork="true"
301
            failonerror="true"
302
            dir="${basedir}">
303
         <jvmarg value="-server"/>
304
         <jvmarg value="-Xmx4G"/>
305
         <jvmarg value="-XX:-OmitStackTraceInFastThrow"/>
306
         <jvmarg value="-DP2J_HOME=${p2j.home}"/>
307
         <arg value="-Sd2"/>
308
         <arg value="f2"/>
309
         <arg value="${app.4gl.src}"/>
310
         <arg value="${app.4gl.pattern}"/>
311
         <classpath refid="compile.classpath"/>
312
      </java>
313
      <record name="cvt_f2_${LOG_STAMP}.log" action="stop"/>
314
   </target>
315

    
316
   <target name="convert.front.list" depends="init, check-file-cvt-list" description="Execute the parse phase of the conversion process, using the file named 'file-cvt-list.txt' as input." if="file-cvt-list">
317
      <record name="cvt_f2_${LOG_STAMP}.log" action="start"/>
318
      <java classname="com.goldencode.p2j.convert.ConversionDriver"
319
            fork="true"
320
            failonerror="true"
321
            dir="${basedir}">
322
         <jvmarg value="-server"/>
323
         <jvmarg value="-Xmx4G"/>
324
         <jvmarg value="-XX:-OmitStackTraceInFastThrow"/>
325
         <jvmarg value="-DP2J_HOME=${p2j.home}"/>
326
         <arg value="-Fd2"/>
327
         <arg value="f2"/>
328
         <arg value="file-cvt-list.txt"/>
329
         <classpath refid="compile.classpath"/>
330
      </java>
331
      <record name="cvt_f2_${LOG_STAMP}.log" action="stop"/>
332
   </target>
333
   
334
   <target name="convert.middle" depends="init, check-file-cvt-list" description="Execute the parse and schema conversion phases of the conversion process, using a pattern as input." unless="file-cvt-list">
335
      <record name="cvt_f2m0_${LOG_STAMP}.log" action="start"/>
336
      <java classname="com.goldencode.p2j.convert.ConversionDriver"
337
            fork="true"
338
            failonerror="true"
339
            dir="${basedir}">
340
         <jvmarg value="-server"/>
341
         <jvmarg value="-Xmx4G"/>
342
         <jvmarg value="-XX:-OmitStackTraceInFastThrow"/>
343
         <jvmarg value="-DP2J_HOME=${p2j.home}"/>
344
         <arg value="-Sd2"/>
345
         <arg value="f2+m0"/>
346
         <arg value="${app.4gl.src}"/>
347
         <arg value="${app.4gl.pattern}"/>
348
         <classpath refid="compile.classpath"/>
349
      </java>
350
      <record name="cvt_f2m0_${LOG_STAMP}.log" action="stop"/>
351
   </target>
352
   
353
   <target name="convert.middle.list" depends="init, check-file-cvt-list" description="Execute the parse and schema conversion phases of the conversion process, using the file named 'file-cvt-list.txt' as input." if="file-cvt-list">
354
      <record name="cvt_f2m0_${LOG_STAMP}.log" action="start"/>
355
      <java classname="com.goldencode.p2j.convert.ConversionDriver"
356
            fork="true"
357
            failonerror="true"
358
            dir="${basedir}">
359
         <jvmarg value="-server"/>
360
         <jvmarg value="-Xmx4G"/>
361
         <jvmarg value="-XX:-OmitStackTraceInFastThrow"/>
362
         <jvmarg value="-DP2J_HOME=${p2j.home}"/>
363
         <arg value="-Fd2"/>
364
         <arg value="f2+m0"/>
365
         <arg value="file-cvt-list.txt"/>
366
         <classpath refid="compile.classpath"/>
367
      </java>
368
      <record name="cvt_f2m0_${LOG_STAMP}.log" action="stop"/>
369
   </target>
370

    
371
   <!-- make sure the p2j project code is compiled -->
372
   <target name="p2j-build" depends="check.p2j.dir" description="Compile the P2J project." >
373
      <!-- compile the java code from ${src} into ${build} 
374
      <ant antfile="build.xml" target="all" dir="p2j" inheritall="false" inheritrefs="false"/>
375
      -->
376
   </target>
377
  
378
   <!-- compile -->
379
   <target name="compile"
380
           depends="init, check.p2j.dir, clean.build, p2j-build, prepare"
381
           description="Compiles the converted application Java source code.  Does NOT convert, create jars or deploy." >
382
           
383
      <record name="build_${LOG_STAMP}.log" action="start"/>
384
      <!-- Compile DMO and UI classes only -->
385
      <javac srcdir="${src.home}"
386
             destdir="${build.home}/classes"
387
             includes="${pkgroot}/dmo/**
388
                       ${pkgroot}/ui/**"
389
             debug="${compile.debug}"
390
             deprecation="${compile.deprecation}"
391
             memoryMaximumSize="4G"
392
             fork="true"
393
             optimize="${compile.optimize}"
394
             includeantruntime="false" >   
395
         <classpath refid="compile.classpath"/>
396
      </javac>
397

    
398
      <!-- Compile all other classes -->
399
      <javac srcdir="${src.home}"
400
             destdir="${build.home}/classes"
401
             debug="${compile.debug}"
402
             deprecation="${compile.deprecation}"
403
             memoryMaximumSize="4G"
404
             fork="true"
405
             optimize="${compile.optimize}"
406
             includeantruntime="false" >   
407
         <classpath refid="compile.classpath"/>
408
      </javac>
409

    
410
      <record name="build_${LOG_STAMP}.log" action="stop"/>
411
      <echo message="Compiling Java Sources Done."/>
412
   </target>
413
   
414
   <target name="prepare.embedded">
415
      <!-- FWD scripts/css to embedded/src/resources -->
416
      <copy todir="${basedir}/embedded/src/resources/fwd/">
417
         <fileset dir="${p2j.home}/p2j/src/com/goldencode/p2j/ui/client/gui/driver/web/res/">
418
            <include name="p2j.emain.js"/>
419
            <include name="p2j.embedded.js"/>
420
         </fileset>
421
      </copy>
422
      
423
      <!-- copy adm_windows.json to embedded/src/resources -->
424
      <copy file="${basedir}/adm_windows.json" todir="${basedir}/embedded/src/resources/"/>
425

    
426
      <!-- copy custom embedded sources and data to the main app -->
427
      <copy todir="src/${pkgroot}/embedded/">
428
         <fileset dir="embedded/src/resources/custom/" />
429
      </copy>
430
      <copy todir="src/${pkgroot}/embedded/">
431
         <fileset dir="embedded/src/resources/">
432
            <include name="adm_windows.json"/>
433
            <include name="index.html"/>
434
         </fileset>
435
      </copy>
436

    
437
      <!-- copy embedded resources -->
438
      <copy todir="${build.home}/classes">
439
         <fileset dir="${src.home}" includes="${pkgroot}/embedded/**" />
440
      </copy>
441

    
442
   </target>
443

    
444
   <target name="prepare" depends="prepare.embedded">
445

    
446
      <!-- create build directories as needed -->
447
      
448
      <mkdir dir="${build.home}" />
449
      <mkdir dir="${build.home}/lib" />
450
      <mkdir dir="${build.home}/classes" />
451
      
452
      <!-- create distribution directory as needed -->
453
      
454
      <mkdir dir="${dist.home}" />
455
      <mkdir dir="${dist.home}/docs/api" />
456
      
457
      <!-- copy external jars -->
458
      
459
      <mkdir dir="${lib.home}" />
460
      <copy todir="${build.home}/lib">
461
         <fileset dir="${lib.home}" />
462
      </copy>
463
      
464
      <!-- create src dir -->
465
      <mkdir dir="${src.home}" />
466
      
467
      <!-- copy application graphics -->
468
      <copy todir="${build.home}/classes/${pkgroot}">
469
         <fileset dir="${app.4gl.src}" includes="**/*.png **/*.jpg **/*.bmp **/*.ico" />
470
      </copy>
471

    
472
      <!-- copy all XML documents -->
473
      <copy todir="${build.home}/classes">
474
         <fileset dir="${src.home}" includes="**/*.xml" />
475
      </copy>
476
      
477
      <!-- Copy ehcache production config file into classpath -->
478
      <copy file="${cfg.home}/ehcache.xml"
479
            tofile="${build.home}/classes/ehcache.xml" />   
480

    
481
      <!-- Copy SQL scripts from src to equivalent location in build -->
482
      <copy todir="${build.home}/classes">
483
         <fileset dir="${src.home}" includes="**/*.sql" />
484
      </copy>
485

    
486
      <!-- Copy name_map.cache file to root of build -->
487
      <copy file="${basedir}/name_map.cache" failonerror="false"
488
            todir="${build.home}/classes" />
489

    
490
      <!-- Copy p2j.cfg.xml* from src to equivalent location in build -->
491
      <copy todir="${build.home}/classes/cfg">
492
         <fileset dir="${cfg.home}" includes="p2j.cfg.xml* registry.xml" />
493
      </copy>
494

    
495
      <!-- Copy data/ from src to equivalent location in build -->
496
      <copy todir="${build.home}/classes/data">
497
         <fileset dir="${data.home}" includes="**/*.dict" />
498
         <fileset dir="${data.home}" includes="**/*.p2o" />
499
      </copy>
500

    
501
      <!-- Copy data ASTs to equivalent location in build -->
502
      <copy todir="${build.home}/classes">
503
         <fileset dir="${data.home}" includes="**/*.dict, **/*.schema, **/*.p2o" />
504
      </copy>
505
   </target>
506
   
507
   <!-- jar -->  
508
   <target name="jar" depends="check.p2j.dir,compile" description="Compiles and Jars the converted application Java source code.  Does NOT convert or deploy." >
509
      <jar jarfile="${build.home}/lib/${appname}.jar"
510
           basedir="${build.home}/classes"
511
           includes="**/${pkgroot}/**
512
                     dmo-index*.dtd
513
                     dir_schema_ext.xml
514
                     ehcache.xml
515
                     *.jasper
516
                     **.xml
517
                     cfg/**
518
                     data/**
519
                     **/*.png
520
                     **/*.jpg
521
                     **/*.bmp
522
                     **/*.ico"
523
           manifest="${manifest.dir}/${appname}.mf"
524
           index="true"   />
525
   </target>      
526

    
527
   <!-- zip-hints -->
528
   <target name="zip-hints" description="Creates a zip archive with all the .hints files in the abl/ and data/ folders." >
529
      <delete file="${appname}_hints.zip"/>
530
      <zip destfile="${appname}_hints.zip"
531
           basedir="."
532
           includes="abl/**/*.hints" />
533
      <zip destfile="${appname}_hints.zip"
534
           basedir="."
535
           includes="data/**/*.hints" 
536
           update="true"/>
537
   </target>
538

    
539
   <!-- deploy the application jars and database -->
540
   <target name="deploy.all"
541
           depends="clean, clean.dist, convert, convert.list, jar, deploy.prepare, import.db "
542
           description="Convert, compile the converted Java sources, create jars, deploys the jars and creates/imports the database." >
543
   </target>
544
   
545
   <!-- deploy the application jars and database -->
546
   <target name="deploy"
547
           depends="clean, clean.dist, convert, convert.list, jar, deploy.prepare"
548
           description="Convert, compile the converted Java sources, create jars, deploys the jars.  Does NOT create/import the database." >
549
   </target>
550
   
551
   <target name="deploy.dist" description="Create an archive with the application jars and other files required for deployment on other systems.">
552
      <mkdir dir="${dist.home}/"/>
553
      <zip destfile="${dist.home}/${appname}_jars_deploy_${DSTAMP}.zip" basedir="${basedir}" 
554
           includes="build/lib/*.jar
555
                     adm_windows.json
556
                     name_map.cache
557
                     ddl/*
558
                     data/namespace/*
559
                     cfg/registry.xml" />
560
   </target>
561

    
562
   <!-- deploy the application jars and database -->
563
   <target name="deploy.prepare" depends="prepare.embedded"
564
           description="Deploys the generated jars by copying them to the location expected by the runtime scripts." >
565
           
566
      <!-- create the deploy lib folder -->
567
      <mkdir dir="${deploy.home}/lib"/>
568
      
569
      <!-- copy the required jars to the distibution directory -->
570
      <copy file="${build.home}/lib/${appname}.jar" tofile="${deploy.home}/lib/${appname}.jar"/>
571

    
572
      <!-- Copy external jars -->
573
      <copy todir="${deploy.home}/lib">
574
        <!--  exclude the AspectJ tools -->
575
        <fileset dir="${p2jlib.home}" excludes="aspectjtools.jar"/>
576
      </copy>
577
   </target>
578
   
579
   <target name="dist" depends="deploy.all" description="Does a deploy.all and then tars the result." >
580
      <mkdir dir="${dist.home}"/>
581
      <tar destfile="${dist.home}/${appname}-${DSTAMP}.tar" basedir="${deploy.home}" />
582
   </target>
583
   
584
   <target name="dist.abl" depends="init" description="Create a zip archive with the files needed to run the sample on OpenEdge" >
585
      <mkdir dir="${dist.home}/"/>
586
      <zip destfile="${dist.home}/${appname}-abl-${DSTAMP}.zip" basedir="${basedir}" 
587
           includes="abldb/
588
                     *.bat
589
                     *.ini
590
                     *.pf
591
                     start_*_abl.cmd
592
                     abl/**/*
593
                     data/*.df
594
                     data/dump/**/*.d"/>
595
   </target>
596
   
597
   <target name="clean.build" description="Remove all built files from the conversion process." >
598
      <delete includeemptydirs="true" failonerror="false">
599
         <fileset dir="${build.home}">
600
            <include name="**/*"/>
601
            <exclude name="ant.contrib/**"/>
602
         </fileset>
603
      </delete>
604

    
605
      <delete dir="${deploy.home}/spawner"/>
606
      <delete>
607
         <fileset dir="${deploy.home}/lib" includes="*" />
608
      </delete>
609
      <delete>
610
         <fileset dir="${deploy.home}/client/" includes="*.log" />
611
      </delete>
612
      <delete>
613
         <fileset dir="${deploy.home}/server/" includes="*.log" />
614
      </delete>
615
      <delete dir="${dist.home}"/>
616
   </target>
617
   
618
   <target name="clean" description="Remove all generated files from the conversion process." >
619
      <delete includeemptydirs="true" failonerror="false">
620
         <fileset dir="${basedir}/src"
621
            includes="**/*"
622
            excludes="text-metrics.xml
623
                      font-metrics.xml" /> 
624
      </delete>
625
      <!-- only delete the src dir if it is empty -->
626
      <delete includeemptydirs="true" failonerror="false">
627
        <fileset dir="${src.home}" excludes="**/*" />
628
      </delete>
629
      <delete dir="${basedir}/ddl"/>
630
      <delete dir="${basedir}/local"/>
631
      <delete dir="${basedir}/com"/>
632
      <delete dir="${basedir}/lib"/>
633
      <delete dir="${basedir}/rptdb"/>
634
      <delete>
635
         <fileset dir="${app.4gl.src}" 
636
                  includes="**/*.pphints 
637
                            **/*.cache
638
                            **/*.lexer 
639
                            **/*.parser 
640
                            **/*.ast
641
                            **/*.ast.original
642
                            **/*.jast 
643
                            **/*.dict
644
                            **/*.p2o
645
                            **/*.schema
646
                            **/*.log" />
647
      </delete>
648
      <delete>
649
         <fileset dir="${basedir}/data/namespace" includes="*.dict *.p2o *.schema" />
650
      </delete>
651
      <delete>
652
         <fileset dir="${basedir}" includes="schema_names*.rpt *.log " />
653
      </delete>
654
      <delete file="ui_strings.txt"/>
655
      <delete file="orphan-frames.dat"/>
656
      <delete file="schema-triggers.xml"/>
657
      <delete file="internal_procedures.xml"/>
658
      <delete file="name_map.cache"/>
659
      <delete file="file_sys.xml"/>
660
      <delete file="name_map.xml"/>
661
      <delete file="function_return_types.xml"/>
662
      <delete file="duplicate_function_return_types.xml"/>
663
      <delete file="cfg/registry.xml"/>
664

    
665
      <delete file="adm_windows.json"/>
666
      <delete file="embedded/src/resources/adm_windows.json"/>
667
      <delete file="${app.4gl.src}/fwd-embedded-driver.p"/>
668
   </target>
669
   
670
   <!-- delete the ${build} and ${dist} directory trees -->
671
   <target name="clean.dist" description="Remove the distribution (docs and tar files) directories." >
672
      <delete dir="${dist.home}"/>
673
   </target>   
674
   
675
   <target name="dir.check">
676
      <condition property="dir.exists">
677
         <available file="${p2j.home}" type="dir"/>
678
      </condition>
679
   </target>
680
     
681
   <target name="check.p2j.dir" depends="dir.check" unless="dir.exists">
682
      <echo>"${p2j.home} directory is missing.  Please add a link to the P2J directory location."</echo>
683
   </target>
684

    
685
   <!-- delete the ${rpt.home} directory trees -->
686
   <target name="clean.rpt" description="Remove generated reports directory.">
687
      <delete dir="${rpt.home}" /> 
688
   </target>
689
   
690
   <!-- delete the ${cg.home} directory trees -->
691
   <target name="clean.cg" description="Remove generated call graph.">
692
      <delete dir="${cg.home}" /> 
693
      <delete file="callgraph.graphml" /> 
694
   </target>
695
   
696
   <!-- Remove all traces of conversion, import or execution of the result (generated files, logs, imported dbs). -->
697
   <target name="clean.all"
698
           depends="clean, clean.build, clean.db, clean.rpt, clean.cg"
699
           description="Remove all traces of conversion, reporting, callgraph analysis, import or execution of the result (generated files, logs, imported dbs)." >
700
   </target>
701
   
702
   <target name="clean.db" description="Drop all databases."
703
           depends="clean.db.h2, clean.db.pg" />
704

    
705
   <target name="create.db" depends="create.db.h2, create.db.pg"
706
           description="Create empty database instance for all enabled database types." />
707
   
708
   <target name="import.db" depends="import.db.h2, import.db.pg"
709
           description="Create empty database instance and import data for all enabled database types." />
710

    
711
   <target name="db.task" depends="init-ant-contrib">
712
      <for list="${db.names}" param="db.name">
713
         <sequential>
714
            <ant antfile="build_db.xml" inheritRefs="true" target="${db.task}">
715
               <property name="db.name" value="@{db.name}"/>
716
            </ant>
717
         </sequential>
718
      </for>
719
   </target>
720

    
721
   <!-- drop the H2 database by deleting the ${db.home} directory -->
722
   <target name="clean.db.h2" description="Remove generated database directory." if="${db.h2}">
723
      <antcall target="db.task" inheritRefs="true">
724
         <param name="db.task" value="clean.db.h2"/>
725
      </antcall>
726
   </target>
727

    
728
   <target name="create.db.h2" depends="check.p2j.dir, init, clean.db.h2"
729
           description="Creates an empty H2 database instance using the DDL generated during conversion."
730
           if="${db.h2}">
731
      <antcall target="db.task" inheritRefs="true">
732
         <param name="db.task" value="create.db.h2"/>
733
      </antcall>
734
   </target>
735
   
736
   <target name="import.db.h2" depends="create.db.h2"
737
           description="Import data (.d files) into database."
738
           if="${db.h2}">
739
      <antcall target="db.task" inheritRefs="true">
740
         <param name="db.task" value="import.db.h2"/>
741
      </antcall>
742
   </target>
743

    
744
   <!-- drop the PostgreSQL database -->
745
   <target name="clean.db.pg" description="Drop PostgreSQL database." if="${db.postgresql}">
746
      <antcall target="db.task" inheritRefs="true">
747
         <param name="db.task" value="clean.db.pg"/>
748
      </antcall>
749
   </target>
750
   
751
   <target name="create.db.pg" depends="check.p2j.dir, init, clean.db.pg"
752
           description="Create an empty PostgreSQL database instance using the DDL generated during conversion."
753
           if="${db.postgresql}">
754
      <antcall target="db.task" inheritRefs="true">
755
         <param name="db.task" value="create.db.pg"/>
756
      </antcall>
757
   </target>
758
   
759
   <target name="import.db.pg" depends="create.db.pg"
760
           description="Import data (.d files) into PostgreSQL database."
761
           if="${db.postgresql}">
762
      <antcall target="db.task" inheritRefs="true">
763
         <param name="db.task" value="import.db.pg"/>
764
      </antcall>
765
   </target>
766
</project> 
767