Convert shell script into Ant task.

This commit is contained in:
iwakeh 2018-01-31 19:29:57 +00:00 committed by Karsten Loesing
parent e11c2962bf
commit 3be34c3be4
2 changed files with 49 additions and 6 deletions

View File

@ -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" />

View File

@ -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