-
Notifications
You must be signed in to change notification settings - Fork 4
/
build.xml
168 lines (160 loc) · 6.36 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
161
162
163
164
165
166
167
168
<?xml version="1.0" encoding="UTF-8"?>
<project basedir="." default="build" name="stanse" xmlns:cpptasks="antlib:net.sf.antcontrib.cpptasks">
<property name="dist" value="dist"/>
<property name="parser.location" value="src/cz/muni/stanse/cparser"/>
<property name="antlr.location" value="tools/antlr-3.2.jar"/>
<property name="antlr-runtime.location" value="${dist}/lib/antlr-runtime-3.2.jar"/>
<condition property="platform" value="windows">
<os family="windows" />
</condition>
<condition property="platform" value="linux">
<os family="unix" /> <!-- or better: name="linux"; someone with a linux box should test that -->
</condition>
<path id="project.classpath">
<pathelement location="build"/>
<pathelement location="${antlr-runtime.location}"/>
<pathelement location="${dist}/lib/dom4j-1.6.1.jar"/>
<pathelement location="${dist}/lib/jgrapht-jdk1.6.jar"/>
<pathelement location="${dist}/lib/jopt-simple-3.1.jar"/>
<pathelement location="${dist}/lib/log4j-1.2.16.jar"/>
<pathelement location="${dist}/lib/swing-layout-1.0.4.jar"/>
<pathelement location="${dist}/lib/com.inamik.utils.tableformatter-0.96.2.jar"/>
</path>
<target name="run">
<java jar="${dist}/${ant.project.name}.jar" fork="true" >
<arg line="${stanse.args}"/>
</java>
</target>
<target name="init">
<mkdir dir="build"/>
</target>
<target name="parser-clean">
<delete>
<fileset dir="${parser.location}">
<include name="GNUCa__.g"/>
<include name="GNUCa.java"/>
<include name="GNUCa.tokens"/>
<include name="GNUCaLexer.java"/>
<include name="GNUCaParser.java"/>
<include name="XMLEmitter.java"/>
<include name="XMLEmitter.tokens"/>
<include name="CFGEmitter.java"/>
<include name="CFGEmitter.tokens"/>
</fileset>
<fileset dir="src/cparser-c/">
<include name="GNUCaLexer.c"/>
<include name="GNUCaLexer.h"/>
<include name="GNUCaParser.c"/>
<include name="GNUCaParser.h"/>
<include name="GNUCa.tokens"/>
</fileset>
</delete>
</target>
<target name="clean" depends="parser-clean, javadoc-clean">
<delete dir="build"/>
<delete>
<fileset dir="${dist}">
<include name="stanse.jar"/>
</fileset>
<fileset dir="${dist}/bin">
<include name="stcparser-c"/>
</fileset>
</delete>
</target>
<target name="parser">
<antlr:antlr3 xmlns:antlr="antlib:org/apache/tools/ant/antlr"
target="${parser.location}/GNUCa.g">
<classpath path="${antlr.location}"/>
</antlr:antlr3>
<antlr:antlr3 xmlns:antlr="antlib:org/apache/tools/ant/antlr"
target="${parser.location}/XMLEmitter.g">
<classpath path="${antlr.location}"/>
</antlr:antlr3>
<antlr:antlr3 xmlns:antlr="antlib:org/apache/tools/ant/antlr"
target="${parser.location}/CFGEmitter.g">
<classpath path="${antlr.location}"/>
</antlr:antlr3>
</target>
<target name="cparser-c">
<mkdir dir="build/cparser-c/"/>
<exec executable="./getarch.sh" outputproperty="arch" osfamily="unix"/>
<exec executable="cmd" outputproperty="arch" osfamily="windows">
<arg value="/c" />
<arg value="getarch.cmd" />
</exec>
<antlr:antlr3 xmlns:antlr="antlib:org/apache/tools/ant/antlr"
target="src/cparser-c/GNUCa.g">
<classpath path="${antlr.location}"/>
</antlr:antlr3>
<cpptasks:cc optimize="full" objdir="build/cparser-c/">
<includepath path="src/cparser-c/lib/include-${arch}/"/>
<fileset dir="src/cparser-c/">
<include name="GNUCaLexer.c"/>
<include name="GNUCaParser.c"/>
<include name="main.c"/>
</fileset>
</cpptasks:cc>
<cpptasks:cc outtype="executable" outfile="build/cparser-c/stcparser-c">
<fileset dir="build/cparser-c/">
<include name="GNUCaLexer.o"/>
<include name="GNUCaParser.o"/>
<include name="main.o"/>
</fileset>
<libset dir="src/cparser-c/lib/" libs="antlr3c-${arch}-${platform}"/>
</cpptasks:cc>
<copy todir="${dist}/bin" >
<fileset dir="build/cparser-c">
<include name="stcparser-c"/>
<include name="stcparser-c.exe"/>
</fileset>
</copy>
<chmod file="${dist}/bin/stcparser-c" perm="ugo+rx" />
</target>
<target name="build" depends="init,cparser-c,parser">
<echo message="${ant.project.name}: ${ant.file}"/>
<javac debug="true" destdir="build" encoding="utf-8">
<src path="src"/>
<exclude name="cz/muni/stanse/ownershipchecker/*"/>
<classpath refid="project.classpath"/>
</javac>
<!-- Copy .properties to the build directory, so they get included in the Jar -->
<copy todir="build" >
<fileset dir="src">
<include name="**/*.properties"/>
</fileset>
</copy>
</target>
<target name="jar" depends="build">
<tstamp>
<format property="TODAY" pattern="yyyy-MM-dd HH:mm:ss" />
</tstamp>
<manifest file="manifest.mf">
<attribute name="Built-By" value="${user.name}"/>
<attribute name="Main-Class" value="cz.muni.stanse.Stanse"/>
<attribute name="Implementation-Version" value="Built on: ${TODAY}" />
<attribute name="Class-Path" value="lib/antlr-runtime-3.2.jar lib/dom4j-1.6.1.jar lib/jaxen-1.1.3.jar lib/jgrapht-jdk1.6.jar lib/jopt-simple-3.1.jar lib/log4j-1.2.16.jar lib/swing-layout-1.0.4.jar lib/com.inamik.utils.tableformatter-0.96.2.jar" />
</manifest>
<jar destfile="${dist}/stanse.jar" basedir="build" manifest="manifest.mf" excludes="cparser-c/"/>
</target>
<target name="javadoc-clean">
<delete dir="${dist}/javadoc"/>
</target>
<target name="javadoc" depends="init" description="Build javadoc documentation">
<mkdir dir="${dist}/javadoc"/>
<javadoc destdir="${dist}/javadoc" source="1.5" author="true" failonerror="true" useexternalfile="true">
<classpath refid="project.classpath"/>
<sourcepath>
<pathelement location="src/"/>
</sourcepath>
<packageset dir="src/" includes="*/**"/>
<fileset dir="src/" includes="*.java"/>
</javadoc>
</target>
<target name="archive">
<tar destfile="stanse.tgz" compression="gzip">
<tarfileset dir="${dist}" prefix="stanse-0.9" username="stanse" group="stanse">
<exclude name="**/.svn"/>
</tarfileset>
</tar>
</target>
</project>