Merge "Disable syslog in heat-translator for functest integration"
[parser.git] / verigraph / gRPC-build.xml
1 <?xml version="1.0" encoding="UTF-8"?>
2 <!--
3  Copyright (c) 2017 Politecnico di Torino and others.
4
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
9 -->
10 <project name="gRPC-Verigraph" default="gRPC-run" basedir="."  xmlns:artifact="antlib:org.apache.maven.artifact.ant">
11   <description>
12       Script for gRPC-Verigraph
13   </description>
14
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" />
41
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" />
47     </fileset>
48     <fileset refid="mvn-dependencies" />
49   </path>
50
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"/>
57
58   <!-- Load pom.xml for dependencies -->
59   <artifact:pom id="pomfile" file="pom.xml" />
60   <artifact:dependencies filesetId="mvn-dependencies" pomRefId="pomfile" />
61
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>-->
66
67   <path id="build.classpath">
68       <fileset refid="mvn-dependencies" />
69   </path>
70
71   <!-- target name="init">
72     <mkdir dir="${build.dir}" />
73   </target-->
74
75
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>
80       <javac
81         debug="${debug}"
82         debuglevel="${debuglevel}"
83         source="${source}"
84         target="${target}"
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"/>
92         <classpath>
93           <pathelement path="${grpc.location}/lib/com.microsoft.z3.jar"/>
94         </classpath>
95         <include name="$it/polito/**/**/*.java"/>
96         <!-- classpath>
97           <pathelement path="${other_lib.dir}/qjutils.jar"/>
98         </classpath-->
99       </javac>
100     <echo>Done.</echo>
101   </target>
102
103
104   <!-- The target for running the gRPC application -->
105   <target name="gRPC-run" depends="gRPC-build" description="Run gRPC">
106     <parallel>
107        <sequential>
108           <java classname="it.polito.verigraph.grpc.Service" failonerror="true" classpathref="build.classpath" fork="yes">
109             <classpath>
110               <pathelement path="${build.dir}"/>
111             </classpath>
112             </java>
113         </sequential>
114         <sequential>
115           <sleep milliseconds="500"/>
116             <java classname="it.polito.verigraph.grpc.Client" failonerror="true" classpathref="build.classpath" fork="yes">
117            <classpath>
118           <pathelement path="${build.dir}"/>
119         </classpath>
120            </java>
121       </sequential>
122     </parallel>
123   </target>
124
125
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">
128       <classpath>
129         <pathelement path="${build.dir}"/>
130       </classpath>
131     </java>
132   </target>
133
134
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">
137       <classpath>
138         <pathelement path="${build.dir}"/>
139       </classpath>
140     </java>
141   </target>
142
143
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" />
151     </antcall>
152   </target>
153
154
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}"/>
162       <classpath>
163         <path refid="test.classpath" />
164       </classpath>
165     </junit>
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>
168
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}"/>
174       <classpath>
175         <path refid="test.classpath" />
176       </classpath>
177     </junit>
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>
180
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}"/>
186       <classpath>
187         <path refid="test.classpath" />
188       </classpath>
189     </junit>
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-->
192
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}"/>
198       <classpath>
199         <path refid="test.classpath" />
200         <fileset dir="${lib.dir}">
201           <include name="*.jar" />
202         </fileset>
203       </classpath>
204     </junit>
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>
209   </target>
210
211
212   <!-- target for cleaning -->
213   <!-- target name="clean">
214     <delete dir="${build.dir}" />
215   </target-->
216 </project>