-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.xml
More file actions
103 lines (88 loc) · 4.56 KB
/
build.xml
File metadata and controls
103 lines (88 loc) · 4.56 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
<?xml version="1.0" encoding="UTF-8"?>
<!-- This DOCTYPE tag shuts off the warning from Eclipse that there is no DTD
associated with this XML file. -->
<!DOCTYPE project >
<project name="classver" default="jar" basedir=".">
<!-- Change this number to change the version. This is the only location
that needs to be changed to update the version. -->
<property name="version" value="3.0.0"/>
<property name="vendor" value="Altered Mechanism"/>
<property name="main.class" value="com.alteredmechanism.classver.ClassVersionExtractor" />
<property name="lang.version" value="1.5" />
<property name="src.dir" value="src/main/java" />
<property name="java.compiler" value="${user.home}/Dropbox/opt/jdk1.5.0/jdk1.5.0_22/bin/javac" />
<target name="setup" description="Sets stuff up">
<mkdir dir="${cls.dir}"/>
<mkdir dir="${libs.dir}"/>
<tstamp>
<format property="build.date" pattern="yyyy-MM-dd hh:mm aa" />
</tstamp>
</target>
<property name="dist.dir" value="src/main/dist" />
<property name="cls.dir" value="build/classes" />
<property name="libs.dir" value="build/libs" />
<property name="jar" value="${libs.dir}/${ant.project.name}.jar"/>
<property name="run.script" value="${dist.dir}/bin/${ant.project.name}" />
<property name="sys.install.dir" value="/usr/local" />
<property name="bld.dist.dir" value="build/distribution" />
<target name="compile" depends="setup" description="Compiles the source">
<javac srcdir="${src.dir}" destdir="${cls.dir}" classpath="${cls.dir}"
debug="on" source="${lang.version}" target="${lang.version}"
includeAntRuntime="false" fork="yes" executable="${java.compiler}"/>
</target>
<target name="jar" depends="compile" description="Builds an executable jar file">
<!-- The attribute update="false" makes sure no old classes will exist
in the new jar file. -->
<jar destfile="${jar}" basedir="${cls.dir}" update="false">
<manifest>
<attribute name="Built-By" value="${user.name}"/>
<attribute name="Main-Class" value="${main.class}" />
<attribute name="Specification-Title" value="${ant.project.name}" />
<attribute name="Specification-Version" value="${version}" />
<attribute name="Specification-Vendor" value="${vendor}" />
<attribute name="Implementation-Build-Date" value="${build.date}"/>
<attribute name="Implementation-Title" value="${ant.project.name}" />
<attribute name="Implementation-Version" value="${version}" />
<attribute name="Implementation-Vendor" value="${vendor}" />
<section name="com.alteredmechanism.classver">
<attribute name="Specification-Title" value="${ant.project.name}" />
<attribute name="Specification-Version" value="${version}" />
<attribute name="Specification-Vendor" value="${vendor}" />
<attribute name="Implementation-Build-Date" value="${build.date}"/>
<attribute name="Implementation-Title" value="${ant.project.name}" />
<attribute name="Implementation-Version" value="${version}" />
<attribute name="Implementation-Vendor" value="${vendor}" />
</section>
</manifest>
</jar>
</target>
<target name="userInstall" depends="jar" description="Installs into $HOME/bin and $HOME/lib">
<mkdir dir="${user.home}/bin"/>
<copy file="${run.script}" todir="${user.home}/bin" preservelastmodified="true"/>
<chmod file="${user.home}/bin/${ant.project.name}" perm="ugo+rx"/>
<mkdir dir="${user.home}/lib"/>
<copy file="${jar}" todir="${user.home}/lib" preservelastmodified="true" />
<exec dir="${user.home}/bin" executable="cmd.exe" osfamily="windows" >
<arg line="${dist.dir}/bin/addtopath.bat"/>
</exec>
</target>
<target name="systemInstall" depends="jar" description="Installs into /usr/local/bin and /usr/local/lib">
<mkdir dir="${sys.install.dir}/bin"/>
<copy file="${run.script}" todir="${sys.install.dir}/bin" preservelastmodified="true" />
<chmod file="${sys.install.dir}/bin/${ant.project.name}" perm="ugo+rx"/>
<mkdir dir="${sys.install.dir}/lib"/>
<copy file="${jar}" todir="${sys.install.dir}/lib" preservelastmodified="true"/>
</target>
<target name="distZip" depends="jar" description="Build a zip file with just binaries for distribution to users">
<mkdir dir="${bld.dist.dir}"/>
<move file="build/libs" tofile="build/lib"/>
<zip destfile="${bld.dist.dir}/${ant.project.name}-${version}-bin.zip">
<fileset dir="${dist.dir}" includes="bin/*"/>
<fileset dir="build" includes="lib/${ant.project.name}-${version}.jar"/>
</zip>
<move file="build/lib" tofile="build/libs"/>
</target>
<target name="clean">
<delete dir="build"/>
</target>
</project>