diff options
| author | Rob Mensching <rob@firegiant.com> | 2022-09-03 16:08:33 -0700 |
|---|---|---|
| committer | Rob Mensching <rob@firegiant.com> | 2022-09-23 09:50:52 -0700 |
| commit | 63b588262aa0b7869741aa888905c1eeda7ae2f8 (patch) | |
| tree | 54ec7ccb6e1a6f4859d3d2f0bbd8c79cff50b1ed /src/api | |
| parent | db2fe6554f449a108b77cd3d2c7f30a68d54ddc2 (diff) | |
| download | wix-63b588262aa0b7869741aa888905c1eeda7ae2f8.tar.gz wix-63b588262aa0b7869741aa888905c1eeda7ae2f8.tar.bz2 wix-63b588262aa0b7869741aa888905c1eeda7ae2f8.zip | |
Implement single pass patch build
This new implementation of patching in WiX v4 creates an MSP's transforms and
MSP file in a single pass. This single pass allows the build to use MSI as the
source of files for diffing purposes.
Completes 6401
Fixes 4629
Diffstat (limited to 'src/api')
8 files changed, 70 insertions, 78 deletions
diff --git a/src/api/wix/WixToolset.Data/ErrorMessages.cs b/src/api/wix/WixToolset.Data/ErrorMessages.cs index 40378a2e..77ce73aa 100644 --- a/src/api/wix/WixToolset.Data/ErrorMessages.cs +++ b/src/api/wix/WixToolset.Data/ErrorMessages.cs | |||
| @@ -651,7 +651,8 @@ namespace WixToolset.Data | |||
| 651 | public static Message FileNotFound(SourceLineNumber sourceLineNumbers, string file, string fileType, IEnumerable<string> checkedPaths) | 651 | public static Message FileNotFound(SourceLineNumber sourceLineNumbers, string file, string fileType, IEnumerable<string> checkedPaths) |
| 652 | { | 652 | { |
| 653 | var combinedCheckedPaths = String.Join(", ", checkedPaths); | 653 | var combinedCheckedPaths = String.Join(", ", checkedPaths); |
| 654 | return Message(sourceLineNumbers, Ids.FileNotFound, "The system cannot find the file '{0}' with type '{1}'. The following paths were checked: {2}", file, fileType, combinedCheckedPaths); | 654 | var withType = String.IsNullOrEmpty(fileType) ? String.Empty : $" with type '{fileType}'"; |
| 655 | return Message(sourceLineNumbers, Ids.FileNotFound, "The system cannot find the file '{0}'{1}. The following paths were checked: {2}", file, withType, combinedCheckedPaths); | ||
| 655 | } | 656 | } |
| 656 | 657 | ||
| 657 | public static Message FileOrDirectoryPathRequired(string parameter) | 658 | public static Message FileOrDirectoryPathRequired(string parameter) |
diff --git a/src/api/wix/WixToolset.Data/Symbols/WixPatchBaselineSymbol.cs b/src/api/wix/WixToolset.Data/Symbols/WixPatchBaselineSymbol.cs index d7295424..cbf51e2e 100644 --- a/src/api/wix/WixToolset.Data/Symbols/WixPatchBaselineSymbol.cs +++ b/src/api/wix/WixToolset.Data/Symbols/WixPatchBaselineSymbol.cs | |||
| @@ -14,7 +14,6 @@ namespace WixToolset.Data | |||
| 14 | new IntermediateFieldDefinition(nameof(WixPatchBaselineSymbolFields.ValidationFlags), IntermediateFieldType.Number), | 14 | new IntermediateFieldDefinition(nameof(WixPatchBaselineSymbolFields.ValidationFlags), IntermediateFieldType.Number), |
| 15 | new IntermediateFieldDefinition(nameof(WixPatchBaselineSymbolFields.BaselineFile), IntermediateFieldType.Path), | 15 | new IntermediateFieldDefinition(nameof(WixPatchBaselineSymbolFields.BaselineFile), IntermediateFieldType.Path), |
| 16 | new IntermediateFieldDefinition(nameof(WixPatchBaselineSymbolFields.UpdateFile), IntermediateFieldType.Path), | 16 | new IntermediateFieldDefinition(nameof(WixPatchBaselineSymbolFields.UpdateFile), IntermediateFieldType.Path), |
| 17 | new IntermediateFieldDefinition(nameof(WixPatchBaselineSymbolFields.TransformFile), IntermediateFieldType.Path), | ||
| 18 | }, | 17 | }, |
| 19 | typeof(WixPatchBaselineSymbol)); | 18 | typeof(WixPatchBaselineSymbol)); |
| 20 | } | 19 | } |
| @@ -28,7 +27,6 @@ namespace WixToolset.Data.Symbols | |||
| 28 | ValidationFlags, | 27 | ValidationFlags, |
| 29 | BaselineFile, | 28 | BaselineFile, |
| 30 | UpdateFile, | 29 | UpdateFile, |
| 31 | TransformFile, | ||
| 32 | } | 30 | } |
| 33 | 31 | ||
| 34 | public class WixPatchBaselineSymbol : IntermediateSymbol | 32 | public class WixPatchBaselineSymbol : IntermediateSymbol |
| @@ -66,11 +64,5 @@ namespace WixToolset.Data.Symbols | |||
| 66 | get => this.Fields[(int)WixPatchBaselineSymbolFields.UpdateFile].AsPath(); | 64 | get => this.Fields[(int)WixPatchBaselineSymbolFields.UpdateFile].AsPath(); |
| 67 | set => this.Set((int)WixPatchBaselineSymbolFields.UpdateFile, value); | 65 | set => this.Set((int)WixPatchBaselineSymbolFields.UpdateFile, value); |
| 68 | } | 66 | } |
| 69 | |||
| 70 | public IntermediateFieldPathValue TransformFile | ||
| 71 | { | ||
| 72 | get => this.Fields[(int)WixPatchBaselineSymbolFields.TransformFile].AsPath(); | ||
| 73 | set => this.Set((int)WixPatchBaselineSymbolFields.TransformFile, value); | ||
| 74 | } | ||
| 75 | } | 67 | } |
| 76 | } | 68 | } |
diff --git a/src/api/wix/WixToolset.Extensibility/Data/IBindContext.cs b/src/api/wix/WixToolset.Extensibility/Data/IBindContext.cs index 671da292..9d663c65 100644 --- a/src/api/wix/WixToolset.Extensibility/Data/IBindContext.cs +++ b/src/api/wix/WixToolset.Extensibility/Data/IBindContext.cs | |||
| @@ -18,6 +18,11 @@ namespace WixToolset.Extensibility.Data | |||
| 18 | IServiceProvider ServiceProvider { get; } | 18 | IServiceProvider ServiceProvider { get; } |
| 19 | 19 | ||
| 20 | /// <summary> | 20 | /// <summary> |
| 21 | /// Bind paths used during resolution. | ||
| 22 | /// </summary> | ||
| 23 | IReadOnlyCollection<IBindPath> BindPaths { get; set; } | ||
| 24 | |||
| 25 | /// <summary> | ||
| 21 | /// Counnt of threads to use in cabbing. | 26 | /// Counnt of threads to use in cabbing. |
| 22 | /// </summary> | 27 | /// </summary> |
| 23 | int CabbingThreadCount { get; set; } | 28 | int CabbingThreadCount { get; set; } |
diff --git a/src/api/wix/WixToolset.Extensibility/Data/IFileFacade.cs b/src/api/wix/WixToolset.Extensibility/Data/IFileFacade.cs index fea00d4e..8a9e3fee 100644 --- a/src/api/wix/WixToolset.Extensibility/Data/IFileFacade.cs +++ b/src/api/wix/WixToolset.Extensibility/Data/IFileFacade.cs | |||
| @@ -5,34 +5,13 @@ namespace WixToolset.Extensibility.Data | |||
| 5 | using System.Collections.Generic; | 5 | using System.Collections.Generic; |
| 6 | using WixToolset.Data; | 6 | using WixToolset.Data; |
| 7 | using WixToolset.Data.Symbols; | 7 | using WixToolset.Data.Symbols; |
| 8 | using WixToolset.Data.WindowsInstaller.Rows; | ||
| 9 | 8 | ||
| 10 | /// <summary> | 9 | /// <summary> |
| 11 | /// Interface that provides a common facade over <c>FileSymbol</c> and <c>FileRow</c>. | 10 | /// Interface that provides a common facade over file information. |
| 12 | /// </summary> | 11 | /// </summary> |
| 13 | public interface IFileFacade | 12 | public interface IFileFacade |
| 14 | { | 13 | { |
| 15 | /// <summary> | 14 | /// <summary> |
| 16 | /// Reference to assembly application for this file. | ||
| 17 | /// </summary> | ||
| 18 | string AssemblyApplicationFileRef { get; } | ||
| 19 | |||
| 20 | /// <summary> | ||
| 21 | /// Reference to assembly manifest for this file. | ||
| 22 | /// </summary> | ||
| 23 | string AssemblyManifestFileRef { get; } | ||
| 24 | |||
| 25 | /// <summary> | ||
| 26 | /// List of assembly name values in the file. | ||
| 27 | /// </summary> | ||
| 28 | List<MsiAssemblyNameSymbol> AssemblyNames { get; set; } | ||
| 29 | |||
| 30 | /// <summary> | ||
| 31 | /// Optionally indicates what sort of assembly the file is. | ||
| 32 | /// </summary> | ||
| 33 | AssemblyType? AssemblyType { get; } | ||
| 34 | |||
| 35 | /// <summary> | ||
| 36 | /// Component containing the file. | 15 | /// Component containing the file. |
| 37 | /// </summary> | 16 | /// </summary> |
| 38 | string ComponentRef { get; } | 17 | string ComponentRef { get; } |
| @@ -58,21 +37,6 @@ namespace WixToolset.Extensibility.Data | |||
| 58 | int FileSize { get; set; } | 37 | int FileSize { get; set; } |
| 59 | 38 | ||
| 60 | /// <summary> | 39 | /// <summary> |
| 61 | /// Indicates whether the file came from a merge module. | ||
| 62 | /// </summary> | ||
| 63 | bool FromModule { get; } | ||
| 64 | |||
| 65 | /// <summary> | ||
| 66 | /// Indicates whether the file came from a transform. | ||
| 67 | /// </summary> | ||
| 68 | bool FromTransform { get; } | ||
| 69 | |||
| 70 | /// <summary> | ||
| 71 | /// Hash symbol of the file. | ||
| 72 | /// </summary> | ||
| 73 | MsiFileHashSymbol Hash { get; set; } | ||
| 74 | |||
| 75 | /// <summary> | ||
| 76 | /// Underlying identifier of the file. | 40 | /// Underlying identifier of the file. |
| 77 | /// </summary> | 41 | /// </summary> |
| 78 | Identifier Identifier { get; } | 42 | Identifier Identifier { get; } |
| @@ -118,9 +82,13 @@ namespace WixToolset.Extensibility.Data | |||
| 118 | string Version { get; set; } | 82 | string Version { get; set; } |
| 119 | 83 | ||
| 120 | /// <summary> | 84 | /// <summary> |
| 121 | /// Gets the underlying <c>FileRow</c> if one is present. | 85 | /// Calculated hash of the file. |
| 86 | /// </summary> | ||
| 87 | MsiFileHashSymbol MsiFileHashSymbol { get; set; } | ||
| 88 | |||
| 89 | /// <summary> | ||
| 90 | /// Assembly names found in the file. | ||
| 122 | /// </summary> | 91 | /// </summary> |
| 123 | /// <returns><c>FileRow</c> if one is present, otherwise throws.</returns> | 92 | ICollection<MsiAssemblyNameSymbol> AssemblyNameSymbols { get; } |
| 124 | FileRow GetFileRow(); | ||
| 125 | } | 93 | } |
| 126 | } | 94 | } |
diff --git a/src/api/wix/WixToolset.Extensibility/Data/IWindowsInstallerDecompileContext.cs b/src/api/wix/WixToolset.Extensibility/Data/IWindowsInstallerDecompileContext.cs index 27d30a5a..7b974942 100644 --- a/src/api/wix/WixToolset.Extensibility/Data/IWindowsInstallerDecompileContext.cs +++ b/src/api/wix/WixToolset.Extensibility/Data/IWindowsInstallerDecompileContext.cs | |||
| @@ -63,11 +63,6 @@ namespace WixToolset.Extensibility.Data | |||
| 63 | string IntermediateFolder { get; set; } | 63 | string IntermediateFolder { get; set; } |
| 64 | 64 | ||
| 65 | /// <summary> | 65 | /// <summary> |
| 66 | /// Gets or sets whether the decompiler admin image. | ||
| 67 | /// </summary> | ||
| 68 | bool IsAdminImage { get; set; } | ||
| 69 | |||
| 70 | /// <summary> | ||
| 71 | /// Gets or sets where to output the result. | 66 | /// Gets or sets where to output the result. |
| 72 | /// </summary> | 67 | /// </summary> |
| 73 | string OutputPath { get; set; } | 68 | string OutputPath { get; set; } |
diff --git a/src/api/wix/WixToolset.Extensibility/Services/IBackendHelper.cs b/src/api/wix/WixToolset.Extensibility/Services/IBackendHelper.cs index eff42b99..8bb1b2d6 100644 --- a/src/api/wix/WixToolset.Extensibility/Services/IBackendHelper.cs +++ b/src/api/wix/WixToolset.Extensibility/Services/IBackendHelper.cs | |||
| @@ -5,8 +5,6 @@ namespace WixToolset.Extensibility.Services | |||
| 5 | using System; | 5 | using System; |
| 6 | using System.Collections.Generic; | 6 | using System.Collections.Generic; |
| 7 | using WixToolset.Data; | 7 | using WixToolset.Data; |
| 8 | using WixToolset.Data.Symbols; | ||
| 9 | using WixToolset.Data.WindowsInstaller.Rows; | ||
| 10 | using WixToolset.Extensibility.Data; | 8 | using WixToolset.Extensibility.Data; |
| 11 | 9 | ||
| 12 | /// <summary> | 10 | /// <summary> |
| @@ -15,28 +13,6 @@ namespace WixToolset.Extensibility.Services | |||
| 15 | public interface IBackendHelper : ILayoutServices | 13 | public interface IBackendHelper : ILayoutServices |
| 16 | { | 14 | { |
| 17 | /// <summary> | 15 | /// <summary> |
| 18 | /// Creates a file facade from a <c>FileSymbol</c> and possible <c>AssemblySymbol</c>. | ||
| 19 | /// </summary> | ||
| 20 | /// <param name="file"><c>FileSymbol</c> backing the facade.</param> | ||
| 21 | /// <param name="assembly"><c>AssemblySymbol</c> backing the facade.</param> | ||
| 22 | /// <returns></returns> | ||
| 23 | IFileFacade CreateFileFacade(FileSymbol file, AssemblySymbol assembly); | ||
| 24 | |||
| 25 | /// <summary> | ||
| 26 | /// Creates a file facade from a File row. | ||
| 27 | /// </summary> | ||
| 28 | /// <param name="fileRow"><c>FileRow</c> </param> | ||
| 29 | /// <returns>New <c>IFileFacade</c>.</returns> | ||
| 30 | IFileFacade CreateFileFacade(FileRow fileRow); | ||
| 31 | |||
| 32 | /// <summary> | ||
| 33 | /// Creates a file facade from a Merge Module's File symbol. | ||
| 34 | /// </summary> | ||
| 35 | /// <param name="fileSymbol"><c>FileSymbol</c> created from a Merge Module.</param> | ||
| 36 | /// <returns>New <c>IFileFacade</c>.</returns> | ||
| 37 | IFileFacade CreateFileFacadeFromMergeModule(FileSymbol fileSymbol); | ||
| 38 | |||
| 39 | /// <summary> | ||
| 40 | /// Creates a MSI compatible GUID. | 16 | /// Creates a MSI compatible GUID. |
| 41 | /// </summary> | 17 | /// </summary> |
| 42 | /// <returns>Creates an uppercase GUID with braces.</returns> | 18 | /// <returns>Creates an uppercase GUID with braces.</returns> |
diff --git a/src/api/wix/WixToolset.Extensibility/Services/IFileResolver.cs b/src/api/wix/WixToolset.Extensibility/Services/IFileResolver.cs new file mode 100644 index 00000000..2804cc28 --- /dev/null +++ b/src/api/wix/WixToolset.Extensibility/Services/IFileResolver.cs | |||
| @@ -0,0 +1,38 @@ | |||
| 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 | |||
| 3 | namespace WixToolset.Extensibility.Services | ||
| 4 | { | ||
| 5 | using System.Collections.Generic; | ||
| 6 | using WixToolset.Data; | ||
| 7 | using WixToolset.Extensibility.Data; | ||
| 8 | |||
| 9 | /// <summary> | ||
| 10 | /// Interface to resolve file paths using extensions and bind paths. | ||
| 11 | /// </summary> | ||
| 12 | public interface IFileResolver | ||
| 13 | { | ||
| 14 | /// <summary> | ||
| 15 | /// Resolves the source path of a file using binder extensions. | ||
| 16 | /// </summary> | ||
| 17 | /// <param name="source">Original source value.</param> | ||
| 18 | /// <param name="librarianExtensions">Extensions used to resolve the file path.</param> | ||
| 19 | /// <param name="bindPaths">Collection of bind paths for the binding stage.</param> | ||
| 20 | /// <param name="sourceLineNumbers">Optional source line of source file being resolved.</param> | ||
| 21 | /// <param name="symbolDefinition">Optional type of source file being resolved.</param> | ||
| 22 | /// <returns>Should return a valid path for the stream to be imported.</returns> | ||
| 23 | string ResolveFile(string source, IEnumerable<ILibrarianExtension> librarianExtensions, IEnumerable<IBindPath> bindPaths, SourceLineNumber sourceLineNumbers, IntermediateSymbolDefinition symbolDefinition); | ||
| 24 | |||
| 25 | /// <summary> | ||
| 26 | /// Resolves the source path of a file using binder extensions. | ||
| 27 | /// </summary> | ||
| 28 | /// <param name="source">Original source value.</param> | ||
| 29 | /// <param name="resolverExtensions">Extensions used to resolve the file path.</param> | ||
| 30 | /// <param name="bindPaths">Collection of bind paths for the binding stage.</param> | ||
| 31 | /// <param name="bindStage">The binding stage used to determine what collection of bind paths will be used</param> | ||
| 32 | /// <param name="sourceLineNumbers">Optional source line of source file being resolved.</param> | ||
| 33 | /// <param name="symbolDefinition">Optional type of source file being resolved.</param> | ||
| 34 | /// <param name="alreadyCheckedPaths">Optional collection of paths already checked.</param> | ||
| 35 | /// <returns>Should return a valid path for the stream to be imported.</returns> | ||
| 36 | string ResolveFile(string source, IEnumerable<IResolverExtension> resolverExtensions, IEnumerable<IBindPath> bindPaths, BindStage bindStage, SourceLineNumber sourceLineNumbers, IntermediateSymbolDefinition symbolDefinition, IEnumerable<string> alreadyCheckedPaths = null); | ||
| 37 | } | ||
| 38 | } | ||
diff --git a/src/api/wix/WixToolset.Extensibility/Services/IWindowsInstallerBackendHelper.cs b/src/api/wix/WixToolset.Extensibility/Services/IWindowsInstallerBackendHelper.cs index 81325131..2216e957 100644 --- a/src/api/wix/WixToolset.Extensibility/Services/IWindowsInstallerBackendHelper.cs +++ b/src/api/wix/WixToolset.Extensibility/Services/IWindowsInstallerBackendHelper.cs | |||
| @@ -3,7 +3,10 @@ | |||
| 3 | namespace WixToolset.Extensibility.Services | 3 | namespace WixToolset.Extensibility.Services |
| 4 | { | 4 | { |
| 5 | using WixToolset.Data; | 5 | using WixToolset.Data; |
| 6 | using WixToolset.Data.Symbols; | ||
| 6 | using WixToolset.Data.WindowsInstaller; | 7 | using WixToolset.Data.WindowsInstaller; |
| 8 | using WixToolset.Data.WindowsInstaller.Rows; | ||
| 9 | using WixToolset.Extensibility.Data; | ||
| 7 | 10 | ||
| 8 | /// <summary> | 11 | /// <summary> |
| 9 | /// Interface provided to help Windows Installer backend extensions. | 12 | /// Interface provided to help Windows Installer backend extensions. |
| @@ -11,6 +14,20 @@ namespace WixToolset.Extensibility.Services | |||
| 11 | public interface IWindowsInstallerBackendHelper : IBackendHelper | 14 | public interface IWindowsInstallerBackendHelper : IBackendHelper |
| 12 | { | 15 | { |
| 13 | /// <summary> | 16 | /// <summary> |
| 17 | /// Creates a file facade from a <c>FileSymbol</c>. | ||
| 18 | /// </summary> | ||
| 19 | /// <param name="file"><c>FileSymbol</c> backing the facade.</param> | ||
| 20 | /// <returns></returns> | ||
| 21 | IFileFacade CreateFileFacade(FileSymbol file); | ||
| 22 | |||
| 23 | /// <summary> | ||
| 24 | /// Creates a file facade from a File row. | ||
| 25 | /// </summary> | ||
| 26 | /// <param name="fileRow"><c>FileRow</c></param> | ||
| 27 | /// <returns>New <c>IFileFacade</c>.</returns> | ||
| 28 | IFileFacade CreateFileFacade(FileRow fileRow); | ||
| 29 | |||
| 30 | /// <summary> | ||
| 14 | /// Creates a <see cref="Row"/> in the specified table. | 31 | /// Creates a <see cref="Row"/> in the specified table. |
| 15 | /// </summary> | 32 | /// </summary> |
| 16 | /// <param name="section">Parent section.</param> | 33 | /// <param name="section">Parent section.</param> |
