File: build.xml

package info (click to toggle)
cmdreader 1.5-2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster
  • size: 284 kB
  • sloc: java: 1,078; xml: 188; makefile: 9
file content (206 lines) | stat: -rw-r--r-- 8,452 bytes parent folder | download | duplicates (2)
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
<!--
  Copyright © 2010-2011 Reinier Zwitserloot.
  
  Permission is hereby granted, free of charge, to any person obtaining a copy
  of this software and associated documentation files (the "Software"), to deal
  in the Software without restriction, including without limitation the rights
  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  copies of the Software, and to permit persons to whom the Software is
  furnished to do so, subject to the following conditions:
  
  The above copyright notice and this permission notice shall be included in
  all copies or substantial portions of the Software.
  
  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  THE SOFTWARE.
-->
<project name="com.zwitserloot.cmdreader" default="dist" xmlns:ivy="antlib:org.apache.ivy.ant">
	<description>
com.zwitserloot.cmdreader is a library to read command line arguments for java.
To use it, first build a class containing fields, with each field representing a command line option.
Then, annotate each field to configure settings (such as whether a parameter can show up more than once, is mandatory, etc),
and finally call CmdReader.of(ThatClass.class).make(cmdargs) to get an instance of your class, with all fields filled in.
	</description>
	<property name="version" value="1.5" />
	
	<property name="build.compiler" value="javac1.6" />
	<property name="ivy.retrieve.pattern" value="lib/[conf]/[artifact].[ext]" />
	<property name="ivyplusplus.location" value="http://projectlombok.org/downloads/ivyplusplus.jar" />
	<available file="lib/ivyplusplus.jar" property="ivyplusplus.available" />
	
	<path id="build.path">
		<fileset dir="lib/build">
			<include name="*.jar" />
		</fileset>
	</path>
	
	<path id="test.path">
		<fileset dir="lib/test">
			<include name="*.jar" />
		</fileset>
	</path>
	
	<target name="download-ipp" unless="ivyplusplus.available">
		<mkdir dir="lib" />
		<get src="${ivyplusplus.location}" dest="lib/ivyplusplus.jar" usetimestamp="true" />
	</target>
	
	<target name="load-ipp" depends="download-ipp">
		<taskdef classpath="lib/ivyplusplus.jar" resource="com/zwitserloot/ivyplusplus/antlib.xml" uri="antlib:com.zwitserloot.ivyplusplus" />
		<ivy:ensureippversion version="1.5" property="ipp.versionOkay" />
	</target>
	
	<target name="checkver-ipp" depends="load-ipp" unless="ipp.versionOkay">
		<get src="${ivyplusplus.location}" dest="lib/ivyplusplus.jar" />
		<fail>ivyplusplus has been updated to a new version. Restart the script to continue.</fail>
	</target>
	
	<target name="ensure-ipp" depends="load-ipp, checkver-ipp" />
	
	<target name="config-ivy" unless="ivy.config">
		<ivy:configure file="buildScripts/ivysettings.xml" />
		<property name="ivy.config" value="true" />
	</target>
	
	<target name="deps" depends="ensureBuildDeps, ensureRuntimeDeps, ensureTestDeps" description="Downloads all dependencies." />
	
	<target name="ensureBuildDeps" depends="config-ivy">
		<mkdir dir="lib/build" />
		<ivy:resolve file="buildScripts/ivy.xml" refresh="true" conf="build" />
		<ivy:retrieve />
	</target>
	
	<target name="ensureRuntimeDeps" depends="config-ivy">
		<mkdir dir="lib/runtime" />
		<ivy:resolve file="buildScripts/ivy.xml" refresh="true" conf="runtime" />
		<ivy:retrieve />
	</target>
	
	<target name="ensureTestDeps" depends="config-ivy">
		<mkdir dir="lib/test" />
		<ivy:resolve file="buildScripts/ivy.xml" refresh="true" conf="test" />
		<ivy:retrieve />
	</target>
	
	<target name="clean" description="Deletes build artifacts.">
		<delete quiet="true" dir="dist" />
		<delete quiet="true" dir="build" />
		<delete quiet="true" dir="doc/api" />
	</target>
	
	<target name="distclean" depends="clean" description="Deletes everything this build script has ever generated.">
		<delete dir="lib" quiet="true" />
		<delete dir="dist" quiet="true" />
		<delete file=".project" quiet="true" />
		<delete file=".classpath" quiet="true" />
		<delete dir=".settings" quiet="true" />
		<delete dir=".idea" quiet="true" />
		<delete file="cmdreader.iml" quiet="true" />
	</target>
	
	<target name="compile" depends="ensureBuildDeps" description="Compiles program code">
		<mkdir dir="build/prog" />
		<javac destdir="build/prog" target="1.8" source="1.8" encoding="ISO-8859-1" includeantruntime="false">
			<src path="src" />
			<classpath refid="build.path" />
            <classpath location="/usr/share/java/hamcrest-all.jar"/>
		</javac>
	</target>
	
	<target name="compileTests" depends="compile, ensureTestDeps" description="Compiles test code">
        <mkdir dir="build/tests" />
		<javac destdir="build/tests" source="1.8" target="1.8" encoding="ISO-8859-1" includeantruntime="false">
			<src path="test" />
			<classpath refid="test.path" />
			<classpath>
				<pathelement path="build/prog" />
			</classpath>
		</javac>
	</target>
	
	<target name="dist" depends="compile, -test.quiet, -test, javadoc" description="Creates the distributable">
		<mkdir dir="dist" />
		<jar destfile="dist/com.zwitserloot.cmdreader-${version}.jar" basedir="build/prog" />
		<copy file="dist/com.zwitserloot.cmdreader-${version}.jar" tofile="dist/com.zwitserloot.cmdreader.jar" />
		<zip destfile="dist/com.zwitserloot.cmdreader-javadoc-${version}.zip" basedir="doc/api" />
		<zip destfile="dist/com.zwitserloot.cmdreader-src-${version}.zip">
			<zipfileset dir="." prefix="com.zwitserloot.cmdreader/">
				<include name="LICENSE" />
				<include name="README.markdown" />
				<include name="src/**" />
				<include name="build.xml" />
				<include name="buildScripts/**" />
				<include name="test/**" />
			</zipfileset>
		</zip>
	</target>
	
	<target name="-test.quiet">
		<property name="tests.quiet" value="true" />
	</target>
	
	<target name="-test" depends="compileTests" unless="skipTests">
		<junit haltonfailure="yes" fork="on">
			<formatter type="plain" usefile="false" unless="tests.quiet" />
			<classpath refid="test.path" />
			<classpath>
				<pathelement path="build/prog" />
				<pathelement path="build/tests" />
                <pathelement location="/usr/share/java/hamcrest-core.jar" />
			</classpath>
			<batchtest>
				<fileset dir="test">
					<include name="**/Test*.java" />
				</fileset>
			</batchtest>
		</junit>
		<echo level="info">All tests successful.</echo>
	</target>
	
	<target name="test" depends="-test" description="Runs the unit tests" />
	
	<target name="javadoc" description="Generates the javadoc to doc/api">
		<delete dir="doc/api" quiet="true" />
		<mkdir dir="doc/api" />
		<javadoc sourcepath="src" defaultexcludes="yes" destdir="doc/api" windowtitle="com.zwitserloot.cmdreader">
			<classpath refid="build.path" />
			<link href="http://java.sun.com/javase/6/docs/api/" />
		</javadoc>
	</target>
	
	<target name="contrib" depends="config-ivy" description="Downloads various non-crucial documentation, sources, etc that are useful when developing lombok.ast.">
		<ivy:resolve file="buildScripts/ivy.xml" refresh="true" conf="contrib" />
		<ivy:retrieve />
	</target>
	
	<target name="intellij" depends="deps, contrib" description="Creates intellij project files and downloads all dependencies. Open this directory as a project in IntelliJ after running this target.">
		<ivy:intellijgen>
			<conf name="build" sources="contrib" />
			<conf name="test" sources="contrib" />
			<module name="cmdreader" depends="build, test">
				<srcdir dir="src" />
				<srcdir dir="test" test="true" />
			</module>
			<settings>
				<url url="http://projectlombok.org/downloads/lombok.intellij.settings" />
			</settings>
		</ivy:intellijgen>
	</target>
	
	<target name="eclipse" depends="deps, contrib" description="Creates eclipse project files and downloads all dependencies. Open this directory as project in eclipse after running this target.">
		<ivy:eclipsegen>
			<srcdir dir="src" />
			<srcdir dir="test" />
			<conf name="build" sources="contrib" />
			<conf name="test" sources="contrib" />
			<settings>
				<url url="http://projectlombok.org/downloads/lombok.eclipse.settings" />
			</settings>
		</ivy:eclipsegen>
	</target>
</project>