seeddms-code/build.xml
2023-12-15 14:19:49 +01:00

212 lines
10 KiB
XML

<?xml version="1.0" encoding="UTF-8"?>
<project name="seeddms" basedir="." default="main">
<property name="tmp" value="/tmp" />
<property name="package" value="${phing.project.name}" override="true" />
<property name="seeddmsurl" value="http://localhost/seeddms51x" />
<property name="builddir" value="${tmp}/build/${phing.project.name}" override="true" />
<property name="srcdir" value="${project.basedir}" override="true" />
<property name="datadir" value="" override="true" />
<property name="dbtype" value="sqlite" override="true" />
<property name="dbhost" value="" override="true" />
<property name="dbuser" value="" override="true" />
<property name="dbpass" value="" override="true" />
<property name="dbname" value="" override="true" />
<property name="version" value="-" />
<property name="shortversion" value="${version}" />
<propertyregex property="shortversion" subject="${version} kk" pattern="([56])\.([0-9]).*" replace="seeddms$1$2x" override="true"/>
<property name="majorversion" value="${version}" />
<propertyregex property="majorversion" subject="${version}" pattern="([56])\..*" replace="$1" override="true"/>
<property name="composer_version" value="2.2.22" />
<property name="composer_extra_params" value="" />
<property name="composer_env" value="" />
<property name="mink_driver" value="chrome" />
<property name="snooze_multiplier" value="1" />
<fileset id="distfiles" dir=".">
<include name="languages/**" />
<include name="op/**" />
<include name="out/**" />
<include name="inc/**" />
<include name="controllers/**" />
<include name="styles/**" />
<include name="views/bootstrap*/**" />
<include name="utils/**" />
<include name="doc/**" />
<include name="webdav/**" />
<include name="install/**" />
<include name="restapi/**" />
<include name="pdfviewer/**" />
<include name="index.php" />
<include name="CHANGELOG" />
<include name=".htaccess" />
<include name="LICENSE" />
</fileset>
<target name="main">
<echo>Hello</echo>
</target>
<!-- PHP CodeSniffer -->
<target name="phpcbf">
<exec command="${srcdir}/vendor/bin/phpcbf --standard=${srcdir}/phpcs.xml" escape="false" passthru="true" checkreturn="true" />
</target>
<target name="phpcs">
<exec command="${srcdir}/vendor/bin/phpcs --standard=${srcdir}/phpcs.xml --report=checkstyle &gt; ${builddir}/reports/checkstyle.xml" escape="false" />
</target>
<target name="phpcs-console">
<exec command="${srcdir}/vendor/bin/phpcs --standard=${srcdir}/phpcs.xml" escape="false" passthru="true" checkreturn="true" />
</target>
<target name="php-cs-fixer-dryrun">
<exec command="${srcdir}/vendor/bin/php-cs-fixer fix --dry-run -vvv --diff ${srcdir}/inc" passthru="true" escape="false" checkreturn="true" />
</target>
<!-- PHPUnit -->
<target name="phpunitfast" description="Run tests">
<exec dir="${srcdir}/SeedDMS_Core" command="XDEBUG_MODE=coverage SEEDDMS_CORE_SQL=../install/create_tables-sqlite3.sql ${srcdir}/vendor/bin/phpunit --bootstrap ${srcdir}/SeedDMS_Core/bootstrap-${majorversion}.php --coverage-html ${srcdir}/coverage/" passthru="true" checkreturn="true" />
<!-- exec dir="${srcdir}/tests" command="SEEDDMS_URL=${seeddmsurl} SEEDDMS_MINK_DRIVER=${mink_driver} SEEDDMS_SNOOZE_MULTIPLIER=${snooze_multiplier} ${srcdir}/vendor/bin/phpunit" passthru="true" checkreturn="true" / -->
</target>
<target name="composer" description="Install dependencies with Composer">
<if>
<equals arg1="${composer_version}" arg2="latest-2.x" />
<then>
<httpget url="https://getcomposer.org/composer-2.phar" sslVerifyPeer="false" dir="${srcdir}" filename="composer.phar" />
</then>
<else>
<httpget url="https://getcomposer.org/download/${composer_version}/composer.phar" sslVerifyPeer="false" dir="${srcdir}" />
</else>
</if>
<echo message="Installing dependencies..." />
<exec command="${composer_env} php ${srcdir}/composer.phar install ${composer_extra_params}" passthru="true" checkreturn="true" />
</target>
<target name="dist" description="build SeedDMS tar archive">
<if>
<equals arg1="-" arg2="${version}" />
<then><fail msg="Pass version as property 'version'" /></then>
</if>
<echo msg="This is ${shortversion}" />
<delete file="./seeddms-${version}.tar.gz" failonerror="false" />
<tar destfile="./seeddms-${version}.tar.gz" prefix="seeddms-${version}" compression="gzip">
<fileset refid="distfiles" />
</tar>
</target>
<target name="package" description="build SeedDMS quickstart packages for distribution">
<if>
<equals arg1="-" arg2="${version}" />
<then><fail msg="Pass version as property 'version'" /></then>
</if>
<echo msg="This is ${shortversion}" />
<if>
<matches string="${version}" pattern="^6\.0\..*" />
<then><echo msg="This is version 6" /></then>
<else><echo msg="This is version 5" /></else>
</if>
<!-- make sure the work area is empty, then rebuild it -->
<delete dir="${builddir}/packages" includeemptydirs="true" failonerror="false" />
<mkdir dir="${builddir}/packages" />
<delete dir="${builddir}/export" includeemptydirs="true" failonerror="false" />
<mkdir dir="${builddir}/export/${shortversion}" />
<mkdir dir="${builddir}/export/${shortversion}/conf" />
<mkdir dir="${builddir}/export/${shortversion}/data" />
<mkdir dir="${builddir}/export/${shortversion}/data/1048576" />
<mkdir dir="${builddir}/export/${shortversion}/data/log" />
<mkdir dir="${builddir}/export/${shortversion}/data/cache" />
<exec command="echo 'Signature: 8a477f597d28d172789f06886806bc55' &gt; ${builddir}/export/${shortversion}/data/cache/CACHEDIR.TAG" />
<exec command="echo '# This file is a cache directory tag created by seeddms.' &gt;&gt; ${builddir}/export/${shortversion}/data/cache/CACHEDIR.TAG" />
<exec command="echo '# For information about cache directory tags, see: http://www.brynosaurus.com/cachedir/' &gt;&gt; ${builddir}/export/${shortversion}/data/cache/CACHEDIR.TAG" />
<mkdir dir="${builddir}/export/${shortversion}/data/backup" />
<mkdir dir="${builddir}/export/${shortversion}/data/lucene" />
<mkdir dir="${builddir}/export/${shortversion}/data/staging" />
<mkdir dir="${builddir}/export/${shortversion}/pear" />
<mkdir dir="${builddir}/export/${shortversion}/www" />
<mkdir dir="${builddir}/export/${shortversion}/www/ext" />
<mkdir dir="${builddir}/export/${shortversion}/seeddms-${version}" />
<copy file="${srcdir}/conf/settings.xml.template" tofile="${builddir}/export/${shortversion}/conf/settings.xml">
<filterchain>
<replaceregexp>
<regexp pattern="_DBC_DBTYPE_" replace="${dbtype}"/>
<regexp pattern="_DBC_DBSERVER_" replace="${dbhost}"/>
<regexp pattern="_DBC_DBNAME_" replace="${dbname}"/>
<regexp pattern="_DBC_DBUSER_" replace="${dbuser}"/>
<regexp pattern="_DBC_DBPASS_" replace="${dbpass}"/>
<regexp pattern="_SHORT_VERSION_" replace="${shortversion}"/>
</replaceregexp>
</filterchain>
</copy>
<copy file="${srcdir}/conf/.htaccess" tofile="${builddir}/export/${shortversion}/conf/.htaccess" />
<copy todir="${builddir}/export/${shortversion}/seeddms-${version}">
<fileset refid="distfiles" />
</copy>
<copy todir="${builddir}/export/${shortversion}/pear/vendor">
<fileset dir="${srcdir}/vendor" defaultexcludes="false" />
</copy>
<copy todir="${builddir}/export/${shortversion}/www/ext/example">
<fileset dir="${srcdir}/ext/example" defaultexcludes="false" />
</copy>
<!-- copy todir="${builddir}/export/${shortversion}/pear/SeedDMS">
<fileset dir="SeedDMS_Core">
<include name="Core/**" />
<include name="Core.php" />
</fileset>
<fileset dir="SeedDMS_Preview">
<include name="Preview/**" />
<include name="Preview.php" />
</fileset>
<fileset dir="SeedDMS_Lucene">
<include name="Lucene/**" />
<include name="Lucene.php" />
</fileset -->
<!-- fileset dir="SeedDMS_SQLiteFTS">
<include name="SQLiteFTS/**" />
<include name="SQLiteFTS.php" />
</fileset>
</copy -->
<!-- copy todir="${builddir}/export/${shortversion}/pear">
<fileset dir="../seeddms-ext/http_webdav_server">
<include name="HTTP/WebDAV/Server/**" />
<include name="HTTP/WebDAV/Server.php" />
</fileset>
</copy>
<copy todir="${builddir}/export/${shortversion}/pear/HTTP/WebDAV">
<fileset dir="../seeddms-ext/http_webdav_server">
<include name="Tools/**" />
</fileset>
</copy -->
<copy tofile="${builddir}/export/${shortversion}/pear/composer.json" file="composer-dist.json">
</copy>
<phingcall target="composer">
<property name="composer_extra_params" value="--working-dir=${builddir}/export/${shortversion}/pear/" />
<property name="composer_envv" value="COMPOSER=${srcdir}/composer-dist.json" />
</phingcall>
<exec command="cd ${builddir}/export/${shortversion} &amp;&amp; ln -s seeddms-${version} seeddms" />
<exec command="cd ${builddir}/export/${shortversion}/www &amp;&amp; ln -s ../seeddms/op" />
<exec command="cd ${builddir}/export/${shortversion}/www &amp;&amp; ln -s ../seeddms/out" />
<exec command="cd ${builddir}/export/${shortversion}/www &amp;&amp; ln -s ../seeddms/inc" />
<exec command="cd ${builddir}/export/${shortversion}/www &amp;&amp; ln -s ../seeddms/controllers" />
<exec command="cd ${builddir}/export/${shortversion}/www &amp;&amp; ln -s ../seeddms/languages" />
<exec command="cd ${builddir}/export/${shortversion}/www &amp;&amp; ln -s ../seeddms/views" />
<exec command="cd ${builddir}/export/${shortversion}/www &amp;&amp; ln -s ../seeddms/restapi" />
<exec command="cd ${builddir}/export/${shortversion}/www &amp;&amp; ln -s ../seeddms/styles" />
<exec command="cd ${builddir}/export/${shortversion}/www &amp;&amp; ln -s ../seeddms/pdfviewer" />
<exec command="cd ${builddir}/export/${shortversion}/www &amp;&amp; ln -s ../seeddms/install" />
<exec command="cd ${builddir}/export/${shortversion}/www &amp;&amp; ln -s ../seeddms/webdav" />
<exec command="cd ${builddir}/export/${shortversion}/www &amp;&amp; ln -s ../seeddms/index.php" />
<exec command="cd ${builddir}/export/${shortversion}/www &amp;&amp; ln -s ../seeddms/.htaccess" />
<exec command="cat ${srcdir}/install/create_tables-sqlite3.sql | sqlite3 ${builddir}/export/${shortversion}/data/content.db" />
<!-- build the standard tar.gz archive -->
<echo message="Building .tar.gz...." />
<exec command="cd ${builddir}/export ; tar czf ${builddir}/packages/seeddms-quickstart-${version}.tar.gz ${shortversion}" checkreturn="true" />
<echo message="Built in ${builddir}/packages/seeddms-quickstart-${version}.tar.gz" />
</target>
</project>