aboutsummaryrefslogtreecommitdiff
path: root/src/WixToolset.Core/Binder.cs
diff options
context:
space:
mode:
Diffstat (limited to 'src/WixToolset.Core/Binder.cs')
-rw-r--r--src/WixToolset.Core/Binder.cs54
1 files changed, 29 insertions, 25 deletions
diff --git a/src/WixToolset.Core/Binder.cs b/src/WixToolset.Core/Binder.cs
index 34bf0dee..07a92d02 100644
--- a/src/WixToolset.Core/Binder.cs
+++ b/src/WixToolset.Core/Binder.cs
@@ -14,7 +14,7 @@ namespace WixToolset.Core
14 using WixToolset.Core.Bind; 14 using WixToolset.Core.Bind;
15 using WixToolset.Data; 15 using WixToolset.Data;
16 using WixToolset.Data.Bind; 16 using WixToolset.Data.Bind;
17 using WixToolset.Data.Rows; 17 using WixToolset.Data.Tuples;
18 using WixToolset.Extensibility; 18 using WixToolset.Extensibility;
19 using WixToolset.Extensibility.Services; 19 using WixToolset.Extensibility.Services;
20 20
@@ -43,16 +43,9 @@ namespace WixToolset.Core
43 //this.SuppressIces = new List<string>(); 43 //this.SuppressIces = new List<string>();
44 } 44 }
45 45
46 public Binder(IBindContext context) 46 private IBindContext Context { get; set; }
47 {
48 this.Context = context;
49
50 this.TableDefinitions = WindowsInstallerStandard.GetTableDefinitions();
51 }
52
53 private IBindContext Context { get; }
54 47
55 private TableDefinitionCollection TableDefinitions { get; } 48 //private TableDefinitionCollection TableDefinitions { get; }
56 49
57 //public IEnumerable<IBackendFactory> BackendFactories { get; set; } 50 //public IEnumerable<IBackendFactory> BackendFactories { get; set; }
58 51
@@ -173,8 +166,10 @@ namespace WixToolset.Core
173 // this.fileManagers.Add(extension); 166 // this.fileManagers.Add(extension);
174 //} 167 //}
175 168
176 public bool Bind() 169 public bool Bind(IBindContext context)
177 { 170 {
171 this.Context = context;
172
178 //if (!String.IsNullOrEmpty(this.Context.FileManagerCore.CabCachePath)) 173 //if (!String.IsNullOrEmpty(this.Context.FileManagerCore.CabCachePath))
179 //{ 174 //{
180 // Directory.CreateDirectory(this.Context.FileManagerCore.CabCachePath); 175 // Directory.CreateDirectory(this.Context.FileManagerCore.CabCachePath);
@@ -225,7 +220,7 @@ namespace WixToolset.Core
225 220
226 private ResolveResult Resolve() 221 private ResolveResult Resolve()
227 { 222 {
228 var buildingPatch = (this.Context.IntermediateRepresentation.Type == OutputType.Patch); 223 var buildingPatch = this.Context.IntermediateRepresentation.Sections.Any(s => s.Type == SectionType.Patch);
229 224
230 var filesWithEmbeddedFiles = new ExtractEmbeddedFiles(); 225 var filesWithEmbeddedFiles = new ExtractEmbeddedFiles();
231 226
@@ -238,13 +233,14 @@ namespace WixToolset.Core
238 command.Extensions = this.Context.Extensions; 233 command.Extensions = this.Context.Extensions;
239 command.FilesWithEmbeddedFiles = filesWithEmbeddedFiles; 234 command.FilesWithEmbeddedFiles = filesWithEmbeddedFiles;
240 command.IntermediateFolder = this.Context.IntermediateFolder; 235 command.IntermediateFolder = this.Context.IntermediateFolder;
241 command.Tables = this.Context.IntermediateRepresentation.Tables; 236 command.Intermediate = this.Context.IntermediateRepresentation;
242 command.SupportDelayedResolution = true; 237 command.SupportDelayedResolution = true;
243 command.Execute(); 238 command.Execute();
244 239
245 delayedFields = command.DelayedFields; 240 delayedFields = command.DelayedFields;
246 } 241 }
247 242
243#if REVISIT_FOR_PATCHING
248 if (this.Context.IntermediateRepresentation.SubStorages != null) 244 if (this.Context.IntermediateRepresentation.SubStorages != null)
249 { 245 {
250 foreach (SubStorage transform in this.Context.IntermediateRepresentation.SubStorages) 246 foreach (SubStorage transform in this.Context.IntermediateRepresentation.SubStorages)
@@ -256,11 +252,12 @@ namespace WixToolset.Core
256 command.Extensions = this.Context.Extensions; 252 command.Extensions = this.Context.Extensions;
257 command.FilesWithEmbeddedFiles = filesWithEmbeddedFiles; 253 command.FilesWithEmbeddedFiles = filesWithEmbeddedFiles;
258 command.IntermediateFolder = this.Context.IntermediateFolder; 254 command.IntermediateFolder = this.Context.IntermediateFolder;
259 command.Tables = transform.Data.Tables; 255 command.Intermediate = this.Context.IntermediateRepresentation;
260 command.SupportDelayedResolution = false; 256 command.SupportDelayedResolution = false;
261 command.Execute(); 257 command.Execute();
262 } 258 }
263 } 259 }
260#endif
264 261
265 var expectedEmbeddedFiles = filesWithEmbeddedFiles.GetExpectedEmbeddedFiles(); 262 var expectedEmbeddedFiles = filesWithEmbeddedFiles.GetExpectedEmbeddedFiles();
266 263
@@ -275,9 +272,11 @@ namespace WixToolset.Core
275 { 272 {
276 var backendFactories = this.Context.ExtensionManager.Create<IBackendFactory>(); 273 var backendFactories = this.Context.ExtensionManager.Create<IBackendFactory>();
277 274
275 var entrySection = this.Context.IntermediateRepresentation.Sections[0];
276
278 foreach (var factory in backendFactories) 277 foreach (var factory in backendFactories)
279 { 278 {
280 if (factory.TryCreateBackend(this.Context.IntermediateRepresentation.Type.ToString(), this.Context.OutputPath, null, out var backend)) 279 if (factory.TryCreateBackend(entrySection.Type.ToString(), this.Context.OutputPath, null, out var backend))
281 { 280 {
282 var result = backend.Bind(this.Context); 281 var result = backend.Bind(this.Context);
283 return result; 282 return result;
@@ -288,6 +287,7 @@ namespace WixToolset.Core
288 287
289 return null; 288 return null;
290 } 289 }
290
291 private void Layout(BindResult result) 291 private void Layout(BindResult result)
292 { 292 {
293 try 293 try
@@ -461,25 +461,28 @@ namespace WixToolset.Core
461 /// </summary> 461 /// </summary>
462 /// <param name="output">The output.</param> 462 /// <param name="output">The output.</param>
463 /// <param name="databaseFile">The output file if OutputFile not set.</param> 463 /// <param name="databaseFile">The output file if OutputFile not set.</param>
464 private void WriteBuildInfoTable(Output output, string outputFile) 464 private void WriteBuildInfoTable(Intermediate output, string outputFile)
465 { 465 {
466 Table buildInfoTable = output.EnsureTable(this.TableDefinitions["WixBuildInfo"]); 466 var entrySection = output.Sections.First(s => s.Type != SectionType.Fragment);
467 Row buildInfoRow = buildInfoTable.CreateRow(null);
468 467
469 Assembly executingAssembly = Assembly.GetExecutingAssembly(); 468 Assembly executingAssembly = Assembly.GetExecutingAssembly();
470 FileVersionInfo fileVersion = FileVersionInfo.GetVersionInfo(executingAssembly.Location); 469 FileVersionInfo fileVersion = FileVersionInfo.GetVersionInfo(executingAssembly.Location);
471 buildInfoRow[0] = fileVersion.FileVersion; 470
472 buildInfoRow[1] = outputFile; 471 var buildInfoRow = new WixBuildInfoTuple();
472 buildInfoRow.WixVersion = fileVersion.FileVersion;
473 buildInfoRow.WixOutputFile = outputFile;
473 474
474 if (!String.IsNullOrEmpty(this.Context.WixprojectFile)) 475 if (!String.IsNullOrEmpty(this.Context.WixprojectFile))
475 { 476 {
476 buildInfoRow[2] = this.Context.WixprojectFile; 477 buildInfoRow.WixProjectFile = this.Context.WixprojectFile;
477 } 478 }
478 479
479 if (!String.IsNullOrEmpty(this.Context.OutputPdbPath)) 480 if (!String.IsNullOrEmpty(this.Context.OutputPdbPath))
480 { 481 {
481 buildInfoRow[3] = this.Context.OutputPdbPath; 482 buildInfoRow.WixPdbFile = this.Context.OutputPdbPath;
482 } 483 }
484
485 entrySection.Tuples.Add(buildInfoRow);
483 } 486 }
484 487
485#if DELETE_THIS_CODE 488#if DELETE_THIS_CODE
@@ -720,7 +723,7 @@ namespace WixToolset.Core
720 /// </summary> 723 /// </summary>
721 /// <param name="path">Path to write file.</param> 724 /// <param name="path">Path to write file.</param>
722 /// <param name="payloads">Collection of payloads whose source will be written to file.</param> 725 /// <param name="payloads">Collection of payloads whose source will be written to file.</param>
723 private void CreateContentsFile(string path, IEnumerable<WixBundlePayloadRow> payloads) 726 private void CreateContentsFile(string path, IEnumerable<WixBundlePayloadTuple> payloads)
724 { 727 {
725 string directory = Path.GetDirectoryName(path); 728 string directory = Path.GetDirectoryName(path);
726 if (!Directory.Exists(directory)) 729 if (!Directory.Exists(directory))
@@ -730,11 +733,12 @@ namespace WixToolset.Core
730 733
731 using (StreamWriter contents = new StreamWriter(path, false)) 734 using (StreamWriter contents = new StreamWriter(path, false))
732 { 735 {
733 foreach (WixBundlePayloadRow payload in payloads) 736 foreach (var payload in payloads)
734 { 737 {
735 if (payload.ContentFile) 738 if (payload.ContentFile)
736 { 739 {
737 contents.WriteLine(payload.FullFileName); 740 var fullPath = Path.GetFullPath(payload.SourceFile);
741 contents.WriteLine(fullPath);
738 } 742 }
739 } 743 }
740 } 744 }