aboutsummaryrefslogtreecommitdiff
path: root/src/WixToolset.Core
diff options
context:
space:
mode:
authorRob Mensching <rob@firegiant.com>2019-03-01 11:12:52 -0800
committerRob Mensching <rob@robmensching.com>2019-03-01 11:15:40 -0800
commit5392cf57c09bddde7157e5b26c5c2a013f819ead (patch)
tree96063a49293bd9eea122218e770b52d3c20812f2 /src/WixToolset.Core
parenta4f5a5a042c00254607fbecdf132a2e2a91a1bdd (diff)
downloadwix-5392cf57c09bddde7157e5b26c5c2a013f819ead.tar.gz
wix-5392cf57c09bddde7157e5b26c5c2a013f819ead.tar.bz2
wix-5392cf57c09bddde7157e5b26c5c2a013f819ead.zip
Integrate interface-only WixToolset.Extensibility change
Diffstat (limited to 'src/WixToolset.Core')
-rw-r--r--src/WixToolset.Core/Bind/FileResolver.cs12
-rw-r--r--src/WixToolset.Core/Bind/ResolveFieldsCommand.cs2
-rw-r--r--src/WixToolset.Core/BindFileWithPath.cs22
-rw-r--r--src/WixToolset.Core/BindPath.cs18
-rw-r--r--src/WixToolset.Core/BindResult.cs14
-rw-r--r--src/WixToolset.Core/Binder.cs4
-rw-r--r--src/WixToolset.Core/CommandLine/BuildCommand.cs275
-rw-r--r--src/WixToolset.Core/CompilerCore.cs6
-rw-r--r--src/WixToolset.Core/ComponentKeyPath.cs24
-rw-r--r--src/WixToolset.Core/DecompileResult.cs15
-rw-r--r--src/WixToolset.Core/Decompiler.cs4
-rw-r--r--src/WixToolset.Core/ExtensibilityServices/ParseHelper.cs6
-rw-r--r--src/WixToolset.Core/IBinder.cs4
-rw-r--r--src/WixToolset.Core/IDecompiler.cs2
-rw-r--r--src/WixToolset.Core/IResolver.cs4
-rw-r--r--src/WixToolset.Core/LibraryContext.cs4
-rw-r--r--src/WixToolset.Core/ResolveContext.cs4
-rw-r--r--src/WixToolset.Core/ResolveFileResult.cs14
-rw-r--r--src/WixToolset.Core/ResolveResult.cs19
-rw-r--r--src/WixToolset.Core/ResolvedCabinet.cs22
-rw-r--r--src/WixToolset.Core/Resolver.cs4
-rw-r--r--src/WixToolset.Core/VariableResolution.cs29
-rw-r--r--src/WixToolset.Core/VariableResolver.cs11
-rw-r--r--src/WixToolset.Core/WixToolsetServiceProvider.cs14
24 files changed, 370 insertions, 163 deletions
diff --git a/src/WixToolset.Core/Bind/FileResolver.cs b/src/WixToolset.Core/Bind/FileResolver.cs
index 01dfe36c..a67d784d 100644
--- a/src/WixToolset.Core/Bind/FileResolver.cs
+++ b/src/WixToolset.Core/Bind/FileResolver.cs
@@ -1,4 +1,4 @@
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
3namespace WixToolset.Core.Bind 3namespace WixToolset.Core.Bind
4{ 4{
@@ -14,24 +14,24 @@ namespace WixToolset.Core.Bind
14 { 14 {
15 private const string BindPathOpenString = "!(bindpath."; 15 private const string BindPathOpenString = "!(bindpath.";
16 16
17 private FileResolver(IEnumerable<BindPath> bindPaths) 17 private FileResolver(IEnumerable<IBindPath> bindPaths)
18 { 18 {
19 this.BindPaths = (bindPaths ?? Array.Empty<BindPath>()).ToLookup(b => b.Stage); 19 this.BindPaths = (bindPaths ?? Array.Empty<IBindPath>()).ToLookup(b => b.Stage);
20 this.RebaseTarget = this.BindPaths[BindStage.Target].Any(); 20 this.RebaseTarget = this.BindPaths[BindStage.Target].Any();
21 this.RebaseUpdated = this.BindPaths[BindStage.Updated].Any(); 21 this.RebaseUpdated = this.BindPaths[BindStage.Updated].Any();
22 } 22 }
23 23
24 public FileResolver(IEnumerable<BindPath> bindPaths, IEnumerable<IResolverExtension> extensions) : this(bindPaths) 24 public FileResolver(IEnumerable<IBindPath> bindPaths, IEnumerable<IResolverExtension> extensions) : this(bindPaths)
25 { 25 {
26 this.ResolverExtensions = extensions ?? Array.Empty<IResolverExtension>(); 26 this.ResolverExtensions = extensions ?? Array.Empty<IResolverExtension>();
27 } 27 }
28 28
29 public FileResolver(IEnumerable<BindPath> bindPaths, IEnumerable<ILibrarianExtension> extensions) : this(bindPaths) 29 public FileResolver(IEnumerable<IBindPath> bindPaths, IEnumerable<ILibrarianExtension> extensions) : this(bindPaths)
30 { 30 {
31 this.LibrarianExtensions = extensions ?? Array.Empty<ILibrarianExtension>(); 31 this.LibrarianExtensions = extensions ?? Array.Empty<ILibrarianExtension>();
32 } 32 }
33 33
34 private ILookup<BindStage, BindPath> BindPaths { get; } 34 private ILookup<BindStage, IBindPath> BindPaths { get; }
35 35
36 public bool RebaseTarget { get; } 36 public bool RebaseTarget { get; }
37 37
diff --git a/src/WixToolset.Core/Bind/ResolveFieldsCommand.cs b/src/WixToolset.Core/Bind/ResolveFieldsCommand.cs
index b7ed8a18..6c9f17dd 100644
--- a/src/WixToolset.Core/Bind/ResolveFieldsCommand.cs
+++ b/src/WixToolset.Core/Bind/ResolveFieldsCommand.cs
@@ -20,7 +20,7 @@ namespace WixToolset.Core.Bind
20 20
21 public IVariableResolver VariableResolver { private get; set; } 21 public IVariableResolver VariableResolver { private get; set; }
22 22
23 public IEnumerable<BindPath> BindPaths { private get; set; } 23 public IEnumerable<IBindPath> BindPaths { private get; set; }
24 24
25 public IEnumerable<IResolverExtension> Extensions { private get; set; } 25 public IEnumerable<IResolverExtension> Extensions { private get; set; }
26 26
diff --git a/src/WixToolset.Core/BindFileWithPath.cs b/src/WixToolset.Core/BindFileWithPath.cs
new file mode 100644
index 00000000..539600d3
--- /dev/null
+++ b/src/WixToolset.Core/BindFileWithPath.cs
@@ -0,0 +1,22 @@
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
3namespace WixToolset.Core
4{
5 using WixToolset.Extensibility.Data;
6
7 /// <summary>
8 /// Bind file with its path.
9 /// </summary>
10 internal class BindFileWithPath : IBindFileWithPath
11 {
12 /// <summary>
13 /// Gets or sets the identifier of the file with this path.
14 /// </summary>
15 public string Id { get; set; }
16
17 /// <summary>
18 /// Gets or sets the file path.
19 /// </summary>
20 public string Path { get; set; }
21 }
22}
diff --git a/src/WixToolset.Core/BindPath.cs b/src/WixToolset.Core/BindPath.cs
new file mode 100644
index 00000000..85aef97a
--- /dev/null
+++ b/src/WixToolset.Core/BindPath.cs
@@ -0,0 +1,18 @@
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
3namespace WixToolset.Core
4{
5 using WixToolset.Extensibility.Data;
6
7 /// <summary>
8 /// Bind path representation.
9 /// </summary>
10 internal class BindPath : IBindPath
11 {
12 public string Name { get; set; }
13
14 public string Path { get; set; }
15
16 public BindStage Stage { get; set; }
17 }
18}
diff --git a/src/WixToolset.Core/BindResult.cs b/src/WixToolset.Core/BindResult.cs
new file mode 100644
index 00000000..7883fabd
--- /dev/null
+++ b/src/WixToolset.Core/BindResult.cs
@@ -0,0 +1,14 @@
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
3namespace WixToolset.Core
4{
5 using System.Collections.Generic;
6 using WixToolset.Extensibility.Data;
7
8 internal class BindResult : IBindResult
9 {
10 public IEnumerable<IFileTransfer> FileTransfers { get; set; }
11
12 public IEnumerable<ITrackedFile> TrackedFiles { get; set; }
13 }
14}
diff --git a/src/WixToolset.Core/Binder.cs b/src/WixToolset.Core/Binder.cs
index 87b5d2b3..73ad7c04 100644
--- a/src/WixToolset.Core/Binder.cs
+++ b/src/WixToolset.Core/Binder.cs
@@ -24,7 +24,7 @@ namespace WixToolset.Core
24 24
25 public IServiceProvider ServiceProvider { get; } 25 public IServiceProvider ServiceProvider { get; }
26 26
27 public BindResult Bind(IBindContext context) 27 public IBindResult Bind(IBindContext context)
28 { 28 {
29 // Prebind. 29 // Prebind.
30 // 30 //
@@ -52,7 +52,7 @@ namespace WixToolset.Core
52 return bindResult; 52 return bindResult;
53 } 53 }
54 54
55 private BindResult BackendBind(IBindContext context) 55 private IBindResult BackendBind(IBindContext context)
56 { 56 {
57 var extensionManager = context.ServiceProvider.GetService<IExtensionManager>(); 57 var extensionManager = context.ServiceProvider.GetService<IExtensionManager>();
58 58
diff --git a/src/WixToolset.Core/CommandLine/BuildCommand.cs b/src/WixToolset.Core/CommandLine/BuildCommand.cs
index fbc88f08..b83aaec4 100644
--- a/src/WixToolset.Core/CommandLine/BuildCommand.cs
+++ b/src/WixToolset.Core/CommandLine/BuildCommand.cs
@@ -21,7 +21,7 @@ namespace WixToolset.Core.CommandLine
21 this.ServiceProvider = serviceProvider; 21 this.ServiceProvider = serviceProvider;
22 this.Messaging = serviceProvider.GetService<IMessaging>(); 22 this.Messaging = serviceProvider.GetService<IMessaging>();
23 this.ExtensionManager = serviceProvider.GetService<IExtensionManager>(); 23 this.ExtensionManager = serviceProvider.GetService<IExtensionManager>();
24 this.commandLine = new CommandLine(this.Messaging); 24 this.commandLine = new CommandLine(this.ServiceProvider, this.Messaging);
25 } 25 }
26 26
27 public bool ShowLogo => this.commandLine.ShowLogo; 27 public bool ShowLogo => this.commandLine.ShowLogo;
@@ -214,7 +214,7 @@ namespace WixToolset.Core.CommandLine
214 return intermediates; 214 return intermediates;
215 } 215 }
216 216
217 private Intermediate LibraryPhase(IEnumerable<Intermediate> intermediates, IEnumerable<Localization> localizations, bool bindFiles, IEnumerable<BindPath> bindPaths) 217 private Intermediate LibraryPhase(IEnumerable<Intermediate> intermediates, IEnumerable<Localization> localizations, bool bindFiles, IEnumerable<IBindPath> bindPaths)
218 { 218 {
219 var context = this.ServiceProvider.GetService<ILibraryContext>(); 219 var context = this.ServiceProvider.GetService<ILibraryContext>();
220 context.BindFiles = bindFiles; 220 context.BindFiles = bindFiles;
@@ -257,7 +257,7 @@ namespace WixToolset.Core.CommandLine
257 return linker.Link(context); 257 return linker.Link(context);
258 } 258 }
259 259
260 private void BindPhase(Intermediate output, IEnumerable<Localization> localizations, IEnumerable<string> filterCultures, string cabCachePath, IEnumerable<BindPath> bindPaths) 260 private void BindPhase(Intermediate output, IEnumerable<Localization> localizations, IEnumerable<string> filterCultures, string cabCachePath, IEnumerable<IBindPath> bindPaths)
261 { 261 {
262 var intermediateFolder = this.IntermediateFolder; 262 var intermediateFolder = this.IntermediateFolder;
263 if (String.IsNullOrEmpty(intermediateFolder)) 263 if (String.IsNullOrEmpty(intermediateFolder))
@@ -265,7 +265,7 @@ namespace WixToolset.Core.CommandLine
265 intermediateFolder = Path.Combine(Path.GetTempPath(), Path.GetRandomFileName()); 265 intermediateFolder = Path.Combine(Path.GetTempPath(), Path.GetRandomFileName());
266 } 266 }
267 267
268 ResolveResult resolveResult; 268 IResolveResult resolveResult;
269 { 269 {
270 var context = this.ServiceProvider.GetService<IResolveContext>(); 270 var context = this.ServiceProvider.GetService<IResolveContext>();
271 context.BindPaths = bindPaths; 271 context.BindPaths = bindPaths;
@@ -286,7 +286,7 @@ namespace WixToolset.Core.CommandLine
286 return; 286 return;
287 } 287 }
288 288
289 BindResult bindResult; 289 IBindResult bindResult;
290 { 290 {
291 var context = this.ServiceProvider.GetService<IBindContext>(); 291 var context = this.ServiceProvider.GetService<IBindContext>();
292 //context.CabbingThreadCount = this.CabbingThreadCount; 292 //context.CabbingThreadCount = this.CabbingThreadCount;
@@ -397,7 +397,7 @@ namespace WixToolset.Core.CommandLine
397 397
398 public bool BindFiles { get; private set; } 398 public bool BindFiles { get; private set; }
399 399
400 public List<BindPath> BindPaths { get; } = new List<BindPath>(); 400 public List<IBindPath> BindPaths { get; } = new List<IBindPath>();
401 401
402 public string CabCachePath { get; private set; } 402 public string CabCachePath { get; private set; }
403 403
@@ -431,11 +431,14 @@ namespace WixToolset.Core.CommandLine
431 431
432 public string BuiltOutputsFile { get; private set; } 432 public string BuiltOutputsFile { get; private set; }
433 433
434 public CommandLine(IMessaging messaging) 434 public CommandLine(IServiceProvider serviceProvider, IMessaging messaging)
435 { 435 {
436 this.ServiceProvider = serviceProvider;
436 this.Messaging = messaging; 437 this.Messaging = messaging;
437 } 438 }
438 439
440 private IServiceProvider ServiceProvider { get; }
441
439 private IMessaging Messaging { get; } 442 private IMessaging Messaging { get; }
440 443
441 public bool TryParseArgument(string arg, ICommandLineParser parser) 444 public bool TryParseArgument(string arg, ICommandLineParser parser)
@@ -445,109 +448,109 @@ namespace WixToolset.Core.CommandLine
445 var parameter = arg.Substring(1); 448 var parameter = arg.Substring(1);
446 switch (parameter.ToLowerInvariant()) 449 switch (parameter.ToLowerInvariant())
447 { 450 {
448 case "?": 451 case "?":
449 case "h": 452 case "h":
450 case "help": 453 case "help":
451 this.ShowHelp = true; 454 this.ShowHelp = true;
452 return true;
453
454 case "arch":
455 case "platform":
456 {
457 var value = parser.GetNextArgumentOrError(arg);
458 if (Enum.TryParse(value, true, out Platform platform))
459 {
460 this.Platform = platform;
461 return true; 455 return true;
462 }
463 break;
464 }
465
466 case "bindfiles":
467 this.BindFiles = true;
468 return true;
469 456
470 case "bindpath": 457 case "arch":
471 { 458 case "platform":
472 var value = parser.GetNextArgumentOrError(arg);
473 if (this.TryParseBindPath(value, out var bindPath))
474 { 459 {
475 this.BindPaths.Add(bindPath); 460 var value = parser.GetNextArgumentOrError(arg);
476 return true; 461 if (Enum.TryParse(value, true, out Platform platform))
462 {
463 this.Platform = platform;
464 return true;
465 }
466 break;
477 } 467 }
478 break; 468
479 } 469 case "bindfiles":
480 case "cc": 470 this.BindFiles = true;
481 this.CabCachePath = parser.GetNextArgumentOrError(arg); 471 return true;
482 return true; 472
483 473 case "bindpath":
484 case "culture":
485 parser.GetNextArgumentOrError(arg, this.Cultures);
486 return true;
487
488 case "contentsfile":
489 this.ContentsFile = parser.GetNextArgumentAsFilePathOrError(arg);
490 return true;
491 case "outputsfile":
492 this.OutputsFile = parser.GetNextArgumentAsFilePathOrError(arg);
493 return true;
494 case "builtoutputsfile":
495 this.BuiltOutputsFile = parser.GetNextArgumentAsFilePathOrError(arg);
496 return true;
497
498 case "d":
499 case "define":
500 parser.GetNextArgumentOrError(arg, this.Defines);
501 return true;
502
503 case "i":
504 case "includepath":
505 parser.GetNextArgumentOrError(arg, this.IncludeSearchPaths);
506 return true;
507
508 case "intermediatefolder":
509 this.IntermediateFolder = parser.GetNextArgumentAsDirectoryOrError(arg);
510 return true;
511
512 case "loc":
513 parser.GetNextArgumentAsFilePathOrError(arg, "localization files", this.LocalizationFilePaths);
514 return true;
515
516 case "lib":
517 parser.GetNextArgumentAsFilePathOrError(arg, "library files", this.LibraryFilePaths);
518 return true;
519
520 case "o":
521 case "out":
522 this.OutputFile = parser.GetNextArgumentAsFilePathOrError(arg);
523 return true;
524
525 case "outputtype":
526 this.OutputType = parser.GetNextArgumentOrError(arg);
527 return true;
528
529 case "nologo":
530 this.ShowLogo = false;
531 return true;
532
533 case "v":
534 case "verbose":
535 this.Messaging.ShowVerboseMessages = true;
536 return true;
537
538 case "sval":
539 // todo: implement
540 return true;
541
542 case "sw":
543 case "suppresswarning":
544 var warning = parser.GetNextArgumentOrError(arg);
545 if (!String.IsNullOrEmpty(warning))
546 { 474 {
547 var warningNumber = Convert.ToInt32(warning); 475 var value = parser.GetNextArgumentOrError(arg);
548 this.Messaging.SuppressWarningMessage(warningNumber); 476 if (this.TryParseBindPath(value, out var bindPath))
477 {
478 this.BindPaths.Add(bindPath);
479 return true;
480 }
481 break;
549 } 482 }
550 return true; 483 case "cc":
484 this.CabCachePath = parser.GetNextArgumentOrError(arg);
485 return true;
486
487 case "culture":
488 parser.GetNextArgumentOrError(arg, this.Cultures);
489 return true;
490
491 case "contentsfile":
492 this.ContentsFile = parser.GetNextArgumentAsFilePathOrError(arg);
493 return true;
494 case "outputsfile":
495 this.OutputsFile = parser.GetNextArgumentAsFilePathOrError(arg);
496 return true;
497 case "builtoutputsfile":
498 this.BuiltOutputsFile = parser.GetNextArgumentAsFilePathOrError(arg);
499 return true;
500
501 case "d":
502 case "define":
503 parser.GetNextArgumentOrError(arg, this.Defines);
504 return true;
505
506 case "i":
507 case "includepath":
508 parser.GetNextArgumentOrError(arg, this.IncludeSearchPaths);
509 return true;
510
511 case "intermediatefolder":
512 this.IntermediateFolder = parser.GetNextArgumentAsDirectoryOrError(arg);
513 return true;
514
515 case "loc":
516 parser.GetNextArgumentAsFilePathOrError(arg, "localization files", this.LocalizationFilePaths);
517 return true;
518
519 case "lib":
520 parser.GetNextArgumentAsFilePathOrError(arg, "library files", this.LibraryFilePaths);
521 return true;
522
523 case "o":
524 case "out":
525 this.OutputFile = parser.GetNextArgumentAsFilePathOrError(arg);
526 return true;
527
528 case "outputtype":
529 this.OutputType = parser.GetNextArgumentOrError(arg);
530 return true;
531
532 case "nologo":
533 this.ShowLogo = false;
534 return true;
535
536 case "v":
537 case "verbose":
538 this.Messaging.ShowVerboseMessages = true;
539 return true;
540
541 case "sval":
542 // todo: implement
543 return true;
544
545 case "sw":
546 case "suppresswarning":
547 var warning = parser.GetNextArgumentOrError(arg);
548 if (!String.IsNullOrEmpty(warning))
549 {
550 var warningNumber = Convert.ToInt32(warning);
551 this.Messaging.SuppressWarningMessage(warningNumber);
552 }
553 return true;
551 } 554 }
552 555
553 return false; 556 return false;
@@ -573,37 +576,37 @@ namespace WixToolset.Core.CommandLine
573 576
574 switch (this.OutputType.ToLowerInvariant()) 577 switch (this.OutputType.ToLowerInvariant())
575 { 578 {
576 case "bundle": 579 case "bundle":
577 case ".exe": 580 case ".exe":
578 return Data.OutputType.Bundle; 581 return Data.OutputType.Bundle;
579 582
580 case "library": 583 case "library":
581 case ".wixlib": 584 case ".wixlib":
582 return Data.OutputType.Library; 585 return Data.OutputType.Library;
583 586
584 case "module": 587 case "module":
585 case ".msm": 588 case ".msm":
586 return Data.OutputType.Module; 589 return Data.OutputType.Module;
587 590
588 case "patch": 591 case "patch":
589 case ".msp": 592 case ".msp":
590 return Data.OutputType.Patch; 593 return Data.OutputType.Patch;
591 594
592 case ".pcp": 595 case ".pcp":
593 return Data.OutputType.PatchCreation; 596 return Data.OutputType.PatchCreation;
594 597
595 case "product": 598 case "product":
596 case "package": 599 case "package":
597 case ".msi": 600 case ".msi":
598 return Data.OutputType.Product; 601 return Data.OutputType.Product;
599 602
600 case "transform": 603 case "transform":
601 case ".mst": 604 case ".mst":
602 return Data.OutputType.Transform; 605 return Data.OutputType.Transform;
603 606
604 case "intermediatepostlink": 607 case "intermediatepostlink":
605 case ".wixipl": 608 case ".wixipl":
606 return Data.OutputType.IntermediatePostLink; 609 return Data.OutputType.IntermediatePostLink;
607 } 610 }
608 611
609 return Data.OutputType.Unknown; 612 return Data.OutputType.Unknown;
@@ -656,7 +659,6 @@ namespace WixToolset.Core.CommandLine
656 return variables; 659 return variables;
657 } 660 }
658 661
659
660 public IEnumerable<SourceFile> GatherSourceFiles(string intermediateDirectory) 662 public IEnumerable<SourceFile> GatherSourceFiles(string intermediateDirectory)
661 { 663 {
662 var files = new List<SourceFile>(); 664 var files = new List<SourceFile>();
@@ -672,10 +674,21 @@ namespace WixToolset.Core.CommandLine
672 return files; 674 return files;
673 } 675 }
674 676
675 private bool TryParseBindPath(string bindPath, out BindPath bp) 677 private bool TryParseBindPath(string bindPath, out IBindPath bp)
676 { 678 {
677 var namedPath = bindPath.Split(BindPathSplit, 2); 679 var namedPath = bindPath.Split(BindPathSplit, 2);
678 bp = (1 == namedPath.Length) ? new BindPath(namedPath[0]) : new BindPath(namedPath[0], namedPath[1]); 680
681 bp = this.ServiceProvider.GetService<IBindPath>();
682
683 if (1 == namedPath.Length)
684 {
685 bp.Path = namedPath[0];
686 }
687 else
688 {
689 bp.Name = namedPath[0];
690 bp.Path = namedPath[1];
691 }
679 692
680 if (File.Exists(bp.Path)) 693 if (File.Exists(bp.Path))
681 { 694 {
diff --git a/src/WixToolset.Core/CompilerCore.cs b/src/WixToolset.Core/CompilerCore.cs
index cc881f48..4df94713 100644
--- a/src/WixToolset.Core/CompilerCore.cs
+++ b/src/WixToolset.Core/CompilerCore.cs
@@ -534,7 +534,7 @@ namespace WixToolset.Core
534 string value = this.GetAttributeValue(sourceLineNumbers, attribute); 534 string value = this.GetAttributeValue(sourceLineNumbers, attribute);
535 535
536 // allow for localization of code page names and values 536 // allow for localization of code page names and values
537 if (IsValidLocIdentifier(value)) 537 if (this.IsValidLocIdentifier(value))
538 { 538 {
539 return value; 539 return value;
540 } 540 }
@@ -648,7 +648,7 @@ namespace WixToolset.Core
648 648
649 if (0 < value.Length) 649 if (0 < value.Length)
650 { 650 {
651 if (IsValidLocIdentifier(value) || Common.IsValidBinderVariable(value)) 651 if (this.IsValidLocIdentifier(value) || Common.IsValidBinderVariable(value))
652 { 652 {
653 return value; 653 return value;
654 } 654 }
@@ -1010,7 +1010,7 @@ namespace WixToolset.Core
1010 /// <param name="parentElement">Element containing element to be parsed.</param> 1010 /// <param name="parentElement">Element containing element to be parsed.</param>
1011 /// <param name="element">Element to be parsed.</param> 1011 /// <param name="element">Element to be parsed.</param>
1012 /// <param name="contextValues">Extra information about the context in which this element is being parsed.</param> 1012 /// <param name="contextValues">Extra information about the context in which this element is being parsed.</param>
1013 public ComponentKeyPath ParsePossibleKeyPathExtensionElement(XElement parentElement, XElement element, IDictionary<string, string> context) 1013 public IComponentKeyPath ParsePossibleKeyPathExtensionElement(XElement parentElement, XElement element, IDictionary<string, string> context)
1014 { 1014 {
1015 return this.parseHelper.ParsePossibleKeyPathExtensionElement(this.extensions.Values, this.intermediate, this.ActiveSection, parentElement, element, context); 1015 return this.parseHelper.ParsePossibleKeyPathExtensionElement(this.extensions.Values, this.intermediate, this.ActiveSection, parentElement, element, context);
1016 } 1016 }
diff --git a/src/WixToolset.Core/ComponentKeyPath.cs b/src/WixToolset.Core/ComponentKeyPath.cs
new file mode 100644
index 00000000..f81465fd
--- /dev/null
+++ b/src/WixToolset.Core/ComponentKeyPath.cs
@@ -0,0 +1,24 @@
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
3namespace WixToolset.Core
4{
5 using WixToolset.Extensibility.Data;
6
7 internal class ComponentKeyPath : IComponentKeyPath
8 {
9 /// <summary>
10 /// Identifier of the resource to be a key path.
11 /// </summary>
12 public string Id { get; set; }
13
14 /// <summary>
15 /// Indicates whether the key path was explicitly set for this resource.
16 /// </summary>
17 public bool Explicit { get; set; }
18
19 /// <summary>
20 /// Type of resource to be the key path.
21 /// </summary>
22 public ComponentKeyPathType Type { get; set; }
23 }
24}
diff --git a/src/WixToolset.Core/DecompileResult.cs b/src/WixToolset.Core/DecompileResult.cs
new file mode 100644
index 00000000..120d099d
--- /dev/null
+++ b/src/WixToolset.Core/DecompileResult.cs
@@ -0,0 +1,15 @@
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
3namespace WixToolset.Core
4{
5 using System.Collections.Generic;
6 using System.Xml.Linq;
7 using WixToolset.Extensibility.Data;
8
9 internal class DecompileResult : IDecompileResult
10 {
11 public XDocument Document { get; set; }
12
13 public IEnumerable<string> ExtractedFilePaths { get; set; }
14 }
15}
diff --git a/src/WixToolset.Core/Decompiler.cs b/src/WixToolset.Core/Decompiler.cs
index 685722a8..c0ca200b 100644
--- a/src/WixToolset.Core/Decompiler.cs
+++ b/src/WixToolset.Core/Decompiler.cs
@@ -19,7 +19,7 @@ namespace WixToolset.Core
19 19
20 public IServiceProvider ServiceProvider { get; } 20 public IServiceProvider ServiceProvider { get; }
21 21
22 public DecompileResult Decompile(IDecompileContext context) 22 public IDecompileResult Decompile(IDecompileContext context)
23 { 23 {
24 // Pre-decompile. 24 // Pre-decompile.
25 // 25 //
@@ -45,7 +45,7 @@ namespace WixToolset.Core
45 return result; 45 return result;
46 } 46 }
47 47
48 private DecompileResult BackendDecompile(IDecompileContext context) 48 private IDecompileResult BackendDecompile(IDecompileContext context)
49 { 49 {
50 var extensionManager = context.ServiceProvider.GetService<IExtensionManager>(); 50 var extensionManager = context.ServiceProvider.GetService<IExtensionManager>();
51 51
diff --git a/src/WixToolset.Core/ExtensibilityServices/ParseHelper.cs b/src/WixToolset.Core/ExtensibilityServices/ParseHelper.cs
index f62f8f10..dce77781 100644
--- a/src/WixToolset.Core/ExtensibilityServices/ParseHelper.cs
+++ b/src/WixToolset.Core/ExtensibilityServices/ParseHelper.cs
@@ -1,4 +1,4 @@
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
3namespace WixToolset.Core.ExtensibilityServices 3namespace WixToolset.Core.ExtensibilityServices
4{ 4{
@@ -777,9 +777,9 @@ namespace WixToolset.Core.ExtensibilityServices
777 } 777 }
778 } 778 }
779 779
780 public ComponentKeyPath ParsePossibleKeyPathExtensionElement(IEnumerable<ICompilerExtension> extensions, Intermediate intermediate, IntermediateSection section, XElement parentElement, XElement element, IDictionary<string, string> context) 780 public IComponentKeyPath ParsePossibleKeyPathExtensionElement(IEnumerable<ICompilerExtension> extensions, Intermediate intermediate, IntermediateSection section, XElement parentElement, XElement element, IDictionary<string, string> context)
781 { 781 {
782 ComponentKeyPath keyPath = null; 782 IComponentKeyPath keyPath = null;
783 783
784 if (ParseHelper.TryFindExtension(extensions, element.Name.Namespace, out var extension)) 784 if (ParseHelper.TryFindExtension(extensions, element.Name.Namespace, out var extension))
785 { 785 {
diff --git a/src/WixToolset.Core/IBinder.cs b/src/WixToolset.Core/IBinder.cs
index 884ee6b9..c2ebc2a0 100644
--- a/src/WixToolset.Core/IBinder.cs
+++ b/src/WixToolset.Core/IBinder.cs
@@ -1,4 +1,4 @@
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
3namespace WixToolset.Core 3namespace WixToolset.Core
4{ 4{
@@ -6,6 +6,6 @@ namespace WixToolset.Core
6 6
7 public interface IBinder 7 public interface IBinder
8 { 8 {
9 BindResult Bind(IBindContext context); 9 IBindResult Bind(IBindContext context);
10 } 10 }
11} 11}
diff --git a/src/WixToolset.Core/IDecompiler.cs b/src/WixToolset.Core/IDecompiler.cs
index 82b02943..05b04be2 100644
--- a/src/WixToolset.Core/IDecompiler.cs
+++ b/src/WixToolset.Core/IDecompiler.cs
@@ -6,6 +6,6 @@ namespace WixToolset.Core
6 6
7 public interface IDecompiler 7 public interface IDecompiler
8 { 8 {
9 DecompileResult Decompile(IDecompileContext context); 9 IDecompileResult Decompile(IDecompileContext context);
10 } 10 }
11} 11}
diff --git a/src/WixToolset.Core/IResolver.cs b/src/WixToolset.Core/IResolver.cs
index a027f348..c5b2568f 100644
--- a/src/WixToolset.Core/IResolver.cs
+++ b/src/WixToolset.Core/IResolver.cs
@@ -1,4 +1,4 @@
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
3namespace WixToolset.Core 3namespace WixToolset.Core
4{ 4{
@@ -6,6 +6,6 @@ namespace WixToolset.Core
6 6
7 public interface IResolver 7 public interface IResolver
8 { 8 {
9 ResolveResult Resolve(IResolveContext context); 9 IResolveResult Resolve(IResolveContext context);
10 } 10 }
11} 11}
diff --git a/src/WixToolset.Core/LibraryContext.cs b/src/WixToolset.Core/LibraryContext.cs
index e61b6ce8..5dd17dc8 100644
--- a/src/WixToolset.Core/LibraryContext.cs
+++ b/src/WixToolset.Core/LibraryContext.cs
@@ -1,4 +1,4 @@
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
3namespace WixToolset.Core 3namespace WixToolset.Core
4{ 4{
@@ -22,7 +22,7 @@ namespace WixToolset.Core
22 22
23 public bool BindFiles { get; set; } 23 public bool BindFiles { get; set; }
24 24
25 public IEnumerable<BindPath> BindPaths { get; set; } 25 public IEnumerable<IBindPath> BindPaths { get; set; }
26 26
27 public IEnumerable<ILibrarianExtension> Extensions { get; set; } 27 public IEnumerable<ILibrarianExtension> Extensions { get; set; }
28 28
diff --git a/src/WixToolset.Core/ResolveContext.cs b/src/WixToolset.Core/ResolveContext.cs
index cadc6678..1801f820 100644
--- a/src/WixToolset.Core/ResolveContext.cs
+++ b/src/WixToolset.Core/ResolveContext.cs
@@ -1,4 +1,4 @@
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
3namespace WixToolset.Core 3namespace WixToolset.Core
4{ 4{
@@ -18,7 +18,7 @@ namespace WixToolset.Core
18 18
19 public IServiceProvider ServiceProvider { get; } 19 public IServiceProvider ServiceProvider { get; }
20 20
21 public IEnumerable<BindPath> BindPaths { get; set; } 21 public IEnumerable<IBindPath> BindPaths { get; set; }
22 22
23 public IEnumerable<IResolverExtension> Extensions { get; set; } 23 public IEnumerable<IResolverExtension> Extensions { get; set; }
24 24
diff --git a/src/WixToolset.Core/ResolveFileResult.cs b/src/WixToolset.Core/ResolveFileResult.cs
new file mode 100644
index 00000000..e36c474a
--- /dev/null
+++ b/src/WixToolset.Core/ResolveFileResult.cs
@@ -0,0 +1,14 @@
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
3namespace WixToolset.Core
4{
5 using System.Collections.Generic;
6 using WixToolset.Extensibility.Data;
7
8 public class ResolveFileResult : IResolveFileResult
9 {
10 public string Path { get; set; }
11
12 public IEnumerable<string> CheckedPaths { get; set; }
13 }
14}
diff --git a/src/WixToolset.Core/ResolveResult.cs b/src/WixToolset.Core/ResolveResult.cs
new file mode 100644
index 00000000..6b6bc7c4
--- /dev/null
+++ b/src/WixToolset.Core/ResolveResult.cs
@@ -0,0 +1,19 @@
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
3namespace WixToolset.Core
4{
5 using System.Collections.Generic;
6 using WixToolset.Data;
7 using WixToolset.Extensibility.Data;
8
9 internal class ResolveResult : IResolveResult
10 {
11 public int Codepage { get; set; }
12
13 public IEnumerable<IDelayedField> DelayedFields { get; set; }
14
15 public IEnumerable<IExpectedExtractFile> ExpectedEmbeddedFiles { get; set; }
16
17 public Intermediate IntermediateRepresentation { get; set; }
18 }
19}
diff --git a/src/WixToolset.Core/ResolvedCabinet.cs b/src/WixToolset.Core/ResolvedCabinet.cs
new file mode 100644
index 00000000..9304b413
--- /dev/null
+++ b/src/WixToolset.Core/ResolvedCabinet.cs
@@ -0,0 +1,22 @@
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
3namespace WixToolset.Core
4{
5 using WixToolset.Extensibility.Data;
6
7 /// <summary>
8 /// Data returned from build file manager ResolveCabinet callback.
9 /// </summary>
10 public class ResolvedCabinet : IResolvedCabinet
11 {
12 /// <summary>
13 /// Gets or sets the build option for the resolved cabinet.
14 /// </summary>
15 public CabinetBuildOption BuildOption { get; set; }
16
17 /// <summary>
18 /// Gets or sets the path for the resolved cabinet.
19 /// </summary>
20 public string Path { get; set; }
21 }
22}
diff --git a/src/WixToolset.Core/Resolver.cs b/src/WixToolset.Core/Resolver.cs
index 98101f16..c69c4f68 100644
--- a/src/WixToolset.Core/Resolver.cs
+++ b/src/WixToolset.Core/Resolver.cs
@@ -28,7 +28,7 @@ namespace WixToolset.Core
28 28
29 private IMessaging Messaging { get; } 29 private IMessaging Messaging { get; }
30 30
31 public IEnumerable<BindPath> BindPaths { get; set; } 31 public IEnumerable<IBindPath> BindPaths { get; set; }
32 32
33 public string IntermediateFolder { get; set; } 33 public string IntermediateFolder { get; set; }
34 34
@@ -38,7 +38,7 @@ namespace WixToolset.Core
38 38
39 public IEnumerable<string> FilterCultures { get; set; } 39 public IEnumerable<string> FilterCultures { get; set; }
40 40
41 public ResolveResult Resolve(IResolveContext context) 41 public IResolveResult Resolve(IResolveContext context)
42 { 42 {
43 43
44 foreach (var extension in context.Extensions) 44 foreach (var extension in context.Extensions)
diff --git a/src/WixToolset.Core/VariableResolution.cs b/src/WixToolset.Core/VariableResolution.cs
new file mode 100644
index 00000000..3b34e294
--- /dev/null
+++ b/src/WixToolset.Core/VariableResolution.cs
@@ -0,0 +1,29 @@
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
3namespace WixToolset.Core
4{
5 using WixToolset.Extensibility.Services;
6
7 internal class VariableResolution : IVariableResolution
8 {
9 /// <summary>
10 /// Indicates whether the variable should be delay resolved.
11 /// </summary>
12 public bool DelayedResolve { get; set; }
13
14 /// <summary>
15 /// Indicates whether the value is the default value of the variable.
16 /// </summary>
17 public bool IsDefault { get; set; }
18
19 /// <summary>
20 /// Indicates whether the value changed.
21 /// </summary>
22 public bool UpdatedValue { get; set; }
23
24 /// <summary>
25 /// Resolved value.
26 /// </summary>
27 public string Value { get; set; }
28 }
29} \ No newline at end of file
diff --git a/src/WixToolset.Core/VariableResolver.cs b/src/WixToolset.Core/VariableResolver.cs
index eb65d3d6..de722613 100644
--- a/src/WixToolset.Core/VariableResolver.cs
+++ b/src/WixToolset.Core/VariableResolver.cs
@@ -23,6 +23,7 @@ namespace WixToolset.Core
23 /// </summary> 23 /// </summary>
24 internal VariableResolver(IServiceProvider serviceProvider) 24 internal VariableResolver(IServiceProvider serviceProvider)
25 { 25 {
26 this.ServiceProvider = serviceProvider;
26 this.Messaging = serviceProvider.GetService<IMessaging>(); 27 this.Messaging = serviceProvider.GetService<IMessaging>();
27 28
28 this.locVariables = new Dictionary<string, BindVariable>(); 29 this.locVariables = new Dictionary<string, BindVariable>();
@@ -31,6 +32,8 @@ namespace WixToolset.Core
31 this.Codepage = -1; 32 this.Codepage = -1;
32 } 33 }
33 34
35 private IServiceProvider ServiceProvider { get; }
36
34 private IMessaging Messaging { get; } 37 private IMessaging Messaging { get; }
35 38
36 public int Codepage { get; private set; } 39 public int Codepage { get; private set; }
@@ -71,7 +74,7 @@ namespace WixToolset.Core
71 } 74 }
72 } 75 }
73 76
74 public VariableResolution ResolveVariables(SourceLineNumber sourceLineNumbers, string value, bool localizationOnly) 77 public IVariableResolution ResolveVariables(SourceLineNumber sourceLineNumbers, string value, bool localizationOnly)
75 { 78 {
76 return this.ResolveVariables(sourceLineNumbers, value, localizationOnly, true); 79 return this.ResolveVariables(sourceLineNumbers, value, localizationOnly, true);
77 } 80 }
@@ -90,12 +93,14 @@ namespace WixToolset.Core
90 /// <param name="localizationOnly">true to only resolve localization variables; false otherwise.</param> 93 /// <param name="localizationOnly">true to only resolve localization variables; false otherwise.</param>
91 /// <param name="errorOnUnknown">true if unknown variables should throw errors.</param> 94 /// <param name="errorOnUnknown">true if unknown variables should throw errors.</param>
92 /// <returns>The resolved value.</returns> 95 /// <returns>The resolved value.</returns>
93 internal VariableResolution ResolveVariables(SourceLineNumber sourceLineNumbers, string value, bool localizationOnly, bool errorOnUnknown) 96 internal IVariableResolution ResolveVariables(SourceLineNumber sourceLineNumbers, string value, bool localizationOnly, bool errorOnUnknown)
94 { 97 {
95 var matches = Common.WixVariableRegex.Matches(value); 98 var matches = Common.WixVariableRegex.Matches(value);
96 99
97 // the value is the default unless its substituted further down 100 // the value is the default unless its substituted further down
98 var result = new VariableResolution { IsDefault = true, Value = value }; 101 var result = this.ServiceProvider.GetService<IVariableResolution>();
102 result.IsDefault = true;
103 result.Value = value;
99 104
100 if (0 < matches.Count) 105 if (0 < matches.Count)
101 { 106 {
diff --git a/src/WixToolset.Core/WixToolsetServiceProvider.cs b/src/WixToolset.Core/WixToolsetServiceProvider.cs
index 49d4b3fe..d29d4e3f 100644
--- a/src/WixToolset.Core/WixToolsetServiceProvider.cs
+++ b/src/WixToolset.Core/WixToolsetServiceProvider.cs
@@ -40,6 +40,15 @@ namespace WixToolset.Core
40 this.AddService<ILayoutContext>((provider, singletons) => new LayoutContext(provider)); 40 this.AddService<ILayoutContext>((provider, singletons) => new LayoutContext(provider));
41 this.AddService<IInscribeContext>((provider, singletons) => new InscribeContext(provider)); 41 this.AddService<IInscribeContext>((provider, singletons) => new InscribeContext(provider));
42 42
43 this.AddService<IBindFileWithPath>((provider, singletons) => new BindFileWithPath());
44 this.AddService<IBindPath>((provider, singletons) => new BindPath());
45 this.AddService<IBindResult>((provider, singletons) => new BindResult());
46 this.AddService<IComponentKeyPath>((provider, singletons) => new ComponentKeyPath());
47 this.AddService<IDecompileResult>((provider, singletons) => new DecompileResult());
48 this.AddService<IResolveResult>((provider, singletons) => new ResolveResult());
49 this.AddService<IResolvedCabinet>((provider, singletons) => new ResolvedCabinet());
50 this.AddService<IVariableResolution>((provider, singletons) => new VariableResolution());
51
43 this.AddService<IBinder>((provider, singletons) => new Binder(provider)); 52 this.AddService<IBinder>((provider, singletons) => new Binder(provider));
44 this.AddService<ICompiler>((provider, singletons) => new Compiler(provider)); 53 this.AddService<ICompiler>((provider, singletons) => new Compiler(provider));
45 this.AddService<IDecompiler>((provider, singletons) => new Decompiler(provider)); 54 this.AddService<IDecompiler>((provider, singletons) => new Decompiler(provider));
@@ -59,7 +68,10 @@ namespace WixToolset.Core
59 68
60 public bool TryGetService(Type serviceType, out object service) 69 public bool TryGetService(Type serviceType, out object service)
61 { 70 {
62 if (serviceType == null) throw new ArgumentNullException(nameof(serviceType)); 71 if (serviceType == null)
72 {
73 throw new ArgumentNullException(nameof(serviceType));
74 }
63 75
64 if (!this.Singletons.TryGetValue(serviceType, out service)) 76 if (!this.Singletons.TryGetValue(serviceType, out service))
65 { 77 {