-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathbuild.xml
104 lines (93 loc) · 3.25 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
<project name="cpsaextras" default="all" basedir=".">
<!-- Directory names -->
<property name="src" value="src"/>
<!-- Directory for Scala libraries -->
<property name="lib" value="lib"/>
<property name="build" value="build"/>
<property name="dist" value="dist"/>
<property name="api" value="api"/>
<property name="proj" value="${ant.project.name}"/>
<property name="version" value="0.0.0"/>
<property name="pkg" value="${proj}"/>
<!-- Name of version resource -->
<property name="props" value="${src}/${proj}/version.properties"/>
<!-- Name of Scala library -->
<property name="library" value="${lib}/scala-library.jar"/>
<!-- One usually need not change anything below this comment -->
<!-- An exception might be the manifest in the jar task -->
<target name="init">
<!-- Create the build directory structure used by compile -->
<mkdir dir="${build}"/>
<uptodate property="version_added" srcfile="build.xml"
targetfile="${props}"/>
<path id="build.classpath">
<pathelement location="${build}"/>
</path>
<taskdef resource="scala/tools/ant/antlib.xml">
<classpath>
<pathelement location="${lib}/scala-compiler.jar"/>
<pathelement location="${lib}/scala-library.jar"/>
</classpath>
</taskdef>
</target>
<target name="version" depends="init" unless="version_added">
<propertyfile file="${props}">
<entry key="version" value="${version}" operation="="/>
<entry key="program" value="${proj}" operation="="/>
</propertyfile>
<unjar src="${library}" dest="${build}"/>
</target>
<target name="compile" depends="version">
<!-- Compile the scala code from ${src} into ${build} -->
<scalac srcdir="${src}" destdir="${build}" deprecation="on"
classpathref="build.classpath"/>
</target>
<target name="resource" depends="init">
<!-- Copy resources from ${src} into ${build} -->
<copy todir="${build}">
<fileset dir="${src}">
<include name="**/*.properties"/>
</fileset>
</copy>
<!-- Copy the license into ${build} -->
<copy todir="${build}" file="license.txt"/>
</target>
<target name="all" depends="compile,version,resource">
<jar jarfile="${proj}.jar" basedir="${build}">
<manifest>
<attribute name="Main-Class" value="${pkg}.Main"/>
<attribute name="Specification-Title" value="${proj}"/>
<attribute name="Specification-Version" value="${version}"/>
</manifest>
</jar>
</target>
<target name="doc" depends="version">
<mkdir dir="${api}"/>
<scaladoc srcdir="${src}" destdir="${api}"
classpathref="build.classpath">
<include name="**/*.scala"/>
</scaladoc>
</target>
<target name="dist" depends="all,doc">
<mkdir dir="${dist}/${proj}"/>
<copy todir="${dist}/${proj}">
<fileset dir=".">
<include name="${proj}.jar"/>
<include name="${lib}/"/>
<include name="${src}/**/*.scala"/>
<include name="${src}/**/*.properties"/>
<include name="${api}/"/>
</fileset>
</copy>
<zip zipfile="${proj}-${version}.zip" basedir="${dist}"/>
</target>
<target name="clean">
<!-- Delete the ${build} directory, the project jar file, -->
<!-- the version resource file, and the ${dist} and ${api} directories -->
<delete dir="${build}"/>
<delete file="${proj}.jar"/>
<delete file="${props}"/>
<delete dir="${api}"/>
<delete dir="${dist}"/>
</target>
</project>