commit 2d7e8cf4dadfbf100126570f8e2e7066de38c016 Author: iwakeh iwakeh@torproject.org Date: Mon Dec 4 11:14:20 2017 +0000
Add ant task for collectdescs run, move related sources.
Delete old build.xml and shell script; add some deployment related properties to build.xml; add ant helper task for running java modules. --- build.xml | 35 ++++++++++++++++++++++ modules/collectdescs/build.xml | 11 ------- shared/bin/01-collectdescs.sh | 5 ---- .../org/torproject/metrics/collectdescs/Main.java | 0 4 files changed, 35 insertions(+), 16 deletions(-)
diff --git a/build.xml b/build.xml index 7ebe764..7f2abe9 100644 --- a/build.xml +++ b/build.xml @@ -74,7 +74,18 @@ </exec> </target>
+ <!-- This can be adapted to point at the actual deployment path. --> + <property name="prepare.deployment" value="${basedir}/generated" /> + + <!-- Don't alter the following. --> + <property name="modulebase" value="${prepare.deployment}/modules" /> + <!-- Operational tasks. --> + <target name="collectdescs" > + <property name="module.name" value="collectdescs" /> + <antcall target="run-java" /> + </target> + <target name="run-rserver"> <exec executable="R" dir="${Rsources}/rserver" @@ -88,6 +99,30 @@ </exec> </target>
+ <!-- Support tasks for operation --> + <target name="run-java"> + <echo message="Running java module ${module.name} ... " /> + <available file="${dist}/${jarfile}" property="have.jar"/> + <fail unless="have.jar" message="Please run 'ant jar'."/> + <condition property="mainclass" + value="${module.main}" + else="org.torproject.metrics.${module.name}.Main" > + <isset property="module.main"/> + </condition> + <property name="workingdir" value="${modulebase}/${module.name}" /> + <mkdir dir="${workingdir}" /> + <java dir="${workingdir}" + fork="true" + maxmemory="2g" + classname="${mainclass}"> + <classpath> + <pathelement location="${dist}/${jarfile}"/> + <pathelement location="${resources}"/> + </classpath> + <jvmarg value="-DLOGBASE=../logs"/> + </java> + </target> + <!-- The following line adds the common targets and properties for Metrics' Java Projects. --> diff --git a/modules/collectdescs/build.xml b/modules/collectdescs/build.xml deleted file mode 100644 index 1499df6..0000000 --- a/modules/collectdescs/build.xml +++ /dev/null @@ -1,11 +0,0 @@ -<project default="run" name="collectdescs" basedir="."> - - <property name="mainclass" value="org.torproject.metrics.collectdescs.Main"/> - - <include file="../../shared/build-base.xml" as="basetask"/> - <target name="clean" depends="basetask.clean"/> - <target name="compile" depends="basetask.compile"/> - <target name="run" depends="basetask.run"/> - -</project> - diff --git a/shared/bin/01-collectdescs.sh b/shared/bin/01-collectdescs.sh deleted file mode 100755 index 18b900f..0000000 --- a/shared/bin/01-collectdescs.sh +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/sh -cd modules/collectdescs/ -ant | grep "[java]" -cd ../../ - diff --git a/modules/collectdescs/src/main/java/org/torproject/metrics/collectdescs/Main.java b/src/main/java/org/torproject/metrics/collectdescs/Main.java similarity index 100% rename from modules/collectdescs/src/main/java/org/torproject/metrics/collectdescs/Main.java rename to src/main/java/org/torproject/metrics/collectdescs/Main.java