summaryrefslogtreecommitdiffstats
path: root/build.xml
blob: e656b02ac8daeb4086568cbaf78c499aaf5dbbf7 (plain)
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
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
<?xml version="1.0" encoding="UTF-8"?>
<project name="iciql" default="build" xmlns:mx="antlib:org.moxie">

	<!--
		~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
		Retrieve Moxie Toolkit

		documentation @ http://gitblit.github.io/moxie
		~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
	-->
	<property name="moxie.version" value="0.9.2" />
	<property name="moxie.url" value="http://gitblit.github.io/moxie/maven" />
	<property name="moxie.jar" value="moxie-toolkit-${moxie.version}.jar" />
	<property name="moxie.dir" value="${user.home}/.moxie" />

	<!-- Download Moxie from it's Maven repository to user.home -->
	<mkdir dir="${moxie.dir}" />
	<get src="${moxie.url}/com/gitblit/moxie/moxie-toolkit/${moxie.version}/${moxie.jar}"
		dest="${moxie.dir}" skipexisting="true" verbose="true" />

	<!-- Register Moxie tasks -->
	<taskdef uri="antlib:org.moxie">
		<classpath location="${moxie.dir}/${moxie.jar}" />
	</taskdef>


	<!--
		~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
		Initialize Moxie and setup build properties
		~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
	-->
	<target name="prepare"  description="Retrieves dependencies and sets up build properties">

		<mx:init mxroot="${moxie.dir}" />

	</target>


	<!--
		~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
		Clean
		~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
	-->
	<target name="clean" depends="prepare" description="Cleans build directory">

		<mx:clean />

	</target>


	<!--
		~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
		Compile
		~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
	-->
	<target name="compile" depends="prepare" description="Compiles iciql from source">

		<mx:javac />

	</target>


	<!--
		~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
		TestSuite
		~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
	-->
	<target name="testsuite" depends="compile" description="runs the benchmark test suite against all databases">
		<echo/>
		<echo>This will take a minute or two...</echo>
		<echo/>
		<mx:javac scope="test" />
		<mx:run scope="test" classname="com.iciql.test.IciqlSuite">
			<arg value="--dbFile" />
			<arg value="${project.outputDirectory}/performance_db.txt" />

			<arg value="--sqlFile" />
			<arg value="${project.outputDirectory}/performance_sql.txt" />
		</mx:run>
	</target>


	<!--
		~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
		Build
		~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
	-->
	<target name="build" depends="compile" description="Packages iciql for deployment">

		<!-- Package the jar, javadoc, sources, and zip distribution -->
		<mx:package />

		<!-- Deploy the artifacts into the version-controlled repository -->
		<mx:deploy basedir="${basedir}/maven" allowSnapshots="false" />

	</target>


	<!--
		~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
		Build the iciql website
		~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
	-->
	<target name="buildSite" description="Build the iciql website">
		<!-- ensure we have performance data -->
		<mx:if>
			<not>
				<available file="${project.outputDirectory}/performance_db.txt" />
			</not>
			<then>
				<fail message="Please run the &quot;testsuite&quot; target!"/>
			</then>
		</mx:if>

		<!-- Download links -->
		<property name="gc.url" value="http://gitblit.github.io/iciql/maven/com/iciql/${project.artifactId}/${project.releaseVersion}/" />
		<property name="releaselog" value="${basedir}/releases.moxie" />

		<mx:doc googleplusone="true" prettifyTheme="googlecode" minify="true"
			templateDir="${project.siteSourceDirectory}/templates"
			customless="custom.less" rssFeed="rss.xml" atomFeed="atom.xml">

			<logo file="iciql_white.png" />
			<favicon file="iciql-favicon.png" />

			<load token="%DBPERFORMANCE%" file="${project.outputDirectory}/performance_db.txt" />
			<regex searchPattern="\b(issue)(\s*[#]?|-){0,1}(\d+)\b"
				replacePattern="&lt;a href='${project.issuesUrl}/detail?id=$3'&gt;issue $3&lt;/a&gt;" />

			<structure>

				<menu name="about" pager="true" pagerPlacement="bottom" pagerLayout="justified">
					<page name="overview" src="index.mkd" out="index.html" />
					<page name="performance" src="performance.mkd" out="performance.html" />
					<page name="jaqu comparison" src="jaqu_comparison.mkd" out="jaqu_comparison.html" />
				</menu>

				<menu name="getting started" pager="true" pagerPlacement="bottom" pagerLayout="justified">
					<page name="table model classes" src="model_classes.mkd" out="model_classes.html" headerLinks="true" />
					<page name="data type adapters (DTA)" src="dta.mkd" out="dta.html" headerLinks="true" />
					<page name="data access object (DAO) usage" src="dao.mkd" out="dao.html" headerLinks="true" />
					<page name="database and table versioning" src="table_versioning.mkd" out="table_versioning.html" headerLinks="true" />
          <divider />
					<page name="SQL DSL usage" src="usage.mkd" out="usage.html" headerLinks="true" />
					<page name="SQL DSL examples" src="examples.mkd" out="examples.html" headerLinks="true" />
					<page name="tools" src="tools.mkd" out="tools.html" headerLinks="true" />
				</menu>

				<page name="building" src="building.mkd" out="building.html" />
				<page name="javadoc" src="javadoc.mkd" out="javadoc.html" />

				<page name="release notes" out="releasenotes.html">
					<template src="releasecurrent.ftl" data="${releaselog}" />
				</page>
				<page out="releases.html" navbarlink="false">
					<template src="releasehistory.ftl" data="${releaselog}" />
				</page>

				<menu name="downloads">
					<link name="${project.artifactId}-${project.releaseVersion}"
						src="${gc.url}${project.artifactId}-${project.releaseVersion}.zip" />
					<divider />
					<link name="Maven Repository" src="${project.mavenUrl}" />
				</menu>

				<menu name="links">
					<link name="Github" src="${project.scmUrl}" />
					<link name="Issues" src="${project.issuesUrl}" />
					<link name="Maven Repository" src="${project.mavenUrl}" />
				</menu>
				<divider />
			</structure>

			<!-- Generate RSS and Atom feeds from the release history -->
			<page as="atom.xml">
				<template src="atom.ftl" data="${releaselog}" />
			</page>
			<page as="rss.xml">
				<template src="rss.ftl" data="${releaselog}" />
			</page>

		</mx:doc>

		<!-- Copy standard javadoc -->
		<mkdir dir="${project.siteTargetDirectory}/javadoc" />
		<copy todir="${project.siteTargetDirectory}/javadoc">
			<fileset dir="${project.javadocTargetDirectory}" />
		</copy>
	</target>


	<!--
		~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
		Copy the built site to the gh-pages branch
		~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
	-->
	<target name="updateGhpages" depends="buildSite">
		<mx:ghpages obliterate="false" />
	</target>


	<!--
		~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
		Publish site to hosting service
		~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
	-->
	<target name="publishSite" depends="updateGhpages" description="Publish the iciql site to a webserver" >

		<echo>Uploading ${project.artifactId} ${project.version} website</echo>

		<mx:ftp server="${ftp.server}"
			userid="${ftp.user}"
			password="${ftp.password}"
			remotedir="${ftp.site.dir}"
			passive="true"
			verbose="yes">
			<fileset dir="${project.siteTargetDirectory}" />
		</mx:ftp>
	</target>


	<!--
		~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
		Tag a new version and prepare for the next development cycle.
		~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
	-->
	<target name="tagRelease" depends="prepare" description="Tags a release">
		<!-- release -->
		<property name="dryrun" value="false" />
		<mx:version stage="release" dryrun="${dryrun}" />
		<property name="project.tag" value="v${project.version}" />
		<!-- commit build.moxie & releases.moxie (automatic) -->
		<mx:commit showtitle="no">
		    <message>Prepare ${project.version} release</message>
			<tag name="${project.tag}">
				<message>${project.name} ${project.version} release</message>
			</tag>
		</mx:commit>

		<!-- create the release process script -->
		<mx:if>
			<os family="windows" />
			<then>
				<!-- Windows PowerShell script        -->
				<!-- set-executionpolicy remotesigned -->
				<property name="recipe" value="release_${project.version}.ps1" />
			</then>
			<else>
				<!-- Bash script -->
				<property name="recipe" value="release_${project.version}.sh" />
			</else>
		</mx:if>
		<delete file="${recipe}" failonerror="false" quiet="true" verbose="false" />
		<!-- Work-around for lack of proper ant property substitution in copy -->
		<property name="dollar" value="$"/>
		<copy file="release.template" tofile="${recipe}">
			<filterset begintoken="${dollar}{" endtoken="}">
				<filter token="project.version" value="${project.version}" />
				<filter token="project.commitId" value="${project.commitId}" />
				<filter token="project.tag" value="${project.tag}" />
			</filterset>
		</copy>
		<chmod file="${recipe}" perm="ugo+rx" />

		<!-- next cycle -->
		<mx:version stage="snapshot" incrementNumber="minor" dryrun="${dryrun}" />
		<mx:commit showtitle="no">
		    <message>Reset build identifiers for next development cycle</message>
		</mx:commit>
	</target>


</project>