-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathcontinuous.build
178 lines (163 loc) · 9.36 KB
/
continuous.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
<?xml version="1.0" ?>
<project name="Epic.NET" default="continuous" xmlns="http://nant.sf.net/schemas/nant.xsd">
<property name="build.target" value="Build" overwrite="false" />
<property name="build.configuration" value="Debug" overwrite="false" />
<property name="repository.rootdirectory" value="${path::get-full-path('.')}" />
<property name="nant.include.dir" value="${path::combine(path::combine(repository.rootdirectory, 'Tools'), 'NantScripts')}" />
<include buildfile="${path::combine(nant.include.dir, 'Properties.include')}" if="${not property::exists('epic.infofile')}"/>
<include buildfile="${path::combine(nant.include.dir, 'RunNUnit.include')}" />
<target name="continuous" depends="clean-builddirectory">
<tstamp />
<if test="${property::exists('build.vcs.number')}">
<echo message="Commit: ${build.vcs.number}" />
</if>
<call target="update-version" />
<trycatch>
<try>
<call target="build-code" />
<call target="test-code" cascade="false"/>
<call target="documentation" cascade="false" />
</try>
<finally>
<call target="restore-version" />
</finally>
</trycatch>
</target>
<target name="clean-builddirectory">
<delete if="${directory::exists(website.tmp.path)}" dir="${website.tmp.path}" />
<delete if="${directory::exists(api.tmp.path)}" dir="${api.tmp.path}" />
<delete if="${directory::exists(repository.testdirectory)}">
<fileset>
<include name="${path::combine(path::combine(repository.testdirectory, '**'), '*.dll')}" />
<include name="${path::combine(path::combine(repository.testdirectory, '**'), '*.pdb')}" />
<include name="${path::combine(path::combine(repository.testdirectory, '**'), '*.xml')}" />
<include name="${path::combine(path::combine(repository.testdirectory, '**'), '*.txt')}" />
<include name="${path::combine(path::combine(repository.testdirectory, '**'), '*.log')}" />
<include name="${path::combine(path::combine(repository.testdirectory, '**'), '*.html')}" />
</fileset>
</delete>
<delete if="${directory::exists(repository.builddirectory)}">
<fileset>
<include name="${path::combine(path::combine(repository.builddirectory, '**'), '*.dll')}" />
<include name="${path::combine(path::combine(repository.builddirectory, '**'), '*.pdb')}" />
<include name="${path::combine(path::combine(repository.builddirectory, '**'), '*.xml')}" />
<include name="${path::combine(path::combine(repository.builddirectory, '**'), '*.txt')}" />
<include name="${path::combine(path::combine(repository.builddirectory, '**'), '*.log')}" />
<include name="${path::combine(path::combine(repository.builddirectory, '**'), '*.html')}" />
</fileset>
</delete>
</target>
<target name="update-version">
<if test="${build.configuration=='Release'}">
<if test="${not (property::exists('build.number'))}">
<fail message="Can not build a Release without a build numeber. Use -D:build.number=N to define one."/>
</if>
<foreach item="Line" in="${epic.infofile}" property="line">
<if test="${string::contains(line, '[assembly: AssemblyVersion')}">
<property name="assembly.version" value="${string::replace(string::replace(line, '[assembly: AssemblyVersion("', ''), '")]', '')}"/>
<regex pattern="^(?'_major'\d+)\.(?'_minor'\d+)\.(?'_build'\d+)\.(?'_revision'\d+)$" input="${assembly.version}"/>
<property name="assembly.file.version" value="${_major + '.' + _minor + '.' + build.number + '.' + _revision}"/>
</if>
</foreach>
<if test="${not (property::exists('assembly.file.version'))}">
<fail message="Can not build a Release: can't define the AssemblyFileVersion."/>
</if>
<move file="${epic.infofile}" tofile="${epic.infofile}.orig" />
<copy file="${epic.infofile}.orig" tofile="${epic.infofile}">
<filterchain>
<replacestring from="${'[assembly: AssemblyFileVersion("'+assembly.version+'")]'}"
to="${'[assembly: AssemblyFileVersion("'+assembly.file.version+'")]'}" />
</filterchain>
</copy>
</if>
</target>
<target name="restore-version">
<if test="${file::exists(epic.infofile + '.orig')}">
<move file="${epic.infofile}.orig" tofile="${epic.infofile}" overwrite="true" />
</if>
</target>
<target name="build-code">
<echo message="Building Epic.NET in ${path::get-full-path('.')}." />
<exec program="${msbuild.path}"
commandline="Epic.sln /t:${build.target} /p:Configuration=${build.configuration} /v:${build.verbosity}"
workingdir="${path::get-full-path('.')}" />
</target>
<target name="test-code">
<property name="working.dir" value="${repository.testdirectory}" />
<property name="component.name" value="Epic"/>
<property name="tests.to.run" value="${path::combine(repository.rootdirectory, 'Epic.nunit')}" />
<call target="run-nunit"/>
</target>
<target name="documentation" depends="api,manual">
<property name="website.commit.msg" value="Update documentation to ${build.vcs.number}."/>
<echo message="Clone [email protected]:bards/Epic.NET.git "${website.tmp.path}""/>
<exec program="cmd">
<arg value="/c" />
<arg value="git clone [email protected]:bards/Epic.NET.git -b gh-pages "${website.tmp.path}"" />
</exec>
<delete if="${directory::exists(website.tmp.docApi.path)}" dir="${website.tmp.docApi.path}" />
<delete if="${directory::exists(website.tmp.docManual.path)}" dir="${website.tmp.docManual.path}" />
<copy todir="${website.tmp.docApi.path}" if="${directory::exists(api.tmp.path)}">
<fileset basedir="${api.tmp.path}">
<include name="${path::combine('html', '*.htm')}" />
<include name="${path::combine('icons', '*.gif')}" />
<include name="${path::combine('scripts', '*.js')}" />
<include name="${path::combine('styles', '*.css')}" />
</fileset>
</copy>
<copy todir="${website.tmp.docManual.path}" if="${directory::exists(manual.tmp.path)}">
<fileset basedir="${manual.tmp.path}">
<include name="*.html" />
<include name="${path::combine('images', '*.*')}" />
<include name="${path::combine('css', '*.css')}" />
</fileset>
</copy>
<exec program="cmd" workingdir="${website.tmp.path}">
<arg value="/c" />
<arg value="git add ." />
</exec>
<echo message="Commit API doc changes with message "${website.commit.msg}""/>
<exec program="cmd" workingdir="${website.tmp.path}">
<arg value="/c" />
<arg value="git commit -am "${website.commit.msg}"" />
</exec>
<exec program="cmd" workingdir="${website.tmp.path}">
<arg value="/c" />
<arg value="git push origin gh-pages" />
</exec>
</target>
<target name="api">
<property name="project.path" value="${path::combine(documentation.dir, 'Epic.API.shfbproj')}"/>
<echo message="Call sandcastle with arguments ${project.path} /p:PresentationStyle=${website.presentationstyle} /t:${build.target} /p:Configuration=${build.configuration} /v:${build.verbosity}"/>
<exec program="${msbuild.path}"
workingdir="${documentation.dir}" >
<arg value="${project.path}"/>
<arg value="/p:PresentationStyle=${website.presentationstyle}"/>
<arg value="/t:${build.target}"/>
<arg value="/p:Configuration=${build.configuration}"/>
<arg value="/v:${build.verbosity}"/>
</exec>
</target>
<target name="manual">
<if test="${property::exists('a2x.path')}">
<exec program="python"
workingdir="${documentation.dir}" verbose="true" >
<!--
Enable Verbosity
<arg value="-v"/>
-->
<arg value="${a2x.path}" />
<arg value="--no-xmllint"/>
<arg value="--icons"/>
<arg value="--xsltproc-opts="--stringparam highlight.source 1 --stringparam navig.graphics 0""/>
<arg value="--resource=${path::combine(documentation.dir, 'resources')}"/>
<arg value="--format=chunked"/>
<arg value="--destination-dir=../build/tmp/"/>
<arg value="--conf-file=a2x.conf"/>
<arg value="--stylesheet="css/layout.css css/screen.css css/shCore.css css/shCoreDefault.css css/shThemeDefault.css css/documentation.css""/>
<arg value="--xsl-file=xsl/website.xsl"/>
<arg value="en-US/manual.txt"/>
</exec>
</if>
</target>
</project>