-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.xml
142 lines (126 loc) · 5.91 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
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!--Be sure to set name and use.libs before using this file.-->
<project default="create_jar" name="Generalized ANT Buildfile, modified for my JSON Library project" xmlns:if="ant:if" xmlns:unless="ant:unless">
<!--ANT 1.9.1+ is required -->
<!--Most properties in this file have a default value, but can also be set from the command line.-->
<!--When setting the prefix from the command line, it must include a trailing '/'.-->
<!--When setting the .jar's name from the command line, it must include the '.jar' suffix.-->
<!--Change this value to the desired name of the .jar file. Include the '.jar' suffix.-->
<property unless:set="name" name="name" value="JSONLib.jar" />
<!--Change this value to true if the project uses external libraries.-->
<!--This cannot be changed from the command line.-->
<property name="use.libs" value="true" />
<!--Change this value to true if the project uses native libraries.-->
<property name="use.nativelibs" value="false" />
<!--Change this value to true if the project is assuming Homebrew was used to install its libraries.-->
<property unless:set="use.hombrew" name="use.homebrew" value="false" />
<!--Path parameters. These generally won't need to be changed-->
<property unless:set="src" name="src" location="src" />
<property unless:set="bin" name="bin" location="bin" />
<property unless:set="doc" name="doc" value="doc" />
<property unless:set="libs" name="libs" value="../" />
<property unless:set="nativelibs" name="nativelibs" value="native libraries" />
<!--The path into which the .jar should be placed-->
<property unless:set="prefix" name="prefix" value="../" />
<!--Whether to force a complete rebuild every run-->
<property unless:set="clean" name="clean" value="true" />
<!--What to pack into the .jar in addition to the compiled code.-->
<property unless:set="package.doc" name="package.doc" value="true" />
<property unless:set="package.src" name="package.src" value="true" />
<property unless:set="package.libs" name="package.libs" value="false" />
<!--Construct the location of the output .jar file-->
<property if:set="jar" name="jar" location="${jar}" />
<property unless:set="jar" name="jar" location="${prefix}${name}" />
<!--Convert the libs property to a location-->
<property name="libs" location="${libs}" />
<patternset id="libraries">
<!--Add the names of the libraries to be included here.-->
<include name="Lexer.jar" />
<include name="Structures.jar" />
<include name="Utils.jar" />
</patternset>
<patternset id="Build Excludes">
<exclude name="**/*.css" />
<exclude name="**/*.class" />
<!--Add the names of files to exclude from the src directory here.-->
</patternset>
<patternset id="Debug">
<!--Add the names of debug classes that should be excluded from the packaged jar here.-->
<exclude name="**/testCases/**" />
</patternset>
<target name="javadoc">
<javadoc access="protected" author="true" destdir="${doc}" packagenames="*" source="1.8" splitindex="true" use="true" version="true">
<fileset dir="${src}">
<patternset refid="Build Excludes" />
<patternset refid="Debug" />
</fileset>
<classpath if:true="${use.libs}" refid="build.classpath" />
</javadoc>
</target>
<target name="build">
<mkdir dir="${bin}" />
<javac srcdir="${src}" destdir="${bin}" includeAntRuntime="false" debug="true" debuglevel="lines,vars,source">
<patternset refid="Build Excludes" />
<classpath if:true="${use.libs}" refid="build.classpath" />
</javac>
<!--Copy css files to their appropriate locations in the bin directory (for JavaFx)-->
<copy todir="${bin}">
<fileset dir="${src}" includes="**/*.css" />
</copy>
</target>
<target if="${use.homebrew}" name="find.brew">
<exec unless:set="brew.path" searchpath="true" executable="env" outputproperty="brew.path">
<arg value="bash" />
<arg value="-l" />
<arg value="-c" />
<arg value="which brew" />
</exec>
<exec unless:set="brew.prefix" searchpath="true" executable="${brew.path}" outputproperty="brew.prefix">
<arg value="--prefix" />
</exec>
</target>
<target if="${use.libs}" name="construct.classpath" depends="find.brew">
<echo if:true="${use.homebrew}" level="info" message="Using libraries from homebrew." />
<echo unless:true="${use.homebrew}" level="info" message="Using libraries from ${libs}" />
<pathconvert property="manifest.classpath" pathsep=" ">
<path id="build.classpath">
<multirootfileset id="library">
<basedir if:set="brew.prefix" file="${brew.prefix}/lib/" />
<basedir file="${libs}" />
<patternset refid="libraries" />
</multirootfileset>
</path>
<scriptmapper language="javascript">
self.addMappedName(source.replace(/ /g, "%20"));
</scriptmapper>
</pathconvert>
</target>
<target name="create_jar" depends="construct.classpath,clean,javadoc,build">
<jar destfile="${jar}" filesetmanifest="mergewithoutmain">
<manifest>
<attribute name="Main-Class" value="toberumono.wrf.Runner" />
<attribute if:true="${use.libs}" name="Class-Path" value="${manifest.classpath}" />
<attribute unless:true="${use.libs}" name="Class-Path" value="." />
</manifest>
<fileset dir="${bin}">
<patternset refid="Debug" />
</fileset>
<fileset if:true="${package.doc}" dir="." includes="${doc}/**" />
<fileset if:true="${package.nativelibs}" dir="." includes="${nativelibs}/**" />
<fileset if:true="${package.src}" dir="${src}" />
<restrict if:true="${package.libs}">
<name regex=".*\.(class|java)" />
<archives>
<zips>
<multirootfileset refid="library" />
</zips>
</archives>
</restrict>
</jar>
</target>
<target name="clean" description="Remove all files created by the build process.">
<echo unless:true="${clean}" level="info" message="Cleaning disabled." />
<delete if:true="${clean}" dir="${bin}" />
<delete if:true="${clean}" dir="${doc}" />
</target>
</project>