forked from kylewest/DotNetShipping
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnant.build
113 lines (100 loc) · 5.21 KB
/
nant.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
<?xml version="1.0" encoding="utf-8"?>
<project name="DotNetShipping" default="build" xmlns="http://nant.sourceforge.net/release/0.92/nant.xsd">
<property name="quote" value='"' />
<!-- directories, solutions and projects -->
<property name="solution.dir" value="src" />
<property name="project.dir" value="src/${project::get-name()}/" />
<property name="solution.file" value="${solution.dir}/${project::get-name()}.sln" />
<property name="msbuild.dir" value="C:\Windows\Microsoft.NET\Framework\v4.0.30319\" dynamic="true" />
<property name="nuget.dir" value="C:\NuGet\" dynamic="true" />
<if test="${directory::exists('C:\Windows\Microsoft.NET\Framework64\v4.0.30319\')}">
<property name="msbuild.dir" value="C:\Windows\Microsoft.NET\Framework64\v4.0.30319\" dynamic="true" />
</if>
<!-- versioning -->
<property name="company.name" value="Kyle West" />
<property name="assembly.description" value="UPS, FedEx, USPS shipping rate calculators for .NET" />
<property name="version.major" value="0" />
<property name="version.minor" value="8" />
<property name="version.build" value="2" />
<property name="version.revision" value="0" />
<property name="project.fullversion" value="${version.major}.${version.minor}.${version.build}.${version.revision}" dynamic="true" />
<!-- default configuration -->
<property name="project.config" value="debug" />
<target name="build" depends="init, version, assemblyinfo, compile" />
<target name="pack">
<property name="project.config" value="release" />
<call target="build" />
<call target="nuget-pack" />
</target>
<target name="push" depends="pack, nuget-push" />
<!-- init -->
<target name="init" description="Initializes build properties">
<tstamp>
<formatter property="datetime.buildtime" pattern="yyyy-MM-dd, HH:mm:ss" />
</tstamp>
<echo message="Current Directory: ${project::get-base-directory()}" />
</target>
<!-- version -->
<target name="version" depends="init" description="mark AssemblyInfo builds with the build number">
<if test="${property::exists('env.BUILD_NUMBER')}">
<property name="version.build" value="${env.BUILD_NUMBER}" />
<echo message="VERSION BUILD DETECTED ${version.build}" />
</if>
<echo message="VERSION REVISION DETECTED ${version.revision}" />
</target>
<!-- assemblyinfo -->
<target name="assemblyinfo" depends="init, version">
<echo message="MARKING THIS BUILD AS VERSION ${project.fullversion}" />
<delete file="${solution.dir}/AssemblyInfo.cs" failonerror="false" />
<asminfo output="${solution.dir}/AssemblyInfo.cs" language="CSharp">
<imports>
<import namespace="System" />
<import namespace="System.Reflection" />
<import namespace="System.Runtime.InteropServices" />
</imports>
<attributes>
<attribute type="AssemblyTitle" value="${quote}${project::get-name()}${quote}" asis="true" />
<attribute type="AssemblyDescription" value="${quote}${assembly.description}${quote}" asis="true" />
<attribute type="AssemblyConfiguration" value="${quote}${quote}" asis="true" />
<attribute type="AssemblyCompany" value="${quote}${company.name}${quote}" asis="true" />
<attribute type="AssemblyProduct" value="${quote}${project::get-name()}${quote}" asis="true" />
<attribute type="AssemblyCopyright" value="${quote}Copyright (c) ${datetime::get-year(datetime::now())} ${company.name}${quote}" asis="true" />
<attribute type="AssemblyTrademark" value="${quote}${quote}" asis="true" />
<attribute type="AssemblyCulture" value="${quote}${quote}" asis="true" />
<attribute type="ComVisible" value="false" asis="true" />
<attribute type="AssemblyVersion" value="${quote}${project.fullversion}${quote}" asis="true" />
<attribute type="AssemblyFileVersion" value="${quote}${project.fullversion}${quote}" asis="true" />
</attributes>
<references>
<include name="System.dll" />
</references>
</asminfo>
</target>
<!-- compile -->
<target name="compile" depends="assemblyinfo">
<echo message="Build Directory is ${directory::get-current-directory()}" />
<echo message="MSBuild is ${msbuild.dir}" />
<exec program="${msbuild.dir}\MSBuild.exe" basedir="${directory::get-current-directory()}" >
<arg value="${directory::get-current-directory()}\${solution.file}" />
<arg value="/property:Configuration=${project.config}" />
<arg value="/t:Rebuild" />
</exec>
</target>
<!-- nuget-pack -->
<target name="nuget-pack">
<echo message="Pack Directory is ${project.dir}" />
<echo message="NuGet is ${nuget.dir}" />
<exec program="${nuget.dir}\NuGet.exe" workingdir="${project.dir}" >
<arg value="pack" />
</exec>
</target>
<!-- nuget-pack -->
<target name="nuget-push">
<echo message="Pack Directory is ${project.dir}" />
<echo message="NuGet is ${nuget.dir}" />
<exec program="${nuget.dir}\NuGet.exe" workingdir="${project.dir}" >
<arg value="push" />
<arg value="${project::get-name()}.${project.fullversion}.nupkg" />
</exec>
</target>
</project>