Skip Installing Parse when building documentation
[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  All rights reserved. This program and the accompanying materials
5  are made available under the terms of the Apache License, Version 2.0
6  which accompanies this distribution, and is available at
7  http://www.apache.org/licenses/LICENSE-2.0
8 -->
9 <project name="gRPC-Verigraph" default="gRPC-run" basedir="."  xmlns:artifact="antlib:org.apache.maven.artifact.ant">
10   <description>
11       Script for gRPC-Verigraph
12   </description>
13
14   <!-- The location of this assignment -->
15   <property name="grpc.location" location="." />
16   <!-- The location to be used for class files -->
17   <property name="build.dir" location="${grpc.location}/build" />
18   <!-- The location for source files -->
19   <property name="src.dir" location="${grpc.location}/src" />
20   <!-- The location for solutions -->
21   <property name="grpc.dir" value="src/it/polito/verigraph/grpc" />
22   <!-- The location for jar files -->
23   <property name="lib.dir" location="${grpc.location}/lib" />
24   <!-- The location for jar files -->
25   <property name="other_lib.dir" location="${grpc.location}/service/build" />
26   <!-- The location for generated files -->
27   <property name="generated.dir" location="${basedir}/gen-protobuf" />
28   <!-- The default test class -->
29   <property name="test1.class" value="it.polito.verigraph.grpc.test.GrpcServerTest" />
30   <property name="test2.class" value="it.polito.verigraph.grpc.test.GrpcTest" />
31   <property name="test3.class" value="it.polito.verigraph.grpc.test.MultiThreadTest" />
32   <property name="test4.class" value="it.polito.verigraph.grpc.test.ReachabilityTest" />
33   <!-- Tosca grpc test class -->
34   <property name="testToscaGrpc.class" value="it.polito.verigraph.grpc.tosca.test.GrpcToscaTest" />
35   <!-- The name to be given to the final zip -->
36   <property name="sol.zip" value="grpc.zip" />
37   <!-- Java compiler settings -->
38   <property name="debug" value="true" />
39   <property name="debuglevel" value="source,lines,vars" />
40   <property name="target" value="1.8" />
41   <property name="source" value="1.8" />
42
43   <!-- The classpath to be used for running the tests -->
44   <path id="test.classpath">
45     <pathelement path="${build.dir}" />
46     <fileset dir="${grpc.location}/lib">
47       <include name="com.microsoft.z3.jar" />
48     </fileset>
49     <fileset refid="mvn-dependencies" />
50   </path>
51
52   <!-- Here starts part for Maven -->
53   <path id="maven-ant-tasks.classpath" path="lib/maven-ant-tasks-2.1.3.jar" />
54   <typedef resource="org/apache/maven/artifact/ant/antlib.xml"
55              uri="antlib:org.apache.maven.artifact.ant"
56              classpathref="maven-ant-tasks.classpath" />
57   <property file="build.properties"/>
58
59   <!-- Load pom.xml for dependencies -->
60   <artifact:pom id="pomfile" file="pom.xml" />
61   <artifact:dependencies filesetId="mvn-dependencies" pomRefId="pomfile" />
62
63   <!-- Grab the HSQLDB jar and add it to the classpath
64   <artifact:dependencies filesetId="warDeps">
65     <dependency groupId="org.glassfish.jersey" artifactId="jersey-bom" version="2.22.1" />
66   </artifact:dependencies>-->
67
68   <path id="build.classpath">
69     <fileset refid="mvn-dependencies" />
70   </path>
71
72   <!-- target name="init">
73     <mkdir dir="${build.dir}" />
74   </target-->
75
76
77   <!-- The target for compiling the gRPC application -->
78   <!--target name="gRPC-build" depends="init" description="Build the sources"-->
79   <target name="gRPC-build" description="Build the sources">
80     <echo>Building gRPC (if needed)...</echo>
81     <javac
82         debug="${debug}"
83         debuglevel="${debuglevel}"
84         source="${source}"
85         target="${target}"
86         destdir="${build.dir}"
87         classpathref="build.classpath"
88         includeantruntime="false">
89       <src path="${generated.dir}" />
90       <src path="${src.dir}" />
91       <src path="${grpc.location}/gen-src"/>
92       <compilerarg value="-Xlint:unchecked"/>
93       <classpath>
94         <pathelement path="${grpc.location}/lib/com.microsoft.z3.jar"/>
95       </classpath>
96       <include name="$it/polito/**/**/*.java"/>
97       <!-- classpath>
98           <pathelement path="${other_lib.dir}/qjutils.jar"/>
99         </classpath-->
100     </javac>
101     <echo>Done.</echo>
102   </target>
103
104
105   <!-- The target for running the gRPC application -->
106   <target name="gRPC-run" depends="gRPC-build" description="Run gRPC">
107     <parallel>
108       <sequential>
109         <java classname="it.polito.verigraph.grpc.Service" failonerror="true" classpathref="build.classpath" fork="yes">
110           <classpath>
111             <pathelement path="${build.dir}"/>
112             <path refid="test.classpath" />
113           </classpath>
114         </java>
115       </sequential>
116       <sequential>
117         <sleep milliseconds="500"/>
118         <java classname="it.polito.verigraph.grpc.Client" failonerror="true" classpathref="build.classpath" fork="yes">
119           <classpath>
120             <pathelement path="${build.dir}"/>
121           </classpath>
122         </java>
123       </sequential>
124     </parallel>
125   </target>
126
127
128   <target name="gRPC-run-client" depends="gRPC-build" description="Run gRPC client">
129     <java classname="it.polito.verigraph.grpc.client.Client" failonerror="true" classpathref="build.classpath" fork="yes">
130       <classpath>
131         <pathelement path="${build.dir}"/>
132       </classpath>
133     </java>
134   </target>
135
136
137   <target name="gRPC-run-server" depends="gRPC-build" description="Run gRPC server">
138     <java classname="it.polito.verigraph.grpc.server.Service" failonerror="true" classpathref="build.classpath" fork="yes">
139       <classpath>
140         <pathelement path="${build.dir}"/>
141         <path refid="test.classpath" />
142       </classpath>
143     </java>
144   </target>
145
146
147   <target name="gRPC-run-tests" description="Run tests for gRPC">
148     <echo>Running functional tests</echo>
149     <antcall target="runFuncTest.real">
150       <param name="exit.code1" value="126" />
151       <param name="exit.code2" value="125" />
152       <param name="exit.code3" value="124" />
153       <param name="exit.code4" value="123" />
154     </antcall>
155   </target>
156
157   <!-- Run Tosca Grpc Tests -->
158   <target name="gRPC-tosca-run-tests" description="Run tests for Tosca implementation of gRPC">
159     <echo>Running grpc tests...</echo>
160     <junit printsummary="yes" dir="." fork="yes" haltonfailure="no" showoutput="yes" filtertrace="true" timeout="120000">
161       <jvmarg value="-Djava.awt.headless=true" />
162       <formatter type="brief" usefile="false" />
163       <test haltonfailure="no" failureproperty="test_failed" name="${testToscaGrpc.class}" />
164       <classpath>
165         <path refid="test.classpath" />
166       </classpath>
167     </junit>
168     <fail if="test_failed" message="*** JUnit tests for gRPC Tosca completed: some Tests FAILED ***" />
169   </target>
170
171   <!-- Target runFuncTest.real  -->
172   <target name="runFuncTest.real" depends="gRPC-build">
173     <echo>Running First set of Junit tests...</echo>
174     <junit printsummary="yes" dir="." fork="yes" haltonfailure="no" showoutput="no" filtertrace="true" timeout="120000">
175       <jvmarg value="-Djava.awt.headless=true" />
176       <formatter type="brief" usefile="false"/>
177       <test haltonfailure="no" failureproperty="test_failed" name="${test1.class}"/>
178       <classpath>
179         <path refid="test.classpath" />
180       </classpath>
181     </junit>
182     <fail if="test_failed" status="${exit.code1}" message="*** First set of Junit tests: Some Tests FAILED ***"/>
183     <echo>*** First set of Junit tests: All Tests PASSED  ***</echo>
184
185     <echo>Running Second set of Junit tests...</echo>
186     <junit printsummary="yes" dir="." fork="yes" haltonfailure="no" showoutput="no" filtertrace="true" timeout="120000">
187       <jvmarg value="-Djava.awt.headless=true" />
188       <formatter type="brief" usefile="false"/>
189       <test haltonfailure="no" failureproperty="test_failed" name="${test2.class}"/>
190       <classpath>
191         <path refid="test.classpath" />
192       </classpath>
193     </junit>
194     <fail if="test_failed" status="${exit.code2}" message="*** Second set of Junit tests: Some Tests FAILED ***"/>
195     <echo>*** Second set of Junit tests: All Tests PASSED  ***</echo>
196
197     <!--echo>Running Third set of Junit tests...</echo>
198     <junit printsummary="yes" dir="." fork="yes" haltonfailure="no" showoutput="no" filtertrace="true" timeout="120000">
199       <jvmarg value="-Djava.awt.headless=true" />
200       <formatter type="brief" usefile="false"/>
201       <test haltonfailure="no" failureproperty="test_failed" name="${test3.class}"/>
202       <classpath>
203         <path refid="test.classpath" />
204       </classpath>
205     </junit>
206     <fail if="test_failed" status="${exit.code3}" message="*** Third set of Junit tests: Some Tests FAILED ***"/>
207     <echo>*** Third set of Junit tests: All Tests PASSED  ***</echo-->
208
209     <echo>Running Fourth set of Junit tests...</echo>
210     <junit printsummary="yes" dir="." fork="yes" haltonfailure="no" showoutput="no" filtertrace="true" timeout="120000">
211       <jvmarg value="-Djava.awt.headless=true" />
212       <formatter type="brief" usefile="false"/>
213       <test haltonfailure="no" failureproperty="test_failed" name="${test4.class}"/>
214       <classpath>
215         <path refid="test.classpath" />
216         <fileset dir="${lib.dir}">
217           <include name="*.jar" />
218         </fileset>
219       </classpath>
220     </junit>
221     <fail if="test_failed" status="${exit.code4}" message="*** Fourth set of Junit tests: Some Tests FAILED ***"/>
222     <echo>*** Fourth set of Junit tests: All Tests PASSED  ***</echo>
223     <echo>***************************************************</echo>
224     <echo>*************** All Tests PASSED  *****************</echo>
225   </target>
226
227
228   <!-- target for cleaning -->
229   <!-- target name="clean">
230     <delete dir="${build.dir}" />
231   </target-->
232 </project>