forked from toshok/scsharp
-
Notifications
You must be signed in to change notification settings - Fork 1
/
nant.build
207 lines (169 loc) · 6.55 KB
/
nant.build
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
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
<?xml version="1.0"?>
<project name="SCSharp" default="build">
<description>Starcraft in C#</description>
<property name="project.name" value="scsharp"/>
<property name="project.version" value="0.0000009"/>
<!--configuration properties -->
<property name="overwriteConfig" value="false"/> <!-- determines wether or not the existing scsharp config file should be overwritten when build completes -->
<!-- other properties -->
<property name="debug" value="true" />
<property name="win32" value="${platform::is-win32()}" overwrite="true" />
<property name="unix" value="${platform::is-unix()}" overwrite="true" />
<property name="output.dir" value="bin"/>
<property name="input.libs" value="sdldotnet-bin"/>
<!-- Build code -->
<echo message="Running on Windows" if="${win32}" />
<echo message="Running on Unix" if="${unix}" />
<target name="build" description="Default build target" depends="scsharp.exe,tools">
<echo message="Copying necessary libraries to output directory"/>
<copy if="${win32}" todir="${output.dir}">
<fileset basedir="${input.libs}/win32" >
<include name="*.dll" />
</fileset>
</copy>
<copy todir="${output.dir}">
<fileset basedir="${input.libs}" >
<include name="*.dll" />
</fileset>
</copy>
<echo message="Setting up configuration files"/>
<copy if="${unix}" todir="${output.dir}" flatten="true">
<fileset>
<include name="${input.libs}/Tao.Sdl.dll.config" />
</fileset>
</copy>
<copy if="${overwriteConfig or not file::exists('${output.dir}/scsharp.exe.config')}"
file="src/scsharp.exe.config-example" tofile="${output.dir}/scsharp.exe.config"/>
</target>
<target name="scsharp.exe" description="scsharp executable" depends="setup,SCSharp.Smk.dll,SCSharp.UI.dll,SCSharp.dll">
<echo message="Building scsharp.exe"/>
<csc target="exe" output="${output.dir}/scsharp.exe" debug="${debug}" >
<sources basedir="src">
<includesfile name="src/scsharp.exe.sources"/>
</sources>
<references>
<include name="${output.dir}/SCSharp.dll"/>
<include name="${output.dir}/SCSharp.Smk.dll"/>
<include name="${output.dir}/SCSharp.UI.dll"/>
<include name="${input.libs}/SdlDotNet.dll"/>
<include name="${input.libs}/Tao.Sdl.dll"/>
<include name="System.Configuration.dll"/>
</references>
</csc>
</target>
<target name="setup" description="Setup build directories">
<echo message="Setting up main build directories." />
<mkdir dir="${output.dir}"/>
<copy file="build/Consts.cs.in" tofile="build/Consts.cs"
if="${(not file::exists('build/Consts.cs')) or (file::get-last-write-time('nant.build') > file::get-last-write-time('build/Consts.cs'))}">
<filterchain>
<replacetokens>
<token key="VERSION" value="${project.version}" />
</replacetokens>
</filterchain>
</copy>
</target>
<target name="SCSharp.Smk.dll" description="The Smacker Decoder module" depends="setup,SCSharp.dll">
<echo message="Building SCSharp.Smk.dll" />
<csc target="library" output="${output.dir}/SCSharp.Smk.dll" debug="${debug}" >
<sources basedir="SCSharp">
<includesfile name="SCSharp/SCSharp.Smk.dll.sources"/>
</sources>
<references>
<include name="${output.dir}/SCSharp.dll"/>
<include name="System.Drawing.dll"/>
</references>
</csc>
</target>
<target name="SCSharp.UI.dll" description="The SCSharp UI module" depends="setup,SCSharp.dll,SCSharp.Smk.dll">
<echo message="Building SCSharp.UI.dll" />
<csc target="library" output="${output.dir}/SCSharp.UI.dll" debug="${debug}" >
<sources basedir="SCSharp">
<includesfile name="SCSharp/SCSharp.UI.dll.sources"/>
</sources>
<references>
<include name="${output.dir}/SCSharp.dll"/>
<include name="${output.dir}/SCSharp.Smk.dll"/>
<include name="${input.libs}/SdlDotNet.dll"/>
<include name="${input.libs}/Tao.Sdl.dll"/>
<include name="System.Drawing.dll"/>
<include name="System.Configuration.dll"/>
</references>
</csc>
</target>
<target name="SCSharp.dll" description="The SCSharp DLL" depends="setup">
<echo message="Building SCSharp.dll" />
<csc target="library" output="${output.dir}/SCSharp.dll" debug="${debug}" >
<sources basedir="SCSharp">
<includesfile name="SCSharp/SCSharp.dll.sources"/>
</sources>
</csc>
</target>
<target name="tools" depends="setup,SCSharp.dll">
<echo message="Building tools" />
<csc target="exe" output="${output.dir}/lsmpq.exe" debug="${debug}" >
<sources> <include name="tools/lsmpq.cs" /> </sources>
<references> <include name="${output.dir}/SCSharp.dll"/> </references>
</csc>
<csc target="exe" output="${output.dir}/extract.exe" debug="${debug}" >
<sources> <include name="tools/extract.cs" /> </sources>
<references> <include name="${output.dir}/SCSharp.dll"/> </references>
</csc>
</target>
<target name="dist">
<property name="dist.dir" value="${project.name}-src-${project.version}"/>
<delete file="${dist.dir}.zip" />
<zip zipfile="${dist.dir}.zip">
<fileset prefix="${dist.dir}">
<exclude name="**/*.zip" />
<exclude name="**/*~" />
<exclude name="**/Makefile" />
<exclude name="**/*.mdb" />
<exclude name="**/*.exe" />
<include name="*" />
<exclude name="autom4te.cache" />
<exclude name="config.status" />
<exclude name="config.log" />
<exclude name="aclocal.m4" />
<include name="build/*" />
<include name="docs/*" />
<include name="src/*" />
<include name="Tests/*" />
<include name="tools/*" />
<include name="sdldotnet-bin/*" />
<include name="SCSharp/**" />
<exclude name="build/Consts.cs" />
<exclude name="SCSharp/*.dll" />
<exclude name="src/scsharp.exe.config" />
<exclude name="bin" />
<exclude name="release-bin" />
</fileset>
</zip>
</target>
<target name="release">
<property name="release.dir" value="${project.name}-${project.version}"/>
<property name="output.dir" value="release-bin"/>
<delete dir="${output.dir}" />
<delete file="${release.dir}.zip" />
<call target="build" />
<zip zipfile="${release.dir}.zip">
<fileset basedir="${output.dir}" prefix="${release.dir}">
<include name="*" />
</fileset>
<fileset prefix="${release.dir}">
<include name="AUTHORS" />
<include name="NEWS" />
<include name="RELEASE_README" />
</fileset>
</zip>
<delete dir="${output.dir}" />
</target>
<target name="clean">
<delete>
<fileset>
<include name="${output.dir}/*" />
<exclude name="${output.dir}/scsharp.exe.config" />
</fileset>
</delete>
</target>
</project>