1<?xml version="1.0" encoding='iso-8859-1' ?>
2<project name="all" default="usage">
3
4	<property name="base.dir" 			value="${path::get-full-path( project::get-base-directory() )}" />
5	<property name="sharedlibrary.dir" 	value="${base.dir}/Libraries" />
6	<property name="tools.dir" 			value="${base.dir}/Tools" />
7	<property name="tempdir" 			value="tempdir" />
8
9	<property name="version" 			value="3.1b1" />
10
11	<include buildfile="antlr3.runtime.net.common.inc" />
12
13  	<!-- =================================================================== -->
14  	<!-- Help on usage                                                       -->
15  	<!-- =================================================================== -->
16  	
17  	<target name="usage">
18    	<echo message="ANTLR v3 C# Runtime - Nant Build file"/>
19    	<echo message="-------------------------------------------------------------"/>
20    	<echo message=""/>
21    	<echo message="available targets are:"/>
22    	<echo message=""/>
23    	<echo message="  build      - build debug or release version in '${base.dir}/build/${framework::get-target-framework()}'"/>
24    	<echo message="                 (use -Ddebug=true or -Ddebug=false )"/>
25    	<echo message=""/>
26    	<echo message="  release    - build release version in '${base.dir}/build/${framework::get-target-framework()}'"/>
27    	<echo message=""/>
28    	<echo message="  dist       - build src/bin/docs distro in '${base.dir}'"/>
29    	<echo message="                 (uses **pre-built** binaries.)"/>
30    	<echo message=""/>
31    	<echo message="  cleanall   - delete all the Nant and VS.NET build artifacts"/>
32    	<echo message="  clean      - delete all the Nant build artifacts only"/>
33    	<echo message=""/>
34    	<echo message="  usage      - show this message (default)"/>
35    	<echo message=""/>
36    	<echo message="-------------------------------------------------------------"/>
37  	</target>
38
39	<target name="build" 
40			depends="clean, init, build.v3.runtime, build.v3.utility, copytobuilddir"
41			description="Build debug or release version ( -Ddebug=true|false )"
42	/>
43
44    <target name="release" depends="clean" description="Builds release (i.e. non-debug) version">
45        <!-- build a clean release distribution for release -->
46        <property name="debug" value="false"/>
47        <call target="build"/>
48    </target>
49
50	<target name="cleanall" depends="clean" description="Cleans all the Nant and VS.NET build artifacts">
51		<nant buildfile="Sources/Antlr3.Runtime/default.build" target="clean.vsnet" inheritall="true" />
52		<nant buildfile="Sources/Antlr3.Utility/default.build" target="clean.vsnet" inheritall="true" />
53	</target>
54	
55	<target name="dist" 
56			depends="releaseDocs, zipsource, zip11, zip20, zipdoc"
57			description="Creates src/bin/docs distros (uses pre-built binaries)"
58	/>
59	
60
61	<target name="clean" description="Cleans Nant build artifacts">
62		<delete dir="${build.working.dir}" failonerror="false" />
63		<delete dir="${build.dest.dir}"    failonerror="false" />
64		<!-- <delete dir="${doc.dir}"           failonerror="false" /> -->
65	</target>
66	
67	<target name="init">
68		<mkdir dir="${build.working.dir}" />
69		<mkdir dir="${build.dest.dir}" />
70		<call target="copy_build_dependencies" />
71	</target>
72	
73	<target name="copy_build_dependencies">
74		<copy todir="${build.dest.dir}">
75			<fileset basedir="${sharedlibrary.dir}/MbUnit">
76				<include name="MbUnit.Framework.dll" />
77				<include name="QuickGraph.Algorithms.dll" />
78				<include name="QuickGraph.dll" />
79			</fileset>
80		</copy>
81		<copy todir="${build.dest.dir}">
82			<fileset basedir="${sharedlibrary.dir}/StringTemplate.NET/${target.clr}">
83				<include name="StringTemplate.dll" />
84				<include name="antlr.runtime.dll" />
85			</fileset>
86		</copy>
87	</target>
88
89	<target name="build.v3.runtime" depends="init">
90		<nant buildfile="Sources/Antlr3.Runtime/default.build" target="build" inheritall="true" />
91	</target>
92	
93	<target name="build.v3.utility" depends="init">
94		<nant buildfile="Sources/Antlr3.Utility/default.build" target="build" inheritall="true" />
95	</target>
96	
97	<target name="copytobuilddir">
98		<copy todir="${build.dest.dir}">
99			<fileset basedir="${build.working.dir}">
100				<include name="Antlr3.Runtime.dll" />
101				<include name="Antlr3.Runtime.xml" />
102				<include name="Antlr3.Utility.dll" />
103				<include name="Antlr3.Utility.xml" />
104				<include name="StringTemplate.dll" />
105				<include name="antlr.runtime.dll" />
106				
107				<include name="Antlr3.Runtime.pdb" />
108				<include name="Antlr3.Utility.pdb" />
109				<include name="StringTemplate.pdb" />
110				<include name="antlr.runtime.pdb" />
111			</fileset>
112		</copy>
113	</target>
114	
115	<target name="zip11">
116		<zip zipfile="${base.dir}/Antlr3.C#.Runtime.v${version}.net-1.1.zip">
117			<fileset basedir="${base.dir}/build">
118				<include name="net-1.1/Antlr3.Runtime.dll" />
119				<include name="net-1.1/Antlr3.Utility.dll" />
120				<include name="net-1.1/StringTemplate.dll" />
121				<include name="net-1.1/antlr.runtime.dll" />
122			</fileset>
123			<fileset basedir="${base.dir}">
124				<include name="README.TXT" />
125				<include name="LICENSE.TXT" />
126				<include name="NOTICE.TXT" />
127				<include name="CHANGES.TXT" />
128			</fileset>
129			<fileset basedir="${base.dir}/docs">
130				<include name="Antlr3.Runtime.chm" />
131				<include name="Antlr3.Utility.chm" />
132			</fileset>
133		</zip>
134	</target>
135
136	<target name="zip20">
137		<zip zipfile="${base.dir}/Antlr3.C#.Runtime.v${version}.net-2.0.zip">
138			<fileset basedir="${base.dir}/build">
139				<include name="net-2.0/Antlr3.Runtime.dll" />
140				<include name="net-2.0/Antlr3.Utility.dll" />
141				<include name="net-2.0/StringTemplate.dll" />
142				<include name="net-2.0/antlr.runtime.dll" />
143			</fileset>
144			<fileset basedir="${base.dir}">
145				<include name="README.TXT" />
146				<include name="LICENSE.TXT" />
147				<include name="NOTICE.TXT" />
148				<include name="CHANGES.TXT" />
149			</fileset>
150			<fileset basedir="${base.dir}/docs">
151				<include name="Antlr3.Runtime.chm" />
152				<include name="Antlr3.Utility.chm" />
153			</fileset>
154		</zip>
155	</target>
156	
157	<target name="zipdoc">
158		<zip zipfile="${base.dir}/Antlr3.C#.Runtime.v${version}.api-doc.zip">
159			<fileset basedir="${base.dir}/docs">
160				<include name="Antlr3.Runtime.chm" />
161				<include name="Antlr3.Utility.chm" />
162			</fileset>
163		</zip>
164	</target>
165
166	<target name="zipsource">
167		<zip zipfile="${base.dir}/Antlr3.C#.Runtime.v${version}.src.zip">
168			<fileset basedir="${base.dir}">
169				<include name="**/*.build" />
170				<include name="**/*.xml" />
171				<include name="**/*.inc" />
172				<include name="**/*.sln" />
173				<include name="**/*.cs" />
174				<include name="**/*.csproj" />
175				<include name="**/*.resx" />
176				<include name="**/*.ico" />
177				<include name="**/*.html" />
178				<include name="**/*.jpg" />
179				<include name="**/*.pdf" />
180
181				<include name="${sharedlibrary.dir}/**/*.dll" />
182
183				<include name="${tools.dir}/**/*.dll" />
184				<include name="${tools.dir}/**/*.exe" />
185				
186				<include name="README.TXT" />
187				<include name="LICENSE.TXT" />
188				<include name="NOTICE.TXT" />
189				<include name="CHANGES.TXT" />
190
191				<exclude name="*.snk" />
192				<exclude name="**/obj/Debug/*.*" />
193				<exclude name="**/obj/Debug/net-1.1/*.*" />
194				<exclude name="**/obj/Debug/net-2.0/*.*" />
195				<exclude name="**/bin/Debug/*.*" />
196				<exclude name="**/bin/Debug/net-1.1/*.*" />
197				<exclude name="**/bin/Debug/net-2.0/*.*" />
198				<exclude name="**/bin/*.*" />
199				<exclude name="bin/**/*.*" />
200				<exclude name="build/**/*.*" />
201				<exclude name="**/*.user" />
202				<exclude name="**/*.resharperoptions" />
203				<exclude name="**/*.obj" />
204				<exclude name="**/*.pch" />
205				<exclude name="**/*.pdb" />
206				<exclude name="**/*.idb" />
207				<exclude name="**/*.log*" />
208				<exclude name="**/*.suo" />
209				<exclude name="**/*.bak" />
210				<exclude name="**/*.new" />
211				<exclude name="**/*.original" />
212			</fileset>
213		</zip>
214	</target>
215	
216	<!-- Documentation generation. -->
217	<property name="base.dir" value="." />
218	<property name="doc.dir" value="${base.dir}/docs" />
219	<property name="tempBin.dir" value="${doc.dir}/bin"/>
220	<property name="outputDocs.file" value="Antlr3.Runtime"/>
221	
222	<!-- Docs generation properties. -->
223	<property name="ShowMissing" value="false"/>
224	<property name="ShowPrivate" value="false"/>
225	<property name="OutputTarget" value="HTMLHelp"/>
226
227<!--		
228		description: 
229			Generates documentation with default properties.
230-->	
231	<target name="releaseDocs" depends="clean.docs">
232		<call target="copyFilesToDocument"/>
233		<call target="generateReleaseDocs"/>
234	</target>
235	
236<!--		
237		description: 
238			Generates documentation for developers, with all missing information indicated and private members visible.
239-->	
240	<target name="devDocs" depends="clean.docs">
241		<property name="ShowMissing" value="true"/>
242		<property name="ShowPrivate" value="true"/>
243		<property name="outputDocs.file" value="Antlr3.Runtime.Dev"/>
244		<call target="copyFilesToDocument"/>
245		<call target="generateReleaseDocs"/>
246	</target>
247		
248<!--		
249		description: 
250			 Generates documentation for release.
251-->	
252	<target name="generateReleaseDocs">
253		<ndoc failonerror="true">
254			<assemblies basedir="${tempBin.dir}">
255				<include name="Antlr3.Runtime.dll"/>
256				<include name="Antlr3.Utility.dll"/>
257			</assemblies>
258			<referencepaths>
259				<include name="Libraries/StringTemplate.NET/${framework::get-target-framework()}"/>
260			</referencepaths>
261			<documenters>
262				<documenter name="MSDN">
263					<property name="OutputTarget" value="${OutputTarget}" />
264					<property name="Preliminary" value="true" />
265					<property name="BinaryTOC" value="true" />
266					<property name="CleanIntermediates" value="true" />
267					<property name="SdkLinksOnWeb" value="true" />
268					
269					<property name="OutputDirectory" value="${doc.dir}" />
270					<property name="HtmlHelpName" value="${outputDocs.file}" />
271					<property name="IncludeFavorites" value="True" />
272					<property name="SplitTOCs" value="False" />
273					
274					<property name="Title" value="ANTLR v3 C# Runtime Library API documentation" />	
275					<property name="DefaulTOC" value="Antlr.Runtime" />
276					
277					<property name="ShowVisualBasic" value="True" />
278					<property name="ShowMissingSummaries" value="${ShowMissing}" />
279					<property name="ShowMissingRemarks" value="${ShowMissing}" />
280					<property name="ShowMissingParams" value="${ShowMissing}" />
281					<property name="ShowMissingReturns" value="${ShowMissing}" />
282					<property name="ShowMissingValues" value="${ShowMissing}" />
283					<property name="DocumentEmptyNamespaces" value="${ShowMissing}" />
284					
285					<property name="AutoPropertyBackerSummaries" value="true" />
286					<property name="AutoDocumentConstructors" value="true" />
287					<property name="DocumentProtected" value="True" />
288					<property name="DocumentInternals" value="${ShowPrivate}" />
289					<property name="DocumentPrivates" value="${ShowPrivate}" />
290					
291					<property name="IncludeAssemblyVersion" value="True" />
292					<property name="CopyrightText" value="Copyright 2005-2007 - Kunle Odutola" />
293					<property name="CopyrightHref" value="http://www.antlr.org" />
294				</documenter>
295			</documenters>
296		</ndoc>
297	</target>
298
299<!--		
300		description: 
301			Copies all files to be documented to a single location to speed up the documentation process.
302-->	
303	<target name="copyFilesToDocument">
304		<copy todir="${tempBin.dir}" flatten="true">
305			<fileset basedir="build/${target.clr}">
306				<include name="Antlr3.Runtime.dll"/>
307				<include name="Antlr3.Runtime.xml"/>
308				<include name="Antlr3.Utility.dll"/>
309				<include name="Antlr3.Utility.xml"/>
310			</fileset>
311		</copy>
312	</target>
313		
314<!--		
315		description: 
316			 Cleans up prior to documentation generation.
317-->	
318	<target name="clean.docs">
319		<delete>
320			<fileset>
321<!--
322				<include name="${doc.dir}/**"/>
323-->				
324				<exclude name="**/*.chm"/>
325			</fileset>
326		</delete>
327	</target>
328
329</project>
330