-
Notifications
You must be signed in to change notification settings - Fork 11
/
build.xml
141 lines (115 loc) · 5.04 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
<?xml version="1.0" encoding="UTF-8"?>
<project name="phantm" default="build" basedir=".">
<property environment="env"/>
<!-- Prevents system classpath from being used -->
<property name="build.sysclasspath" value="ignore"/>
<!-- ===========================================================================
PROPERTIES
============================================================================ -->
<property name="source.dir" value="src"/>
<property name="target.dir" value="target/scala_2.8.0/classes"/>
<property file=".build.properties"/>
<!-- the following properties can be set in the above property file -->
<property name="scala.dir" value="${env.SCALA_HOME}"/>
<property name="build.dir" value="${target.dir}"/>
<property name="release.dir" value="releases"/>
<property name="lib.dir" value="lib"/>
<property name="main.class" value="phantm.Main"/>
<property name="proguard.jar" value="${lib.dir}/proguard.jar" />
<!-- ===========================================================================
INITIALISATION
============================================================================ -->
<target name="init">
<available file="${scala.dir}" property="scala.present"/>
<fail
message="Installed Scala distribution could not be found."
unless="scala.present"
/>
<property name="scala-library.jar" value="${scala.dir}/lib/scala-library.jar"/>
<property name="scala-compiler.jar" value="${scala.dir}/lib/scala-compiler.jar"/>
<fail message="Scala library '${scala-library.jar}' is not available">
<condition><not><and>
<available classname="scala.Predef"
classpath="${scala-library.jar}"/>
<available classname="scala.Option"
classpath="${scala-library.jar}"/>
</and></not></condition>
</fail>
<path id="scala.classpath">
<pathelement location="${scala-library.jar}"/>
<pathelement location="${scala-compiler.jar}"/>
</path>
<taskdef resource="scala/tools/ant/antlib.xml">
<classpath>
<path refid="scala.classpath"/>
</classpath>
</taskdef>
<path id="build.classpath">
<pathelement location="${scala-library.jar}"/>
<pathelement location="lib/cup/dist/java-cup-11a.jar"/>
<pathelement location="${build.dir}"/>
</path>
</target>
<!-- ===========================================================================
JAR
============================================================================ -->
<target name="jar" depends="init">
<mkdir dir="builds"/>
<mkdir dir="${target.dir}/spec"/>
<copy file="spec/internal_api.xml" tofile="${target.dir}/spec/internal_api.xml" />
<copy file="spec/build.xml" tofile="${target.dir}/spec/build.xml" />
<mkdir dir="${target.dir}/tables"/>
<copy file="src/main/java/phantm/parser/action_table.bin" tofile="${target.dir}/tables/action_table.bin" />
<copy file="src/main/java/phantm/parser/reduce_table.bin" tofile="${target.dir}/tables/reduce_table.bin" />
<copy file="src/main/java/phantm/parser/production_table.bin" tofile="${target.dir}/tables/production_table.bin" />
<copy file="scala-license.txt" tofile="${target.dir}/scala-license.txt" />
<delete file="builds/phantm.jar"/>
<delete file="builds/MANIFEST.mf"/>
<manifest file="builds/MANIFEST.mf">
<attribute name="Main-Class" value="phantm.Main" />
</manifest>
<jar destfile="builds/phantm.jar"
manifest="builds/MANIFEST.mf"
basedir="${target.dir}"
includes="**/*.class,spec/*.xml,tables/*.bin,scala-license.txt"
/>
<delete file="${target.dir}/scala-license.txt"/>
<delete file="${target.dir}/spec"/>
<delete file="${target.dir}/tables"/>
</target>
<!-- ===========================================================================
RELEASE
============================================================================ -->
<target name="release" description="Make a (no-source) release." depends="jar">
<mkdir dir="${release.dir}"/>
<java jar="${proguard.jar}" fork="true">
<arg value="
-injars builds/phantm.jar
-injars lib/cup/dist/java-cup-11a-runtime.jar
-injars ${scala-library.jar}
-outjars ${release.dir}/phantm-latest.jar
-libraryjars ${java.home}/lib/rt.jar
-ignorewarnings
-dontwarn
-dontoptimize
-dontobfuscate
-verbose
-keep public class ${main.class} {
public static void main(java.lang.String[]);
}
" />
</java>
</target>
<!-- ===========================================================================
CLEAN
============================================================================ -->
<macrodef name="remove">
<attribute name="dir"/>
<sequential>
<delete dir="@{dir}" includeemptydirs="yes" quiet="yes" failonerror="no"/>
</sequential>
</macrodef>
<target name="clean">
<remove dir="${build.dir}"/>
</target>
</project>