-
Notifications
You must be signed in to change notification settings - Fork 0
/
default.build
248 lines (216 loc) · 9.55 KB
/
default.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
247
248
<?xml version="1.0"?>
<project name="WCFExtras+"
default="release"
xsi:schemaLocation="http://nant.sf.net/nightly/2008-08-18-0.86/nant.xsd SDKs\nant-0.86\schema\nant.xsd"
xmlns="http://nant.sf.net/nightly/2008-08-18-0.86/nant.xsd"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<!-- <property name="nant.settings.currentframework" value="net-3.5" /> -->
<echo message="Using '${nant.settings.currentframework}' framework on '${platform::get-name()}' platform." />
<!-- Indicates whether to increment the build number -->
<property name="incr.major" value="false" />
<property name="incr.minor" value="false" />
<property name="incr.revision" value="false" />
<property name="incr.build" value="true" />
<property name="project.dir" value="${project::get-base-directory()}" />
<property name="source.dir" value="${project.dir}/source" />
<property name="build.configuration" value="Release" />
<property name="project.title" value="WCFExtrasPlus" />
<property name="build.debug" value="false" />
<property name="build.dir" value="${project::get-base-directory()}/Release" />
<property name="nuget.exe" value="NuGet.exe" />
<property name="nuget.spec.file" value="${project.dir}/NuGet/WCFExtrasPlus.nuspec" />
<property name="releasenotes.file" value="${project.dir}/ReleaseNotes.txt" />
<property name="global.assembly.file" value="${project.dir}/Source/GlobalAssemblyInfo.cs" />
<target name="release">
<call target="clean" />
<call target="show-properties" />
<call target="build-global-assembly" />
<call target="build-wcfextrasplus" />
<copy file="license.txt" tofile="${build.dir}\license.txt" />
</target>
<target name="show-properties">
<echo message="Build configuration:" />
<script language="C#">
<references>
<include name="System.dll" />
</references>
<imports>
<import namespace="System.Collections.Generic" />
</imports>
<code>
<![CDATA[
public static void ScriptMain(Project project) {
var sortedByKey = new SortedDictionary<string, string>();
foreach(DictionaryEntry de in project.Properties)
sortedByKey.Add(de.Key.ToString(), de.Value.ToString());
var echo = new NAnt.Core.Tasks.EchoTask();
echo.Project = project;
foreach(var kvp in sortedByKey) {
if(kvp.Key.StartsWith("nant."))
continue;
echo.Message = String.Format("{0}: {1}", kvp.Key, kvp.Value);
echo.Execute();
}
}
]]>
</code>
</script>
</target>
<target name="get-last-version">
<loadfile
file="${global.assembly.file}"
property="global.assembly.info" />
<regex
pattern="assembly: AssemblyVersionAttribute..(?'lastversion'\d+.\d+.\d+.\d+).."
input="${global.assembly.info}" />
<echo message="Last version=${lastversion}" />
</target>
<target name="update-version" depends="get-last-version">
<!--
The Version class is documented to use a build number format of
<major>.<minor>.<build>.<revision>, but I use it as
<major>.<minor>.<revision>.<build>, so the "build", which is always
incremented, is last, and the "revision" can be static.
-->
<echo message="Incrementing build number"/>
<script language="C#">
<imports>
<import namespace="System.Globalization" />
<import namespace="System.Threading" />
</imports>
<code><![CDATA[
public static void ScriptMain(Project project) {
Version version = new Version(project.Properties["lastversion"]);
int major = version.Major;
int minor = version.Minor;
int revision = version.Build;
int build = version.Revision;
if (project.Properties["incr.major"] == "true") {
major++;
minor = 0;
revision = 0;
build = 0;
}
else if (project.Properties["incr.minor"] == "true") {
minor++;
revision = 0;
build = 0;
}
if (project.Properties["incr.revision"] == "true")
revision++;
if (project.Properties["incr.build"] == "true")
build++;
version = new Version(major, minor, revision, build);
project.Properties["build.version"] = version.ToString();
}
]]></code>
</script>
<echo message="New number: ${build.version}"/>
</target>
<target name="build-global-assembly" depends="update-version">
<echo message="Re-generating global assembly file with version ${build.version}"/>
<asminfo language="CSharp" output="${global.assembly.file}">
<imports>
<import namespace="System.Reflection" />
</imports>
<attributes>
<attribute type="AssemblyProductAttribute" value="WCFExtrasPlus" />
<attribute type="AssemblyCopyrightAttribute" value="Copyright © 2008-2014 Eyal Post, Chris Jansen" />
<attribute type="AssemblyConfigurationAttribute" value="${build.configuration}" />
<attribute type="AssemblyVersionAttribute" value="${build.version}" />
</attributes>
</asminfo>
</target>
<target name="build-wcfextrasplus">
<echo message="Building WCFExtrasPlus"/>
<loadtasks assembly="${project.dir}\source\packages\NAnt.Contrib.Portable.0.92\tools\NAnt.Contrib.Tasks.dll" />
<echo message="Target framework: 3.5"/>
<msbuild project="${source.dir}/WCFExtrasPlus/WCFExtrasPlus.csproj" verbose="true">
<arg value="/p:Configuration=ReleaseNet35" />
<arg value="/t:Rebuild" />
<arg value="/p:OutputPath=${build.dir}/net35" />
</msbuild>
<echo message="Target framework: 4.0"/>
<msbuild project="${source.dir}/WCFExtrasPlus/WCFExtrasPlus.csproj" verbose="true">
<arg value="/p:Configuration=ReleaseNet40" />
<arg value="/t:Rebuild" />
<arg value="/p:OutputPath=${build.dir}/net40" />
</msbuild>
<echo message="Target framework: 4.5"/>
<msbuild project="${source.dir}/WCFExtrasPlus/WCFExtrasPlus.csproj" verbose="true">
<arg value="/p:Configuration=Release" />
<arg value="/t:Rebuild" />
<arg value="/p:OutputPath=${build.dir}/net45" />
</msbuild>
</target>
<target name="pack-nuget">
<!-- Download nuget if it does not exist. -->
<get if="${not file::exists(nuget.exe)}"
src="http://nuget.org/nuget.exe"
dest="${nuget.exe}" />
<!-- Copy Release folder into NuGet folder -->
<echo message="Copying release files to NuGet directory" />
<copy todir="${project.dir}/NuGet/lib">
<fileset basedir="${build.dir}">
<include name="**/*.dll" />
</fileset>
</copy>
<!-- Set the nuget version from the DLL version -->
<property name="nuget.version" value="${version::get-major(assemblyname::get-version(assemblyname::get-assembly-name(build.dir + '\net45\WCFExtrasPlus.dll')))}.${version::get-minor(assemblyname::get-version(assemblyname::get-assembly-name(build.dir + '\net45\WCFExtrasPlus.dll')))}.${version::get-build(assemblyname::get-version(assemblyname::get-assembly-name(build.dir + '\net45\WCFExtrasPlus.dll')))}"/>
<echo message="Packing NuGet package version ${nuget.version}" />
<!-- Load release notes into the nuspec -->
<loadfile file="${releasenotes.file}" property="releasenotes" />
<xmlpoke
file="${nuget.spec.file}"
xpath="/package/metadata/releaseNotes"
value="${releasenotes}" />
<exec program="${nuget.exe}" commandline="pack ${nuget.spec.file} -Version ${nuget.version}" verbose="true" failonerror="true" />
</target>
<target name="zip-release">
<delete>
<fileset><include name="*.zip"/></fileset>
</delete>
<property name="wcfextrasplus.version" value="${assemblyname::get-version(assemblyname::get-assembly-name(build.dir + '\net45\WCFExtrasPlus.dll'))}"/>
<zip zipfile="WCFExtrasPlus${wcfextrasplus.version}.zip">
<fileset basedir="${build.dir}">
<include name="**/*" />
<exclude name="**/*.pdb" />
</fileset>
</zip>
</target>
<target name="zip-source">
<!--<delete>
<fileset>
<include name="*.zip"/>
</fileset>
</delete>-->
<property name="wcfextrasplus.version" value="${assemblyname::get-version(assemblyname::get-assembly-name(build.dir + '\WCFExtrasPlus.dll'))}"/>
<zip zipfile="WCFExtrasPlus${wcfextrasplus.version}.Source.zip">
<fileset basedir="${project.dir}">
<include name="Release/*"/>
<include name="Source/SampleClient/*"/>
<include name="Source/SampleClient/Properties/*"/>
<include name="Source/SampleClient/Web References/localhost/*"/>
<include name="Source/SampleServer/*"/>
<include name="Source/SampleServer/Properties/*"/>
<include name="Source/SampleWCFClient/*"/>
<include name="Source/SampleWCFClient/Properties/*"/>
<include name="Source/SampleWCFClient/Service References/SoapHeaders/*"/>
<include name="Source/SampleWCFClient/Service References/WsdlSample/*"/>
<include name="Source/WCFExtrasPlus/*"/>
<include name="Source/WCFExtrasPlus/Properties/*"/>
<include name="Source/WCFExtrasPlus/Soap/*.cs"/>
<include name="Source/WCFExtrasPlus/Utils/*.cs"/>
<include name="Source/WCFExtrasPlus/Wsdl/Documentation/*.cs"/>
<include name="Source/WCFExtrasPlus/Wsdl/*.cs"/>
<include name="Source/WCFExtrasPlus.Tests/*"/>
<include name="Source/WCFExtrasPlus.Tests/Properties/*"/>
<include name="Source/GlobalAssemblyInfo.cs"/>
<include name="Source/WCFExtrasPlus.sln"/>
</fileset>
</zip>
</target>
<target name="clean">
<delete dir="${build.dir}" />
</target>
</project>