1 <?xml version="1.0" encoding="UTF-8"?>
3 Copyright (c) 2017 Politecnico di Torino and others.
5 All rights reserved. This program and the accompanying materials
6 are made available under the terms of the Apache License, Version 2.0
7 which accompanies this distribution, and is available at
8 http://www.apache.org/licenses/LICENSE-2.0
10 <project name="gRPC-Verigraph" default="gRPC-run" basedir="." xmlns:artifact="antlib:org.apache.maven.artifact.ant">
12 Script for gRPC-Verigraph
15 <!-- The location of this assignment -->
16 <property name="grpc.location" location="." />
17 <!-- The location to be used for class files -->
18 <property name="build.dir" location="${grpc.location}/build" />
19 <!-- The location for source files -->
20 <property name="src.dir" location="${grpc.location}/src" />
21 <!-- The location for solutions -->
22 <property name="grpc.dir" value="src/it/polito/verigraph/grpc" />
23 <!-- The location for jar files -->
24 <property name="lib.dir" location="${grpc.location}/lib" />
25 <!-- The location for jar files -->
26 <property name="other_lib.dir" location="${grpc.location}/service/build" />
27 <!-- The location for generated files -->
28 <property name="generated.dir" location="${basedir}/gen-protobuf" />
29 <!-- The default test class -->
30 <property name="test1.class" value="it.polito.verigraph.grpc.test.GrpcServerTest" />
31 <property name="test2.class" value="it.polito.verigraph.grpc.test.GrpcTest" />
32 <property name="test3.class" value="it.polito.verigraph.grpc.test.MultiThreadTest" />
33 <property name="test4.class" value="it.polito.verigraph.grpc.test.ReachabilityTest" />
34 <!-- The name to be given to the final zip -->
35 <property name="sol.zip" value="grpc.zip" />
36 <!-- Java compiler settings -->
37 <property name="debug" value="true" />
38 <property name="debuglevel" value="source,lines,vars" />
39 <property name="target" value="1.8" />
40 <property name="source" value="1.8" />
42 <!-- The classpath to be used for running the tests -->
43 <path id="test.classpath">
44 <pathelement path="${build.dir}" />
45 <fileset dir="${grpc.location}/lib">
46 <include name="com.microsoft.z3.jar" />
48 <fileset refid="mvn-dependencies" />
51 <!-- Here starts part for Maven -->
52 <path id="maven-ant-tasks.classpath" path="lib/maven-ant-tasks-2.1.3.jar" />
53 <typedef resource="org/apache/maven/artifact/ant/antlib.xml"
54 uri="antlib:org.apache.maven.artifact.ant"
55 classpathref="maven-ant-tasks.classpath" />
56 <property file="build.properties"/>
58 <!-- Load pom.xml for dependencies -->
59 <artifact:pom id="pomfile" file="pom.xml" />
60 <artifact:dependencies filesetId="mvn-dependencies" pomRefId="pomfile" />
62 <!-- Grab the HSQLDB jar and add it to the classpath
63 <artifact:dependencies filesetId="warDeps">
64 <dependency groupId="org.glassfish.jersey" artifactId="jersey-bom" version="2.22.1" />
65 </artifact:dependencies>-->
67 <path id="build.classpath">
68 <fileset refid="mvn-dependencies" />
71 <!-- target name="init">
72 <mkdir dir="${build.dir}" />
76 <!-- The target for compiling the gRPC application -->
77 <!--target name="gRPC-build" depends="init" description="Build the sources"-->
78 <target name="gRPC-build" description="Build the sources">
79 <echo>Building gRPC (if needed)...</echo>
82 debuglevel="${debuglevel}"
85 destdir="${build.dir}"
86 classpathref="build.classpath"
87 includeantruntime="false">
88 <src path="${generated.dir}" />
89 <src path="${src.dir}" />
90 <src path="${grpc.location}/gen-src"/>
91 <compilerarg value="-Xlint:unchecked"/>
93 <pathelement path="${grpc.location}/lib/com.microsoft.z3.jar"/>
95 <include name="$it/polito/**/**/*.java"/>
97 <pathelement path="${other_lib.dir}/qjutils.jar"/>
104 <!-- The target for running the gRPC application -->
105 <target name="gRPC-run" depends="gRPC-build" description="Run gRPC">
108 <java classname="it.polito.verigraph.grpc.Service" failonerror="true" classpathref="build.classpath" fork="yes">
110 <pathelement path="${build.dir}"/>
115 <sleep milliseconds="500"/>
116 <java classname="it.polito.verigraph.grpc.Client" failonerror="true" classpathref="build.classpath" fork="yes">
118 <pathelement path="${build.dir}"/>
126 <target name="gRPC-run-client" depends="gRPC-build" description="Run gRPC client">
127 <java classname="it.polito.verigraph.grpc.client.Client" failonerror="true" classpathref="build.classpath" fork="yes">
129 <pathelement path="${build.dir}"/>
135 <target name="gRPC-run-server" depends="gRPC-build" description="Run gRPC server">
136 <java classname="it.polito.verigraph.grpc.server.Service" failonerror="true" classpathref="build.classpath" fork="yes">
138 <pathelement path="${build.dir}"/>
144 <target name="gRPC-run-tests" description="Run tests for gRPC">
145 <echo>Running functional tests</echo>
146 <antcall target="runFuncTest.real">
147 <param name="exit.code1" value="126" />
148 <param name="exit.code2" value="125" />
149 <param name="exit.code3" value="124" />
150 <param name="exit.code4" value="123" />
155 <!-- Target runFuncTest.real -->
156 <target name="runFuncTest.real" depends="gRPC-build">
157 <echo>Running First set of Junit tests...</echo>
158 <junit printsummary="yes" dir="." fork="yes" haltonfailure="no" showoutput="no" filtertrace="true" timeout="120000">
159 <jvmarg value="-Djava.awt.headless=true" />
160 <formatter type="brief" usefile="false"/>
161 <test haltonfailure="no" failureproperty="test_failed" name="${test1.class}"/>
163 <path refid="test.classpath" />
166 <fail if="test_failed" status="${exit.code1}" message="*** First set of Junit tests: Some Tests FAILED ***"/>
167 <echo>*** First set of Junit tests: All Tests PASSED ***</echo>
169 <echo>Running Second set of Junit tests...</echo>
170 <junit printsummary="yes" dir="." fork="yes" haltonfailure="no" showoutput="no" filtertrace="true" timeout="120000">
171 <jvmarg value="-Djava.awt.headless=true" />
172 <formatter type="brief" usefile="false"/>
173 <test haltonfailure="no" failureproperty="test_failed" name="${test2.class}"/>
175 <path refid="test.classpath" />
178 <fail if="test_failed" status="${exit.code2}" message="*** Second set of Junit tests: Some Tests FAILED ***"/>
179 <echo>*** Second set of Junit tests: All Tests PASSED ***</echo>
181 <!--echo>Running Third set of Junit tests...</echo>
182 <junit printsummary="yes" dir="." fork="yes" haltonfailure="no" showoutput="no" filtertrace="true" timeout="120000">
183 <jvmarg value="-Djava.awt.headless=true" />
184 <formatter type="brief" usefile="false"/>
185 <test haltonfailure="no" failureproperty="test_failed" name="${test3.class}"/>
187 <path refid="test.classpath" />
190 <fail if="test_failed" status="${exit.code3}" message="*** Third set of Junit tests: Some Tests FAILED ***"/>
191 <echo>*** Third set of Junit tests: All Tests PASSED ***</echo-->
193 <echo>Running Fourth set of Junit tests...</echo>
194 <junit printsummary="yes" dir="." fork="yes" haltonfailure="no" showoutput="no" filtertrace="true" timeout="120000">
195 <jvmarg value="-Djava.awt.headless=true" />
196 <formatter type="brief" usefile="false"/>
197 <test haltonfailure="no" failureproperty="test_failed" name="${test4.class}"/>
199 <path refid="test.classpath" />
200 <fileset dir="${lib.dir}">
201 <include name="*.jar" />
205 <fail if="test_failed" status="${exit.code4}" message="*** Fourth set of Junit tests: Some Tests FAILED ***"/>
206 <echo>*** Fourth set of Junit tests: All Tests PASSED ***</echo>
207 <echo>***************************************************</echo>
208 <echo>*************** All Tests PASSED *****************</echo>
212 <!-- target for cleaning -->
213 <!-- target name="clean">
214 <delete dir="${build.dir}" />