build.xml 6.33 KB
Newer Older
1
<?xml version="1.0"?>
Karsten Loesing's avatar
Karsten Loesing committed
2

3
4
5
6
7
8
9
10
<!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" />
Karsten Loesing's avatar
Karsten Loesing committed
11
  <property name="release.version" value="3.0.1" />
Karsten Loesing's avatar
Karsten Loesing committed
12
  <property name="metricslibversion" value="2.4.0" />
13
  <property name="jetty.version" value="-9.2.21.v20170120" />
14
15
16
17
18
19
  <property name="warfile"
            value="exonerator-${release.version}.war"/>

  <property name="name" value="exonerator"/>

  <property name="project-main-class"
20
            value="org.torproject.metrics.exonerator.ExoneraTorDatabaseImporter" />
21
22
23
24
25
26
27
28
29
30
31
32
33
34
  <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" >
35
    <include name="commons-codec-1.10.jar"/>
36
    <include name="commons-lang3-3.5.jar"/>
Karsten Loesing's avatar
Karsten Loesing committed
37
38
39
    <include name="jackson-annotations-2.8.6.jar"/>
    <include name="jackson-core-2.8.6.jar"/>
    <include name="jackson-databind-2.8.6.jar"/>
40
41
    <include name="logback-core-1.1.9.jar" />
    <include name="logback-classic-1.1.9.jar" />
42
    <include name="postgresql-9.4.1212.jar"/>
43
44
45
46
47
48
49
    <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"/>
50
    <include name="servlet-api-3.1.jar"/>
51
52
53
    <include name="xz-1.6.jar"/>
  </patternset>

54
  <patternset id="web" >
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
    <include name="jetty9-annotations${jetty.version}.jar"/>
    <include name="jetty9-server${jetty.version}.jar"/>
    <include name="jetty9-servlet${jetty.version}.jar"/>
    <include name="jetty9-util${jetty.version}.jar"/>
    <include name="jetty9-http${jetty.version}.jar"/>
    <include name="jetty9-io${jetty.version}.jar"/>
    <include name="jetty9-xml${jetty.version}.jar"/>
    <include name="jetty9-webapp${jetty.version}.jar"/>
    <include name="jetty9-continuation${jetty.version}.jar"/>
    <include name="jetty9-security${jetty.version}.jar"/>
  </patternset>

  <patternset id="webruntime" >
    <include name="asm-5.2.jar" />
    <include name="asm-commons-5.2.jar" />
    <include name="jetty9-plus${jetty.version}.jar"/>
    <include name="jetty9-jndi${jetty.version}.jar"/>
    <include name="jetty9-apache-jsp${jetty.version}-tweaked.jar" />
    <include name="tomcat8-embed-jasper-8.5.14.jar" />
    <include name="tomcat8-embed-el-8.5.14.jar" />
    <include name="tomcat8-embed-core-8.5.14.jar" />
    <include name="eclipse-ecj-3.11.1.jar" />
77
  </patternset>
Karsten Loesing's avatar
Karsten Loesing committed
78

79
80
  <patternset id="runtime" >
    <patternset refid="library" />
81
    <patternset refid="web" />
82
  </patternset>
Karsten Loesing's avatar
Karsten Loesing committed
83

Karsten Loesing's avatar
Karsten Loesing committed
84
85
86
  <!-- Create a .war file for deployment. -->
  <target name="war"
          depends="compile">
87
88
89
90
91
92
93
94
95
96
    <echo message="Removing problematic service definitions from"/>
    <echo message="${libs}/jetty9-apache-jsp${jetty.version}.jar and using "/>
    <echo message="${libs}/jetty9-apache-jsp${jetty.version}-tweaked.jar below." />
    <delete file="${libs}/jetty9-apache-jsp${jetty.version}-tweaked.jar"
            quiet="true" />
    <jar destfile="${libs}/jetty9-apache-jsp${jetty.version}-tweaked.jar">
      <zipfileset src="${libs}/jetty9-apache-jsp${jetty.version}.jar" >
        <exclude name="**/javax.servlet.ServletContainerInitializer"/>
      </zipfileset>
    </jar>
97
    <war destfile="${dist}/${warfile}"
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
         duplicate="fail"
         webxml="${resources}/web.xml"
	       basedir="${classes}">
      <restrict>
        <not>
          <and>
            <name name="META-INF/*" />
            <not>
              <name name="META-INF/services/*" />
            </not>
          </and>
        </not>
        <archives>
          <zips>
            <fileset dir="${libs}">
              <patternset refid="common" />
              <patternset refid="web" />
              <patternset refid="webruntime" />
            </fileset>
          </zips>
        </archives>
      </restrict>
      <exclude name="**/Test*.class" />
      <zipfileset dir="${resources}"
                  prefix=""
                  includes="logback.xml" />
124
125
      <zipfileset dir="${resources}/web"
                  prefix=""
126
                  includes="css/* images/*" />
127
128
129
      <zipfileset dir="${resources}/web/jsps"
                  prefix="WEB-INF"
                  includes="*.jsp"/>
130
      <zipfileset dir="${resources}"
131
                  includes="*.properties" />
132
133
134
135
136
137
138
      <fileset dir="${resources}" includes="jetty.xml" />
      <manifest>
        <attribute name="Implemented-By" value="The Tor Project" />
        <attribute name="Implementation-Title" value="Exonerator Server"/>
        <attribute name="Implementation-Version"
                   value="${release.version}-${git.revision}"/>
        <attribute name="Main-Class"
139
                   value="org.torproject.metrics.exonerator.ServerMain" />
140
      </manifest>
Karsten Loesing's avatar
Karsten Loesing committed
141
142
    </war>
  </target>
143

144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
  <!-- Create a test .war file for basic start w/o db resources. -->
  <target name="smoke-test-war"
          depends="war">

    <delete file="${generated}/${name}-dummy-test.war"
            quiet="true" />
    <copy overwrite="true"
          file="${resources}/test-web.xml"
          tofile="${generated}/web.xml"/>
    <jar destfile="${generated}/${name}-dummy-test.war">
      <zipfileset src="${dist}/${warfile}" >
        <exclude name="WEB-INF/web.xml"/>
      </zipfileset>
      <zipfileset dir="${generated}"
                  prefix="WEB-INF"
                  includes="web.xml" />
      <manifest>
        <attribute name="Implemented-By" value="The Tor Project" />
        <attribute name="Implementation-Title" value="Test Exonerator Server"/>
        <attribute name="Implementation-Version"
                   value="${release.version}-${git.revision}"/>
        <attribute name="Main-Class"
166
                   value="org.torproject.metrics.exonerator.ServerMain" />
167
168
169
      </manifest>
    </jar>
  </target>
170
171
172
173
174
175

  <!-- The following line adds the common targets and properties
       for Metrics' Java Projects.
  -->
  &base;

Karsten Loesing's avatar
Karsten Loesing committed
176
177
</project>