Permalink
Fetching contributors…
Cannot retrieve contributors at this time
executable file 404 lines (360 sloc) 16.4 KB
<?xml version="1.0" encoding="utf-8"?>
<project name="PCT" default="dist">
<property environment="env" />
<!-- If DLC10, DLC10-64 and DLC11 are provided as properties, then skip loading properties from file -->
<condition property="skip.properties" value="true">
<and>
<isset property="DLC10" />
<isset property="DLC10-64" />
<isset property="DLC11" />
</and>
</condition>
<property name="pct.release" value="210.pre" />
<property name="pct.version.string" value="pct-${pct.release}-${env.BRANCH_NAME}-${GIT_COMMIT}" />
<!-- Some directories definitions -->
<property name="src.java" location="src/java" />
<property name="src.progress" location="src/progress" />
<property name="src.test" location="src/test" />
<property name="build" location="build" />
<property name="build-java" location="build/java" />
<property name="build-javadoc" location="build/javadoc" />
<property name="build-test" location="build/test" />
<property name="build-v10" location="build/build-v10" />
<property name="build-v10-64" location="build/build-v10-64" />
<property name="build-v11" location="build/build-v11" />
<property name="build-win" location="build/windows" />
<property name="doc" location="doc" />
<property name="dist" location="dist" />
<!-- Properties that control Java build options -->
<property name="debug" value="true" />
<property name="deprecation" value="true" />
<property name="optimize" value="false" />
<property name="javac.source" value="1.7" />
<property name="javac.target" value="1.7" />
<!-- Different filesets depending on version -->
<fileset id="fs.v10" dir="${src.progress}">
<include name="pct/*.p" />
<include name="pct/v10/*.p" />
<include name="pct/v102b/*.p" />
</fileset>
<fileset id="fs.v11" dir="${src.progress}">
<include name="pct/*.p" />
<include name="pct/v11/*.p" />
<include name="rssw/**/*.cls" />
</fileset>
<fileset id="fs.classDoc" dir="${src.progress}">
<include name="Consultingwerk/**/*.cls" />
<include name="Consultingwerk/**/*.p" />
</fileset>
<!-- Different propath depending on version -->
<path id="pp.v8">
<pathelement location="${src.progress}" />
</path>
<path id="pp.v9">
<pathelement location="${src.progress}" />
</path>
<path id="pp.v10">
<pathelement location="${src.progress}" />
<pathelement location="lib/OEUnit_dlc10.pl" />
</path>
<path id="pp.v10-64">
<pathelement location="${src.progress}" />
<pathelement location="lib/OEUnit_dlc10-64.pl" />
</path>
<path id="pp.v11">
<pathelement location="${src.progress}" />
<pathelement location="lib/OEUnit_dlc11.pl" />
</path>
<!-- Classpath for PCT compilation -->
<path id="pct.compil">
<pathelement location="lib/ant.jar" />
<pathelement location="lib/jcommander-1.30.jar" />
<pathelement location="lib/gson-2.2.4.jar" />
<pathelement location="lib/ast.jar" />
<pathelement location="lib/ast-dependencies.jar" />
<!-- ABLDuck classes -->
<pathelement location="lib/antlr-runtime-4.7.jar"/>
<pathelement location="lib/commonmark-0.9.0.jar"/>
<pathelement location="${build-javadoc}" />
</path>
<path id="pct.test.compil">
<path refid="pct.compil" />
<pathelement location="${build-java}" />
<pathelement location="lib/testng-6.13.1.jar" />
<pathelement location="lib/ini4j-0.5.1.jar" />
<pathelement location="lib/guava.jar" />
</path>
<target name="init" description="Initialize PCT builder" depends="init-properties">
<tstamp>
<format property="year" pattern="yyyy" />
</tstamp>
<mkdir dir="${build-java}" />
<mkdir dir="${build-javadoc}" />
<mkdir dir="${build-test}" />
<mkdir dir="${build-v10}" />
<mkdir dir="${build-v10-64}" />
<mkdir dir="${build-v11}" />
<mkdir dir="${doc}" />
<mkdir dir="${dist}" />
<!-- Checking v10 and v11 availability -->
<available file="${DLC10}/version" property="dlc.v10.present" />
<available file="${DLC10-64}/version" property="dlc.v10-64.present" />
<available file="${DLC11}/version" property="dlc.v11.present" />
<echo message="Version tag : ${pct.version.string}" />
<echo file="${src.java}/com/phenix/pct/PCT.properties">PCTVersion=${pct.version.string}</echo>
</target>
<target name="init-properties" description="Initialize properties" unless="${skip.properties}">
<echo message="Loading properties from pct.build.properties" />
<property file="${basedir}/pct.build.properties" />
</target>
<target name="build" depends="init" description="Java source files compilation">
<!-- Generate javadoc classes from the antlr grammar files -->
<java jar="lib/antlr-4.7-complete.jar" fork="true">
<arg line="${src.java}/za/co/mip/ablduck/javadoc/JavadocParser.g4 ${src.java}/za/co/mip/ablduck/javadoc/JavadocLexer.g4"/>
<arg line="-o ${build-javadoc}/za/co/mip/ablduck/javadoc"/>
<arg line="-listener -no-visitor -encoding UTF-8"/>
<arg line="-package za.co.mip.ablduck.javadoc"/>
</java>
<javac srcdir="${build-javadoc}" destdir="${build-java}" debug="${debug}" source="${javac.source}" target="${javac.target}" deprecation="${deprecation}" optimize="${optimize}" encoding="utf-8" includeAntRuntime="false">
<include name="za/co/mip/**/*.java" />
<classpath refid="pct.compil" />
</javac>
<javac srcdir="${src.java}" destdir="${build-java}" debug="${debug}" source="${javac.source}" target="${javac.target}" deprecation="${deprecation}" optimize="${optimize}" encoding="utf-8" includeAntRuntime="false">
<include name="com/phenix/pct/*.java" />
<include name="net/cordova/prounit/*.java" />
<include name="eu/rssw/pct/**/*.java" />
<include name="za/co/mip/**/*.java" />
<classpath refid="pct.compil" />
</javac>
<copy todir="${build-java}">
<fileset dir="${src.java}" includes="**/*.properties" />
</copy>
</target>
<target name="jar-lite" depends="build" description="Bootstrap JAR file">
<jar jarfile="${dist}/bootstrap.jar">
<fileset dir="${build-java}">
<include name="**/*.class" />
<include name="**/*.properties" />
<exclude name="com/phenix/pct/*Test.class" />
</fileset>
</jar>
<jar jarfile="${dist}/prolib.jar">
<zipfileset src="lib/jcommander-1.30.jar" />
<fileset dir="${build-java}">
<include name="eu/rssw/pct/standalone/**/*.class" />
<include name="com/phenix/pct/PLReader*.class" />
<include name="com/phenix/pct/FileEntry.class" />
<include name="com/phenix/pct/RCodeInfo*.class" />
</fileset>
<manifest>
<attribute name="Main-Class" value="eu.rssw.pct.standalone.Prolib" />
</manifest>
</jar>
</target>
<target name="declare-bootstrap" depends="jar-lite" description="Bootstrap tasks declaration">
<taskdef resource="bootstrap.properties" classpath="${dist}/bootstrap.jar" />
</target>
<target name="cond.pbuild" if="${build.this.version}">
<exec executable="${dlcHome}/bin/_dbutil">
<arg value="procopy" />
<arg value="${dlcHome}/empty.db" />
<arg value="empty" />
<env key="DLC" value="${dlcHome}" />
</exec>
<bootstrapCompile destdir="${buildDir}" debugListing="true" listing="true" keepXref="true" xmlXref="${xmlxref}" md5="true" minSize="false" graphicalMode="false" dlcHome="${dlcHome}" includedPL="false" compileUnderscore="true" cpstream="utf-8" relativePaths="true" requireFullKeywords="true" requireFullNames="true" requireFieldQualifiers="true">
<fileset refid="${fsid}" />
<propath refid="${propid}" />
<PCTRunOption name="-cprcodeout" value="undefined" />
<PCTConnection dbName="empty" singleUser="true" logicalName="dictdb">
<PCTAlias name="dictdb" />
<PCTAlias name="dictdb2" />
</PCTConnection>
</bootstrapCompile>
<bootstrapLibrary destfile="${build}/${libName}" dlcHome="${dlcHome}" encoding="undefined">
<fileset dir="${buildDir}">
<include name="**/*.r" />
</fileset>
</bootstrapLibrary>
<delete>
<fileset dir="${basedir}" includes="empty*.*" />
</delete>
</target>
<target name="pbuild" depends="declare-bootstrap" description="Progress code compilation">
<echo message="Checking v10 in ${DLC10}" />
<echo message="Checking v10-64 in ${DLC10-64}" />
<echo message="Checking v11 in ${DLC11}" />
<antcall target="cond.pbuild">
<param name="build.this.version" value="dlc.v10.present" />
<param name="dlcHome" value="${DLC10}" />
<param name="buildDir" value="${build-v10}" />
<param name="libName" value="pct10.pl" />
<param name="fsid" value="fs.v10" />
<param name="propid" value="pp.v10" />
<param name="xmlxref" value="false" />
</antcall>
<antcall target="cond.pbuild">
<param name="build.this.version" value="dlc.v10-64.present" />
<param name="dlcHome" value="${DLC10-64}" />
<param name="buildDir" value="${build-v10-64}" />
<param name="libName" value="pct10-64.pl" />
<param name="fsid" value="fs.v10" />
<param name="propid" value="pp.v10-64" />
<param name="xmlxref" value="false" />
</antcall>
<antcall target="cond.pbuild">
<param name="build.this.version" value="dlc.v11.present" />
<param name="dlcHome" value="${DLC11}" />
<param name="buildDir" value="${build-v11}" />
<param name="libName" value="pct11.pl" />
<param name="fsid" value="fs.v11" />
<param name="propid" value="pp.v11" />
<param name="xmlxref" value="true" />
</antcall>
<zip destfile="${build}/pct-src.zip">
<fileset dir="${src.progress}" includes="**/*" excludes="Consultingwerk/Studio/ClassDocumentation/Templates/resources/**/*" />
</zip>
</target>
<target name="classDoc" depends="declare-bootstrap" description="Windows compilation of class documentation">
<mkdir dir="${build-win}" />
<bootstrapCompile destdir="${build-win}" md5="true" minSize="false" graphicalMode="true" dlcHome="${DLC11}" includedPL="false" cpstream="iso8859-1" debugListing="true" listing="true" relativePaths="true" requireFullKeywords="true" requireFullNames="true" requireFieldQualifiers="true">
<fileset refid="fs.classDoc" />
<propath>
<pathelement location="${src.progress}" />
</propath>
<PCTRunOption name="-cprcodeout" value="undefined" />
</bootstrapCompile>
<zip destFile="${dist}/classDoc.zip">
<fileset dir="${build-win}" />
</zip>
</target>
<target name="fakeClassDoc" unless="classDocOK">
<echo message="Generating fake classDoc.zip file" />
<zip destFile="${dist}/classDoc.zip" whenEmpty="create">
<fileset dir="." includes="leave.it.empty" />
</zip>
</target>
<target name="jar" depends="pbuild,test-build" description="JAR file generation">
<condition property="classDocOK">
<resourceexists><file file="${dist}/classDoc.zip" /></resourceexists>
</condition>
<antcall target="fakeClassDoc" />
<!-- Updating pct11.pl with rcode compiled on Windows -->
<mkdir dir="classDocTemp" />
<copy todir="classDocTemp">
<zipfileset src="dist/classDoc.zip" includes="**/*.r" />
</copy>
<bootstrapLibrary destfile="${build}/pct11.pl" dlcHome="${DLC11}" encoding="undefined">
<fileset dir="classDocTemp" />
</bootstrapLibrary>
<delete dir="classDocTemp" />
<jar jarfile="${dist}/PCT.jar">
<fileset dir="${build-java}">
<include name="**/*.class" />
<include name="**/*.properties" />
</fileset>
<fileset dir="${build}">
<include name="pct10.pl" />
<include name="pct10-64.pl" />
<include name="pct11.pl" />
<include name="pct-src.zip" />
</fileset>
<fileset dir="${src.java}">
<include name="eu/rssw/pct/antlib.xml" />
<include name="eu/rssw/pct/oedoc/antlib.xml" />
<include name="za/co/mip/ablduck/resources/ablduck.zip" />
</fileset>
<zipfileset src="lib/gson-2.2.4.jar" />
<!-- ABLDuck classes -->
<zipfileset src="lib/antlr-runtime-4.7.jar"/>
<zipfileset src="lib/commonmark-0.9.0.jar"/>
<zipfileset dir="${src.progress}/Consultingwerk/Studio/ClassDocumentation/Templates" prefix="templates" />
<manifest>
<attribute name="Built-By" value="${user.name}" />
<section name="common">
<attribute name="Specification-Title" value="PCT" />
<attribute name="Specification-Version" value="${pct.release}" />
<attribute name="Specification-Vendor" value="Riverside Software" />
<attribute name="Implementation-Title" value="PCT" />
<attribute name="Implementation-Version" value="${GIT_COMMIT}" />
<attribute name="Implementation-Vendor" value="Riverside Software" />
</section>
</manifest>
</jar>
</target>
<target name="test-build" depends="build" description="Builds TestNG tests">
<javac srcdir="${src.test}" destdir="${build-test}" debug="${debug}" source="${javac.source}" target="${javac.target}" deprecation="${deprecation}" optimize="${optimize}" encoding="utf-8" includeAntRuntime="false">
<include name="org/ini4j/**/*.java" />
<include name="com/phenix/pct/*.java" />
<include name="net/cordova/prounit/*.java" />
<include name="za/co/mip/ablduck/*.java" />
<classpath refid="pct.test.compil" />
</javac>
</target>
<target name="prepare-test" >
<delete dir="testbox" />
<mkdir dir="testbox" />
<mkdir dir="testbox/PCTCompileExt" />
<copy todir="testbox/PCTCompileExt">
<fileset dir="tests/PCTCompile" />
</copy>
<replace dir="testbox/PCTCompileExt" includes="test??/build.xml" token="PCTCompile" value="PCTCompileExt" />
<replace dir="testbox/PCTCompileExt" includes="test??/build.xml" token="pct:compile" value="pct:compile_ext" />
<copy todir="testbox">
<fileset dir="tests" />
</copy>
<mkdir dir="testbox/ClassDocumentation/test3/src" />
<copy todir="testbox/ClassDocumentation/test3/src">
<fileset dir="${src.progress}" includes="Consultingwerk/**/*" />
</copy>
</target>
<target name="javadoc" depends="build" description="Javadoc generation">
<javadoc destdir="${doc}" useexternalfile="yes" charset="utf-8" encoding="utf-8">
<packageset dir="${src.java}" />
<classpath>
<path refid="pct.compil" />
<pathelement location="${build-java}" />
</classpath>
<group title="PCT Core" packages="com.phenix.pct.*" />
<group title="Class documentation" packages="eu.rssw.pct.*" />
<group title="ABLDuck" packages="za.co.mip.ablduck.*" />
<group title="ProUnit" packages="net.cordova.prounit.*" />
<bottom>Copyright © 2003-${year} Gilles QUERRET. All Rights Reserved.</bottom>
<link href="https://docs.oracle.com/javase/8/docs/api/" />
<link href="https://ant.apache.org/manual/api/" />
</javadoc>
<jar destfile="${dist}/PCT-javadoc.jar">
<fileset dir="${doc}" />
</jar>
</target>
<target name="srcdist" description="Generates source zip/tarball archive">
<jar destfile="${dist}/PCT-sources.jar">
<fileset dir="src/java" />
<zipfileset dir="src/progress" prefix="progress" />
</jar>
</target>
<target name="testdist">
<zip destfile="${dist}/testcases.zip" encoding="utf-8">
<zipfileset dir="${build-test}" includes="**/*" prefix="build/test" />
<zipfileset dir="tests" includes="**/*" prefix="testbox" />
<zipfileset dir="${src.progress}" includes="Consultingwerk/**/*" prefix="testbox/ClassDocumentation/test3/src" />
<zipfileset dir="lib" includes="ast.jar,ast-dependencies.jar,ant.jar,ant-apache-regexp.jar,ant-launcher.jar,antlr4-runtime-4.5.jar,ini4j-0.5.1.jar,guava.jar,jakarta-regexp-1.5.jar,testng-6.13.1.jar,jcommander-1.30.jar,jacocoant.jar,*.pl" prefix="lib" />
<zipfileset dir="${dist}" includes="PCT.jar" prefix="dist" />
</zip>
</target>
<target name="install" depends="jar" >
<copy file="${dist}/PCT.jar" todir="${ant.library.dir}"/>
</target>
<target name="dist" depends="srcdist,javadoc,jar,testdist" />
<target name="clean" description="Nettoyage">
<delete dir="${build}" />
<delete dir="${dist}" />
<delete dir="${doc}" />
<delete>
<fileset dir=".">
<include name="pct*.tar.gz" />
<include name="pct*.zip" />
<include name="TEST*.xml" />
</fileset>
</delete>
</target>
</project>