forked from bards/Epic.NET
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcontinuous.build
116 lines (99 loc) · 5.41 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
<?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')}"/>
<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="build-samples" />
<call target="test-code" cascade="false"/>
<call target="test-samples" cascade="false" />
</try>
<finally>
<call target="restore-version" />
</finally>
</trycatch>
</target>
<target name="clean-builddirectory">
<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">
<nant buildfile="Code/nant.build" target="build-code" />
</target>
<target name="build-samples">
<foreach item="Folder" in="${samples.dir}" property="sample">
<nant buildfile="${path::combine(sample, 'nant.build')}" target="build-code"/>
</foreach>
</target>
<target name="test-code">
<nant buildfile="Code/nant.build" target="run-tests" />
</target>
<target name="test-samples">
<foreach item="Folder" in="${samples.dir}" property="sample">
<nant buildfile="${path::combine(sample, 'nant.build')}" target="run-tests"/>
</foreach>
</target>
<target name="documentation" depends="api,manual">
</target>
<target name="api">
</target>
<target name="manual">
</target>
</project>