Commit c3c6c509 authored by Mathias Goebel's avatar Mathias Goebel 🎠
Browse files

handling fail on project config read

parent 1adf235f
......@@ -41,10 +41,43 @@
<property name="fontane.sadeproject.git" value="https://gitlab.gwdg.de/fontane-notizbuecher/SADE-Project.git"/>
<property name="fontane.sadeproject.git.branch" value="develop"/>
<property name="fontane.sadeproject.dest" value="${build.dir}/fontane"/>
<property name="fontane.sadeproject.credentials" value="${sade.src}../SADE-Project/credentials.txt"/>
<property name="${fontane.sadeproject.target}" value="fastdeploy"/>
<!-- ^ path to credentials text file -->
<!-- build with rdf indexer? -->
<property name="rdf" value="false"/>
<target name="exist-git" depends="ant-dependencies">
<!-- TODO: use http://ant.apache.org/manual/properties.html#if+unless -->
<if>
<available file="${exist.dest}" type="dir" />
<then>
<echo message="updating exist git repository" />
<git:git directory="${exist.dest}" verbose="false">
<git:checkout branchName="develop" />
<git:pull />
<git:checkout branchName="tags/${exist.tag}" />
</git:git>
<!-- alternative with exec:
<exec executable="git" dir="${exist.dest}">
<arg value="checkout"/>
<arg value="master"/>
</exec>
<exec executable="git" dir="${exist.dest}">
<arg value="pull"/>
</exec -->
</then>
<else>
<echo message="cloning exist git repository"/>
<git:git directory="${exist.dest}" verbose="false">
<git:clone uri="${exist.git}"/>
<git:checkout branchName="tags/${exist.tag}" />
</git:git>
</else>
</if>
</target>
<!-- <target name="build" depends="exist-git,markdown"> -->
<target name="build" depends="exist-git">
<echo message="building eXist"/>
......@@ -55,7 +88,11 @@
<!-- include cqlparser in build-->
<copy file="${resources.dir}/exist.extension.properties.override" tofile="${exist.dest}/extensions/local.build.properties" />
<!--
if we want to get more from public repo… -->
<replace file="${exist.dest}/build.properties" token="dashboard,shared,eXide,monex" value="dashboard,shared,eXide,monex,functx,fundocs,markdown" />
<antcall target="existBuild" />
<replace file="${exist.dest}/build.properties" token="dashboard,shared,eXide,monex,functx,fundocs,markdown" value="dashboard,shared,eXide,monex" />
<!-- include cqlparser in conf.xml -->
<replace file="${exist.dist}/conf.xml">
......@@ -76,11 +113,14 @@
</copy>
<antcall target="eXistconfig"/>
<!-- get FunctX from public Package Repo -->
<!-- get FunctX from public Package Repo
we are now using the autodeployment feature on build process, see existconfig below!!!
<get src="http://exist-db.org/exist/apps/public-repo/public/functx-1.0.xar" dest="${exist.dist}/autodeploy/functx-1.0.xar"/>
<get src="http://exist-db.org/exist/apps/public-repo/public/markdown-0.5.xar" dest="${exist.dist}/autodeploy/markdown-0.5.xar"/>
<get src="http://exist-db.org/exist/apps/public-repo/public/fundocs-0.8.xar" dest="${exist.dist}/autodeploy/fundocs-0.8.xar"/>
-->
<antcall target="rdf-indexer" />
<!-- add bin/sade.sh symlink for backwards compatibility / does not work with tar / zip-->
......@@ -90,7 +130,7 @@
<antcall target="fontane-static" />
<antcall target="tgz" />
<antcall target="textgrid-tgz" />
<!--antcall target="project-data" /-->
<antcall target="project-data" />
</target>
<target name="existBuild">
......@@ -136,7 +176,8 @@
</tar -->
</target>
<target name="textgrid-tgz" depends="textgrid-default-project,textgrid-sade-connector">
<target name="textgrid-tgz" depends="textgrid-sade-connector">
<!-- had a dependency on textgrid-default-project? -->
<delete file="${tgsade.tgz.file}" />
<!--delete dir="${build.dir}/sade" /-->
<!--move file="${exist.dist}" toFile="${build.dir}/sade" /-->
......@@ -207,35 +248,6 @@
<ant antfile="${tg.sadeconnect.dest}/build.xml" inheritAll="false" />
</target>
<target name="exist-git" depends="ant-dependencies">
<!-- TODO: use http://ant.apache.org/manual/properties.html#if+unless -->
<if>
<available file="${exist.dest}" type="dir" />
<then>
<echo message="updating exist git repository" />
<git:git directory="${exist.dest}" verbose="false">
<git:checkout branchName="develop" />
<git:pull />
<git:checkout branchName="tags/${exist.tag}" />
</git:git>
<!-- alternative with exec:
<exec executable="git" dir="${exist.dest}">
<arg value="checkout"/>
<arg value="master"/>
</exec>
<exec executable="git" dir="${exist.dest}">
<arg value="pull"/>
</exec -->
</then>
<else>
<echo message="cloning exist git repository"/>
<git:git directory="${exist.dest}" verbose="false">
<git:clone uri="${exist.git}"/>
<git:checkout branchName="tags/${exist.tag}" />
</git:git>
</else>
</if>
</target>
<target name="ant-dependencies" depends="install-ivy">
<property name="ivy.default.ivy.user.dir" value="${basedir}/ivy"/>
......@@ -326,11 +338,31 @@
</git:git>
</else>
</if>
<echo message="injecting credentials" />
<copy file="${fontane.sadeproject.credentials}" tofile="${fontane.sadeproject.dest}/credentials.txt"/>
<echo message="packaging sade-project-develop.xar" />
<ant antfile="${fontane.sadeproject.dest}/build.xml" inheritAll="false" />
<move file="${fontane.sadeproject.dest}/build/*.xar" todir="${build.dir}/sade/autodeploy/" />
<if>
<equals arg1="${fontane.sadeproject.target}" arg2="fastdeploy" />
<then>
<echo message="preparing for faster deployment" />
<ant antfile="${fontane.sadeproject.dest}/build.xml" target="fastdeploy" inheritAll="false" />
</then>
<else>
<echo message="prepering complete database" />
<ant antfile="${fontane.sadeproject.dest}/build.xml" inheritAll="false" />
</else>
</if>
<echo message="removing credentials" />
<delete file="${fontane.sadeproject.dest}/credentials.txt" />
<move todir="${build.dir}/sade/autodeploy/">
<fileset dir="${fontane.sadeproject.dest}/build/">
<include name="*.xar"/>
</fileset>
</move>
</target>
......@@ -343,6 +375,7 @@
<!-- memory configuration Xmx -->
<replace file="${exist.dist}/bin/functions.d/eXist-settings.sh" token="JAVA_OPTIONS=&quot;-Xms128m -Xmx2048m -Dfile.encoding=UTF-8&quot;;" value="JAVA_OPTIONS=&quot;-Xms128m -Xmx${sade.Xmx}m -Dfile.encoding=UTF-8&quot;;"/>
<replace file="${exist.dist}/tools/yajsw/conf/wrapper.conf" token="wrapper.java.maxmemory=2048" value="wrapper.java.maxmemory=${sade.Xmx}"/>
</target>
<target name="rdf-indexer">
......
......@@ -9,7 +9,7 @@ module namespace fconfig="https://fontane-nb.dariah.eu/fontane-config";
import module namespace config="http://exist-db.org/xquery/apps/config-params" at "config.xql";
declare variable $fconfig:project :=
let $value:= try { request:get-url() => substring-after("SADE/") => substring-before("/") } catch * { "" }
let $value:= try { request:get-url() => substring-after("SADE/") => substring-before("/") } catch * { "textgrid" }
return if($value="") then "textgrid" else $value;
declare variable $fconfig:configDoc := doc( $config:projects-dir || $fconfig:project || "/config.xml" );
declare variable $fconfig:configMap := map:new(
......@@ -18,10 +18,24 @@ declare variable $fconfig:configMap := map:new(
);
declare function fconfig:get($key as xs:string) as xs:string {
let $return :=
switch ($key)
case "data-dir" return $config:projects-dir || $fconfig:project || "/" || $fconfig:configMap($key)
case "project-dir" return $config:projects-dir || $fconfig:project
default return $fconfig:configMap($key)
return
if(string($return) != "")
then $return
else
let $doc := doc( $config:projects-dir || $fconfig:project || "/config.xml" )
let $map := map:new(for $param in $doc/config/*[@key] return map:entry(string($param/@key), string($param)))
return
switch ($key)
case "data-dir" return $config:projects-dir || $fconfig:project || "/" || $map($key)
case "project-dir" return $config:projects-dir || $fconfig:project
default return $map($key)
};
declare function fconfig:keys() {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment