P3/COBOL use with ANT
P3/COBOL can be used with the ANT build system. Feel free to use, modify and extend the following sample:
<?xml version="1.0" encoding="UTF-8"?>
<project name="P3/COBOL - ANT example" basedir="." default="jar">
<property name="p3home" value="/opt/p3cobol"/>
<!--
<property environment="env"/>
<property name="p3home" value="${env.P3_HOME}"/>
<property name="p3home" value="C:/PROGRA~1/p3cobol"/>
-->
<property name="report" value="${basedir}/build/report"/>
<!-- clean -->
<target name="clean">
<delete dir="${basedir}/bin" />
<delete dir="${basedir}/bin-cobol" />
<delete dir="${basedir}/build" />
<delete dir="${basedir}/lst" />
<mkdir dir="${basedir}/bin"/>
</target>
<!-- build -->
<target name="build" depends="clean">
<java classpath="${p3home}/lib/p3cobol.jar"
classname="com.turrettech.launch.P3BuildLauncher"
fork="true"
failonerror="true">
<sysproperty key="com.turrettech.p3cobol.common.Emojis.ACTIVE" value="true"/>
<sysproperty key="com.turrettech.launch.P3BuildLauncher.REPORT_DIR" value="${report}"/>
<arg line="-c compiler.p3c"/>
<arg line="src-cobol/*.cbl"/>
<arg line="--report"/>
</java>
</target>
<!-- jar -->
<target name="jar" depends="build">
<jar destfile="${basedir}/build/libs/app.jar">
<fileset dir="${basedir}/bin" includes="**/*.class" />
<fileset dir="${basedir}/bin-cobol" includes="**/*" excludes="**/*.java" />
</jar>
</target>
</project>