-
Notifications
You must be signed in to change notification settings - Fork 2
/
bolt.build
246 lines (199 loc) · 11.4 KB
/
bolt.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
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
<?xml version="1.0"?>
<project name="Bolt" default="build-release" xmlns="http://nant.sf.net/release/0.85-rc3/nant.xsd">
<target name="build-release" depends="clean, make-builddir, release-properties, get-release-version, copy-to-release, retrieve-published-documentation" description="Compile and run unit tests" />
<target name="deploy-release" depends="build-release, deploy-to-qa"/>
<target name="ship-release" depends="deploy-release, git.tag.release, deploy-to-ship, authenticate-against-website deploy-product-to-public-website, deploy-documentation-to-public-website, unauthenticate-from-website"/>
<!-- Main paths -->
<property name="tools.dir" value="${path::get-full-path('tools')}" />
<property name="src.dir" value="${path::get-full-path('code')}" />
<property name="build.dir" value="${path::get-full-path('build')}" />
<!--Clean-->
<target name="clean" description="Delete automated build artifacts">
<delete dir="${build.dir}" if="${directory::exists(build.dir)}" failonerror="false"/>
</target>
<!--Make build dir-->
<target name="make-builddir" description="Create build dir and build report dir">
<mkdir dir="${build.dir}" unless="${directory::exists(build.dir)}" />
</target>
<target name="release-properties">
<property name="asm.version" value="9.9" />
<property name="release.dir" value="${path::combine(path::get-full-path(build.dir),'Release')}"/>
<property name="htmldocs.release.dir" value="${path::combine(path::get-full-path(release.dir),'docs')}"/>
<property name="asm.version.file" value="Bolt.Version.xml"/>
<property name="documentation.unc" value="\\focus.fcs.local\DovetailCRM\releases\documentation\BOLT"/>
<property name="website.unc" value="\\focus.fcs.local\DovetailCRM\releases\products\BOLT"/>
<property name="website.username" value="FOCUS\dovetaildeployer"/>
<property name="website.password" value="B0mb3rM@n"/>
<property name="product.chm.path" value="\\authorit\Publishing\HTMLHelp\Dovetail BOLT\" />
<property name="product.chm.file" value="${product.chm.path}\bolt.chm" />
<property name="product.html.docs.dir" value="\\authorit\Publishing\HTML\Dovetail BOLT\" />
</target>
<target name="copy-to-release">
<mkdir dir="${release.dir}" failonerror="false"/>
<copy todir="${release.dir}">
<fileset basedir="${src.dir}">
<include name="*" />
<include name="css/*" />
<include name="img/*" />
<include name="inc/*" />
<include name="js/*" />
<include name="ClarifyID/*" />
<include name="files/*" />
<exclude name="*.sln"/>
<exclude name="*.suo"/>
<exclude name="_ReSharper.bolt"/>
<exclude name="*.Resharper*"/>
</fileset>
</copy>
</target>
<target name="retrieve-published-documentation" depends="release-properties">
<mkdir dir="${htmldocs.release.dir}"/>
<copy todir="${htmldocs.release.dir}">
<fileset basedir="\\authorit\Publishing\HTML\Dovetail Bolt">
<include name="*"/>
</fileset>
</copy>
<copy file="\\authorit\Publishing\HTMLHelp\Dovetail Bolt\bolt.chm" tofile="${htmldocs.release.dir}\bolt.chm" />
</target>
<target name="deploy-to-qa">
<property name="deployment.base.dir" value="\\marvin\build\bolt" />
<property name="deployment.dir" value="${deployment.base.dir}\${asm.version}" />
<mkdir dir="${deployment.base.dir}" unless="${directory::exists(deployment.base.dir)}" />
<mkdir dir="${deployment.dir}" unless="${directory::exists(deployment.dir)}" />
<copy todir="${deployment.dir}" overwrite="true">
<fileset basedir="${release.dir}">
<include name="${release.dir}/bolt_${asm.version}.chm" />
<include name="*.msi" />
</fileset>
</copy>
</target>
<target name="deploy-to-ship">
<property name="deployment.base.dir" value="\\marvin\product\bolt" />
<property name="deployment.dir" value="${deployment.base.dir}\${asm.version}" />
<property name="ship.dir" value="${deployment.dir}\ship" />
<mkdir dir="${deployment.base.dir}" unless="${directory::exists(deployment.base.dir)}" />
<mkdir dir="${deployment.dir}" unless="${directory::exists(deployment.dir)}" />
<mkdir dir="${ship.dir}" unless="${directory::exists(ship.dir)}" />
<copy todir="${ship.dir}" overwrite="true">
<fileset basedir="${release.dir}">
<include name="${release.dir}/bolt_${asm.version}.chm" />
<include name="*.msi" />
</fileset>
</copy>
</target>
<target name="git.tag">
<property name="git.describe.file" value="gitDescribe.txt" />
<exec program="CMD" commandline="/C git.cmd describe --long" output="${git.describe.file}" verbose="true" failonerror="false"/>
<loadfile file="${git.describe.file}" property="git.describe" />
<delete file="${git.describe.file}" />
<property name="gitTag" value="0" />
<regex pattern="v(?'gitTagVersion'\d+.\d+.\d+)-(?'gitTagCommits'\d*)" input="${git.describe}" failonerror="false"/>
<property name="git.tag" value="${gitTagCommits}"/>
<property name="git.tag.version" value="${gitTagVersion}"/>
<echo message="Git tag version is ${git.tag.version}. There have been ${git.tag} commits since the tag." />
</target>
<target name="git.tag.release" depends="get-release-version">
<echo if="${git.tag.version == asm.version.sans.tag}">Tag and Assembly version are the same ${asm.version.sans.tag}. No tag will be created.</echo>
<if test="${git.tag.version != asm.version.sans.tag}">
<echo message="Creating tag for release ${asm.version.sans.tag}" />
<property name="git.tag.name" value="v${asm.version.sans.tag}"/>
<exec program="CMD" commandline="/C git.cmd tag -a ${git.tag.name} -m "tagging release ${git.tag.name}" --force" verbose="true"/>
<exec program="CMD" commandline="/C git.cmd push dovetail git.tag.name" verbose="true"/>
<echo message="Created tag ${git.tag.name} pushed to dovetail master" />
</if>
</target>
<target name="git.sha">
<property name="git.log.file" value="gitLog.txt" />
<exec program="CMD" commandline="/C git.cmd log -1 --pretty=%H" output="${git.log.file}" />
<loadfile file="${git.log.file}" property="git.log" />
<delete file="${git.log.file}" />
<property name="gitSHA" value="" />
<regex pattern="(?'gitSHA'.*)\s*" input="${git.log}" />
<property name="git.sha" value="${gitSHA}"/>
<echo message="${gitSHA} is the most recent commit sha." />
</target>
<target name="get-release-version" depends="git.tag, git.sha">
<xmlpeek file="${asm.version.file}" property="asm.tempversion" xpath="//version"/>
<property name="asm.version.sans.tag"
value="${ int::to-string(version::get-major(version::parse(asm.tempversion)))
+ '.' + int::to-string(version::get-minor(version::parse(asm.tempversion))) + '.' + int::to-string(version::get-build(version::parse(asm.tempversion)))}"/>
<property name="asm.version" value="${asm.version.sans.tag + '.' + git.tag }" overwrite="true" />
<property name="asm.version.major" value="${ int::to-string(version::get-major(version::parse(asm.tempversion))) }" overwrite="true" />
<property name="asm.version.minor" value="${ int::to-string(version::get-minor(version::parse(asm.tempversion))) }" overwrite="true" />
<property name="asm.version.build" value="${ int::to-string(version::get-build(version::parse(asm.tempversion))) }" overwrite="true" />
<property name="asm.version.revision" value="${git.tag}" overwrite="true" />
<setenv name="asm.version" value="${asm.version}"/>
<echo message="Version set to ${asm.version}"/>
</target>
<!--
<target name="svn.revision">
<property name="svn.infotempfile" value="svninfo.txt" />
<exec program="svn.exe" output="${svn.infotempfile}">
<arg value="info" />
</exec>
<loadfile file="${svn.infotempfile}" property="svn.info" />
<delete file="${svn.infotempfile}" />
<property name="match" value="" />
<regex pattern="Last Changed Rev: (?'match'\d+)" input="${svn.info}" />
<property name="svn.info.revision" value="${match}"/>
</target>
<target name="get-release-version" depends="release-properties, svn.revision">
<exec program="svn.exe" commandline="update ${asm.version.file}"/>
<xmlpeek file="${asm.version.file}" property="asm.tempversion" xpath="//version"/>
<property name="asm.version.sans.tag"
value="${ int::to-string(version::get-major(version::parse(asm.tempversion)))
+ '.' + int::to-string(version::get-minor(version::parse(asm.tempversion)))
+ '.' + int::to-string(version::get-build(version::parse(asm.tempversion)))}" overwrite="true" />
<property name="asm.version"
value="${ int::to-string(version::get-major(version::parse(asm.tempversion)))
+ '.' + int::to-string(version::get-minor(version::parse(asm.tempversion)))
+ '.' + int::to-string(version::get-build(version::parse(asm.tempversion)))
+ '.' + svn.info.revision }" overwrite="true" />
<property name="asm.version.major" value="${ int::to-string(version::get-major(version::parse(asm.tempversion))) }" overwrite="true" />
<property name="asm.version.minor" value="${ int::to-string(version::get-minor(version::parse(asm.tempversion))) }" overwrite="true" />
<setenv name="asm.version" value="${asm.version}"/>
<echo message="Version set to ${asm.version}"/>
<echo message="Version (sans tag) set to ${asm.version.sans.tag}"/>
</target>
<target name="tag-release" depends="release-properties, get-release-version">
<property name="svn.tag.path" value="https://code.dovetailsoftware.com/svn/classic/bolt/tags/release_${asm.version}" />
<property name="svn.tag.message" value="Tagging Bolt version ${asm.version} to ${svn.tag.path}" />
<echo message="${svn.tag.message}"/>
<exec program="svn.exe" commandline="copy https://code.dovetailsoftware.com/svn/classic/bolt/trunk ${svn.tag.path} -m "${svn.tag.message}"" />
</target>
-->
<target name="deploy-product-to-public-website" depends="get-release-version">
<property name="deployment.dir" value="${website.unc}/${asm.version.sans.tag}"/>
<mkdir dir="${deployment.dir}" failonerror="false"/>
<copy todir="${deployment.dir}" overwrite="true">
<fileset basedir="${release.dir}">
<include name="*.msi" />
</fileset>
</copy>
</target>
<target name="deploy-documentation-to-public-website" depends="get-release-version, release-properties">
<property name="deployment.dir" value="${documentation.unc}/${asm.version.sans.tag}"/>
<property name="deployment.html.dir" value="${deployment.dir}/html"/>
<mkdir dir="${deployment.dir}" failonerror="true"/>
<mkdir dir="${deployment.html.dir}" failonerror="true"/>
<copy todir="${deployment.html.dir}">
<fileset basedir="${product.html.docs.dir}">
<include name="**/*" />
<exclude name="*.chm"/>
</fileset>
</copy>
<copy todir="${deployment.dir}">
<fileset basedir="${product.chm.path}">
<include name="*.chm" />
</fileset>
</copy>
</target>
<target name="authenticate-against-website" depends="release-properties">
<echo message="authenticating against FOCUS.fcs.local IPC"/>
<exec program="net" commandline="use "\\FOCUS.fcs.local\IPC$" /USER:${website.username} ${website.password}" failonerror="false"/>
</target>
<target name="unauthenticate-from-website" depends="release-properties">
<echo message="unauthenticating from FOCUS.fcs.local IPC"/>
<exec program="net" commandline="use \\FOCUS.fcs.local\IPC$ /DELETE" failonerror="false"/>
</target>
</project>