https://hal.archives-ouvertes.fr/hal-02079276
Raw File
Tip revision: bac735336055e1e5fe24e87d33b42a802112e7df authored by Software Heritage on 22 April 2019, 15:46:39 UTC
hal: Deposit 287 in collection hal
Tip revision: bac7353
build.xml
<?xml version="1.0" encoding='utf-8'?>

<project name="XPath Parser" default="all" basedir="." xmlns:unless="ant:unless">

  <description>
This buildfile is used to compile the Java sources for the XPath Parser.
  </description>

  <target name="all" depends="compile">
    <path id="classpath">
      <pathelement path="target/classes"/>
      <pathelement path="lib/jing.jar"/>
    </path>
    <pathconvert property="path" refid="classpath" pathsep=":"/>
    <copy file="src/main/sh/xpparser" tofile="xpparser">
      <filterchain>
        <replacetokens>
          <token key="CLASSPATH" value="${path}"/>
        </replacetokens>
      </filterchain>
    </copy>
    <chmod file="xpparser" perm="+x"/>
  </target>

  <property name="lib.dir" value="lib"/>
  
  <target name="jing">
    <local name="offline"/>
    <available file="${lib.dir}/jing.jar" property="offline"/>
    <mkdir unless:set="offline" dir="${lib.dir}"/>
    <get unless:set="offline"
         src="https://storage.googleapis.com/google-code-archive-downloads/v2/code.google.com/jing-trang/jing-20091111.zip"
         dest="${lib.dir}" usetimestamp="true"/>
    <unzip unless:set="offline" src="${lib.dir}/jing-20091111.zip" dest="${lib.dir}"
           overwrite="no"/>
    <copy unless:set="offline" file="${lib.dir}/jing-20091111/bin/jing.jar"
          tofile="${lib.dir}/jing.jar"/>
  </target>

  <presetdef name="java_compile">
    <javac debug="true" debuglevel="lines,vars,source"
           includeantruntime="false">
      <classpath>
        <pathelement path="${lib.dir}/jing.jar"/>
      </classpath>
    </javac>
  </presetdef>    

  <target name="compile" description="Compile xpparser" depends="jing">
    <mkdir dir="target/classes/"/>
    <java_compile srcdir="src/main/java/" destdir="target/classes/"/>
  </target>

  <target name="javacc" description="Generate xqparser sources">
    <subant target="javacc">
      <fileset dir="xgrammar" includes="build.xml"/>
    </subant>
  </target>

  <target name="test" description="Run sanity tests" depends="all" unless="testuptodate" >
    <uptodate property="testuptodate" targetfile="test/failures.xml">
      <srcfiles dir="." includes="test/tests.xml"/>
      <srcfiles dir="relaxng" includes="xpath*rnc"/>
      <srcfiles dir="." includes="test/failures.xslt"/>
      <srcfiles dir="." includes="xpparser"/>
    </uptodate>
    <exec executable="./xpparser" output="test/results.xml" failonerror="true">
      <arg value="--xml" />
      <arg value="//query" />
      <arg value="test/tests.xml" />
      <arg value="--rnc" />
      <arg value="relaxng/xpath*rnc relaxng/data-xpath.rnc" />
    </exec>
    <xslt in="test/tests.xml" out="test/failures.xml" style="test/failures.xslt" />
    <exec executable="sh" failonerror="true">
      <arg value="-c"/>
      <arg value="if grep failure test/failures.xml ; then exit 1 ; else exit 0 ; fi"/>
    </exec>
  </target>

  <property name="project.root" value="."/>
  <target name="xtask">
    <get unless:set="xtask.offline"
         src="https://github.com/wiztools/ant-xpath-task/archive/master.zip"
         dest="${lib.dir}/xtask.zip" usetimestamp="true"/>
    <unzip unless:set="xtask.offline" src="${lib.dir}/xtask.zip"
           dest="${lib.dir}" overwrite="no"/>
    <javac srcdir="${lib.dir}/ant-xpath-task-master/src/main/java/"
           destdir="${project.root}/target/classes/" includeantruntime="true"/>
  </target>

</project>
back to top