diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 2ae42d21b81deb400de9b1b12b2e749a1f5d2f63..71e7881429032758992daf054fc0bc4aba77706f 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -18,27 +18,40 @@ stages: variables: APTLY: 'https://ci.de.dariah.eu/aptlyAPI' -build: +build:develop: stage: build + except: + - master script: -# cleanup - just in case there is something cached + # cleanup - just in case there is something cached - ant -f generic.xml artifact-cleanup - ant -f generic.xml artifacts: paths: - build/sade/ -test-basic: +build:master: + stage: build + only: + - master + script: + - mv generic-master.build.properties local.build.properties + # cleanup - just in case there is something cached + - ant -f generic.xml artifact-cleanup + - ant -f generic.xml + artifacts: + paths: + - build/sade/ + +test:basic: stage: test1 - dependencies: - - build script: - DIR="$(pwd)" -# remove an old testlogfile + # remove an old testlogfile - mv build/sade /opt/ - bash '/opt/sade/bin/startup.sh' & - while [ $(curl --head --silent http://localhost:8080 | grep -c "200 OK") == 0 ]; do sleep 2s; done - - cd /opt/sade/bin; ./shutdown.sh -u admin -p "$pw" + - bash '/opt/sade/bin/shutdown.sh' - cd $DIR artifacts: paths: @@ -48,7 +61,7 @@ test-basic: stage: test2 allow_failure: true dependencies: - - test-basic + - test:basic script: - mkdir --parents /var/lib/textgrid/ - touch /var/lib/textgrid/charmap.txt diff --git a/architrave.xml b/architrave.xml index 81fe1ad4a5f1ce579801e2810afe7b48de8fe906..398df862ac42ea15fd2ed6640a418d0cefef704e 100644 --- a/architrave.xml +++ b/architrave.xml @@ -5,8 +5,8 @@ xmlns:git="antlib:com.rimerosolutions.ant.git"> <property file="architrave.build.properties"/> - + <property file="generic.build.properties"/> <import file="generic.xml"/> - + </project> diff --git a/build.xml b/build.xml deleted file mode 100644 index f4012979285e3f5ac584399d431901673cff23ed..0000000000000000000000000000000000000000 --- a/build.xml +++ /dev/null @@ -1,292 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<project basedir="." name="SADE" default="build" xmlns:ivy="antlib:org.apache.ivy.ant" - xmlns:git="antlib:com.rimerosolutions.ant.git"> - - <description> builds a generic version of SADE, customizable by projects via own parameter - injection. built packages should be moved to autodeploy directory by their targets! </description> - - <property file="generic.build.properties" /> - <property name="ivy.jardir" value="${basedir}/lib"/> - - <tstamp> - <format property="timestamp" pattern="yyyyMMddHHmmss" unit="hour"/> - </tstamp> - - <target name="build" depends="build-deb-generic, build-deb-project"/> - - <target name="exist-git" depends="ant-dependencies"> - <git repo="${exist.git}" branch="tags/${exist.tag}" dest="${exist.dest}"/> - </target> - <target name="exist-build-conf" depends="exist-git, junit-ant-patch"> - <echo message="configuring eXist"/> - <echo message="patching lucene inlining"/> - <patch patchfile="${resources.dir}/lucene-inline.patch" - originalfile="${exist.dest}/extensions/indexes/lucene/src/org/exist/indexing/lucene/DefaultTextExtractor.java" - ignorewhitespace="true" failonerror="false"/> - - <copy file="${exist.dest}/build.properties" tofile="${exist.dest}/local.build.properties" /> - <replace file="${exist.dest}/local.build.properties" token="dashboard,shared,eXide,monex" - value="dashboard,shared,eXide,monex,functx,fundocs,markdown"/> - </target> - <target name="exist-build" depends="exist-build-conf"> - <java classname="org.apache.tools.ant.launch.Launcher" fork="true"> - <arg value="-Dant.home=${exist.dest}/tools/ant"/> - <arg value="-Dant.library.dir=${exist.dest}/tools/ant/lib"/> - <arg value="-Divy.default.ivy.user.dir=${basedir}/ivy"/> - <arg - value="-Djavax.xml.transform.TransformerFactory=org.apache.xalan.processor.TransformerFactoryImpl"/> - <arg value="-f"/> - <arg value="${exist.dest}/build.xml"/> - <arg value="all"/> - <arg value="dist"/> - <classpath> - <pathelement location="${exist.dest}/tools/ant/lib/ant-launcher-1.10.1.jar"/> - <!--pathelement path="${java.class.path}"/--> - </classpath> - </java> - </target> - <target name="exist-dist-conf" depends="exist-build"> - <!-- enable autostart scripts --> - <replace file="${exist.dist}/conf.xml"> - <replacetoken><!--<trigger - class="org.exist.collections.triggers.XQueryStartupTrigger"/>--></replacetoken> - <replacevalue><trigger - class="org.exist.collections.triggers.XQueryStartupTrigger"/></replacevalue> - </replace> - - <!-- set backup settings --> - <replace file="${exist.dist}/conf.xml"> - <replacetoken></scheduler></replacetoken> - <replacevalue><job type="system" name="check1" - class="org.exist.storage.ConsistencyCheckTask" - cron-trigger="0 0 23 * * ?"> - <parameter name="output" value="export"/> - <parameter name="backup" value="yes"/> - <parameter name="incremental" value="no"/> - <parameter name="incremental-check" value="no"/> - <parameter name="zip" value="yes"/> - <parameter name="max" value="2"/> - </job> - </scheduler></replacevalue> - </replace> - - </target> - - <target name="prepare-dist-dir" depends="exist-dist-conf"> - <delete dir="${build.dir}/sade"/> - <!-- get updated xars to autodeploy dir --> - <delete dir="${exist.dist}/autodeploy"/> - <mkdir dir="${exist.dist}/autodeploy"/> - <move2autodeploy source="${exist.dest}/autodeploy/"/> - <!-- move eXist to the SADE path --> - <mkdir dir="${build.dir}/sade"/> - <move file="${exist.dist}" tofile="${build.dir}/sade" overwrite="true"/> - - <!-- undo changes to tracked files, so git pull is possible…--> - <patch reverse="true" patchfile="${resources.dir}/lucene-inline.patch" - originalfile="${exist.dest}/extensions/indexes/lucene/src/org/exist/indexing/lucene/DefaultTextExtractor.java" - ignorewhitespace="true" failonerror="false"/> - - </target> - - <!-- apply web.xml patch for dashboard, otherwise it will not be visible --> - <target name="dashboard-fix" depends="sade"> - <ant antfile="${build.dir}/sade/extensions/betterform/build.xml" target="patchWebXml" inheritAll="false"/> - </target> - <target name="junit-ant-patch" depends="exist-git"> - <patch patchfile="${resources.dir}/ant-junit-basedir.patch" dir="${exist.dest}" strip="1"/> - </target> - - <!-- SADE --> - <target name="sade" depends="prepare-dist-dir"> - <git repo="${sade.git}" branch="${sade.branch}" dest="${sade.dest}"/> - <ant antfile="${sade.dest}/build.xml" inheritAll="false"/> - <move2autodeploy source="${sade.dest}/build/"/> - </target> - - <target name="tg-sade-connect" depends="prepare-dist-dir"> - <git repo="${tg-sade-connect.git}" branch="${tg-sade-connect.branch}" - dest="${tg-sade-connect.dest}"/> - <ant antfile="${tg-sade-connect.dest}/build.xml" inheritAll="false"/> - <move2autodeploy source="${tg-sade-connect.dest}/build/"/> - </target> - - <target name="tg-sade-defaultproject" depends="prepare-dist-dir"> - <git repo="${tg-sade-defaultproject.git}" branch="${tg-sade-defaultproject.branch}" - dest="${tg-sade-defaultproject.dest}"/> - <ant antfile="${tg-sade-defaultproject.dest}/build.xml" inheritAll="false"/> - <move2autodeploy source="${tg-sade-defaultproject.dest}/build/"/> - </target> - - <target name="sade-search" depends="prepare-dist-dir"> - <mkdir dir="${sade-search.dest}"/> - <get src="${sade-search.build}" dest="${sade-search.dest}"/> - <move2autodeploy source="${sade-search.dest}"/> - </target> - - <!-- apply web.xml patch for dashboard, otherwise it will not be visible --> - <target name="dashboard" depends="sade"> - <ant antfile="${build.dir}/sade/extensions/betterform/build.xml" target="patchWebXml" inheritAll="false"/> - </target> - - <target name="projectapp" depends="prepare-dist-dir" if="projectapp.git" - description="builds a project specific app that contains more specific files and sets up the db in a postinstall.xq"> - <git repo="${projectapp.git}" branch="${projectapp.branch}" - dest="${projectapp.dest}"/> - <ant antfile="${projectapp.dest}/build.xml" target="${projectapp.target}" inheritAll="false"/> - <move2autodeploy source="${projectapp.dest}/build/"/> - </target> - - <target name="build-deb-project" if="projectapp.git" - depends="sade, dashboard-fix, junit-ant-patch, tg-sade-connect, tg-sade-defaultproject, sade-search, projectapp"> - <echo message="Successfully built a project specific version of SADE. Very well."/> - </target> - - <target name="build-deb-generic" unless="projectapp.git" - depends="sade, dashboard-fix, tg-sade-connect, tg-sade-defaultproject, sade-search"> - <echo message="Successfully built a generic version of SADE. Very well."/> - </target> - - <target name="build-targz"/> - - <!-- ************************************* --> - <!-- * ALL DEPENDENCIES BELOW THIS LINE! * --> - <!-- ************************************* --> - <target name="ant-dependencies" depends="install-ivy"> - <property name="ivy.default.ivy.user.dir" value="${basedir}/ivy"/> - <ivy:retrieve conf="tasks"/> - <path id="classpath"> - <fileset dir="./lib"> - <include name="*.jar"/> - </fileset> - </path> - <!-- git --> - <taskdef uri="antlib:com.rimerosolutions.ant.git" - resource="com/rimerosolutions/ant/git/jgit-ant-lib.xml" classpathref="classpath"/> - <!-- contrib has if --> - <taskdef resource="net/sf/antcontrib/antcontrib.properties" classpathref="classpath"/> - <!-- jdeb --> - <taskdef name="deb" classname="org.vafer.jdeb.ant.DebAntTask" classpathref="classpath"/> - </target> - - <target name="download-ivy" unless="skip.download"> - <mkdir dir="${ivy.jardir}"/> - <get - src="http://repo1.maven.org/maven2/org/apache/ivy/ivy/${ivy.version}/ivy-${ivy.version}.jar" - dest="${ivy.jarfile}" usetimestamp="true"/> - </target> - - <target name="install-ivy" depends="download-ivy" description="installs ivy"> - <path id="ivy.lib.path"> - <pathelement location="${ivy.jarfile}"/> - </path> - <taskdef resource="org/apache/ivy/ant/antlib.xml" uri="antlib:org.apache.ivy.ant" - classpathref="ivy.lib.path"/> - </target> - - <macrodef name="move2autodeploy"> - <attribute name="source"/> - <sequential> - <move todir="${build.dir}/sade/autodeploy/"> - <fileset dir="@{source}"> - <include name="*.xar"/> - </fileset> - </move> - </sequential> - </macrodef> - - <macrodef name="git"> - <attribute name="repo"/> - <attribute name="branch"/> - <attribute name="dest"/> - <sequential> - <if> - <available file="@{dest}" type="dir"/> - <then> - <echo message="updating @{dest} from @{repo}"/> - <if> - <matches string="@{branch}" pattern="^tags/.*" /> - <then> - <echo message="checking out tag: @{branch}"/> - <git:git directory="@{dest}" verbose="false"> - <git:fetch uri="@{repo}" /> - <git:checkout branchname="@{branch}" failonerror="true"/> - </git:git> - </then> - <else> - <echo message="pulling from branch: @{branch}"/> - <git-branch-checkout-pull repo="@{repo}" branch="@{branch}" dest="@{dest}"/> - </else> - </if> - </then> - <else> - <if> - <matches string="@{branch}" pattern="^tags/.*" /> - <then> - <echo message="cloning @{repo} and checkout tag"/> - <git:git directory="@{dest}" verbose="false"> - <git:clone uri="@{repo}"/> - <git:checkout branchname="@{branch}"/> - </git:git> - </then> - <else> - <echo message="cloning @{repo} to @{dest}"/> - <git:git directory="@{dest}" verbose="false"> - <git:clone uri="@{repo}" branchtotrack="@{branch}"/> - </git:git> - </else> - </if> - </else> - </if> - </sequential> - </macrodef> - - <!-- the git:checkout task does not so well in checkount and setting new remote - tracking branches, the following task is a workaround --> - <macrodef name="git-branch-checkout-pull"> - <attribute name="repo"/> - <attribute name="branch"/> - <attribute name="dest"/> - <sequential> - - <git:git directory="@{dest}" verbose="false"> - <git:fetch uri="@{repo}" /> - <git:branchlist outputfilename="@{dest}/git.branches"/> - </git:git> - - <loadfile property="localBranchLine" srcfile="@{dest}/git.branches"> - <filterchain> - <linecontains> - <contains value="* @{branch}"></contains> - </linecontains> - </filterchain> - </loadfile> - - <if> - <isset property="localBranchLine"/> - <then> - <git:git directory="@{dest}" verbose="false"> - <git:checkout branchname="@{branch}" failonerror="true" /> - <git:pull uri="@{repo}" /> - </git:git> - </then> - <else> - <echo message="no local branch existing yet, create and set remote tracking"/> - <git:git directory="@{dest}" verbose="false"> - <git:checkout branchname="@{branch}" failonerror="true" createbranch="true" startpoint="@{branch}" /> - </git:git> - <echo file="@{dest}/.git/config" append="true"> - [branch "@{branch}"] - remote = origin - merge = refs/heads/@{branch} - </echo> - <git:git directory="@{dest}" verbose="false"> - <git:pull uri="@{repo}" /> - </git:git> - </else> - </if> - - </sequential> - </macrodef> - -</project> diff --git a/generic-master.build.properties b/generic-master.build.properties new file mode 100644 index 0000000000000000000000000000000000000000..eb83831b440ae9e97dd53d22806e87bbcf67650b --- /dev/null +++ b/generic-master.build.properties @@ -0,0 +1,3 @@ +# master configuration +sade.abbrev=SADE +code-viewer.abbrev=cv diff --git a/generic-test.sh b/generic-test.sh deleted file mode 100755 index 5512a8f18b5faccf79161e703ce82151a00ca266..0000000000000000000000000000000000000000 --- a/generic-test.sh +++ /dev/null @@ -1,20 +0,0 @@ -#!/bin/bash -# test to parse XQSuite -# for details see http://exist-db.org/exist/apps/doc/xqsuite.xml -# -# everything should end with no failures. -# the post-install.xq - responsible to execute the tests under certain -# conditions, writes a "fail" in the resulting documents. - -TEST=$(grep --invert-match 'failures="0"' build/sade_job-*.xml) -TEST=$(grep --no-filename --only-matching --extended-regexp \ - "failures=\"[0-9]+\"" build/sade_job-*.xml \ - | grep --only-matching --extended-regexp "[0-9]+" \ - | paste -sd+ \ - | bc ) -if [ "$TEST" -ne "1" ] - then - echo "there are failing tests."; exit 1 - else - echo "no failures found. good."; exit 0 -fi diff --git a/generic.build.properties b/generic.build.properties index d0f9e5cfbeb21b22c6a44c14b120117e33e8f78a..604ecfa34694d1b0f558403adda3c0f9d95c2d55 100644 --- a/generic.build.properties +++ b/generic.build.properties @@ -14,8 +14,7 @@ exist.git=https\://github.com/eXist-db/exist.git exist.version=4.5.0 exist.tag=eXist-${exist.version} exist.dest=${build.dir}/exist -exist.dist=${exist.dest}/dist/eXist-db-${exist.version} -exist.memory=2048 +exist.memory=2048m exist.enable-xinclude=false # Jetty port configuration @@ -23,23 +22,19 @@ jetty.http.port=8080 jetty.https.port=8443 # SADE configuration -sade.git=https\://gitlab.gwdg.de/SADE/SADE.git -sade.branch=develop -sade.dest=${build.dir}/expkg-sade +sade.abbrev=SADE-develop # SADE Assets configuration -sade-assets.git=https\://gitlab.gwdg.de/SADE/assets.git -sade-assets.branch=master -sade-assets.dest=${build.dir}/expkg-sade_assets +sade-assets.abbrev=sade_assets # SADE code viewer installation # defaults to 'false'. change to 'true' to install the app. +code-viewer.abbrev=cv-develop code-viewer.install=false # Search Index Module, currently maven builded by CI, so only a # URL to the preffered build is needed -sade-search.build=https\://ci.de.dariah.eu/exist-repo/public/fontane-lucene-exist-module-2.0.2.xar -sade-search.dest=${build.dir}/expkg-search +sade-search.abbrev=fontane-lucene-exist-module # debian package deb.initfile.src=${resources.dir}/deb/${deb.name}/sade.init.sh diff --git a/generic.xml b/generic.xml index e3ed3b703d66cf9b0a6f2e6850ef350da1be271a..27500dd31f12273fde39296a5d8db40a957836cf 100644 --- a/generic.xml +++ b/generic.xml @@ -4,192 +4,141 @@ name="SADE" default="build"> - <description> builds a generic version of SADE, customizable by projects via own parameter - injection. built packages should be moved to autodeploy directory by their targets! </description> + <description> + builds a generic version of SADE, customizable by projects via own + parameter injection. built packages should be moved to autodeploy + directory by their targets! + </description> - <property file="local.generic.build.properties" /> + <property file="local.build.properties" /> <property file="generic.build.properties" /> - <property name="ivy.jardir" value="${basedir}/lib"/> - <tstamp> <format property="timestamp" pattern="yyyyMMddHHmmss" unit="hour"/> </tstamp> - <target name="build" depends="ant-dependencies, artifact-cleanup, sade, dashboard, junit-ant-patch, sade-assets, sade-search, undo-junit-ant-patch, jetty-port, sade-memory"/> - - <target name="exist-git" depends="ant-dependencies"> - <git repo="${exist.git}" branch="tags/${exist.tag}" dest="${exist.dest}"/> - </target> - <target name="exist-build-conf" depends="exist-git, junit-ant-patch"> - <echo message="configuring eXist"/> - <echo message="patching lucene inlining"/> - <patch patchfile="${resources.dir}/lucene-inline.patch" - originalfile="${exist.dest}/extensions/indexes/lucene/src/org/exist/indexing/lucene/DefaultTextExtractor.java" - ignorewhitespace="true" failonerror="false"/> - - <copy file="${exist.dest}/build.properties" tofile="${exist.dest}/local.build.properties" /> - <replace file="${exist.dest}/local.build.properties" token="dashboard,shared,eXide,monex" - value="dashboard,shared,eXide,monex,functx,fundocs,markdown"/> - </target> - <target name="exist-build" depends="exist-build-conf"> - <!-- using ant from eXist distribution --> - <first id="antjar"> - <fileset dir="${exist.dest}/tools/ant" includes="**/ant-launcher-*.jar" /> - </first> - <java classname="org.apache.tools.ant.launch.Launcher" fork="true"> - <arg value="-Dant.home=${exist.dest}/tools/ant"/> - <arg value="-Dant.library.dir=${exist.dest}/tools/ant/lib"/> - <arg value="-Divy.default.ivy.user.dir=${basedir}/ivy"/> - <arg - value="-Djavax.xml.transform.TransformerFactory=org.apache.xalan.processor.TransformerFactoryImpl"/> - <arg value="-f"/> - <arg value="${exist.dest}/build.xml"/> - <arg value="all"/> - <arg value="dist"/> - <classpath> - <pathelement location="${toString:antjar}"/> - <!--pathelement path="${java.class.path}"/--> - </classpath> - </java> + <target name="build" depends="artifact-cleanup, sade, jetty-port, sade-memory"/> + <target name="exist" depends="exist-load, exist-conf" /> + + <target name="exist-load" depends="ant-dependencies"> + <echo message="loading eXist" /> + <mkdir dir="${build.dir}"/> + <get src="https://bintray.com/existdb/releases/download_file?file_path=eXist-db-${exist.version}.tar.bz2" + dest="${build.dir}/eXist-${exist.version}.tar.bz2" skipexisting="true" quiet="true" /> + <untar src="${build.dir}/eXist-${exist.version}.tar.bz2" dest="${exist.dest}" compression="bzip2"> + <cutdirsmapper dirs="1" /> + </untar> + + <echo message="loading dependencies to autodeploy"/> + <get + src="http://exist-db.org/exist/apps/public-repo/find.zip?abbrev=markdown&processor=${exist.version}" + dest="${exist.dest}/autodeploy/markdown-latest.xar" ignoreerrors="true"/> + <get + src="http://exist-db.org/exist/apps/public-repo/find.zip?abbrev=functx&processor=${exist.version}" + dest="${exist.dest}/autodeploy/functx-latest.xar" ignoreerrors="true"/> + <get + src="http://exist-db.org/exist/apps/public-repo/find.zip?abbrev=fundocs&processor=${exist.version}" + dest="${exist.dest}/autodeploy/fundocs-latest.xar" ignoreerrors="true"/> </target> - <target name="exist-dist-conf" depends="exist-build"> - <!-- enable autostart scripts --> - <replace file="${exist.dist}/conf.xml"> - <replacetoken><!--<trigger - class="org.exist.collections.triggers.XQueryStartupTrigger"/>--></replacetoken> - <replacevalue><trigger - class="org.exist.collections.triggers.XQueryStartupTrigger"/></replacevalue> - </replace> - <replace file="${exist.dist}/conf.xml"> - <replacetoken>preserve-whitespace-mixed-content="no"</replacetoken> - <replacevalue>preserve-whitespace-mixed-content="yes"</replacevalue> - </replace> - - <!-- set backup settings --> - <replace file="${exist.dist}/conf.xml"> - <replacetoken></scheduler></replacetoken> - <replacevalue><job type="system" name="check1" - class="org.exist.storage.ConsistencyCheckTask" - cron-trigger="0 0 23 * * ?"> - <parameter name="output" value="export"/> - <parameter name="backup" value="yes"/> - <parameter name="incremental" value="no"/> - <parameter name="incremental-check" value="no"/> - <parameter name="zip" value="yes"/> - <parameter name="max" value="2"/> - </job> - </scheduler></replacevalue> - </replace> + <target name="exist-conf"> + <!-- enable autostart scripts --> + <xslt-inplace + input="${exist.dest}/conf.xml" + stylesheet="${resources.dir}/configure-startupTrigger.xsl" /> + + <!-- enable startup trigger --> + <xslt-inplace + input="${exist.dest}/conf.xml" + stylesheet="${resources.dir}/configure-whitespace-preserve.xsl" /> + + <!-- set backup settings --> + <xslt-inplace + input="${exist.dest}/conf.xml" + stylesheet="${resources.dir}/configure-backup.xsl" /> </target> - <target name="sade-memory" depends="exist-dist-conf"> + <target name="sade-memory" depends="exist-conf"> <replace file="${build.dir}/sade/bin/functions.d/eXist-settings.sh" token="Xmx2048m" - value="Xmx${exist.memory}m"/> + value="Xmx${exist.memory}"/> <echo>Total memory available for SADE's eXist-db: ${exist.memory}.</echo> </target> <!-- Port configuration --> - <target name="jetty-port" depends="prepare-dist-dir"> + <target name="jetty-port" depends="prepare-sade-dir"> <!-- HTTP port --> - <xslt - in="${build.dir}/sade/tools/jetty/etc/jetty-http.xml" - out="${build.dir}/sade/tools/jetty/etc/jetty-http-tmp.xml" - style="jetty-port-update.xsl"> + <xslt-inplace + input="${build.dir}/sade/tools/jetty/etc/jetty-http.xml" + stylesheet="${resources.dir}/jetty-port-update.xsl"> <param name="customPort" expression="${jetty.http.port}"/> - </xslt> - <move - file="${build.dir}/sade/tools/jetty/etc/jetty-http-tmp.xml" - tofile="${build.dir}/sade/tools/jetty/etc/jetty-http.xml"/> + </xslt-inplace> <!-- HTTPS port --> - <xslt - in="${build.dir}/sade/tools/jetty/etc/jetty-ssl.xml" - out="${build.dir}/sade/tools/jetty/etc/jetty-ssl-tmp.xml" - style="jetty-port-update.xsl"> + <xslt-inplace + input="${build.dir}/sade/tools/jetty/etc/jetty-ssl.xml" + stylesheet="${resources.dir}/jetty-port-update.xsl"> <param name="customPort" expression="${jetty.https.port}"/> - </xslt> - <move - file="${build.dir}/sade/tools/jetty/etc/jetty-ssl-tmp.xml" - tofile="${build.dir}/sade/tools/jetty/etc/jetty-ssl.xml"/> - - <xslt - in="${build.dir}/sade/tools/jetty/etc/jetty.xml" - out="${build.dir}/sade/tools/jetty/etc/jetty-tmp.xml" - style="jetty-port-update.xsl"> + </xslt-inplace> + + <xslt-inplace + input="${build.dir}/sade/tools/jetty/etc/jetty.xml" + stylesheet="${resources.dir}/jetty-port-update.xsl"> <param name="customPort" expression="${jetty.https.port}"/> - </xslt> - <move - file="${build.dir}/sade/tools/jetty/etc/jetty-tmp.xml" - tofile="${build.dir}/sade/tools/jetty/etc/jetty.xml"/> + </xslt-inplace> <echo>Jetty HTTP port is set to ${jetty.http.port}.</echo> <echo>Jetty HTTPS port is set to ${jetty.https.port}.</echo> </target> + <target name="configure-xinclude-handling" depends="prepare-sade-dir"> + <xslt-inplace + input="${build.dir}/sade/conf.xml" + stylesheet="${resources.dir}/configure-xinclude-handling.xsl"> + <param name="configParam" expression="${exist.enable-xinclude}"/> + </xslt-inplace> - <target name="configure-xinclude-handling" depends="prepare-dist-dir"> - <xslt - in="${build.dir}/sade/conf.xml" - out="${build.dir}/sade/conf-tmp.xml" - style="configure-xinclude-handling.xsl"> - <param name="configParam" expression="${exist.enable-xinclude}"/> - </xslt> - <move - file="${build.dir}/sade/conf-tmp.xml" - tofile="${build.dir}/sade/conf.xml"/> - - <echo>Are XIncludes expanded automatically? ${exist.enable-xinclude}.</echo> + <echo>Are XIncludes expanded automatically? ${exist.enable-xinclude}.</echo> </target> + <target name="prepare-sade-dir" depends="exist"> + <delete dir="${build.dir}/sade"/> - <target name="prepare-dist-dir" depends="exist-dist-conf"> - <delete dir="${build.dir}/sade"/> - <!-- get updated xars to autodeploy dir --> - <delete dir="${exist.dist}/autodeploy"/> - <mkdir dir="${exist.dist}/autodeploy"/> - <move2autodeploy source="${exist.dest}/autodeploy/"/> - - <copy todir="${build.dir}/sade/lib/test"> - <fileset dir="${exist.dest}/lib/test"/> - </copy> - - <!-- move eXist to the SADE path --> - <mkdir dir="${build.dir}/sade"/> - <move file="${exist.dist}" tofile="${build.dir}/sade" overwrite="true"/> - <!-- undo changes to tracked files, so git pull is possible…--> - <patch reverse="true" patchfile="${resources.dir}/lucene-inline.patch" - originalfile="${exist.dest}/extensions/indexes/lucene/src/org/exist/indexing/lucene/DefaultTextExtractor.java" - ignorewhitespace="true" failonerror="false"/> + <!-- move eXist to the SADE path --> + <mkdir dir="${build.dir}/sade"/> + <move file="${exist.dest}" tofile="${build.dir}/sade" overwrite="true"/> + <!-- undo changes to tracked files, so git pull is possible…--> + <patch reverse="true" patchfile="${resources.dir}/lucene-inline.patch" + originalfile="${exist.dest}/extensions/indexes/lucene/src/org/exist/indexing/lucene/DefaultTextExtractor.java" + ignorewhitespace="true" failonerror="false"/> </target> <!-- SADE --> - <target name="sade" depends="prepare-dist-dir, sade-assets, sade-memory, jetty-port, configure-xinclude-handling, code-viewer"> - <git repo="${sade.git}" branch="${sade.branch}" dest="${sade.dest}"/> - <ant antfile="${sade.dest}/build.xml" inheritAll="false"/> - <move2autodeploy source="${sade.dest}/build/"/> - </target> - - <!-- SADE Assets --> - <target name="sade-assets" depends="prepare-dist-dir"> - <git repo="${sade-assets.git}" branch="${sade-assets.branch}" dest="${sade-assets.dest}"/> - <ant antfile="${sade-assets.dest}/build.xml" inheritAll="false"/> - <move2autodeploy source="${sade-assets.dest}/build/"/> - </target> + <target name="sade" depends="prepare-sade-dir, code-viewer, sade-memory, jetty-port, configure-xinclude-handling"> + <!-- SADE --> + <get + src="https://ci.de.dariah.eu/exist-repo/find.zip?abbrev=${sade.abbrev}&processor=${exist.version}" + dest="${build.dir}/sade/autodeploy/${sade.abbrev}-latest.xar"/> + + <!-- assets --> + <get + src="https://ci.de.dariah.eu/exist-repo/find.zip?abbrev=${sade-assets.abbrev}&processor=${exist.version}" + dest="${build.dir}/sade/autodeploy/${sade-assets.abbrev}-latest.xar"/> + + <!-- search --> + <get + src="https://ci.de.dariah.eu/exist-repo/find.zip?abbrev=${sade-search.abbrev}&processor=${exist.version}" + dest="${build.dir}/sade/autodeploy/${sade-search.abbrev}-latest.xar"/> - <target name="sade-search" depends="prepare-dist-dir"> - <mkdir dir="${sade-search.dest}"/> - <get src="${sade-search.build}" dest="${sade-search.dest}"/> - <move2autodeploy source="${sade-search.dest}"/> </target> <!-- SADE Code viewer --> - <target name="code-viewer" if="code-viewer.enabled" depends="prepare-dist-dir, test.if.code-viewer.is.enabled"> + <target name="code-viewer" if="code-viewer.enabled" depends="prepare-sade-dir, test.if.code-viewer.is.enabled"> <echo message="Install Code Viewer: "/> - <get src="https://ci.de.dariah.eu/exist-repo/find.zip?abbrev=cv" dest="${build.dir}/sade/autodeploy/codeview-latest.xar"/> + <get + src="https://ci.de.dariah.eu/exist-repo/find.zip?abbrev=${code-viewer.abbrev}&processor=${exist.version}" + dest="${build.dir}/sade/autodeploy/codeview-latest.xar" /> </target> <target name="test.if.code-viewer.is.enabled"> @@ -198,215 +147,130 @@ </condition> </target> - - <!-- apply web.xml patch for dashboard, otherwise it will not be visible --> - <target name="dashboard" depends="sade"> - <ant antfile="${build.dir}/sade/extensions/betterform/build.xml" target="patchWebXml" inheritAll="false"/> - </target> - <target name="junit-ant-patch" depends="exist-git"> - <patch patchfile="${resources.dir}/ant-junit-basedir.patch" dir="${exist.dest}" strip="1"/> - </target> - <target name="undo-junit-ant-patch" depends="exist-build"> - <patch reverse="yes" patchfile="${resources.dir}/ant-junit-basedir.patch" dir="${exist.dest}" strip="1"/> - </target> - - <target name="build-debian-package" depends="ant-dependencies, artifact-cleanup, sade, dashboard, junit-ant-patch, sade-assets, sade-search"> - <property name="deb.archive.file" value="${build.dir}/${deb.name}_${version}-${timestamp}.tar.gz" /> - <property name="deb.version" value="${version}-${timestamp}" /> - - <!-- https://github.com/tcurdt/jdeb/blob/master/docs/ant.md --> - <copy todir="${build.dir}/deb/control"> - <fileset dir="resources/deb/${deb.name}/control"/> - <filterset begintoken="[[" endtoken="]]"> - <filter token="version" value="${deb.version}"/> - <filter token="description" value="${deb.description}"/> - <filter token="name" value="${deb.name}"/> - </filterset> - </copy> - - <copy file="${deb.initfile.src}" tofile="${build.dir}/sade/bin/sade.init.sh" /> - <exec executable="chmod"> - <arg value="755"/> - <arg value="${build.dir}/sade/bin/sade.init.sh"/> - </exec> - - <tar destfile="${deb.archive.file}" compression="gzip" longfile="gnu"> - <tarfileset dir="${build.dir}/sade" filemode="755" username="${deb.name}" group="${deb.name}"> - <include name="**/*.sh"/> - </tarfileset> - <tarfileset dir="${build.dir}/sade" includes="**" username="${deb.name}" group="${deb.name}"> - <exclude name="**/*.sh"/> - </tarfileset> - </tar> - - <deb destfile="${build.dir}/${deb.name}_${deb.version}.deb" control="${build.dir}/deb/control" verbose="false" > - <data src="${deb.archive.file}" type="archive"> - <mapper type="perm" prefix="/opt/${deb.name}"/> - </data> - </deb> - <delete file="${deb.archive.file}" /> + <target name="debian-package" depends="ant-dependencies, artifact-cleanup, sade"> + <property name="deb.archive.file" value="${build.dir}/${deb.name}_${version}-${timestamp}.tar.gz" /> + <property name="deb.version" value="${version}-${timestamp}" /> + + <!-- https://github.com/tcurdt/jdeb/blob/master/docs/ant.md --> + <copy todir="${build.dir}/deb/control"> + <fileset dir="resources/deb/${deb.name}/control"/> + <filterset begintoken="[[" endtoken="]]"> + <filter token="version" value="${deb.version}"/> + <filter token="description" value="${deb.description}"/> + <filter token="name" value="${deb.name}"/> + </filterset> + </copy> + + <copy file="${deb.initfile.src}" tofile="${build.dir}/sade/bin/sade.init.sh" /> + <exec executable="chmod"> + <arg value="755"/> + <arg value="${build.dir}/sade/bin/sade.init.sh"/> + </exec> + + <tar destfile="${deb.archive.file}" compression="gzip" longfile="gnu"> + <tarfileset dir="${build.dir}/sade" filemode="755" username="${deb.name}" group="${deb.name}"> + <include name="**/*.sh"/> + </tarfileset> + <tarfileset dir="${build.dir}/sade" includes="**" username="${deb.name}" group="${deb.name}"> + <exclude name="**/*.sh"/> + </tarfileset> + </tar> + + <deb destfile="${build.dir}/${deb.name}_${deb.version}.deb" control="${build.dir}/deb/control" verbose="false" > + <data src="${deb.archive.file}" type="archive"> + <mapper type="perm" prefix="/opt/${deb.name}"/> + </data> + </deb> + <delete file="${deb.archive.file}" /> </target> <target name="tar-gz-artifact" depends="artifact-cleanup"> - <tar destfile="${build.dir}/sade-${version}.tar.gz" compression="gzip" longfile="gnu"> - <tarfileset dir="${build.dir}/sade" filemode="755"> - <include name="**/*.sh"/> - </tarfileset> - <tarfileset dir="${build.dir}/sade" includes="**"> - <exclude name="**/*.sh"/> - </tarfileset> - </tar> + <tar destfile="${build.dir}/sade-${version}.tar.gz" compression="gzip" longfile="gnu"> + <tarfileset dir="${build.dir}/sade" filemode="755"> + <include name="**/*.sh"/> + </tarfileset> + <tarfileset dir="${build.dir}/sade" includes="**"> + <exclude name="**/*.sh"/> + </tarfileset> + </tar> </target> + <target name="artifact-cleanup"> - <delete dir="${build.dir}/deb" failonerror="false"/> - <delete failonerror="false"> - <fileset dir="${build.dir}"> - <include name="*.deb"/> - <include name="*.changes"/> - <include name="sade*.tar.gz"/> - </fileset> - </delete> + <delete dir="${build.dir}/deb" failonerror="false"/> + <delete failonerror="false"> + <fileset dir="${build.dir}"> + <include name="*.deb"/> + <include name="*.changes"/> + <include name="sade*.tar.gz"/> + </fileset> + </delete> </target> + <!-- ************************************* --> + <!-- * ALL MACROS BELOW THIS LINE! * --> + <!-- ************************************* --> + <macrodef name="move2autodeploy"> + <attribute name="source"/> + <sequential> + <move todir="${build.dir}/sade/autodeploy/"> + <fileset dir="@{source}"> + <include name="*.xar"/> + </fileset> + </move> + </sequential> + </macrodef> + + <macrodef name="xslt-inplace"> + <attribute name="input"/> + <attribute name="stylesheet"/> + <element name="param" optional="yes" implicit="true"/> + <sequential> + <xslt + in="@{input}" + out="@{input}.tmp" + style="@{stylesheet}"> + <param /> + </xslt> + <move + file="@{input}.tmp" + tofile="@{input}"/> + </sequential> + </macrodef> + <!-- ************************************* --> <!-- * ALL DEPENDENCIES BELOW THIS LINE! * --> <!-- ************************************* --> <target name="ant-dependencies" depends="install-ivy"> - <property name="ivy.default.ivy.user.dir" value="${basedir}/ivy"/> - <ivy:retrieve conf="tasks"/> - <path id="classpath"> - <fileset dir="./lib"> - <include name="*.jar"/> - </fileset> - </path> - <!-- git --> - <taskdef uri="antlib:com.rimerosolutions.ant.git" - resource="com/rimerosolutions/ant/git/jgit-ant-lib.xml" classpathref="classpath"/> - <!-- contrib has if --> - <taskdef resource="net/sf/antcontrib/antcontrib.properties" classpathref="classpath"/> - <!-- jdeb --> - <taskdef name="deb" classname="org.vafer.jdeb.ant.DebAntTask" classpathref="classpath"/> + <property name="ivy.default.ivy.user.dir" value="${basedir}/ivy"/> + <ivy:retrieve conf="tasks"/> + <path id="classpath"> + <fileset dir="./lib"> + <include name="*.jar"/> + </fileset> + </path> + <!-- git --> + <taskdef uri="antlib:com.rimerosolutions.ant.git" + resource="com/rimerosolutions/ant/git/jgit-ant-lib.xml" classpathref="classpath"/> + <!-- contrib has if --> + <taskdef resource="net/sf/antcontrib/antcontrib.properties" classpathref="classpath"/> + <!-- jdeb --> + <taskdef name="deb" classname="org.vafer.jdeb.ant.DebAntTask" classpathref="classpath"/> </target> <target name="download-ivy" unless="skip.download"> - <mkdir dir="${ivy.jardir}"/> - <get - src="http://repo1.maven.org/maven2/org/apache/ivy/ivy/${ivy.version}/ivy-${ivy.version}.jar" - dest="${ivy.jarfile}" usetimestamp="true"/> + <mkdir dir="${ivy.jardir}"/> + <get + src="http://repo1.maven.org/maven2/org/apache/ivy/ivy/${ivy.version}/ivy-${ivy.version}.jar" + dest="${ivy.jarfile}" usetimestamp="true"/> </target> <target name="install-ivy" depends="download-ivy" description="installs ivy"> - <path id="ivy.lib.path"> - <pathelement location="${ivy.jarfile}"/> - </path> - <taskdef resource="org/apache/ivy/ant/antlib.xml" uri="antlib:org.apache.ivy.ant" - classpathref="ivy.lib.path"/> + <path id="ivy.lib.path"> + <pathelement location="${ivy.jarfile}"/> + </path> + <taskdef resource="org/apache/ivy/ant/antlib.xml" uri="antlib:org.apache.ivy.ant" + classpathref="ivy.lib.path"/> </target> - <macrodef name="move2autodeploy"> - <attribute name="source"/> - <sequential> - <move todir="${build.dir}/sade/autodeploy/"> - <fileset dir="@{source}"> - <include name="*.xar"/> - </fileset> - </move> - </sequential> - </macrodef> - - <macrodef name="git"> - <attribute name="repo"/> - <attribute name="branch"/> - <attribute name="dest"/> - <sequential> - <if> - <available file="@{dest}" type="dir"/> - <then> - <echo message="updating @{dest} from @{repo}"/> - <if> - <matches string="@{branch}" pattern="^tags/.*" /> - <then> - <echo message="checking out tag: @{branch}"/> - <git:git directory="@{dest}" verbose="false"> - <git:fetch uri="@{repo}" /> - <git:checkout branchname="@{branch}" failonerror="true"/> - </git:git> - </then> - <else> - <echo message="pulling from branch: @{branch}"/> - <git-branch-checkout-pull repo="@{repo}" branch="@{branch}" dest="@{dest}"/> - </else> - </if> - </then> - <else> - <if> - <matches string="@{branch}" pattern="^tags/.*" /> - <then> - <echo message="cloning @{repo} and checkout tag"/> - <git:git directory="@{dest}" verbose="false"> - <git:clone uri="@{repo}"/> - <git:checkout branchname="@{branch}"/> - </git:git> - </then> - <else> - <echo message="cloning @{repo} to @{dest}"/> - <git:git directory="@{dest}" verbose="false"> - <git:clone uri="@{repo}" branchtotrack="@{branch}"/> - </git:git> - </else> - </if> - </else> - </if> - </sequential> - </macrodef> - - <!-- the git:checkout task does not so well in checkount and setting new remote - tracking branches, the following task is a workaround --> - <macrodef name="git-branch-checkout-pull"> - <attribute name="repo"/> - <attribute name="branch"/> - <attribute name="dest"/> - <sequential> - - <git:git directory="@{dest}" verbose="false"> - <git:fetch uri="@{repo}" /> - <git:branchlist outputfilename="@{dest}/git.branches"/> - </git:git> - - <loadfile property="localBranchLine" srcfile="@{dest}/git.branches"> - <filterchain> - <linecontains> - <contains value="* @{branch}"></contains> - </linecontains> - </filterchain> - </loadfile> - - <if> - <isset property="localBranchLine"/> - <then> - <git:git directory="@{dest}" verbose="false"> - <git:checkout branchname="@{branch}" failonerror="true" /> - <git:pull uri="@{repo}" /> - </git:git> - </then> - <else> - <echo message="no local branch existing yet, create and set remote tracking"/> - <git:git directory="@{dest}" verbose="false"> - <git:checkout branchname="@{branch}" failonerror="true" createbranch="true" startpoint="@{branch}" /> - </git:git> - <echo file="@{dest}/.git/config" append="true"> - [branch "@{branch}"] - remote = origin - merge = refs/heads/@{branch} - </echo> - <git:git directory="@{dest}" verbose="false"> - <git:pull uri="@{repo}" /> - </git:git> - </else> - </if> - - </sequential> - </macrodef> - </project> diff --git a/resources/configure-backup.xsl b/resources/configure-backup.xsl new file mode 100644 index 0000000000000000000000000000000000000000..18c568b65332564518b2111e8a6cc27cda0ad791 --- /dev/null +++ b/resources/configure-backup.xsl @@ -0,0 +1,27 @@ +<?xml version="1.0" encoding="UTF-8"?> +<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> + <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="no"/> + + <xsl:template match="@* | node()"> + <xsl:copy> + <xsl:apply-templates select="@* | node()"/> + </xsl:copy> + </xsl:template> + + <xsl:template match="scheduler"> + <scheduler> + <xsl:apply-templates /> + <job type="system" name="check1" + class="org.exist.storage.ConsistencyCheckTask" + cron-trigger="0 0 23 * * ?"> + <parameter name="output" value="export"/> + <parameter name="backup" value="yes"/> + <parameter name="incremental" value="no"/> + <parameter name="incremental-check" value="no"/> + <parameter name="zip" value="yes"/> + <parameter name="max" value="2"/> + </job> + </scheduler> + </xsl:template> + +</xsl:stylesheet> diff --git a/resources/configure-startupTrigger.xsl b/resources/configure-startupTrigger.xsl new file mode 100644 index 0000000000000000000000000000000000000000..269cd5e91c5a2b04841ceb45b261c57704b1e822 --- /dev/null +++ b/resources/configure-startupTrigger.xsl @@ -0,0 +1,18 @@ +<?xml version="1.0" encoding="UTF-8"?> +<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> + <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="no"/> + + <xsl:template match="@* | node()"> + <xsl:copy> + <xsl:apply-templates select="@* | node()"/> + </xsl:copy> + </xsl:template> + + <xsl:template match="triggers"> + <triggers> + <xsl:apply-templates /> + <trigger class="org.exist.collections.triggers.XQueryStartupTrigger"/> + </triggers> + </xsl:template> + +</xsl:stylesheet> diff --git a/resources/configure-whitespace-preserve.xsl b/resources/configure-whitespace-preserve.xsl new file mode 100644 index 0000000000000000000000000000000000000000..7fc68e810f42d9388a8ee1898e8168087bd37efb --- /dev/null +++ b/resources/configure-whitespace-preserve.xsl @@ -0,0 +1,17 @@ +<?xml version="1.0" encoding="UTF-8"?> +<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> + <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="no" /> + + <xsl:template match="@* | node()"> + <xsl:copy> + <xsl:apply-templates select="@* | node()"/> + </xsl:copy> + </xsl:template> + + <xsl:template match="@preserve-whitespace-mixed-content"> + <xsl:attribute name="preserve-whitespace-mixed-content"> + <xsl:value-of select="yes"/> + </xsl:attribute> + </xsl:template> + +</xsl:stylesheet> diff --git a/configure-xinclude-handling.xsl b/resources/configure-xinclude-handling.xsl similarity index 86% rename from configure-xinclude-handling.xsl rename to resources/configure-xinclude-handling.xsl index 0388aa3563d9dedf9f8e5e35dedbc02ac79fefd5..5ce6e99b7435ff01bc40e9682e284fa712268305 100644 --- a/configure-xinclude-handling.xsl +++ b/resources/configure-xinclude-handling.xsl @@ -1,14 +1,14 @@ <?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> - <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="no" doctype-public="-//Jetty//Configure//EN" doctype-system="http://www.eclipse.org/jetty/configure_9_3.dtd"/> + <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="no" /> <xsl:param name="configParam"/> - + <xsl:template match="@* | node()"> <xsl:copy> <xsl:apply-templates select="@* | node()"/> </xsl:copy> </xsl:template> - + <xsl:template match="@enable-xinclude"> <xsl:attribute name="enable-xinclude"> <xsl:choose> diff --git a/jetty-port-update.xsl b/resources/jetty-port-update.xsl similarity index 100% rename from jetty-port-update.xsl rename to resources/jetty-port-update.xsl