summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoriwakeh <iwakeh@torproject.org>2017-09-16 15:13:30 +0000
committeriwakeh <iwakeh@torproject.org>2017-10-16 13:02:51 +0000
commit0b3a6f930bb2d3c8e32899fca1bbdeabc4806b26 (patch)
tree5b8c2931de5411fccf56b5ba2a5d836b061a74b7
parentcf18da90a6e344d79653ec6d3c45b30f73b92e8b (diff)
Use metrics-base as build environment.task-21145
The task 'war' creates a war-file for deployment in tomcat (as before), the 'run' task is gone, and 'jar' creates an executable jar with main class ExoneraTorDatabaseImporter as well as the source and javadoc jars. Removed obsolete shell script. Coverage is really low, but increasing it wasn't part of this task. Implements task-21145.
-rw-r--r--.gitmodules3
-rw-r--r--build.xml209
-rwxr-xr-xrun-exonerator.sh3
m---------src/build0
-rwxr-xr-xsrc/main/resources/bootstrap-development.sh10
-rw-r--r--src/main/resources/context.xml (renamed from src/main/webapp/context.xml)0
-rw-r--r--src/main/resources/web.xml (renamed from src/main/webapp/web.xml)2
-rw-r--r--src/main/resources/web/css/bootstrap.min.css (renamed from src/main/webapp/css/bootstrap.min.css)0
-rw-r--r--src/main/resources/web/css/exonerator.css (renamed from src/main/webapp/css/exonerator.css)0
-rw-r--r--src/main/resources/web/images/exonerator-logo.png (renamed from src/main/webapp/images/exonerator-logo.png)bin70763 -> 70763 bytes
-rw-r--r--src/main/resources/web/images/exonerator-wordmark.png (renamed from src/main/webapp/images/exonerator-wordmark.png)bin14543 -> 14543 bytes
-rw-r--r--src/main/resources/web/images/favicon.ico (renamed from src/main/webapp/images/favicon.ico)bin1150 -> 1150 bytes
-rw-r--r--src/main/resources/web/jsps/bottom.jsp (renamed from src/main/webapp/WEB-INF/bottom.jsp)0
-rw-r--r--src/main/resources/web/jsps/index.jsp (renamed from src/main/webapp/WEB-INF/index.jsp)0
-rw-r--r--src/main/resources/web/jsps/top.jsp (renamed from src/main/webapp/WEB-INF/top.jsp)0
15 files changed, 77 insertions, 150 deletions
diff --git a/.gitmodules b/.gitmodules
index e69de29..7d3a2ca 100644
--- a/.gitmodules
+++ b/.gitmodules
@@ -0,0 +1,3 @@
+[submodule "src/build"]
+ path = src/build
+ url = https://git.torproject.org/metrics-base.git
diff --git a/build.xml b/build.xml
index 4ba9a3d..ee04e1b 100644
--- a/build.xml
+++ b/build.xml
@@ -1,172 +1,89 @@
-<project default="run" name="exonerator" basedir=".">
+<?xml version="1.0"?>
- <!-- Define build paths. -->
- <property name="sources" value="src/main/java"/>
- <property name="resources" value="src/main/resources"/>
- <property name="webapp" value="src/main/webapp"/>
- <property name="generated" value="generated/"/>
- <property name="classes" value="${generated}/classes"/>
- <property name="testclasses" value="${generated}/testclasses/"/>
- <property name="dist" value="${generated}/dist"/>
- <property name="testresources" value="src/test/resources/"/>
- <property name="testsources" value="src/test/java"/>
- <property name="testresult" value="${generated}/test-results"/>
- <property name="libs" value="lib"/>
- <property name="webxmlfile" value="src/main/webapp/web.xml"/>
- <property name="warfile" value="${dist}/exonerator.war"/>
- <property name="source-and-target-java-version" value="1.8" />
- <property name="metricslibversion" value="2.0.0" />
- <patternset id="runtime" >
- <include name="metrics-lib-${metricslibversion}.jar"/>
- <include name="commons-compress-1.13.jar"/>
+<!DOCTYPE project [
+ <!ENTITY base SYSTEM "src/build/java/base.xml">
+]>
+
+<project default="usage" name="exonerator" basedir=".">
+
+ <property name="javadoc-title" value="ExoneraTor API Documentation"/>
+ <property name="implementation-title" value="ExoneraTor" />
+ <property name="release.version" value="1.0.0-dev" />
+ <property name="metricslibversion" value="2.1.1" />
+ <property name="warfile"
+ value="exonerator-${release.version}.war"/>
+
+ <property name="name" value="exonerator"/>
+
+ <property name="project-main-class"
+ value="org.torproject.exonerator.ExoneraTorDatabaseImporter" />
+ <property name="additional2sign" value="${warfile}" />
+ <property name="tardepends" value="war" />
+
+ <!-- The coverage needs to be improved! -->
+ <target name="coverage-check">
+ <cobertura-check totallinerate="9" totalbranchrate="7" >
+ <!-- example regexes
+ <regex pattern="org.torproject.abc.xyz.*"
+ branchrate="87" linerate="73"/>
+ -->
+ </cobertura-check>
+ </target>
+
+ <patternset id="common" >
<include name="commons-codec-1.10.jar"/>
<include name="commons-lang3-3.5.jar"/>
<include name="gson-2.4.jar" />
<include name="postgresql-9.4.1212.jar"/>
+ <include name="slf4j-api-1.7.22.jar"/>
+ </patternset>
+
+ <patternset id="library" >
+ <patternset refid="common" />
+ <include name="metrics-lib-${metricslibversion}.jar"/>
+ <include name="commons-compress-1.13.jar"/>
<include name="servlet-api-3.0.jar"/>
<include name="logback-core-1.1.9.jar" />
<include name="logback-classic-1.1.9.jar" />
- <include name="slf4j-api-1.7.22.jar"/>
<include name="xz-1.6.jar"/>
</patternset>
- <path id="classpath">
- <pathelement path="${classes}"/>
- <fileset dir="${libs}">
- <patternset refid="runtime" />
- </fileset>
- </path>
- <path id="test.classpath">
- <pathelement path="${classes}"/>
- <pathelement path="${resources}"/>
- <pathelement path="${testclasses}"/>
- <pathelement path="${testresources}"/>
- <fileset dir="${libs}">
- <patternset refid="runtime" />
- </fileset>
- <fileset dir="${libs}">
- <include name="junit4-4.12.jar"/>
- <include name="hamcrest-all-1.3.jar"/>
- </fileset>
- </path>
- <path id="checkstyle.classpath" >
- <fileset dir="${libs}">
- <include name="checkstyle-6.17-all.jar" />
- </fileset>
- </path>
-
- <target name="clean">
- <delete includeEmptyDirs="true" quiet="true">
- <fileset dir="${generated}" defaultexcludes="false" includes="**" />
- </delete>
- </target>
-
- <target name="init">
- <copy file="${resources}/config" tofile="${basedir}/config"/>
- <mkdir dir="${classes}"/>
- <mkdir dir="${testclasses}"/>
- <mkdir dir="${dist}"/>
- </target>
-
- <!-- Compile all servlets and plain Java classes. -->
- <target name="compile" depends="init">
- <javac destdir="${classes}"
- srcdir="${sources}"
- source="${source-and-target-java-version}"
- target="${source-and-target-java-version}"
- debug="true"
- deprecation="true"
- optimize="false"
- failonerror="true"
- includeantruntime="false">
- <classpath refid="classpath"/>
- </javac>
- </target>
-
- <target name="testcompile" depends="init">
- <javac destdir="${testclasses}"
- srcdir="${testsources}"
- source="${source-and-target-java-version}"
- target="${source-and-target-java-version}"
- debug="true"
- deprecation="true"
- optimize="false"
- failonerror="true"
- includeantruntime="false">
- <classpath refid="test.classpath"/>
- </javac>
- </target>
-
- <target name="test" depends="compile,testcompile">
- <junit fork="true"
- haltonfailure="true"
- printsummary="on">
- <classpath refid="test.classpath"/>
- <formatter type="plain" usefile="false"/>
- <batchtest>
- <fileset dir="${testclasses}"
- includes="**/*Test.class"/>
- </batchtest>
- </junit>
- </target>
- <!-- Import descriptors into the ExoneraTor database. -->
- <target name="run" depends="compile">
- <java fork="true"
- maxmemory="2048m"
- classname="org.torproject.exonerator.ExoneraTorDatabaseImporter">
- <classpath refid="classpath"/>
- </java>
- </target>
+ <patternset id="web" >
+ <patternset refid="common" />
+ </patternset>
- <taskdef resource="com/puppycrawl/tools/checkstyle/ant/checkstyle-ant-task.properties">
- <classpath refid="checkstyle.classpath" />
- </taskdef>
- <target name="checks" depends="compile">
- <checkstyle config="${testresources}/metrics_checks.xml">
- <fileset dir="${sources}"
- includes="**/*.java" />
- <fileset dir="${testsources}"
- includes="**/*.java" />
- <classpath>
- <path refid="classpath" />
- <path refid="checkstyle.classpath" />
- </classpath>
- <formatter type="plain"
- toFile="${generated}/checkstyle_report.txt"/>
- </checkstyle>
- <exec executable="cat" outputproperty="checkstyle.result">
- <arg value="${generated}/checkstyle_report.txt" />
- </exec>
- <fail message="Checkstyle complaints: ${checkstyle.result}" >
- <condition>
- <not>
- <length string="${checkstyle.result}"
- length="29" />
- </not>
- </condition>
- </fail>
- </target>
+ <patternset id="runtime" >
+ <patternset refid="library" />
+ </patternset>
<!-- Create a .war file for deployment. -->
<target name="war"
depends="compile">
- <war destfile="${warfile}"
- webxml="${webxmlfile}">
- <fileset dir="${webapp}" includes="css/* images/* WEB-INF/*"/>
+ <war destfile="${dist}/${warfile}"
+ webxml="${resources}/web.xml">
+ <zipfileset dir="${resources}/web"
+ prefix=""
+ includes="css/* images/*"/>
+ <zipfileset dir="${resources}/web/jsps"
+ prefix="WEB-INF"
+ includes="*.jsp"/>
<lib dir="${libs}">
- <include name="commons-codec-1.10.jar"/>
- <include name="commons-lang3-3.5.jar"/>
- <include name="gson-2.4.jar" />
- <include name="postgresql-9.4.1212.jar"/>
- <include name="slf4j-api-1.7.22.jar"/>
+ <patternset refid="web" />
</lib>
<classes dir="${classes}"/>
<zipfileset dir="${resources}"
prefix="WEB-INF/classes"
- excludes="config **/db/* db" />
- <metainf dir="${webapp}"
+ includes="*.properties" />
+ <metainf dir="${resources}"
includes="context.xml"/>
</war>
</target>
+
+
+ <!-- The following line adds the common targets and properties
+ for Metrics' Java Projects.
+ -->
+ &base;
+
</project>
diff --git a/run-exonerator.sh b/run-exonerator.sh
deleted file mode 100755
index d090ec9..0000000
--- a/run-exonerator.sh
+++ /dev/null
@@ -1,3 +0,0 @@
-#!/bin/bash
-ant run | grep "\[java\]"
-
diff --git a/src/build b/src/build
new file mode 160000
+Subproject 4b34756ddd71ccaf0fc30e5f5bf0a813a297d4a
diff --git a/src/main/resources/bootstrap-development.sh b/src/main/resources/bootstrap-development.sh
new file mode 100755
index 0000000..28fb975
--- /dev/null
+++ b/src/main/resources/bootstrap-development.sh
@@ -0,0 +1,10 @@
+#!/bin/sh
+#
+# Copyright 2016--2017 The Tor Project
+# See LICENSE for licensing information
+#
+# Use for submodule initialization and checkout.
+# Only necessary after very first checkout without recursion.
+#
+git submodule update --init --remote
+
diff --git a/src/main/webapp/context.xml b/src/main/resources/context.xml
index 1cf53c5..1cf53c5 100644
--- a/src/main/webapp/context.xml
+++ b/src/main/resources/context.xml
diff --git a/src/main/webapp/web.xml b/src/main/resources/web.xml
index d838059..881a613 100644
--- a/src/main/webapp/web.xml
+++ b/src/main/resources/web.xml
@@ -3,7 +3,7 @@
<web-app version="2.4"
xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
+ xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd" >
<servlet>
diff --git a/src/main/webapp/css/bootstrap.min.css b/src/main/resources/web/css/bootstrap.min.css
index d65c66b..d65c66b 100644
--- a/src/main/webapp/css/bootstrap.min.css
+++ b/src/main/resources/web/css/bootstrap.min.css
diff --git a/src/main/webapp/css/exonerator.css b/src/main/resources/web/css/exonerator.css
index 386d49e..386d49e 100644
--- a/src/main/webapp/css/exonerator.css
+++ b/src/main/resources/web/css/exonerator.css
diff --git a/src/main/webapp/images/exonerator-logo.png b/src/main/resources/web/images/exonerator-logo.png
index 3a31110..3a31110 100644
--- a/src/main/webapp/images/exonerator-logo.png
+++ b/src/main/resources/web/images/exonerator-logo.png
Binary files differ
diff --git a/src/main/webapp/images/exonerator-wordmark.png b/src/main/resources/web/images/exonerator-wordmark.png
index eaa93fc..eaa93fc 100644
--- a/src/main/webapp/images/exonerator-wordmark.png
+++ b/src/main/resources/web/images/exonerator-wordmark.png
Binary files differ
diff --git a/src/main/webapp/images/favicon.ico b/src/main/resources/web/images/favicon.ico
index 48060b1..48060b1 100644
--- a/src/main/webapp/images/favicon.ico
+++ b/src/main/resources/web/images/favicon.ico
Binary files differ
diff --git a/src/main/webapp/WEB-INF/bottom.jsp b/src/main/resources/web/jsps/bottom.jsp
index edfb99b..edfb99b 100644
--- a/src/main/webapp/WEB-INF/bottom.jsp
+++ b/src/main/resources/web/jsps/bottom.jsp
diff --git a/src/main/webapp/WEB-INF/index.jsp b/src/main/resources/web/jsps/index.jsp
index a8c86c6..a8c86c6 100644
--- a/src/main/webapp/WEB-INF/index.jsp
+++ b/src/main/resources/web/jsps/index.jsp
diff --git a/src/main/webapp/WEB-INF/top.jsp b/src/main/resources/web/jsps/top.jsp
index 481996b..481996b 100644
--- a/src/main/webapp/WEB-INF/top.jsp
+++ b/src/main/resources/web/jsps/top.jsp