forked from paulyoder/LinqToExcel
-
Notifications
You must be signed in to change notification settings - Fork 0
/
project.build
161 lines (137 loc) · 6.59 KB
/
project.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
<?xml version="1.0" ?>
<project name="LinqToExcel" default="build">
<property name="nant.settings.currentframework" value="net-3.5" />
<property name="dir.base" value="${directory::get-current-directory()}" />
<property name="dir.bin" value="${dir.base}\bin" />
<property name="dir.bin64" value="${dir.base}\bin64" />
<property name="dir.test" value="${dir.base}\tests" />
<property name="dir.package" value="${dir.base}\package" />
<property name="dir.package64" value="${dir.base}\package64" />
<property name="file.project" value="${dir.base}\src\LinqToExcel\LinqToExcel.csproj" />
<property name="file.project.test" value="${dir.base}\src\LinqToExcel.Tests\LinqToExcel.Tests.csproj" />
<property name="tool.MbUnit" value="${dir.base}\lib\MbUnit\MbUnit.Cons.exe" />
<property name="tool.nuget" value="${dir.base}\tools\NuGet\nuget.exe" />
<target name="build" depends="clean, compile, compile64, deleteLog4netXml" />
<target name="publish" depends="test, build, zip, zip64, package, package64, resetNuspecVersion" />
<target name="clean" description="deletes folders used in the build">
<delete dir="${dir.bin}" if="${directory::exists(dir.bin)}" />
<delete dir="${dir.bin64}" if="${directory::exists(dir.bin64)}" />
<delete dir="${dir.test}" if="${directory::exists(dir.test)}" />
<delete>
<fileset basedir="${dir.package}\lib">
<include name="*.*" />
</fileset>
</delete>
<delete>
<fileset basedir="${dir.package64}\lib">
<include name="*.*" />
</fileset>
</delete>
</target>
<target name="compile" description="compiles the project">
<exec program="${framework::get-framework-directory(framework::get-target-framework())}\msbuild.exe"
commandline=""${file.project}" /p:Configuration=Release;DocumentationFile=LinqToExcel.xml;OutputPath="${dir.bin}\\"" />
</target>
<target name="compile64" description="compiles the project in 64 bit mode">
<exec program="${framework::get-framework-directory(framework::get-target-framework())}\msbuild.exe"
commandline=""${file.project}" /p:Configuration=Release;DocumentationFile=LinqToExcel.xml;Platform=x64;OutputPath="${dir.bin64}\\"" />
</target>
<target name="getPublishVersion" description="Gets the AssemblyVersion and sets it in the nuspec file">
<loadfile
file="${dir.base}\src\LinqToExcel\Properties\AssemblyInfo.cs"
property="assemblyInfoContents" />
<regex
input="${assemblyInfoContents}"
pattern="AssemblyVersion\("(?'assemblyVersion'[^"]*)"\)" />
<property
name="publish.version"
value="${assemblyVersion}" />
</target>
<target name="setVersion" description="Sets the package version in the nuspec file" depends="getPublishVersion">
<xmlpoke
file="${dir.package}\LinqToExcel.nuspec"
xpath="package/metadata/version"
value="${publish.version}" />
</target>
<target name="zip" description="zips the contents of the bin folder to the zip.dir" depends="setVersion">
<xmlpeek
file="${dir.package}\LinqToExcel.nuspec"
xpath="package/metadata/version"
property="publish.version" />
<zip zipfile="${dir.base}\LinqToExcel_${publish.version}.zip">
<fileset basedir="${dir.bin}">
<include name="**/*" />
</fileset>
</zip>
</target>
<target name="zip64" description="zips the contents of the bin64 folder to the zip.dir64" depends="setVersion">
<zip zipfile="${dir.base}\LinqToExcel_x64_${publish.version}.zip">
<fileset basedir="${dir.bin64}">
<include name="**/*" />
</fileset>
</zip>
</target>
<target name="package" description="creates the NuGet package" depends="setVersion">
<copy todir="${dir.package}\lib">
<fileset basedir="${dir.bin}">
<include name="*.dll" />
<include name="LinqToExcel.xml" />
</fileset>
</copy>
<exec program="${tool.nuget}" commandline="pack "${dir.package}\LinqToExcel.nuspec"" />
<delete dir="${dir.package}\lib" />
</target>
<target name="package64" description="creates the NuGet package for the 64bit version" depends="setVersion">
<copy todir="${dir.package64}\lib">
<fileset basedir="${dir.bin64}">
<include name="*.dll" />
<include name="LinqToExcel.xml" />
</fileset>
</copy>
<copy todir="${dir.package64}">
<fileset basedir="${dir.package}">
<include name="LinqToExcel.nuspec" />
</fileset>
</copy>
<move file="${dir.package64}/LinqToExcel.nuspec"
tofile="${dir.package64}/LinqToExcel_x64.nuspec" />
<xmlpoke
file="${dir.package64}\LinqToExcel_x64.nuspec"
xpath="package/metadata/id"
value="LinqToExcel_x64" />
<exec program="${tool.nuget}" commandline="pack "${dir.package64}\LinqToExcel_x64.nuspec"" />
<delete dir="${dir.package64}" />
</target>
<target name="resetNuspecVersion">
<xmlpoke
file="${dir.package}\LinqToExcel.nuspec"
xpath="package/metadata/version"
value="Auto populated from AssemblyInfo.cs file" />
</target>
<target name="compile-test-project" description="compiles the test project">
<exec program="${framework::get-framework-directory(framework::get-target-framework())}\msbuild.exe"
commandline=""${file.project.test}" /p:OutputPath="${dir.test}\bin\\"" />
</target>
<target name="unit-test" depends="clean, compile-test-project" description="runs the unit tests">
<exec program="${tool.MbUnit}"
commandline=""${dir.test}\bin\LinqToExcel.Tests.dll" /report-folder:"${dir.test}\reports\\" /report-type:Html /filter-category:"Unit"" />
<!-- clean up the created directories if the unittests passed -->
<call target="clean" />
</target>
<target name="integration-test" depends="clean, compile-test-project" description="runs the integration tests">
<exec program="${tool.MbUnit}"
commandline=""${dir.test}\bin\LinqToExcel.Tests.dll" /report-folder:"${dir.test}\reports\\" /report-type:Html /filter-category:"Integration"" />
<!-- clean up the created directories if the unittests passed -->
<call target="clean" />
</target>
<target name="test" depends="clean, compile-test-project" description="runs all the tests">
<exec program="${tool.MbUnit}"
commandline=""${dir.test}\bin\LinqToExcel.Tests.dll" /report-folder:"${dir.test}\reports\\" /report-type:Html" />
<!-- clean up the created directories if the unittests passed -->
<call target="clean" />
</target>
<target name="deleteLog4netXml" description="Deletes the log4net.xml file that isn't need and takes up a lot of space">
<delete file="${dir.bin}/log4net.xml" />
<delete file="${dir.bin64}/log4net.xml" />
</target>
</project>