forked from SOM-st/TruffleSOM
-
Notifications
You must be signed in to change notification settings - Fork 2
/
build.xml
160 lines (145 loc) · 6.47 KB
/
build.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
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
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
<project name="som" basedir="." default="compile" xmlns:unless="ant:unless" xmlns:if="ant:if" xmlns:jacoco="antlib:org.jacoco.ant">
<property name="src.dir" value="src" />
<property name="src.dirMate" value="MateExtensions" />
<property name="src_gen.dir" value="src_gen" />
<property name="test.dir" value="tests" />
<property name="lib.dir" location="libs" />
<property name="graallib.dir" location="/Users/guidochari/.local/graalvm-ce-1.0.0-rc16/Contents/Home/jre/lib" />
<property name="sdk.dir" value="${graallib.dir}/boot" />
<property name="truffle.dir" value="${graallib.dir}/truffle/" />
<property name="graal.dir" location="${graallib.dir}/graal/compiler" />
<property name="bd.dir" location="${lib.dir}/black-diamonds/" />
<property name="junit.version" value="4.12" />
<property name="checkstyle.version" value="8.8" />
<property environment="env" />
<property name="build.dir" value="build" />
<property name="classes.dir" value="${build.dir}/classes" />
<path id="project.classpath">
<pathelement location="${classes.dir}" />
<pathelement location="${test.dir}" />
<pathelement location="${lib.dir}/junit-${junit.version}.jar" />
<pathelement location="${lib.dir}/hamcrest-core-1.3.jar" />
<pathelement location="${lib.dir}/gson-2.7.jar" />
<pathelement location="${sdk.dir}/graal-sdk.jar" />
<pathelement location="${truffle.dir}/truffle-api.jar" />
<pathelement location="${truffle.dir}/truffle-dsl-processor.jar" />
<pathelement location="${truffle.dir}/truffle-debug.jar" />
<pathelement location="${truffle.dir}/truffle-tck.jar" />
<pathelement location="${lib.dir}/json/build/minimal-json.jar" />
<pathelement location="${bd.dir}/build/black-diamonds.jar" />
</path>
<target name="clean" description="Remove build directories and generated code">
<delete dir="${build.dir}" />
<delete dir="${src_gen.dir}" />
</target>
<target name="eclipseformat">
<pathconvert pathsep=" " property="javafiles">
<fileset dir="${src.dir}">
<include name="**/*.java" />
</fileset>
<fileset dir="${test.dir}">
<include name="**/*.java" />
</fileset>
</pathconvert>
<exec executable="${env.ECLIPSE_EXE}" dir="${basedir}">
<arg value="-nosplash" />
<arg value="-application" />
<arg value="-consolelog" />
<arg value="-data" />
<arg value="${basedir}" />
<arg value="-vm" />
<arg value="${env.JAVA_HOME}/bin/java" />
<arg value="org.eclipse.jdt.core.JavaCodeFormatter" />
<arg value="-config" />
<arg value="${basedir}/.settings/org.eclipse.jdt.core.prefs" />
<arg line="${javafiles}" />
</exec>
<exec executable="git" dir="${basedir}" failonerror="true">
<arg value="status" />
<arg value="*.java" />
</exec>
<exec executable="git" dir="${basedir}" failonerror="true">
<arg value="diff-index" />
<arg value="--quiet" />
<arg value="HEAD" />
</exec>
</target>
<target name="check-core-lib-available">
<available file="core-lib/.git" property="core-lib.present" />
</target>
<target name="core-lib" depends="check-core-lib-available" unless="core-lib.present">
<exec executable="git">
<arg value="submodule" />
<arg value="update" />
<arg value="--init" />
</exec>
</target>
<target name="bd-lib">
<exec executable="ant" dir="${bd.dir}">
<arg value="jar" />
<arg value="-Dgraallib.dir=${graallib.dir}" />
</exec>
</target>
<target name="minimal-json-lib" depends="core-lib">
<subant buildpath="libs/json" target="jar" failonerror="true" />
</target>
<target name="libs" depends="core-lib, minimal-json-lib, bd-lib">
<get src="https://repo1.maven.org/maven2/junit/junit/${junit.version}/junit-${junit.version}.jar" usetimestamp="true" dest="${lib.dir}/junit-${junit.version}.jar" />
<get src="https://repo1.maven.org/maven2/org/hamcrest/hamcrest-core/1.3/hamcrest-core-1.3.jar" usetimestamp="true" dest="${lib.dir}/hamcrest-core-1.3.jar" />
<get src="https://repo1.maven.org/maven2/com/google/code/gson/gson/2.7/gson-2.7.jar" usetimestamp="true" dest="${lib.dir}/gson-2.7.jar" />
</target>
<target name="checkstyle-jar">
<get src="https://github.com/checkstyle/checkstyle/releases/download/checkstyle-${checkstyle.version}/checkstyle-${checkstyle.version}-all.jar" usetimestamp="true" dest="${lib.dir}/checkstyle-${checkstyle.version}-all.jar" />
</target>
<target name="checkstyle" depends="checkstyle-jar" description="Check Code with Checkstyle">
<taskdef resource="com/puppycrawl/tools/checkstyle/ant/checkstyle-ant-task.properties" classpath="${lib.dir}/checkstyle-${checkstyle.version}-all.jar" />
<checkstyle config=".checkstyle_checks.xml">
<fileset dir="src" includes="**/*.java" />
<formatter type="plain" />
</checkstyle>
</target>
<target name="compile" depends="libs" description="Compile TruffleSOM">
<mkdir dir="${build.dir}" />
<mkdir dir="${classes.dir}" />
<mkdir dir="${src_gen.dir}" />
<javac includeantruntime="false" destdir="${classes.dir}" debug="true">
<src path="${src.dir}" />
<src path="${src.dirMate}" />
<src path="${src_gen.dir}" />
<exclude name="tools/dym/nodes/**"/>
<exclude name="tools/dym/DynamicMetrics.java"/>
<exclude name="som/instrumentation/InstrumentableDirectCallNode.java"/>
<exclude name="som/instrumentation/DirectCallNodeWrapper.java"/>
<classpath refid="project.classpath" />
<compilerarg line="-XDignore.symbol.file" />
<compilerarg line="-Xlint:all" />
</javac>
<javac includeantruntime="false" srcdir="${src_gen.dir}" destdir="${classes.dir}" debug="true">
<classpath refid="project.classpath" />
<compilerarg line="-Xlint:all" />
</javac>
<javac includeantruntime="false" srcdir="${test.dir}" destdir="${classes.dir}" debug="true">
<classpath refid="project.classpath" />
<exclude name="**/TruffleMateTCK.java" />
</javac>
</target>
<target name="jar" depends="compile" description="Package as JAR">
<jar destfile="${build.dir}/som.jar" basedir="${classes.dir}">
</jar>
</target>
<target name="test" depends="compile" description="Execute tests">
<junit haltonerror="false" haltonfailure="false" failureproperty="test.failed" outputtoformatters="true">
<jvmarg value="-ea" />
<jvmarg value="-esa" />
<classpath refid="project.classpath" />
<batchtest fork="yes" filtertrace="false">
<fileset dir="${test.dir}">
<include name="**/*Test*.java" />
</fileset>
</batchtest>
<formatter type="brief" usefile="false" />
</junit>
<fail message="Test failure detected, check test results." if="test.failed" />
</target>
<target name="tests" depends="test" />
</project>