-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathEngageLocator.Build
260 lines (243 loc) · 12.7 KB
/
EngageLocator.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
249
250
251
252
253
254
255
256
257
258
259
260
<?xml version="1.0" encoding="utf-8" ?>
<project xmlns="http://nant.sf.net/release/0.92/nant.xsd" name="Engage Build Script" basedir="." default="package">
<property name="projectName" value="Locator"/>
<property name="versions" value="4,5"/>
<property name="licenses" value="Free"/>
<property name="packageFileNameTemplate" value="${projectName}_${projectVersion}_${packageType}_DNN${dnnVersion}" dynamic="true"/>
<property name="createSourcePackage" value="true"/>
<property name="sourcePackageLicenseName" value="Free"/>
<property name="combineSourceWithInstallPackage" value="false"/>
<property name="projectDllName" value="Engage${projectName}.dll" />
<property name="solutionFile" value="Engage${projectName}.sln"/>
<property name="binDirectory" value="..\..\bin" overwrite="false"/>
<!-- binDirectory is readonly if set from the command line (i.e. during Team Build CI) -->
<property name="currentBinDirectory" value="${binDirectory}"/>
<property name="projectDll" value="${binDirectory}\${projectDllName}"/>
<patternset id="projectAssemblies">
<include name="${projectDll}"/>
<include name="${binDirectory}\LumenWorks.Framework.IO.dll"/>
</patternset>
<property name="testBuild" value="true" overwrite="false"/>
<!-- testBuild is true if building from Visual Studio, false from Team Build (CI) -->
<property name="projectConfig" value="release"/>
<property name="projectConfig" value="Debug" if="${testBuild}"/>
<property name="zipLevel" value="9"/>
<property name="zipLevel" value="1" if="${testBuild}"/>
<property name="referencesDirectory" value="References"/>
<property name="packageDirectory" value="package"/>
<property name="packageName" value="Resources.zip"/>
<target name="package" description="Creates packages for this module, one for each value in the licenses and versions properties">
<call target="build"/>
<property name="assemblyFile" value="${projectDll}"/>
<call target="set-assemblyVersion"/>
<property name="projectVersion" value="${assemblyVersion}"/>
<call target="clean-package-folder"/>
<call target="setup-package-files"/>
<call target="create-resources-zip"/>
<property name="includeSource" value="false"/>
<foreach item="String" in="${licenses}" delim="," property="packageLicense">
<call target="create-packages"/>
</foreach>
<if test="${createSourcePackage}">
<property name="includeSource" value="true"/>
<property name="packageLicense" value="${sourcePackageLicenseName}"/>
<call target="add-sources-to-resource-zip"/>
<call target="create-packages"/>
<if test="${combineSourceWithInstallPackage}">
<foreach item="String" in="${versions}" delim="," property="dnnVersion">
<call target="combine-source"/>
</foreach>
</if>
</if>
<call target="cleanup"/>
</target>
<target name="set-assemblyVersion" description="Sets the assemblyVersion property to the first three numbers from the version of the assembly specified by the assemblyFile property">
<property name="version" value="${fileversioninfo::get-file-version(fileversioninfo::get-version-info(assemblyFile))}" />
<property name="assemblyVersion" value="${string::substring(version,0,string::last-index-of(version,'.'))}" />
</target>
<target name="build" description="Builds solutionFile">
<exec program="${framework::get-framework-directory(framework::get-target-framework())}\msbuild.exe" failonerror="true">
<arg value="${solutionFile}" />
<arg value="/p:Configuration=${projectConfig}" />
<arg value="/p:Platform="Any CPU"" />
<arg value="/p:OutputPath="${currentBinDirectory}"" />
<arg value="/m" /> <!-- multicore -->
</exec>
</target>
<target name="clean-package-folder" description="Deletes all temporary files from package directory, then re-creates the folders to use">
<mkdir dir="${packageDirectory}" failonerror="false"/>
<delete dir="${packageDirectory}/temp/resources" failonerror="false"/>
<delete dir="${packageDirectory}/temp" failonerror="false"/>
<mkdir dir="${packageDirectory}/temp" failonerror="false" />
<mkdir dir="${packageDirectory}/temp/resources" failonerror="false" />
<mkdir dir="${packageDirectory}/temp/package" failonerror="false"/>
</target>
<target name="setup-package-files" description="Copies common package files to the temp/package directory, and sets version-dependent attributes in the DNN 4 and DNN 5 manifest files">
<property name="releaseNotesFile" value="ReleaseNotes_${projectVersion}.htm"/>
<copy todir="${packageDirectory}/temp/package" flatten="true">
<fileset>
<include name="${releaseNotesFile}"/>
<include name="??.??.??.txt" />
<include name="ReadMe.txt" />
<include name="**/*.SqlDataProvider"/>
<include name="**/*.4.dnn"/>
<include name="**/*.5.dnn"/>
</fileset>
</copy>
<copy todir="${packageDirectory}/temp/package/bin" flatten="true">
<fileset>
<patternset refid="projectAssemblies" />
<include name="${referencesDirectory}/**/*.dll"/>
<exclude name="${referencesDirectory}/DotNetNuke.dll"/>
<exclude name="${referencesDirectory}/DotNetNuke.WebUtility.dll"/>
<exclude name="${referencesDirectory}/Microsoft.ApplicationBlocks.Data.dll"/>
<exclude name="${referencesDirectory}/System.Web.Extensions.dll"/>
<exclude name="${referencesDirectory}/*.Design.dll"/>
<exclude name="${referencesDirectory}/Telerik.Web.UI.dll"/>
</fileset>
</copy>
<attrib readonly="false">
<fileset basedir="${packageDirectory}/temp/package">
<include name="**"/>
</fileset>
</attrib>
<if test="${file::exists(packageDirectory + '/temp/package/Engage' + projectName + '.5.dnn')}">
<xmlpoke file="${packageDirectory}/temp/package/Engage${projectName}.5.dnn" value="${releaseNotesFile}" xpath="dotnetnuke/packages/package/releaseNotes/@src" failonerror="false" />
<xmlpoke file="${packageDirectory}/temp/package/Engage${projectName}.5.dnn" value="${projectVersion}" xpath="dotnetnuke/packages/package/@version" failonerror="false" />
<xmlpoke file="${packageDirectory}/temp/package/Engage${projectName}.5.dnn" value="${projectVersion}" xpath="//*[@latestVersion='latestVersion']" failonerror="false" />
<foreach item="File" in="${packageDirectory}/temp/package/bin" property="assemblyFile">
<call target="set-assemblyVersion"/>
<xmlpoke file="${packageDirectory}/temp/package/Engage${projectName}.5.dnn" value="${assemblyVersion}" xpath="dotnetnuke/packages/package/components/component[@type='Assembly']/assemblies/assembly[name='${path::get-file-name(assemblyFile)}']/version" failonerror="false" />
</foreach>
</if>
<if test="${file::exists(packageDirectory + '/temp/package/Engage' + projectName + '.4.dnn')}">
<xmlpoke file="${packageDirectory}/temp/package/Engage${projectName}.4.dnn" value="${projectVersion}" xpath="//*[@latestVersion='latestVersion']" failonerror="false" />
</if>
</target>
<target name="create-resources-zip" description="Creates the Resources.zip file for content (Install package) files">
<copy todir="${packageDirectory}/temp/resources" flatten="false">
<fileset>
<patternset refid="content.fileset"/>
<exclude name="${packageDirectory}/**"/>
</fileset>
</copy>
<zip zipfile="${packageDirectory}/temp/package/${packageName}" ziplevel="${zipLevel}">
<fileset basedir="${packageDirectory}/temp/resources">
<include name="**/*"/>
</fileset>
</zip>
</target>
<target name="create-packages" description="For the given license and type, creates packages for DNN 4 and DNN 5">
<property name="licenseFile" value="EULA-${packageLicense}"/>
<call target="switch-license"/>
<foreach item="String" in="${versions}" delim="," property="dnnVersion">
<call target="zip-package"/>
</foreach>
</target>
<target name="switch-license" description="Switches out the license file and updates the reference to it in the DNN 5 manifest file">
<delete>
<fileset>
<include name="${packageDirectory}/temp/package/EULA-*"/>
</fileset>
</delete>
<copy todir="${packageDirectory}/temp/package" flatten="true">
<fileset>
<include name="Licenses/${licenseFile}.*"/>
</fileset>
</copy>
<if test="${file::exists(packageDirectory + '/temp/package/Engage' + projectName + '.5.dnn')}">
<xmlpoke file="${packageDirectory}/temp/package/Engage${projectName}.5.dnn" value="${licenseFile}.htm" xpath="dotnetnuke/packages/package/license/@src" failonerror="false" />
</if>
</target>
<target name="zip-package" description="Zips up the files in the temp/package directory, getting the correct manifest file and using the correct naming convention">
<property name="packageType" value="Install"/>
<property name="packageType" value="Source" if="${includeSource}"/>
<zip zipfile="${packageDirectory}/${packageFileNameTemplate}.zip">
<fileset basedir="${packageDirectory}/temp/package">
<include name="**/*"/>
<exclude name="**/*.4.dnn" if="${dnnVersion!='4'}"/>
<exclude name="**/*.5.dnn" if="${dnnVersion!='5'}"/>
</fileset>
</zip>
</target>
<target name="add-sources-to-resource-zip" description="Adds the files for the Source package to the Resources.zip file">
<copy todir="${packageDirectory}/temp/resources" flatten="false">
<fileset>
<patternset refid="source.fileset"/>
<exclude name="${packageDirectory}/**"/>
</fileset>
</copy>
<zip zipfile="${packageDirectory}/temp/package/${packageName}" ziplevel="${zipLevel}">
<fileset basedir="${packageDirectory}/temp/resources">
<include name="**/*"/>
</fileset>
</zip>
</target>
<target name="combine-source" description="Combines the Install and Source packages with the same license into one .zip file">
<property name="packageType" value="Install"/>
<property name="installPackageFileName" value="${packageFileNameTemplate}"/>
<property name="packageType" value="Source"/>
<property name="sourcePackageFileName" value="${packageFileNameTemplate}"/>
<zip zipfile="${packageDirectory}/${projectName}_${projectVersion}.zip">
<fileset basedir="${packageDirectory}">
<include name="${installPackageFileName}.zip"/>
<include name="${sourcePackageFileName}.zip"/>
</fileset>
</zip>
<delete file="${packageDirectory}/${installPackageFileName}.zip" failonerror="false"/>
<delete file="${packageDirectory}/${sourcePackageFileName}.zip" failonerror="false"/>
</target>
<target name="cleanup" description="Deletes temporary files">
<delete file="${packageDirectory}\${packageName}" failonerror="false"/>
<delete dir="${packageDirectory}\temp" failonerror="false"/>
</target>
<patternset id="content.fileset">
<include name="**/*.ascx" />
<include name="**/*.aspx" />
<include name="**/*.asmx" />
<include name="**/*.resx" />
<include name="**/*.html" />
<include name="**/*.htm" />
<include name="**/*.css" />
<include name="**/*.jpg" />
<include name="**/*.gif" />
<include name="**/*.png" />
<include name="**/*.pdf" />
<include name="**/*.xml" />
<include name="**/*.xsd" />
<include name="Docs/**" />
<exclude name="Licenses/EULA-*"/>
<exclude name="ReleaseNotes_*.htm"/>
<exclude name="??.??.??.txt" />
<exclude name="_ReSharper.*/**"/>
<exclude name="**/obj/**"/>
<exclude name="CsvReader/**"/>
<exclude name="${referencesDirectory}/**"/>
<exclude name="**/bin/**"/>
</patternset>
<patternset id="source.fileset">
<include name="**/*.js"/>
<include name="**/*.cs"/>
<include name="**/*.vb"/>
<include name="**/*.sln"/>
<include name="**/*.csproj"/>
<include name="**/*.vbproj"/>
<include name="**/*.build"/>
<include name="**/*.dnn"/>
<include name="**/*.docx"/>
<include name="**/*.config"/>
<include name="**/*.dbml"/>
<include name="**/*.dbml.layout"/>
<include name="**/*.rpx"/>
<include name="**/*.txt"/>
<include name="Licenses/EULA-*"/>
<include name="ReleaseNotes_*.htm"/>
<include name="??.??.??.txt" />
<include name="MSBuild/*.dll"/>
<include name="MSBuild/*.targets"/>
<exclude name="**/obj/**"/>
<exclude name="**/bin/**"/>
<exclude name="**/TeamProjectConfig/**"/>
<exclude name="Release.txt" />
</patternset>
</project>