commit 3be34c3be42a9fda3258c152efa5f56a2693519d Author: iwakeh iwakeh@torproject.org Date: Wed Jan 31 19:29:57 2018 +0000
Convert shell script into Ant task. --- build.xml | 49 ++++++++++++++++++++++++++++++++++++++ src/main/resources/spec/convert.sh | 6 ----- 2 files changed, 49 insertions(+), 6 deletions(-)
diff --git a/build.xml b/build.xml index 57eab68..0e05d12 100644 --- a/build.xml +++ b/build.xml @@ -24,6 +24,8 @@ <property name="Rsources" value="${basedir}/src/main/R" /> <property name="pysources" value="${basedir}/src/main/python" />
+ <property name="specdir" value="${basedir}/generated/spec" /> + <!-- Deployment base folder. Be aware that this is also set in R scripts and web.xml, currently! --> <property name="metrics-web.deployment.base" @@ -149,6 +151,7 @@ </jar>
<antcall target="generate-ml-javadoc" /> + <antcall target="generate-specs" />
<war destfile="${dist}/${warfile}" duplicate="fail" @@ -183,6 +186,9 @@ <zipfileset dir="${resources}/web/jsps" prefix="WEB-INF" includes="*.jsp"/> + <zipfileset dir="${specdir}" + prefix="WEB-INF" + includes="*.jsp"/> <zipfileset dir="${resources}" includes="*.properties" /> <fileset dir="${resources}" includes="jetty.xml" /> @@ -249,6 +255,49 @@ <echo message="Java module UpdateNews finished. " /> </target>
+ <target name="generate-specs" depends="init" > + <mkdir dir="${specdir}" /> + <antcall target="xml2jsp"> + <param name="specfile" value="bridge-descriptors"/> + </antcall> + <antcall target="xml2jsp"> + <param name="specfile" value="web-server-logs"/> + </antcall> + </target> + + <target name="xml2jsp" > + <echo message="Generating ${specfile} specification jsp ... " /> + <exec executable="saxon-xslt" + dir="${specdir}" + logError="true" + output="${specdir}/${specfile}.tmp" + failonerror="true" > + <arg value="${basedir}/${resources}/spec/${specfile}.xml" /> + <arg value="${basedir}/${resources}/spec/rfc2629.xslt" /> + <arg value="xml2rfc-topblock=no" /> + </exec> + <exec executable="tidy" + dir="${specdir}" + logError="true" + output="${specdir}/${specfile}.tmp2" + failonerror="true" > + <arg value="-quiet" /> + <arg value="${specdir}/${specfile}.tmp" /> + </exec> + <exec executable="awk" + dir="${specdir}" + logError="true" + output="${specdir}/${specfile}.jsp" + failonerror="true" > + <arg value="-f" /> + <arg value="${basedir}/${resources}/spec/convert.awk" /> + <arg value="${specdir}/${specfile}.tmp2" /> + </exec> + <echo message="Done." /> + <delete file="${specdir}/${specfile}.tmp" quiet="true" /> + <delete file="${specdir}/${specfile}.tmp2" quiet="true" /> + </target> + <!-- This can be adapted to point at the actual work directory. --> <property name="prepare.deployment" value="/srv/metrics.torproject.org/metrics/work" /> diff --git a/src/main/resources/spec/convert.sh b/src/main/resources/spec/convert.sh deleted file mode 100755 index 95287e2..0000000 --- a/src/main/resources/spec/convert.sh +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/bash -for specfile in "bridge-descriptors" "web-server-logs"; do - saxon-xslt $specfile.xml rfc2629.xslt xml2rfc-topblock=no | \ - tidy -q | awk -f convert.awk > ../web/jsps/$specfile.jsp -done -
tor-commits@lists.torproject.org