Project

General

Profile

coverage.patch

Florin Eugen Rotaru, 06/12/2025 06:44 AM

Download (4.42 KB)

View differences:

new/build.xml 2025-06-12 10:38:42 +0000
1
<project name="hotel" default="dist" basedir=".">
1
<project name="hotel" default="dist" basedir="." xmlns:if="ant:if">
2 2

  
3 3
   <description>Hotel Management</description>
4 4

  
......
70 70
   <property name="deploy.home.abs"      location="${deploy.home}" />
71 71
   <property name="rpt.home"             value="${basedir}/rpt" />
72 72
   <property name="cg.home"              value="${basedir}/callgraph" />
73

  
74
   <property name="jacoco.exec"          value="${basedir}/coverage/jacoco.exec"/>
73 75
   
74 76
   <!-- enable database type(s) -->
75 77
   <property name="db.h2"                value="true" /> <!-- default, if none specified in build.properties -->
......
151 153
      <format property="LOG_STAMP" pattern="yyyyMMdd_HHmmss" />
152 154
   </tstamp>
153 155

  
156
   <target name="init-jacoco">
157
      <taskdef if:set="coverage" name="jacocoagent" classname="org.jacoco.ant.AgentTask">
158
         <classpath>
159
            <pathelement location="${deploy.home}/lib/org.jacoco.ant-0.8.13.jar"/>
160
            <pathelement location="${deploy.home}/lib/org.jacoco.core-0.8.13.jar"/>
161
            <pathelement location="${deploy.home}/lib/org.jacoco.agent-0.8.13.jar"/>
162
         </classpath>
163
      </taskdef>
164

  
165
      <taskdef if:set="coverage" name="jacocoreport" classname="org.jacoco.ant.ReportTask">
166
         <classpath>
167
            <pathelement location="${deploy.home}/lib/org.jacoco.ant-0.8.13.jar"/>
168
            <pathelement location="${deploy.home}/lib/org.jacoco.core-0.8.13.jar"/>
169
            <pathelement location="${deploy.home}/lib/org.jacoco.report-0.8.13.jar"/>
170
            <fileset dir="${deploy.home}/lib">
171
               <include name="asm*9.8.jar"/>
172
            </fileset>
173
         </classpath>
174
      </taskdef>
175

  
176
      <jacocoagent if:set="coverage" property="agentvmparam" destfile="${jacoco.exec}"/>
177
   </target>
178

  
154 179
   <!-- create the time stamp -->
155 180
   <target name="init" depends="check.fwd.dir">
156 181
      <tstamp/>
......
321 346
      <record name="cvt_${LOG_STAMP}.log" action="stop"/>
322 347
   </target>
323 348
	
349
   <target name="coverage-report">
350
      <jacocoreport>
351
         <executiondata>
352
            <file file="${jacoco.exec}"/>
353
         </executiondata>
354
         <structure name="JaCoCo Report">
355
            <classfiles>
356
               <fileset dir="${fwd.build.home}/classes/com/goldencode/p2j">
357
                  <include name="**/*.class"/>
358
               </fileset>
359
            </classfiles>
360
            <sourcefiles encoding="UTF-8">
361
               <fileset dir="${fwd.src.home}">
362
                  <include name="**/*.java"/>
363
               </fileset>
364
            </sourcefiles>
365
         </structure>
366
         <html destdir="coverage"/>
367
      </jacocoreport>
368
   </target>
369

  
324 370
   <!-- convert 4GL code from ${app.4gl.src} into ${src}, using a fileset -->
325 371
   <target name="convert.zset"
326
           depends="init, check-zfile-set"
372
           depends="init-jacoco, init, check-zfile-set"
327 373
           description="Convert the 4GL source code to Java source code, using the z-file set file as input."
328 374
           if="zfile-set">
329 375
      <record name="cvt_${LOG_STAMP}.log" action="start"/>
......
332 378
            fork="true"
333 379
            failonerror="true"
334 380
            dir="${basedir}">
381
         <jvmarg if:set="coverage" value="${agentvmparam}"/>
335 382
         <jvmarg value="-server"/>
336 383
         <jvmarg value="-Xmx${conversionHeap}"/>
337 384
         <jvmarg value="-XX:-OmitStackTraceInFastThrow"/>
......
342 389
         <classpath refid="compile.classpath"/>
343 390
      </java>
344 391
      <record name="cvt_${LOG_STAMP}.log" action="stop"/>
392
      <antcall if:set="coverage" target="coverage-report"/>
345 393
   </target>
346 394
   
347 395
   <target name="convert.front" 
......
836 884
           description="Deploys the generated jars for the application (not FWD) by copying them to the location expected by the runtime scripts." >
837 885
           
838 886
      <!-- copy the required jars to the distribution directory -->
839
      <copy file="${build.home}/lib/${appname}.jar" todir="${deploy.home}/lib"/>      
887
      <copy file="${build.home}/lib/${appname}.jar" todir="${deploy.home}/lib" failonerror="false"/>      
840 888
   </target>
889

  
841 890
   <target name="deployapp.prepare.java8" unless="java_11_spi"
842 891
           description="Deploys the FWD *and* generated jars by copying them to the location expected by the runtime scripts, Java 8 version." >
843 892