-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.xml
More file actions
140 lines (127 loc) · 4.64 KB
/
Copy pathbuild.xml
File metadata and controls
140 lines (127 loc) · 4.64 KB
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
<project name="caxy" default="dist" basedir=".">
<property environment="env" />
<property name="src" value="caxy"/>
<property name="bld" value="build"/>
<property name="dst" value="dist"/>
<property name="sdt" value="srcdist"/>
<property name="gnu" value="gnu/getopt"/>
<condition property="ant.build.javac.target" value="${env.JAVA_CROSS_TARGET}" >
<isset property="env.JAVA_CROSS_TARGET" />
</condition>
<condition property="ant.build.javac.source" value="${env.JAVA_CROSS_TARGET}" >
<isset property="env.JAVA_CROSS_TARGET" />
</condition>
<condition property="jrepostfix" value="-jre-${env.JAVA_CROSS_TARGET}" else="" >
<isset property="env.JAVA_CROSS_TARGET" />
</condition>
<condition property="jtargetvers" value="${env.JAVA_CROSS_TARGET}" else="${ant.java.version}" >
<isset property="env.JAVA_CROSS_TARGET" />
</condition>
<condition property="ant.build.javac.bootclasspath" value="${env.JAVA_CROSS_BOOTCLASSPATH}" else="" >
<isset property="env.JAVA_CROSS_BOOTCLASSPATH" />
</condition>
<path id="classpath">
<pathelement location="${bld}"/>
</path>
<target name="init">
<tstamp/>
<mkdir dir="${bld}"/>
</target>
<target name="gnucomp" depends="init" description="compile gnu getopt">
<javac includeantruntime="false"
bootclasspath="${ant.build.javac.bootclasspath}"
srcdir="${gnu}" destdir="${bld}"
excludes="**/GetoptDemo.java"
debug="true" debuglevel="lines,source"
/>
</target>
<target name="compile" depends="init,mkvers,gnucomp" description="compile">
<!-- AutoAddr.java requires java 1.6. However, the presence of this
class is detected at run-time so we just don't compile it under
an older jdk
-->
<condition property="java.preV6.exclude" value="AutoAddr.java" else="">
<!-- no way to do numerical comparison in ant :-( but since caxy
won't compile with anything older than 1.5 we may as well just
check for that
-->
<or>
<equals arg1="${jtargetvers}" arg2="1.5" trim="true"/>
<equals arg1="${jtargetvers}" arg2="1.4" trim="true"/>
<equals arg1="${jtargetvers}" arg2="1.3" trim="true"/>
</or>
</condition>
<echo message="${java.preV6.exclude}"/>
<property name="blax" refid="classpath"/>
<echo message="My classpath ${blax}"/>
<javac includeantruntime="false"
bootclasspath="${ant.build.javac.bootclasspath}"
srcdir="${src}" destdir="${bld}"
excludes="${java.preV6.exclude}"
debug="true" debuglevel="lines,source">
<classpath refid="classpath"/>
</javac>
</target>
<target name="copyresources" depends="compile">
<copy todir="${bld}/${src}">
<fileset dir="." file="JCALibrary.properties"/>
</copy>
</target>
<target name="dist" depends="copyresources" description="jar it up">
<mkdir dir="${dst}"/>
<jar jarfile="${dst}/${git_version_string}${jrepostfix}.jar">
<fileset dir="${bld}" />
<fileset dir="." includes="gnu/**"/>
<manifest>
<attribute name="Main-Class" value="caxy.CaxyMain"/>
</manifest>
</jar>
</target>
<target name="srcdist" depends="dist" description="jar everything">
<mkdir dir="${sdt}"/>
<jar jarfile="${sdt}/${git_version_string}-source.jar">
<fileset dir="." includes="${src}/**" excludes="**/.*.swp"/>
<fileset dir="." includes="${bld}/**"/>
<fileset dir="." includes="gnu/**,README*,JCALibrary.properties,build.xml"/>
</jar>
</target>
<target name="clean" >
<delete dir="${bld}"/>
<delete dir="${dst}"/>
<delete dir="${sdt}"/>
</target>
<target name="havegit">
<available file=".git" property="git.present"/>
<condition property="versjava.needed">
<or>
<isset property="git.present"/>
<not>
<available file="${src}/CaxyVers.java"/>
</not>
</or>
</condition>
<echo message="versjava.needed: ${versjava.needed}, git.present: ${git.present}"/>
</target>
<target name="gitvers" depends="havegit" if="git.present">
<echo message="git describe --always"/>
<exec executable="git" logError="true" outputproperty="git_version_string">
<arg value="describe"/>
<arg value="--always"/>
</exec>
<echo message="VERSION IS: ${git_version_string}"/>
</target>
<target name="mkvers" depends="gitvers" if="versjava.needed">
<condition property="git_version_string" value="unknown">
<not>
<isset property="git_version_string"/>
</not>
</condition>
<echo file="${src}/CaxyVers.java"
message="package caxy;
class CaxyVers {
	public static final String VERSION_STR="${git_version_string}";
}
"
/>
</target>
<target name="jvers">
<echo message="JDK Version ${ant.java.version}"/>
<echo message="Java target version ${jtargetvers}" />
</target>
</project>