aboutsummaryrefslogtreecommitdiff
path: root/src/WixToolset.Core.Burn
diff options
context:
space:
mode:
Diffstat (limited to 'src/WixToolset.Core.Burn')
-rw-r--r--src/WixToolset.Core.Burn/Bind/BindBundleCommand.cs27
-rw-r--r--src/WixToolset.Core.Burn/BurnBackendErrors.cs16
2 files changed, 36 insertions, 7 deletions
diff --git a/src/WixToolset.Core.Burn/Bind/BindBundleCommand.cs b/src/WixToolset.Core.Burn/Bind/BindBundleCommand.cs
index 5ddb6be1..37fc17f9 100644
--- a/src/WixToolset.Core.Burn/Bind/BindBundleCommand.cs
+++ b/src/WixToolset.Core.Burn/Bind/BindBundleCommand.cs
@@ -359,7 +359,6 @@ namespace WixToolset.Core.Burn
359 this.BackendHelper.ResolveDelayedFields(this.DelayedFields, variableCache); 359 this.BackendHelper.ResolveDelayedFields(this.DelayedFields, variableCache);
360 } 360 }
361 361
362 Dictionary<string, WixDependencyProviderSymbol> dependencySymbolsByKey;
363 { 362 {
364 var command = new ProcessDependencyProvidersCommand(this.Messaging, section, facades); 363 var command = new ProcessDependencyProvidersCommand(this.Messaging, section, facades);
365 command.Execute(); 364 command.Execute();
@@ -368,7 +367,6 @@ namespace WixToolset.Core.Burn
368 { 367 {
369 bundleSymbol.ProviderKey = command.BundleProviderKey; // set the overridable bundle provider key. 368 bundleSymbol.ProviderKey = command.BundleProviderKey; // set the overridable bundle provider key.
370 } 369 }
371 dependencySymbolsByKey = command.DependencySymbolsByKey;
372 } 370 }
373 371
374 // Update the bundle per-machine/per-user scope based on the chained packages. 372 // Update the bundle per-machine/per-user scope based on the chained packages.
@@ -381,6 +379,13 @@ namespace WixToolset.Core.Burn
381 command.Execute(); 379 command.Execute();
382 } 380 }
383 381
382 this.DetectDuplicateCacheIds(facades);
383
384 if (this.Messaging.EncounteredError)
385 {
386 return;
387 }
388
384 // Give the extension one last hook before generating the output files. 389 // Give the extension one last hook before generating the output files.
385 foreach (var extension in this.BackendExtensions) 390 foreach (var extension in this.BackendExtensions)
386 { 391 {
@@ -581,6 +586,24 @@ namespace WixToolset.Core.Burn
581 } 586 }
582 } 587 }
583 588
589 private void DetectDuplicateCacheIds(IDictionary<string, PackageFacade> facades)
590 {
591 var duplicateCacheIdDetector = new Dictionary<string, WixBundlePackageSymbol>();
592
593 foreach (var facade in facades.Values)
594 {
595 if (duplicateCacheIdDetector.TryGetValue(facade.PackageSymbol.CacheId, out var collisionPackage))
596 {
597 this.Messaging.Write(BurnBackendErrors.DuplicateCacheIds(collisionPackage.SourceLineNumbers, facade.PackageSymbol.CacheId));
598 this.Messaging.Write(BurnBackendErrors.DuplicateCacheIds2(facade.PackageSymbol.SourceLineNumbers, facade.PackageSymbol.CacheId));
599 }
600 else
601 {
602 duplicateCacheIdDetector.Add(facade.PackageSymbol.CacheId, facade.PackageSymbol);
603 }
604 }
605 }
606
584 private IEnumerable<T> GetRequiredSymbols<T>() where T : IntermediateSymbol 607 private IEnumerable<T> GetRequiredSymbols<T>() where T : IntermediateSymbol
585 { 608 {
586 var symbols = this.Output.Sections.Single().Symbols.OfType<T>().ToList(); 609 var symbols = this.Output.Sections.Single().Symbols.OfType<T>().ToList();
diff --git a/src/WixToolset.Core.Burn/BurnBackendErrors.cs b/src/WixToolset.Core.Burn/BurnBackendErrors.cs
index 106c3b31..4c846e8a 100644
--- a/src/WixToolset.Core.Burn/BurnBackendErrors.cs
+++ b/src/WixToolset.Core.Burn/BurnBackendErrors.cs
@@ -6,10 +6,15 @@ namespace WixToolset.Core.Burn
6 6
7 internal static class BurnBackendErrors 7 internal static class BurnBackendErrors
8 { 8 {
9 //public static Message ReplaceThisWithTheFirstError(SourceLineNumber sourceLineNumbers) 9 public static Message DuplicateCacheIds(SourceLineNumber originalLineNumber, string cacheId)
10 //{ 10 {
11 // return Message(sourceLineNumbers, Ids.ReplaceThisWithTheFirstError, "format string", arg1, arg2); 11 return Message(originalLineNumber, Ids.DuplicateCacheIds, "The cache id '{0}' has been duplicated as indicated in the following message.", cacheId);
12 //} 12 }
13
14 public static Message DuplicateCacheIds2(SourceLineNumber duplicateLineNumber, string cacheId)
15 {
16 return Message(duplicateLineNumber, Ids.DuplicateCacheIds2, "Each cache id must be unique. '{0}' has been used before as indicated in the previous message.", cacheId);
17 }
13 18
14 private static Message Message(SourceLineNumber sourceLineNumber, Ids id, string format, params object[] args) 19 private static Message Message(SourceLineNumber sourceLineNumber, Ids id, string format, params object[] args)
15 { 20 {
@@ -18,7 +23,8 @@ namespace WixToolset.Core.Burn
18 23
19 public enum Ids 24 public enum Ids
20 { 25 {
21 // ReplaceThisWithTheFirstError = 8000, 26 DuplicateCacheIds = 8000,
27 DuplicateCacheIds2 = 8001,
22 } 28 }
23 } 29 }
24} 30}