diff options
Diffstat (limited to 'src/WixToolset.Core/Binder.cs')
-rw-r--r-- | src/WixToolset.Core/Binder.cs | 389 |
1 files changed, 256 insertions, 133 deletions
diff --git a/src/WixToolset.Core/Binder.cs b/src/WixToolset.Core/Binder.cs index 18ad2d62..43c15634 100644 --- a/src/WixToolset.Core/Binder.cs +++ b/src/WixToolset.Core/Binder.cs | |||
@@ -1,6 +1,6 @@ | |||
1 | // Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. | 1 | // Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. |
2 | 2 | ||
3 | namespace WixToolset | 3 | namespace WixToolset.Core |
4 | { | 4 | { |
5 | using System; | 5 | using System; |
6 | using System.Collections; | 6 | using System.Collections; |
@@ -11,105 +11,72 @@ namespace WixToolset | |||
11 | using System.Linq; | 11 | using System.Linq; |
12 | using System.Reflection; | 12 | using System.Reflection; |
13 | using WixToolset.Bind; | 13 | using WixToolset.Bind; |
14 | using WixToolset.Core.Bind; | ||
14 | using WixToolset.Data; | 15 | using WixToolset.Data; |
16 | using WixToolset.Data.Bind; | ||
15 | using WixToolset.Data.Rows; | 17 | using WixToolset.Data.Rows; |
16 | using WixToolset.Extensibility; | 18 | using WixToolset.Extensibility; |
17 | using WixToolset.Msi; | ||
18 | |||
19 | // TODO: (4.0) Refactor so that these don't need to be copied. | ||
20 | // Copied verbatim from ext\UtilExtension\wixext\UtilCompiler.cs | ||
21 | [Flags] | ||
22 | internal enum WixFileSearchAttributes | ||
23 | { | ||
24 | Default = 0x001, | ||
25 | MinVersionInclusive = 0x002, | ||
26 | MaxVersionInclusive = 0x004, | ||
27 | MinSizeInclusive = 0x008, | ||
28 | MaxSizeInclusive = 0x010, | ||
29 | MinDateInclusive = 0x020, | ||
30 | MaxDateInclusive = 0x040, | ||
31 | WantVersion = 0x080, | ||
32 | WantExists = 0x100, | ||
33 | IsDirectory = 0x200, | ||
34 | } | ||
35 | |||
36 | [Flags] | ||
37 | internal enum WixRegistrySearchAttributes | ||
38 | { | ||
39 | Raw = 0x01, | ||
40 | Compatible = 0x02, | ||
41 | ExpandEnvironmentVariables = 0x04, | ||
42 | WantValue = 0x08, | ||
43 | WantExists = 0x10, | ||
44 | Win64 = 0x20, | ||
45 | } | ||
46 | |||
47 | internal enum WixComponentSearchAttributes | ||
48 | { | ||
49 | KeyPath = 0x1, | ||
50 | State = 0x2, | ||
51 | WantDirectory = 0x4, | ||
52 | } | ||
53 | |||
54 | [Flags] | ||
55 | internal enum WixProductSearchAttributes | ||
56 | { | ||
57 | Version = 0x1, | ||
58 | Language = 0x2, | ||
59 | State = 0x4, | ||
60 | Assignment = 0x8, | ||
61 | UpgradeCode = 0x10, | ||
62 | } | ||
63 | 19 | ||
64 | /// <summary> | 20 | /// <summary> |
65 | /// Binder of the WiX toolset. | 21 | /// Binder of the WiX toolset. |
66 | /// </summary> | 22 | /// </summary> |
67 | public sealed class Binder | 23 | public sealed class Binder |
68 | { | 24 | { |
69 | private BinderCore core; | 25 | //private BinderCore core; |
70 | private BinderFileManagerCore fileManagerCore; | 26 | //private List<IBinderExtension> extensions; |
71 | private List<IBinderExtension> extensions; | 27 | //private List<IBinderFileManager> fileManagers; |
72 | private List<IBinderFileManager> fileManagers; | ||
73 | private List<InspectorExtension> inspectorExtensions; | ||
74 | 28 | ||
75 | public Binder() | 29 | public Binder() |
76 | { | 30 | { |
77 | this.DefaultCompressionLevel = CompressionLevel.High; | 31 | //this.DefaultCompressionLevel = CompressionLevel.High; |
78 | 32 | ||
79 | this.BindPaths = new List<BindPath>(); | 33 | //this.BindPaths = new List<BindPath>(); |
80 | this.TargetBindPaths = new List<BindPath>(); | 34 | //this.TargetBindPaths = new List<BindPath>(); |
81 | this.UpdatedBindPaths = new List<BindPath>(); | 35 | //this.UpdatedBindPaths = new List<BindPath>(); |
82 | 36 | ||
83 | this.extensions = new List<IBinderExtension>(); | 37 | //this.extensions = new List<IBinderExtension>(); |
84 | this.fileManagers = new List<IBinderFileManager>(); | 38 | //this.fileManagers = new List<IBinderFileManager>(); |
85 | this.inspectorExtensions = new List<InspectorExtension>(); | 39 | //this.inspectorExtensions = new List<InspectorExtension>(); |
86 | 40 | ||
87 | this.Ices = new List<string>(); | 41 | //this.Ices = new List<string>(); |
88 | this.SuppressIces = new List<string>(); | 42 | //this.SuppressIces = new List<string>(); |
89 | } | 43 | } |
90 | 44 | ||
91 | public string ContentsFile { private get; set; } | 45 | public Binder(BindContext context) |
46 | { | ||
47 | this.Context = context; | ||
48 | |||
49 | this.TableDefinitions = WindowsInstallerStandard.GetTableDefinitions(); | ||
50 | } | ||
51 | |||
52 | private BindContext Context { get; } | ||
53 | |||
54 | private TableDefinitionCollection TableDefinitions { get; } | ||
55 | |||
56 | //public IEnumerable<IBackendFactory> BackendFactories { get; set; } | ||
92 | 57 | ||
93 | public string OutputsFile { private get; set; } | 58 | //public string ContentsFile { private get; set; } |
94 | 59 | ||
95 | public string BuiltOutputsFile { private get; set; } | 60 | //public string OutputsFile { private get; set; } |
96 | 61 | ||
97 | public string WixprojectFile { private get; set; } | 62 | //public string BuiltOutputsFile { private get; set; } |
63 | |||
64 | //public string WixprojectFile { private get; set; } | ||
98 | 65 | ||
99 | /// <summary> | 66 | /// <summary> |
100 | /// Gets the list of bindpaths. | 67 | /// Gets the list of bindpaths. |
101 | /// </summary> | 68 | /// </summary> |
102 | public List<BindPath> BindPaths { get; private set; } | 69 | //public List<BindPath> BindPaths { get; private set; } |
103 | 70 | ||
104 | /// <summary> | 71 | /// <summary> |
105 | /// Gets the list of target bindpaths. | 72 | /// Gets the list of target bindpaths. |
106 | /// </summary> | 73 | /// </summary> |
107 | public List<BindPath> TargetBindPaths { get; private set; } | 74 | //public List<BindPath> TargetBindPaths { get; private set; } |
108 | 75 | ||
109 | /// <summary> | 76 | /// <summary> |
110 | /// Gets the list of updated bindpaths. | 77 | /// Gets the list of updated bindpaths. |
111 | /// </summary> | 78 | /// </summary> |
112 | public List<BindPath> UpdatedBindPaths { get; private set; } | 79 | //public List<BindPath> UpdatedBindPaths { get; private set; } |
113 | 80 | ||
114 | /// <summary> | 81 | /// <summary> |
115 | /// Gets or sets the option to enable building binary delta patches. | 82 | /// Gets or sets the option to enable building binary delta patches. |
@@ -132,17 +99,17 @@ namespace WixToolset | |||
132 | /// Gets or sets the default compression level to use for cabinets | 99 | /// Gets or sets the default compression level to use for cabinets |
133 | /// that don't have their compression level explicitly set. | 100 | /// that don't have their compression level explicitly set. |
134 | /// </summary> | 101 | /// </summary> |
135 | public CompressionLevel DefaultCompressionLevel { get; set; } | 102 | //public CompressionLevel DefaultCompressionLevel { get; set; } |
136 | 103 | ||
137 | /// <summary> | 104 | /// <summary> |
138 | /// Gets and sets the location to save the WixPdb. | 105 | /// Gets and sets the location to save the WixPdb. |
139 | /// </summary> | 106 | /// </summary> |
140 | /// <value>The location in which to save the WixPdb. Null if the the WixPdb should not be output.</value> | 107 | /// <value>The location in which to save the WixPdb. Null if the the WixPdb should not be output.</value> |
141 | public string PdbFile { get; set; } | 108 | //public string PdbFile { get; set; } |
142 | 109 | ||
143 | public List<string> Ices { get; private set; } | 110 | //public List<string> Ices { get; private set; } |
144 | 111 | ||
145 | public List<string> SuppressIces { get; private set; } | 112 | //public List<string> SuppressIces { get; private set; } |
146 | 113 | ||
147 | /// <summary> | 114 | /// <summary> |
148 | /// Gets and sets the option to suppress resetting ACLs by the binder. | 115 | /// Gets and sets the option to suppress resetting ACLs by the binder. |
@@ -185,24 +152,164 @@ namespace WixToolset | |||
185 | /// Gets or sets the Wix variable resolver. | 152 | /// Gets or sets the Wix variable resolver. |
186 | /// </summary> | 153 | /// </summary> |
187 | /// <value>The Wix variable resolver.</value> | 154 | /// <value>The Wix variable resolver.</value> |
188 | public WixVariableResolver WixVariableResolver { get; set; } | 155 | internal WixVariableResolver WixVariableResolver { get; set; } |
189 | 156 | ||
190 | /// <summary> | 157 | /// <summary> |
191 | /// Add a binder extension. | 158 | /// Add a binder extension. |
192 | /// </summary> | 159 | /// </summary> |
193 | /// <param name="extension">New extension.</param> | 160 | /// <param name="extension">New extension.</param> |
194 | public void AddExtension(IBinderExtension extension) | 161 | //public void AddExtension(IBinderExtension extension) |
195 | { | 162 | //{ |
196 | this.extensions.Add(extension); | 163 | // this.extensions.Add(extension); |
197 | } | 164 | //} |
198 | 165 | ||
199 | /// <summary> | 166 | /// <summary> |
200 | /// Add a file manager extension. | 167 | /// Add a file manager extension. |
201 | /// </summary> | 168 | /// </summary> |
202 | /// <param name="extension">New file manager.</param> | 169 | /// <param name="extension">New file manager.</param> |
203 | public void AddExtension(IBinderFileManager extension) | 170 | //public void AddExtension(IBinderFileManager extension) |
171 | //{ | ||
172 | // this.fileManagers.Add(extension); | ||
173 | //} | ||
174 | |||
175 | public bool Bind() | ||
176 | { | ||
177 | //if (!String.IsNullOrEmpty(this.Context.FileManagerCore.CabCachePath)) | ||
178 | //{ | ||
179 | // Directory.CreateDirectory(this.Context.FileManagerCore.CabCachePath); | ||
180 | //} | ||
181 | |||
182 | //this.core = new BinderCore(); | ||
183 | //this.core.FileManagerCore = this.Context.FileManagerCore; | ||
184 | |||
185 | this.WriteBuildInfoTable(this.Context.IntermediateRepresentation, this.Context.OutputPath); | ||
186 | |||
187 | // Prebind. | ||
188 | // | ||
189 | this.Context.Extensions = this.Context.ExtensionManager.Create<IBinderExtension>(); | ||
190 | |||
191 | foreach (IBinderExtension extension in this.Context.Extensions) | ||
192 | { | ||
193 | extension.PreBind(this.Context); | ||
194 | } | ||
195 | |||
196 | // Resolve. | ||
197 | // | ||
198 | var resolveResult = this.Resolve(); | ||
199 | |||
200 | this.Context.DelayedFields = resolveResult.DelayedFields; | ||
201 | |||
202 | this.Context.ExpectedEmbeddedFiles = resolveResult.ExpectedEmbeddedFiles; | ||
203 | |||
204 | // Backend. | ||
205 | // | ||
206 | var bindResult = this.BackendBind(); | ||
207 | |||
208 | if (bindResult != null) | ||
209 | { | ||
210 | // Postbind. | ||
211 | // | ||
212 | foreach (IBinderExtension extension in this.Context.Extensions) | ||
213 | { | ||
214 | extension.PostBind(bindResult); | ||
215 | } | ||
216 | |||
217 | // Layout. | ||
218 | // | ||
219 | this.Layout(bindResult); | ||
220 | } | ||
221 | |||
222 | return Messaging.Instance.EncounteredError; | ||
223 | } | ||
224 | |||
225 | private ResolveResult Resolve() | ||
226 | { | ||
227 | var buildingPatch = (this.Context.IntermediateRepresentation.Type == OutputType.Patch); | ||
228 | |||
229 | var filesWithEmbeddedFiles = new ExtractEmbeddedFiles(); | ||
230 | |||
231 | IEnumerable<DelayedField> delayedFields; | ||
232 | { | ||
233 | var command = new ResolveFieldsCommand(); | ||
234 | command.BuildingPatch = buildingPatch; | ||
235 | command.BindVariableResolver = this.Context.WixVariableResolver; | ||
236 | command.BindPaths = this.Context.BindPaths; | ||
237 | command.Extensions = this.Context.Extensions; | ||
238 | command.FilesWithEmbeddedFiles = filesWithEmbeddedFiles; | ||
239 | command.IntermediateFolder = this.Context.IntermediateFolder; | ||
240 | command.Tables = this.Context.IntermediateRepresentation.Tables; | ||
241 | command.SupportDelayedResolution = true; | ||
242 | command.Execute(); | ||
243 | |||
244 | delayedFields = command.DelayedFields; | ||
245 | } | ||
246 | |||
247 | if (this.Context.IntermediateRepresentation.SubStorages != null) | ||
248 | { | ||
249 | foreach (SubStorage transform in this.Context.IntermediateRepresentation.SubStorages) | ||
250 | { | ||
251 | var command = new ResolveFieldsCommand(); | ||
252 | command.BuildingPatch = buildingPatch; | ||
253 | command.BindVariableResolver = this.Context.WixVariableResolver; | ||
254 | command.BindPaths = this.Context.BindPaths; | ||
255 | command.Extensions = this.Context.Extensions; | ||
256 | command.FilesWithEmbeddedFiles = filesWithEmbeddedFiles; | ||
257 | command.IntermediateFolder = this.Context.IntermediateFolder; | ||
258 | command.Tables = transform.Data.Tables; | ||
259 | command.SupportDelayedResolution = false; | ||
260 | command.Execute(); | ||
261 | } | ||
262 | } | ||
263 | |||
264 | var expectedEmbeddedFiles = filesWithEmbeddedFiles.GetExpectedEmbeddedFiles(); | ||
265 | |||
266 | return new ResolveResult | ||
267 | { | ||
268 | ExpectedEmbeddedFiles = expectedEmbeddedFiles, | ||
269 | DelayedFields = delayedFields, | ||
270 | }; | ||
271 | } | ||
272 | |||
273 | private BindResult BackendBind() | ||
274 | { | ||
275 | var backendFactories = this.Context.ExtensionManager.Create<IBackendFactory>(); | ||
276 | |||
277 | foreach (var factory in backendFactories) | ||
278 | { | ||
279 | if (factory.TryCreateBackend(this.Context.IntermediateRepresentation.Type.ToString(), this.Context.OutputPath, null, out var backend)) | ||
280 | { | ||
281 | var result = backend.Bind(this.Context); | ||
282 | return result; | ||
283 | } | ||
284 | } | ||
285 | |||
286 | // TODO: messaging that a backend could not be found to bind the output type? | ||
287 | |||
288 | return null; | ||
289 | } | ||
290 | private void Layout(BindResult result) | ||
204 | { | 291 | { |
205 | this.fileManagers.Add(extension); | 292 | try |
293 | { | ||
294 | this.LayoutMedia(result.FileTransfers); | ||
295 | } | ||
296 | finally | ||
297 | { | ||
298 | if (!String.IsNullOrEmpty(this.Context.ContentsFile) && result.ContentFilePaths != null) | ||
299 | { | ||
300 | this.CreateContentsFile(this.Context.ContentsFile, result.ContentFilePaths); | ||
301 | } | ||
302 | |||
303 | if (!String.IsNullOrEmpty(this.Context.OutputsFile) && result.FileTransfers != null) | ||
304 | { | ||
305 | this.CreateOutputsFile(this.Context.OutputsFile, result.FileTransfers, this.Context.OutputPdbPath); | ||
306 | } | ||
307 | |||
308 | if (!String.IsNullOrEmpty(this.Context.BuiltOutputsFile) && result.FileTransfers != null) | ||
309 | { | ||
310 | this.CreateBuiltOutputsFile(this.Context.BuiltOutputsFile, result.FileTransfers, this.Context.OutputPdbPath); | ||
311 | } | ||
312 | } | ||
206 | } | 313 | } |
207 | 314 | ||
208 | /// <summary> | 315 | /// <summary> |
@@ -212,6 +319,7 @@ namespace WixToolset | |||
212 | /// <param name="file">The Windows Installer file to create.</param> | 319 | /// <param name="file">The Windows Installer file to create.</param> |
213 | /// <remarks>The Binder.DeleteTempFiles method should be called after calling this method.</remarks> | 320 | /// <remarks>The Binder.DeleteTempFiles method should be called after calling this method.</remarks> |
214 | /// <returns>true if binding completed successfully; false otherwise</returns> | 321 | /// <returns>true if binding completed successfully; false otherwise</returns> |
322 | #if false | ||
215 | public bool Bind(Output output, string file) | 323 | public bool Bind(Output output, string file) |
216 | { | 324 | { |
217 | // Ensure the cabinet cache path exists if we are going to use it. | 325 | // Ensure the cabinet cache path exists if we are going to use it. |
@@ -220,20 +328,20 @@ namespace WixToolset | |||
220 | Directory.CreateDirectory(this.CabCachePath); | 328 | Directory.CreateDirectory(this.CabCachePath); |
221 | } | 329 | } |
222 | 330 | ||
223 | this.fileManagerCore = new BinderFileManagerCore(); | 331 | //var fileManagerCore = new BinderFileManagerCore(); |
224 | this.fileManagerCore.CabCachePath = this.CabCachePath; | 332 | //fileManagerCore.CabCachePath = this.CabCachePath; |
225 | this.fileManagerCore.Output = output; | 333 | //fileManagerCore.Output = output; |
226 | this.fileManagerCore.TempFilesLocation = this.TempFilesLocation; | 334 | //fileManagerCore.TempFilesLocation = this.TempFilesLocation; |
227 | this.fileManagerCore.AddBindPaths(this.BindPaths, BindStage.Normal); | 335 | //fileManagerCore.AddBindPaths(this.BindPaths, BindStage.Normal); |
228 | this.fileManagerCore.AddBindPaths(this.TargetBindPaths, BindStage.Target); | 336 | //fileManagerCore.AddBindPaths(this.TargetBindPaths, BindStage.Target); |
229 | this.fileManagerCore.AddBindPaths(this.UpdatedBindPaths, BindStage.Updated); | 337 | //fileManagerCore.AddBindPaths(this.UpdatedBindPaths, BindStage.Updated); |
230 | foreach (IBinderFileManager fileManager in this.fileManagers) | 338 | //foreach (IBinderFileManager fileManager in this.fileManagers) |
231 | { | 339 | //{ |
232 | fileManager.Core = this.fileManagerCore; | 340 | // fileManager.Core = fileManagerCore; |
233 | } | 341 | //} |
234 | 342 | ||
235 | this.core = new BinderCore(); | 343 | this.core = new BinderCore(); |
236 | this.core.FileManagerCore = this.fileManagerCore; | 344 | this.core.FileManagerCore = fileManagerCore; |
237 | 345 | ||
238 | this.WriteBuildInfoTable(output, file); | 346 | this.WriteBuildInfoTable(output, file); |
239 | 347 | ||
@@ -246,54 +354,69 @@ namespace WixToolset | |||
246 | } | 354 | } |
247 | 355 | ||
248 | // Gather all the wix variables. | 356 | // Gather all the wix variables. |
249 | Table wixVariableTable = output.Tables["WixVariable"]; | 357 | //Table wixVariableTable = output.Tables["WixVariable"]; |
250 | if (null != wixVariableTable) | 358 | //if (null != wixVariableTable) |
359 | //{ | ||
360 | // foreach (WixVariableRow wixVariableRow in wixVariableTable.Rows) | ||
361 | // { | ||
362 | // this.WixVariableResolver.AddVariable(wixVariableRow); | ||
363 | // } | ||
364 | //} | ||
365 | |||
366 | //BindContext context = new BindContext(); | ||
367 | //context.CabbingThreadCount = this.CabbingThreadCount; | ||
368 | //context.DefaultCompressionLevel = this.DefaultCompressionLevel; | ||
369 | //context.Extensions = this.extensions; | ||
370 | //context.FileManagerCore = fileManagerCore; | ||
371 | //context.FileManagers = this.fileManagers; | ||
372 | //context.Ices = this.Ices; | ||
373 | //context.IntermediateFolder = this.TempFilesLocation; | ||
374 | //context.IntermediateRepresentation = output; | ||
375 | //context.Localizer = this.Localizer; | ||
376 | //context.OutputPath = file; | ||
377 | //context.OutputPdbPath = this.PdbFile; | ||
378 | //context.SuppressIces = this.SuppressIces; | ||
379 | //context.SuppressValidation = this.SuppressValidation; | ||
380 | //context.WixVariableResolver = this.WixVariableResolver; | ||
381 | |||
382 | BindResult result = null; | ||
383 | |||
384 | foreach (var factory in this.BackendFactories) | ||
251 | { | 385 | { |
252 | foreach (WixVariableRow wixVariableRow in wixVariableTable.Rows) | 386 | if (factory.TryCreateBackend(output.Type.ToString(), file, null, out var backend)) |
253 | { | 387 | { |
254 | this.WixVariableResolver.AddVariable(wixVariableRow); | 388 | result = backend.Bind(context); |
389 | break; | ||
255 | } | 390 | } |
256 | } | 391 | } |
257 | 392 | ||
258 | IEnumerable<FileTransfer> fileTransfers = null; | 393 | if (result == null) |
259 | IEnumerable<string> contentPaths = null; | ||
260 | |||
261 | switch (output.Type) | ||
262 | { | 394 | { |
263 | case OutputType.Bundle: | 395 | // TODO: messaging that a backend could not be found to bind the output type? |
264 | this.BindBundle(output, file, out fileTransfers, out contentPaths); | ||
265 | break; | ||
266 | |||
267 | case OutputType.Transform: | ||
268 | this.BindTransform(output, file); | ||
269 | break; | ||
270 | 396 | ||
271 | default: | 397 | return false; |
272 | this.BindDatabase(output, file, out fileTransfers, out contentPaths); | ||
273 | break; | ||
274 | } | 398 | } |
275 | 399 | ||
276 | |||
277 | // Layout media | 400 | // Layout media |
278 | try | 401 | try |
279 | { | 402 | { |
280 | this.LayoutMedia(fileTransfers); | 403 | this.LayoutMedia(result.FileTransfers); |
281 | } | 404 | } |
282 | finally | 405 | finally |
283 | { | 406 | { |
284 | if (!String.IsNullOrEmpty(this.ContentsFile) && contentPaths != null) | 407 | if (!String.IsNullOrEmpty(this.ContentsFile) && result.ContentFilePaths != null) |
285 | { | 408 | { |
286 | this.CreateContentsFile(this.ContentsFile, contentPaths); | 409 | this.CreateContentsFile(this.ContentsFile, result.ContentFilePaths); |
287 | } | 410 | } |
288 | 411 | ||
289 | if (!String.IsNullOrEmpty(this.OutputsFile) && fileTransfers != null) | 412 | if (!String.IsNullOrEmpty(this.OutputsFile) && result.FileTransfers != null) |
290 | { | 413 | { |
291 | this.CreateOutputsFile(this.OutputsFile, fileTransfers, this.PdbFile); | 414 | this.CreateOutputsFile(this.OutputsFile, result.FileTransfers, this.PdbFile); |
292 | } | 415 | } |
293 | 416 | ||
294 | if (!String.IsNullOrEmpty(this.BuiltOutputsFile) && fileTransfers != null) | 417 | if (!String.IsNullOrEmpty(this.BuiltOutputsFile) && result.FileTransfers != null) |
295 | { | 418 | { |
296 | this.CreateBuiltOutputsFile(this.BuiltOutputsFile, fileTransfers, this.PdbFile); | 419 | this.CreateBuiltOutputsFile(this.BuiltOutputsFile, result.FileTransfers, this.PdbFile); |
297 | } | 420 | } |
298 | } | 421 | } |
299 | 422 | ||
@@ -301,6 +424,7 @@ namespace WixToolset | |||
301 | 424 | ||
302 | return Messaging.Instance.EncounteredError; | 425 | return Messaging.Instance.EncounteredError; |
303 | } | 426 | } |
427 | #endif | ||
304 | 428 | ||
305 | /// <summary> | 429 | /// <summary> |
306 | /// Does any housekeeping after Bind. | 430 | /// Does any housekeeping after Bind. |
@@ -312,12 +436,12 @@ namespace WixToolset | |||
312 | { | 436 | { |
313 | if (!this.DeleteTempFiles()) | 437 | if (!this.DeleteTempFiles()) |
314 | { | 438 | { |
315 | this.core.OnMessage(WixWarnings.FailedToDeleteTempDir(this.TempFilesLocation)); | 439 | this.Context.Messaging.OnMessage(WixWarnings.FailedToDeleteTempDir(this.TempFilesLocation)); |
316 | } | 440 | } |
317 | } | 441 | } |
318 | else | 442 | else |
319 | { | 443 | { |
320 | this.core.OnMessage(WixVerboses.BinderTempDirLocatedAt(this.TempFilesLocation)); | 444 | this.Context.Messaging.OnMessage(WixVerboses.BinderTempDirLocatedAt(this.TempFilesLocation)); |
321 | } | 445 | } |
322 | } | 446 | } |
323 | 447 | ||
@@ -327,7 +451,7 @@ namespace WixToolset | |||
327 | /// <returns>True if all files were deleted, false otherwise.</returns> | 451 | /// <returns>True if all files were deleted, false otherwise.</returns> |
328 | private bool DeleteTempFiles() | 452 | private bool DeleteTempFiles() |
329 | { | 453 | { |
330 | bool deleted = Common.DeleteTempFiles(this.TempFilesLocation, this.core); | 454 | bool deleted = Common.DeleteTempFiles(this.TempFilesLocation, this.Context.Messaging); |
331 | return deleted; | 455 | return deleted; |
332 | } | 456 | } |
333 | 457 | ||
@@ -338,7 +462,7 @@ namespace WixToolset | |||
338 | /// <param name="databaseFile">The output file if OutputFile not set.</param> | 462 | /// <param name="databaseFile">The output file if OutputFile not set.</param> |
339 | private void WriteBuildInfoTable(Output output, string outputFile) | 463 | private void WriteBuildInfoTable(Output output, string outputFile) |
340 | { | 464 | { |
341 | Table buildInfoTable = output.EnsureTable(this.core.TableDefinitions["WixBuildInfo"]); | 465 | Table buildInfoTable = output.EnsureTable(this.TableDefinitions["WixBuildInfo"]); |
342 | Row buildInfoRow = buildInfoTable.CreateRow(null); | 466 | Row buildInfoRow = buildInfoTable.CreateRow(null); |
343 | 467 | ||
344 | Assembly executingAssembly = Assembly.GetExecutingAssembly(); | 468 | Assembly executingAssembly = Assembly.GetExecutingAssembly(); |
@@ -346,17 +470,18 @@ namespace WixToolset | |||
346 | buildInfoRow[0] = fileVersion.FileVersion; | 470 | buildInfoRow[0] = fileVersion.FileVersion; |
347 | buildInfoRow[1] = outputFile; | 471 | buildInfoRow[1] = outputFile; |
348 | 472 | ||
349 | if (!String.IsNullOrEmpty(this.WixprojectFile)) | 473 | if (!String.IsNullOrEmpty(this.Context.WixprojectFile)) |
350 | { | 474 | { |
351 | buildInfoRow[2] = this.WixprojectFile; | 475 | buildInfoRow[2] = this.Context.WixprojectFile; |
352 | } | 476 | } |
353 | 477 | ||
354 | if (!String.IsNullOrEmpty(this.PdbFile)) | 478 | if (!String.IsNullOrEmpty(this.Context.OutputPdbPath)) |
355 | { | 479 | { |
356 | buildInfoRow[3] = this.PdbFile; | 480 | buildInfoRow[3] = this.Context.OutputPdbPath; |
357 | } | 481 | } |
358 | } | 482 | } |
359 | 483 | ||
484 | #if DELETE_THIS_CODE | ||
360 | /// <summary> | 485 | /// <summary> |
361 | /// Binds a bundle. | 486 | /// Binds a bundle. |
362 | /// </summary> | 487 | /// </summary> |
@@ -454,6 +579,7 @@ namespace WixToolset | |||
454 | command.OutputPath = outputPath; | 579 | command.OutputPath = outputPath; |
455 | command.Execute(); | 580 | command.Execute(); |
456 | } | 581 | } |
582 | #endif | ||
457 | 583 | ||
458 | /// <summary> | 584 | /// <summary> |
459 | /// Final step in binding that transfers (moves/copies) all files generated into the appropriate | 585 | /// Final step in binding that transfers (moves/copies) all files generated into the appropriate |
@@ -464,12 +590,9 @@ namespace WixToolset | |||
464 | { | 590 | { |
465 | if (null != transfers && transfers.Any()) | 591 | if (null != transfers && transfers.Any()) |
466 | { | 592 | { |
467 | this.core.OnMessage(WixVerboses.LayingOutMedia()); | 593 | this.Context.Messaging.OnMessage(WixVerboses.LayingOutMedia()); |
468 | 594 | ||
469 | TransferFilesCommand command = new TransferFilesCommand(); | 595 | var command = new TransferFilesCommand(this.Context.BindPaths, this.Context.Extensions, transfers, this.Context.SuppressAclReset); |
470 | command.FileManagers = this.fileManagers; | ||
471 | command.FileTransfers = transfers; | ||
472 | command.SuppressAclReset = this.SuppressAclReset; | ||
473 | command.Execute(); | 596 | command.Execute(); |
474 | } | 597 | } |
475 | } | 598 | } |
@@ -482,7 +605,7 @@ namespace WixToolset | |||
482 | /// <param name="directory">Directory identifier.</param> | 605 | /// <param name="directory">Directory identifier.</param> |
483 | /// <param name="canonicalize">Canonicalize the path for standard directories.</param> | 606 | /// <param name="canonicalize">Canonicalize the path for standard directories.</param> |
484 | /// <returns>Source path of a directory.</returns> | 607 | /// <returns>Source path of a directory.</returns> |
485 | internal static string GetDirectoryPath(Hashtable directories, Hashtable componentIdGenSeeds, string directory, bool canonicalize) | 608 | public static string GetDirectoryPath(Hashtable directories, Hashtable componentIdGenSeeds, string directory, bool canonicalize) |
486 | { | 609 | { |
487 | if (!directories.Contains(directory)) | 610 | if (!directories.Contains(directory)) |
488 | { | 611 | { |
@@ -543,9 +666,9 @@ namespace WixToolset | |||
543 | /// <param name="compressed">Specifies the package is compressed.</param> | 666 | /// <param name="compressed">Specifies the package is compressed.</param> |
544 | /// <param name="useLongName">Specifies the package uses long file names.</param> | 667 | /// <param name="useLongName">Specifies the package uses long file names.</param> |
545 | /// <returns>Source path of file relative to package directory.</returns> | 668 | /// <returns>Source path of file relative to package directory.</returns> |
546 | internal static string GetFileSourcePath(Hashtable directories, string directoryId, string fileName, bool compressed, bool useLongName) | 669 | public static string GetFileSourcePath(Hashtable directories, string directoryId, string fileName, bool compressed, bool useLongName) |
547 | { | 670 | { |
548 | string fileSourcePath = Installer.GetName(fileName, true, useLongName); | 671 | string fileSourcePath = Common.GetName(fileName, true, useLongName); |
549 | 672 | ||
550 | if (compressed) | 673 | if (compressed) |
551 | { | 674 | { |