diff options
| author | Rob Mensching <rob@firegiant.com> | 2020-01-24 15:27:20 -0800 |
|---|---|---|
| committer | Rob Mensching <rob@firegiant.com> | 2020-02-05 16:15:47 -0800 |
| commit | 6ff680e386b1543ad1a58d1b1d465ce8aa20bc7d (patch) | |
| tree | c717333cd10d5592e59dfb898b391275bba1f389 /src/WixToolset.Core/Bind | |
| parent | 6e2e67ab55c75f4655397588c0dcc64f50d22f92 (diff) | |
| download | wix-6ff680e386b1543ad1a58d1b1d465ce8aa20bc7d.tar.gz wix-6ff680e386b1543ad1a58d1b1d465ce8aa20bc7d.tar.bz2 wix-6ff680e386b1543ad1a58d1b1d465ce8aa20bc7d.zip | |
Start on new patch infrastructure
Diffstat (limited to 'src/WixToolset.Core/Bind')
| -rw-r--r-- | src/WixToolset.Core/Bind/FileFacade.cs | 128 | ||||
| -rw-r--r-- | src/WixToolset.Core/Bind/ResolveFieldsCommand.cs | 8 |
2 files changed, 125 insertions, 11 deletions
diff --git a/src/WixToolset.Core/Bind/FileFacade.cs b/src/WixToolset.Core/Bind/FileFacade.cs index d631a3b5..7bfdb9bb 100644 --- a/src/WixToolset.Core/Bind/FileFacade.cs +++ b/src/WixToolset.Core/Bind/FileFacade.cs | |||
| @@ -2,32 +2,146 @@ | |||
| 2 | 2 | ||
| 3 | namespace WixToolset.Core.Bind | 3 | namespace WixToolset.Core.Bind |
| 4 | { | 4 | { |
| 5 | using System; | ||
| 5 | using System.Collections.Generic; | 6 | using System.Collections.Generic; |
| 7 | using WixToolset.Data; | ||
| 6 | using WixToolset.Data.Tuples; | 8 | using WixToolset.Data.Tuples; |
| 9 | using WixToolset.Data.WindowsInstaller; | ||
| 10 | using WixToolset.Data.WindowsInstaller.Rows; | ||
| 7 | 11 | ||
| 8 | public class FileFacade | 12 | public class FileFacade |
| 9 | { | 13 | { |
| 10 | public FileFacade(FileTuple file, AssemblyTuple assembly) | 14 | public FileFacade(FileTuple file, AssemblyTuple assembly) |
| 11 | { | 15 | { |
| 12 | this.File = file; | 16 | this.FileTuple = file; |
| 13 | this.Assembly = assembly; | 17 | this.AssemblyTuple = assembly; |
| 14 | } | 18 | } |
| 15 | 19 | ||
| 16 | public FileFacade(bool fromModule, FileTuple file) | 20 | public FileFacade(bool fromModule, FileTuple file) |
| 17 | { | 21 | { |
| 18 | this.FromModule = fromModule; | 22 | this.FromModule = fromModule; |
| 19 | this.File = file; | 23 | this.FileTuple = file; |
| 24 | } | ||
| 25 | |||
| 26 | internal FileFacade(FileRow row) | ||
| 27 | { | ||
| 28 | this.FromTransform = true; | ||
| 29 | this.FileRow = row; | ||
| 20 | } | 30 | } |
| 21 | 31 | ||
| 22 | public bool FromModule { get; } | 32 | public bool FromModule { get; } |
| 23 | 33 | ||
| 24 | public FileTuple File { get; } | 34 | public bool FromTransform { get; } |
| 35 | |||
| 36 | private FileRow FileRow { get; } | ||
| 37 | |||
| 38 | private FileTuple FileTuple { get; } | ||
| 39 | |||
| 40 | private AssemblyTuple AssemblyTuple { get; } | ||
| 41 | |||
| 42 | public string Id => this.FileRow == null ? this.FileTuple.Id.Id : this.FileRow.File; | ||
| 43 | |||
| 44 | public Identifier Identifier => this.FileRow == null ? this.FileTuple.Id : throw new NotImplementedException(); | ||
| 45 | |||
| 46 | public string ComponentRef => this.FileRow == null ? this.FileTuple.ComponentRef : this.FileRow.Component; | ||
| 47 | |||
| 48 | public int DiskId | ||
| 49 | { | ||
| 50 | get => this.FileRow == null ? this.FileTuple.DiskId ?? 0 : this.FileRow.DiskId; | ||
| 51 | set | ||
| 52 | { | ||
| 53 | if (this.FileRow == null) | ||
| 54 | { | ||
| 55 | this.FileTuple.DiskId = value; | ||
| 56 | } | ||
| 57 | else | ||
| 58 | { | ||
| 59 | this.FileRow.DiskId = value; | ||
| 60 | } | ||
| 61 | } | ||
| 62 | } | ||
| 63 | |||
| 64 | public string FileName => this.FileRow == null ? this.FileTuple.Name : this.FileRow.FileName; | ||
| 65 | |||
| 66 | public int FileSize | ||
| 67 | { | ||
| 68 | get => this.FileRow == null ? this.FileTuple.FileSize : this.FileRow.FileSize; | ||
| 69 | set | ||
| 70 | { | ||
| 71 | if (this.FileRow == null) | ||
| 72 | { | ||
| 73 | this.FileTuple.FileSize = value; | ||
| 74 | } | ||
| 75 | else | ||
| 76 | { | ||
| 77 | this.FileRow.FileSize = value; | ||
| 78 | } | ||
| 79 | } | ||
| 80 | } | ||
| 81 | |||
| 82 | public string Language | ||
| 83 | { | ||
| 84 | get => this.FileRow == null ? this.FileTuple.Language : this.FileRow.Language; | ||
| 85 | set | ||
| 86 | { | ||
| 87 | if (this.FileRow == null) | ||
| 88 | { | ||
| 89 | this.FileTuple.Language = value; | ||
| 90 | } | ||
| 91 | else | ||
| 92 | { | ||
| 93 | this.FileRow.Language = value; | ||
| 94 | } | ||
| 95 | } | ||
| 96 | } | ||
| 97 | |||
| 98 | public int? PatchGroup => this.FileRow == null ? this.FileTuple.PatchGroup : null; | ||
| 99 | |||
| 100 | public int Sequence | ||
| 101 | { | ||
| 102 | get => this.FileRow == null ? this.FileTuple.Sequence : this.FileRow.Sequence; | ||
| 103 | set | ||
| 104 | { | ||
| 105 | if (this.FileRow == null) | ||
| 106 | { | ||
| 107 | this.FileTuple.Sequence = value; | ||
| 108 | } | ||
| 109 | else | ||
| 110 | { | ||
| 111 | this.FileRow.Sequence = value; | ||
| 112 | } | ||
| 113 | } | ||
| 114 | } | ||
| 115 | |||
| 116 | public SourceLineNumber SourceLineNumber => this.FileRow == null ? this.FileTuple.SourceLineNumbers : this.FileRow.SourceLineNumbers; | ||
| 117 | |||
| 118 | public string SourcePath => this.FileRow == null ? this.FileTuple.Source.Path : this.FileRow.Source; | ||
| 119 | |||
| 120 | public bool Compressed => this.FileRow == null ? (this.FileTuple.Attributes & FileTupleAttributes.Compressed) == FileTupleAttributes.Compressed : (this.FileRow.Attributes & WindowsInstallerConstants.MsidbFileAttributesCompressed) == WindowsInstallerConstants.MsidbFileAttributesCompressed; | ||
| 121 | |||
| 122 | public bool Uncompressed => this.FileRow == null ? (this.FileTuple.Attributes & FileTupleAttributes.Uncompressed) == FileTupleAttributes.Uncompressed : (this.FileRow.Attributes & WindowsInstallerConstants.MsidbFileAttributesNoncompressed) == WindowsInstallerConstants.MsidbFileAttributesNoncompressed; | ||
| 123 | |||
| 124 | public string Version | ||
| 125 | { | ||
| 126 | get => this.FileRow == null ? this.FileTuple.Version : this.FileRow.Version; | ||
| 127 | set | ||
| 128 | { | ||
| 129 | if (this.FileRow == null) | ||
| 130 | { | ||
| 131 | this.FileTuple.Version = value; | ||
| 132 | } | ||
| 133 | else | ||
| 134 | { | ||
| 135 | this.FileRow.Version = value; | ||
| 136 | } | ||
| 137 | } | ||
| 138 | } | ||
| 25 | 139 | ||
| 26 | public AssemblyTuple Assembly { get; } | 140 | public AssemblyType? AssemblyType => this.FileRow == null ? this.AssemblyTuple?.Type : throw new NotImplementedException(); |
| 27 | 141 | ||
| 28 | public int DiskId => this.File.DiskId ?? 0; | 142 | public string AssemblyApplicationFileRef => this.FileRow == null ? this.AssemblyTuple?.ApplicationFileRef : throw new NotImplementedException(); |
| 29 | 143 | ||
| 30 | public bool Uncompressed => (this.File.Attributes & FileTupleAttributes.Uncompressed) == FileTupleAttributes.Uncompressed; | 144 | public string AssemblyManifestFileRef => this.FileRow == null ? this.AssemblyTuple?.ManifestFileRef : throw new NotImplementedException(); |
| 31 | 145 | ||
| 32 | /// <summary> | 146 | /// <summary> |
| 33 | /// Gets the set of MsiAssemblyName rows created for this file. | 147 | /// Gets the set of MsiAssemblyName rows created for this file. |
diff --git a/src/WixToolset.Core/Bind/ResolveFieldsCommand.cs b/src/WixToolset.Core/Bind/ResolveFieldsCommand.cs index 19a26915..5cb2524d 100644 --- a/src/WixToolset.Core/Bind/ResolveFieldsCommand.cs +++ b/src/WixToolset.Core/Bind/ResolveFieldsCommand.cs | |||
| @@ -89,7 +89,7 @@ namespace WixToolset.Core.Bind | |||
| 89 | { | 89 | { |
| 90 | var objectField = field.AsPath(); | 90 | var objectField = field.AsPath(); |
| 91 | 91 | ||
| 92 | #if REVISIT_FOR_PATCHING | 92 | #if TODO_PATCHING |
| 93 | // Skip file resolution if the file is to be deleted. | 93 | // Skip file resolution if the file is to be deleted. |
| 94 | if (RowOperation.Delete == tuple.Operation) | 94 | if (RowOperation.Delete == tuple.Operation) |
| 95 | { | 95 | { |
| @@ -111,7 +111,7 @@ namespace WixToolset.Core.Bind | |||
| 111 | { | 111 | { |
| 112 | if (!this.BuildingPatch) // Normal binding for non-Patch scenario such as link (light.exe) | 112 | if (!this.BuildingPatch) // Normal binding for non-Patch scenario such as link (light.exe) |
| 113 | { | 113 | { |
| 114 | #if REVISIT_FOR_PATCHING | 114 | #if TODO_PATCHING |
| 115 | // keep a copy of the un-resolved data for future replay. This will be saved into wixpdb file | 115 | // keep a copy of the un-resolved data for future replay. This will be saved into wixpdb file |
| 116 | if (null == objectField.UnresolvedData) | 116 | if (null == objectField.UnresolvedData) |
| 117 | { | 117 | { |
| @@ -129,7 +129,7 @@ namespace WixToolset.Core.Bind | |||
| 129 | var value = fileResolver.ResolveFile(objectField.Path, tuple.Definition, tuple.SourceLineNumbers, BindStage.Normal); | 129 | var value = fileResolver.ResolveFile(objectField.Path, tuple.Definition, tuple.SourceLineNumbers, BindStage.Normal); |
| 130 | field.Set(value); | 130 | field.Set(value); |
| 131 | } | 131 | } |
| 132 | #if REVISIT_FOR_PATCHING | 132 | #if TODO_PATCHING |
| 133 | else // Re-base binding path scenario caused by pyro.exe -bt -bu | 133 | else // Re-base binding path scenario caused by pyro.exe -bt -bu |
| 134 | { | 134 | { |
| 135 | // by default, use the resolved Data for file lookup | 135 | // by default, use the resolved Data for file lookup |
| @@ -158,7 +158,7 @@ namespace WixToolset.Core.Bind | |||
| 158 | } | 158 | } |
| 159 | } | 159 | } |
| 160 | 160 | ||
| 161 | #if REVISIT_FOR_PATCHING | 161 | #if TODO_PATCHING |
| 162 | if (null != objectField.PreviousData) | 162 | if (null != objectField.PreviousData) |
| 163 | { | 163 | { |
| 164 | objectField.PreviousData = this.BindVariableResolver.ResolveVariables(tuple.SourceLineNumbers, objectField.PreviousData, false, out isDefault); | 164 | objectField.PreviousData = this.BindVariableResolver.ResolveVariables(tuple.SourceLineNumbers, objectField.PreviousData, false, out isDefault); |
