forked from spring-attic/spring-net-vsnet
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Spring.VisualStudio.build
200 lines (171 loc) · 10.5 KB
/
Spring.VisualStudio.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
<?xml version="1.0" ?>
<project name="Spring.VisualStudio" default="build" xmlns="http://nant.sf.net/release/0.91-alpha2/nant.xsd">
<property name="datetime.now" value="${datetime::now()}" />
<property name="product.name" value="Spring.NET Visual Studio 2010 Extension" />
<property name="product.company" value="SpringSource" />
<property name="product.copyright" value="Copyright 2004-${datetime::get-year(datetime.now)} ${product.company}" />
<property name="product.url" value="http://www.springframework.net/" />
<property name="product.description" value="An extension with intellisence assistance in authoring Spring XML configuration files in VS.NET 2010" />
<property name="product.version" value="1.0.2" />
<!-- Update ${product.code} when ${product.version} changes -->
<property name="product.code" value="e7fe8e5b-9889-40af-b3f2-219742f5cc2c" />
<!-- alpha / beta# / rc# -->
<property name="product.releasetype" value="" />
<property name="product.fullname" value="${product.name} ${product.version}" if="${(product.releasetype == '')}" />
<property name="product.fullname" value="${product.name} ${product.version} (${product.releasetype})" if="${(product.releasetype != '')}" />
<property name="project.buildnumber" value="${math::abs(math::floor(timespan::get-total-days(datetime::now() - datetime::parse('01/01/2010'))))}" />
<property name="project.version" value="${product.version}.${project.buildnumber}" overwrite="false" />
<property name="project.buildconfiguration" value="Debug" />
<property name="project.buildtype" value="dev" />
<readregistry property="net40.install.dir" key="SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full\InstallPath" hive="LocalMachine" failonerror="true" />
<property name="msbuild.exe" value="${net40.install.dir}\msbuild.exe" />
<property name="root.dir" value="${project::get-base-directory()}" />
<property name="build.dir" value="${root.dir}/build" />
<property name="package.dir" value="${root.dir}/package" />
<property name="doc.dir" value="${root.dir}/doc" />
<property name="setup.dir" value="${root.dir}/setup" />
<!-- MAIN TARGETS -->
<target name="build">
<echo message="Current .NET Framework = ${nant.settings.currentframework}" />
<copy file="${root.dir}\src\CommonAssemblyInfo.cs" tofile="${root.dir}\src\CommonAssemblyInfo.cs.temp" />
<call target="update-common-assemblyinfo" />
<call target="update-vsix-manifest" />
<call target="compile" />
<copy file="${root.dir}\src\CommonAssemblyInfo.cs.temp" tofile="${root.dir}\src\CommonAssemblyInfo.cs" overwrite="true" />
<delete file="${root.dir}\src\CommonAssemblyInfo.cs.temp" />
</target>
<target name="daily">
<property name="project.buildconfiguration" value="Release" />
<property name="project.buildtype" value="daily" />
<property name="product.fullname" value="${product.name} (Daily build from ${datetime::get-month(datetime.now)}/${datetime::get-day(datetime.now)}/${datetime::get-year(datetime.now)})" />
<property name="project.msi-filename" value="Spring.VisualStudio-${datetime::get-year(datetime.now)}${string::pad-left(datetime::get-month(datetime.now), 2, '0')}${string::pad-left(datetime::get-day(datetime.now), 2, '0')}-${string::pad-left(datetime::get-hour(datetime.now), 2, '0')}${string::pad-left(datetime::get-minute(datetime.now), 2, '0')}.msi" />
<property name="project.zip-filename" value="Spring.VisualStudio-${datetime::get-year(datetime.now)}${string::pad-left(datetime::get-month(datetime.now), 2, '0')}${string::pad-left(datetime::get-day(datetime.now), 2, '0')}-${string::pad-left(datetime::get-hour(datetime.now), 2, '0')}${string::pad-left(datetime::get-minute(datetime.now), 2, '0')}.zip" />
<call target="package-zip"/>
</target>
<target name="release">
<property name="project.buildconfiguration" value="Release" />
<property name="project.buildtype" value="release" />
<property name="project.msi-filename" value="Spring.VisualStudio-${product.version}.msi" if="${(product.releasetype == '')}" />
<property name="project.msi-filename" value="Spring.VisualStudio-${product.version}-${product.releasetype}.msi" if="${(product.releasetype != '')}" />
<property name="project.zip-filename" value="Spring.VisualStudio-${product.version}.zip" if="${(product.releasetype == '')}" />
<property name="project.zip-filename" value="Spring.VisualStudio-${product.version}-${product.releasetype}.zip" if="${(product.releasetype != '')}" />
<call target="package-zip"/>
</target>
<!-- TARGETS -->
<target name="update-common-assemblyinfo">
<echo message="Generating common AssemblyInfo file..." />
<!-- ensure src/CommonAssemblyInfo.cs is writable if it already exists -->
<attrib file="${root.dir}/src/CommonAssemblyInfo.cs" readonly="false" if="${file::exists('${root.dir}/src/CommonAssemblyInfo.cs')}" />
<!-- generate the source file holding the common assembly-level attributes -->
<asminfo output="${root.dir}/src/CommonAssemblyInfo.cs" language="CSharp">
<imports>
<import namespace="System" />
<import namespace="System.Reflection" />
<import namespace="System.Runtime.InteropServices" />
</imports>
<attributes>
<attribute type="CLSCompliantAttribute" value="false" />
<attribute type="ComVisibleAttribute" value="false" />
<attribute type="AssemblyProductAttribute" value="${product.fullname}" />
<attribute type="AssemblyCompanyAttribute" value="${product.url}" />
<attribute type="AssemblyCopyrightAttribute" value="${product.copyright}" />
<attribute type="AssemblyTrademarkAttribute" value="Apache License, Version 2.0" />
<attribute type="AssemblyCultureAttribute" value="" />
<attribute type="AssemblyVersionAttribute" value="${project.version}" />
<attribute type="AssemblyConfigurationAttribute" value="${project.buildtype}" />
<attribute type="AssemblyInformationalVersionAttribute" value="${project.version}; ${project.buildtype}" />
</attributes>
</asminfo>
</target>
<target name="update-vsix-manifest">
<echo message="Updating VSIX manifest file..." />
<xmlpoke file="${root.dir}\src\Spring.VisualStudio\source.extension.vsixmanifest" xpath="/n:Vsix/n:Identifier/n:Name" value="${product.name}">
<namespaces>
<namespace prefix="n" uri="http://schemas.microsoft.com/developer/vsx-schema/2010" />
</namespaces>
</xmlpoke>
<xmlpoke file="${root.dir}\src\Spring.VisualStudio\source.extension.vsixmanifest" xpath="/n:Vsix/n:Identifier/n:Version" value="${product.version}">
<namespaces>
<namespace prefix="n" uri="http://schemas.microsoft.com/developer/vsx-schema/2010" />
</namespaces>
</xmlpoke>
<xmlpoke file="${root.dir}\src\Spring.VisualStudio\source.extension.vsixmanifest" xpath="/n:Vsix/n:Identifier/n:Description" value="${product.description}">
<namespaces>
<namespace prefix="n" uri="http://schemas.microsoft.com/developer/vsx-schema/2010" />
</namespaces>
</xmlpoke>
</target>
<target name="compile">
<echo message="Building source solution" />
<exec program="${msbuild.exe}">
<arg value="${root.dir}\Spring.VisualStudio.sln" />
<arg line="/nologo" />
<arg line="/target:Rebuild" />
<arg line="/verbosity:minimal" />
<arg line="/property:Configuration=${project.buildconfiguration}" />
</exec>
</target>
<target name="setup" depends="compile">
<echo message="Building setup WiX project" />
<exec program="${msbuild.exe}">
<arg value="${setup.dir}\src\Spring.VisualStudio.wixproj" />
<arg line="/nologo" />
<arg line="/target:Rebuild" />
<arg line="/verbosity:minimal" />
<arg line="/property:Configuration=${project.buildconfiguration}" />
<arg line='/property:NAntRootPath="${root.dir}"' />
<arg line="/property:NAntProductCode=${product.code}" />
<arg line="/property:NAntProductVersion=${product.version}" />
<arg line='/property:NAntProductName="${product.name}"' />
<arg line='/property:NAntProductFullName="${product.fullname}"' />
<arg line='/property:NAntProductDescription="${product.description}"' />
<arg line='/property:NAntProductCompany="${product.company}"' />
<arg line='/property:NAntProductUrl="${product.url}"' />
</exec>
</target>
<target name="doc">
<echo message="Generating documentation" />
<nant buildfile="${doc.dir}/reference/docbook.build" target="all" />
</target>
<target name="package" description="Builds all modules and documentation">
<!-- clean package dir -->
<delete dir="${package.dir}" failonerror="true" />
<!-- build and copy setup file -->
<call target="package.setup" cascade="false" />
<!-- copy reference docs -->
<call target="package.doc" cascade="false" />
<!-- copy over readme etc. -->
<copy todir="${package.dir}" file="${root.dir}/readme.txt" />
<copy todir="${package.dir}" file="${root.dir}/license.txt" />
<copy todir="${package.dir}" file="${root.dir}/changelog.txt" />
</target>
<target name="package.setup" depends="build">
<call target="setup" cascade="false" />
<if test="${not property::exists('project.msi-filename')}">
<fail message="The MSI file name has not been specified (property 'project.msi-filename')."/>
</if>
<echo message="Copying setup file" />
<copy file="${setup.dir}/src/bin/${project.buildconfiguration}/Spring.VisualStudio.msi" tofile="${package.dir}/${project.msi-filename}" verbose="true" />
</target>
<target name="package.doc">
<call target="doc" cascade="false" />
<echo message="Copying documentation files" />
<copy todir="${package.dir}/doc/reference/">
<fileset basedir="${doc.dir}/reference/target/">
<include name="**/*" />
</fileset>
</copy>
</target>
<target name="package-zip" depends="package" description="Build Package distribution as .zip file">
<if test="${not property::exists('project.zip-filename')}">
<fail message="The ZIP file name has not been specified (property 'project.zip-filename')."/>
</if>
<echo message="Zipping package..." />
<zip zipfile="${package.dir}/${project.zip-filename}">
<fileset basedir="${package.dir}">
<include name="**/*" />
<exclude name="*.zip" />
</fileset>
</zip>
</target>
</project>