diff options
| author | Rob Mensching <rob@firegiant.com> | 2017-11-01 10:59:45 -0700 |
|---|---|---|
| committer | Rob Mensching <rob@firegiant.com> | 2017-11-01 10:59:45 -0700 |
| commit | 2bb37beda887d120a0ddabf874ad25357101faa1 (patch) | |
| tree | c35e97b03274b86cfc9ff7fd2caeee211165a140 /src/WixToolset.Core/Bind | |
| parent | df7413aeed3aea3425dff20ae0c8b1be3a3ab525 (diff) | |
| download | wix-2bb37beda887d120a0ddabf874ad25357101faa1.tar.gz wix-2bb37beda887d120a0ddabf874ad25357101faa1.tar.bz2 wix-2bb37beda887d120a0ddabf874ad25357101faa1.zip | |
Update to WiX Intermediate Representation
Diffstat (limited to 'src/WixToolset.Core/Bind')
| -rw-r--r-- | src/WixToolset.Core/Bind/DelayedField.cs | 6 | ||||
| -rw-r--r-- | src/WixToolset.Core/Bind/FileFacade.cs | 17 | ||||
| -rw-r--r-- | src/WixToolset.Core/Bind/ResolveDelayedFieldsCommand.cs | 15 | ||||
| -rw-r--r-- | src/WixToolset.Core/Bind/ResolveFieldsCommand.cs | 67 |
4 files changed, 65 insertions, 40 deletions
diff --git a/src/WixToolset.Core/Bind/DelayedField.cs b/src/WixToolset.Core/Bind/DelayedField.cs index 6c56f27c..8b761b94 100644 --- a/src/WixToolset.Core/Bind/DelayedField.cs +++ b/src/WixToolset.Core/Bind/DelayedField.cs | |||
| @@ -16,7 +16,7 @@ namespace WixToolset.Core.Bind | |||
| 16 | /// </summary> | 16 | /// </summary> |
| 17 | /// <param name="row">Row for the field.</param> | 17 | /// <param name="row">Row for the field.</param> |
| 18 | /// <param name="field">Field needing further resolution.</param> | 18 | /// <param name="field">Field needing further resolution.</param> |
| 19 | public DelayedField(Row row, Field field) | 19 | public DelayedField(IntermediateTuple row, IntermediateField field) |
| 20 | { | 20 | { |
| 21 | this.Row = row; | 21 | this.Row = row; |
| 22 | this.Field = field; | 22 | this.Field = field; |
| @@ -25,11 +25,11 @@ namespace WixToolset.Core.Bind | |||
| 25 | /// <summary> | 25 | /// <summary> |
| 26 | /// The row containing the field. | 26 | /// The row containing the field. |
| 27 | /// </summary> | 27 | /// </summary> |
| 28 | public Row Row { get; } | 28 | public IntermediateTuple Row { get; } |
| 29 | 29 | ||
| 30 | /// <summary> | 30 | /// <summary> |
| 31 | /// The field needing further resolving. | 31 | /// The field needing further resolving. |
| 32 | /// </summary> | 32 | /// </summary> |
| 33 | public Field Field { get; } | 33 | public IntermediateField Field { get; } |
| 34 | } | 34 | } |
| 35 | } | 35 | } |
diff --git a/src/WixToolset.Core/Bind/FileFacade.cs b/src/WixToolset.Core/Bind/FileFacade.cs index aaa6b7d3..ebca9cff 100644 --- a/src/WixToolset.Core/Bind/FileFacade.cs +++ b/src/WixToolset.Core/Bind/FileFacade.cs | |||
| @@ -3,19 +3,18 @@ | |||
| 3 | namespace WixToolset.Core.Bind | 3 | namespace WixToolset.Core.Bind |
| 4 | { | 4 | { |
| 5 | using System.Collections.Generic; | 5 | using System.Collections.Generic; |
| 6 | using WixToolset.Data; | 6 | using WixToolset.Data.Tuples; |
| 7 | using WixToolset.Data.Rows; | ||
| 8 | 7 | ||
| 9 | public class FileFacade | 8 | public class FileFacade |
| 10 | { | 9 | { |
| 11 | public FileFacade(FileRow file, WixFileRow wixFile, WixDeltaPatchFileRow deltaPatchFile) | 10 | public FileFacade(FileTuple file, WixFileTuple wixFile, WixDeltaPatchFileTuple deltaPatchFile) |
| 12 | { | 11 | { |
| 13 | this.File = file; | 12 | this.File = file; |
| 14 | this.WixFile = wixFile; | 13 | this.WixFile = wixFile; |
| 15 | this.DeltaPatchFile = deltaPatchFile; | 14 | this.DeltaPatchFile = deltaPatchFile; |
| 16 | } | 15 | } |
| 17 | 16 | ||
| 18 | public FileFacade(bool fromModule, FileRow file, WixFileRow wixFile) | 17 | public FileFacade(bool fromModule, FileTuple file, WixFileTuple wixFile) |
| 19 | { | 18 | { |
| 20 | this.FromModule = fromModule; | 19 | this.FromModule = fromModule; |
| 21 | this.File = file; | 20 | this.File = file; |
| @@ -24,21 +23,21 @@ namespace WixToolset.Core.Bind | |||
| 24 | 23 | ||
| 25 | public bool FromModule { get; private set; } | 24 | public bool FromModule { get; private set; } |
| 26 | 25 | ||
| 27 | public FileRow File { get; private set; } | 26 | public FileTuple File { get; private set; } |
| 28 | 27 | ||
| 29 | public WixFileRow WixFile { get; private set; } | 28 | public WixFileTuple WixFile { get; private set; } |
| 30 | 29 | ||
| 31 | public WixDeltaPatchFileRow DeltaPatchFile { get; private set; } | 30 | public WixDeltaPatchFileTuple DeltaPatchFile { get; private set; } |
| 32 | 31 | ||
| 33 | /// <summary> | 32 | /// <summary> |
| 34 | /// Gets the set of MsiAssemblyName rows created for this file. | 33 | /// Gets the set of MsiAssemblyName rows created for this file. |
| 35 | /// </summary> | 34 | /// </summary> |
| 36 | /// <value>RowCollection of MsiAssemblyName table.</value> | 35 | /// <value>RowCollection of MsiAssemblyName table.</value> |
| 37 | public List<Row> AssemblyNames { get; set; } | 36 | public List<MsiAssemblyNameTuple> AssemblyNames { get; set; } |
| 38 | 37 | ||
| 39 | /// <summary> | 38 | /// <summary> |
| 40 | /// Gets or sets the MsiFileHash row for this file. | 39 | /// Gets or sets the MsiFileHash row for this file. |
| 41 | /// </summary> | 40 | /// </summary> |
| 42 | public Row Hash { get; set; } | 41 | public MsiFileHashTuple Hash { get; set; } |
| 43 | } | 42 | } |
| 44 | } | 43 | } |
diff --git a/src/WixToolset.Core/Bind/ResolveDelayedFieldsCommand.cs b/src/WixToolset.Core/Bind/ResolveDelayedFieldsCommand.cs index 15365c2a..d05135cf 100644 --- a/src/WixToolset.Core/Bind/ResolveDelayedFieldsCommand.cs +++ b/src/WixToolset.Core/Bind/ResolveDelayedFieldsCommand.cs | |||
| @@ -34,19 +34,19 @@ namespace WixToolset.Core.Bind | |||
| 34 | { | 34 | { |
| 35 | try | 35 | try |
| 36 | { | 36 | { |
| 37 | Row propertyRow = delayedField.Row; | 37 | var propertyRow = delayedField.Row; |
| 38 | 38 | ||
| 39 | // process properties first in case they refer to other binder variables | 39 | // process properties first in case they refer to other binder variables |
| 40 | if ("Property" == propertyRow.Table.Name) | 40 | if (delayedField.Row.Definition.Type == TupleDefinitionType.Property) |
| 41 | { | 41 | { |
| 42 | string value = WixVariableResolver.ResolveDelayedVariables(propertyRow.SourceLineNumbers, (string)delayedField.Field.Data, this.VariableCache); | 42 | var value = WixVariableResolver.ResolveDelayedVariables(propertyRow.SourceLineNumbers, delayedField.Field.AsString(), this.VariableCache); |
| 43 | 43 | ||
| 44 | // update the variable cache with the new value | 44 | // update the variable cache with the new value |
| 45 | string key = String.Concat("property.", Common.Demodularize(this.OutputType, this.ModularizationGuid, (string)propertyRow[0])); | 45 | var key = String.Concat("property.", Common.Demodularize(this.OutputType, this.ModularizationGuid, (string)propertyRow[0])); |
| 46 | this.VariableCache[key] = value; | 46 | this.VariableCache[key] = value; |
| 47 | 47 | ||
| 48 | // update the field data | 48 | // update the field data |
| 49 | delayedField.Field.Data = value; | 49 | delayedField.Field.Set(value); |
| 50 | } | 50 | } |
| 51 | else | 51 | else |
| 52 | { | 52 | { |
| @@ -103,11 +103,12 @@ namespace WixToolset.Core.Bind | |||
| 103 | } | 103 | } |
| 104 | 104 | ||
| 105 | // process the remaining fields in case they refer to property binder variables | 105 | // process the remaining fields in case they refer to property binder variables |
| 106 | foreach (DelayedField delayedField in deferredFields) | 106 | foreach (var delayedField in deferredFields) |
| 107 | { | 107 | { |
| 108 | try | 108 | try |
| 109 | { | 109 | { |
| 110 | delayedField.Field.Data = WixVariableResolver.ResolveDelayedVariables(delayedField.Row.SourceLineNumbers, (string)delayedField.Field.Data, this.VariableCache); | 110 | var value = WixVariableResolver.ResolveDelayedVariables(delayedField.Row.SourceLineNumbers, delayedField.Field.AsString(), this.VariableCache); |
| 111 | delayedField.Field.Set(value); | ||
| 111 | } | 112 | } |
| 112 | catch (WixException we) | 113 | catch (WixException we) |
| 113 | { | 114 | { |
diff --git a/src/WixToolset.Core/Bind/ResolveFieldsCommand.cs b/src/WixToolset.Core/Bind/ResolveFieldsCommand.cs index f4f4f9e8..9253f352 100644 --- a/src/WixToolset.Core/Bind/ResolveFieldsCommand.cs +++ b/src/WixToolset.Core/Bind/ResolveFieldsCommand.cs | |||
| @@ -2,6 +2,7 @@ | |||
| 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; |
| 6 | using WixToolset.Data; | 7 | using WixToolset.Data; |
| 7 | using WixToolset.Data.Bind; | 8 | using WixToolset.Data.Bind; |
| @@ -24,7 +25,7 @@ namespace WixToolset.Core.Bind | |||
| 24 | 25 | ||
| 25 | public string IntermediateFolder { private get; set; } | 26 | public string IntermediateFolder { private get; set; } |
| 26 | 27 | ||
| 27 | public TableIndexedCollection Tables { private get; set; } | 28 | public Intermediate Intermediate { private get; set; } |
| 28 | 29 | ||
| 29 | public bool SupportDelayedResolution { private get; set; } | 30 | public bool SupportDelayedResolution { private get; set; } |
| 30 | 31 | ||
| @@ -36,25 +37,39 @@ namespace WixToolset.Core.Bind | |||
| 36 | 37 | ||
| 37 | var fileResolver = new FileResolver(this.BindPaths, this.Extensions); | 38 | var fileResolver = new FileResolver(this.BindPaths, this.Extensions); |
| 38 | 39 | ||
| 39 | foreach (Table table in this.Tables) | 40 | foreach (var sections in this.Intermediate.Sections) |
| 40 | { | 41 | { |
| 41 | foreach (Row row in table.Rows) | 42 | foreach (var row in sections.Tuples) |
| 42 | { | 43 | { |
| 43 | foreach (Field field in row.Fields) | 44 | foreach (var field in row.Fields) |
| 44 | { | 45 | { |
| 45 | bool isDefault = true; | 46 | if (field == null) |
| 46 | bool delayedResolve = false; | 47 | { |
| 48 | continue; | ||
| 49 | } | ||
| 50 | |||
| 51 | var isDefault = true; | ||
| 52 | var delayedResolve = false; | ||
| 47 | 53 | ||
| 48 | // Check to make sure we're in a scenario where we can handle variable resolution. | 54 | // Check to make sure we're in a scenario where we can handle variable resolution. |
| 49 | if (null != delayedFields) | 55 | if (null != delayedFields) |
| 50 | { | 56 | { |
| 51 | // resolve localization and wix variables | 57 | // resolve localization and wix variables |
| 52 | if (field.Data is string) | 58 | if (field.Type == IntermediateFieldType.String) |
| 53 | { | 59 | { |
| 54 | field.Data = this.BindVariableResolver.ResolveVariables(row.SourceLineNumbers, field.AsString(), false, out isDefault, out delayedResolve); | 60 | var original = field.AsString(); |
| 55 | if (delayedResolve) | 61 | if (!String.IsNullOrEmpty(original)) |
| 56 | { | 62 | { |
| 57 | delayedFields.Add(new DelayedField(row, field)); | 63 | var value = this.BindVariableResolver.ResolveVariables(row.SourceLineNumbers, original, false, out isDefault, out delayedResolve); |
| 64 | if (original != value) | ||
| 65 | { | ||
| 66 | field.Set(value); | ||
| 67 | } | ||
| 68 | |||
| 69 | if (delayedResolve) | ||
| 70 | { | ||
| 71 | delayedFields.Add(new DelayedField(row, field)); | ||
| 72 | } | ||
| 58 | } | 73 | } |
| 59 | } | 74 | } |
| 60 | } | 75 | } |
| @@ -66,44 +81,51 @@ namespace WixToolset.Core.Bind | |||
| 66 | } | 81 | } |
| 67 | 82 | ||
| 68 | // Resolve file paths | 83 | // Resolve file paths |
| 69 | if (ColumnType.Object == field.Column.Type) | 84 | if (field.Type == IntermediateFieldType.Path) |
| 70 | { | 85 | { |
| 71 | ObjectField objectField = (ObjectField)field; | 86 | var objectField = field.AsPath(); |
| 72 | 87 | ||
| 88 | #if REVISIT_FOR_PATCHING | ||
| 73 | // Skip file resolution if the file is to be deleted. | 89 | // Skip file resolution if the file is to be deleted. |
| 74 | if (RowOperation.Delete == row.Operation) | 90 | if (RowOperation.Delete == row.Operation) |
| 75 | { | 91 | { |
| 76 | continue; | 92 | continue; |
| 77 | } | 93 | } |
| 94 | #endif | ||
| 78 | 95 | ||
| 79 | // File is embedded and path to it was not modified above. | 96 | // File is embedded and path to it was not modified above. |
| 80 | if (objectField.EmbeddedFileIndex.HasValue && isDefault) | 97 | if (objectField.EmbeddedFileIndex.HasValue && isDefault) |
| 81 | { | 98 | { |
| 82 | string extractPath = this.FilesWithEmbeddedFiles.AddEmbeddedFileIndex(objectField.BaseUri, objectField.EmbeddedFileIndex.Value, this.IntermediateFolder); | 99 | var extractPath = this.FilesWithEmbeddedFiles.AddEmbeddedFileIndex(objectField.BaseUri, objectField.EmbeddedFileIndex.Value, this.IntermediateFolder); |
| 83 | 100 | ||
| 84 | // Set the path to the embedded file once where it will be extracted. | 101 | // Set the path to the embedded file once where it will be extracted. |
| 85 | objectField.Data = extractPath; | 102 | field.Set(extractPath); |
| 86 | } | 103 | } |
| 87 | else if (null != objectField.Data) // non-compressed file (or localized value) | 104 | else if (null != objectField.Path) // non-compressed file (or localized value) |
| 88 | { | 105 | { |
| 89 | try | 106 | try |
| 90 | { | 107 | { |
| 91 | if (!this.BuildingPatch) // Normal binding for non-Patch scenario such as link (light.exe) | 108 | if (!this.BuildingPatch) // Normal binding for non-Patch scenario such as link (light.exe) |
| 92 | { | 109 | { |
| 110 | #if REVISIT_FOR_PATCHING | ||
| 93 | // keep a copy of the un-resolved data for future replay. This will be saved into wixpdb file | 111 | // keep a copy of the un-resolved data for future replay. This will be saved into wixpdb file |
| 94 | if (null == objectField.UnresolvedData) | 112 | if (null == objectField.UnresolvedData) |
| 95 | { | 113 | { |
| 96 | objectField.UnresolvedData = (string)objectField.Data; | 114 | objectField.UnresolvedData = (string)objectField.Data; |
| 97 | } | 115 | } |
| 116 | #endif | ||
| 98 | 117 | ||
| 99 | // resolve the path to the file | 118 | // resolve the path to the file |
| 100 | objectField.Data = fileResolver.ResolveFile((string)objectField.Data, table.Name, row.SourceLineNumbers, BindStage.Normal); | 119 | var value = fileResolver.ResolveFile(objectField.Path, row.Definition.Name, row.SourceLineNumbers, BindStage.Normal); |
| 120 | field.Set(value); | ||
| 101 | } | 121 | } |
| 102 | else if (!fileResolver.RebaseTarget && !fileResolver.RebaseUpdated) // Normal binding for Patch Scenario (normal patch, no re-basing logic) | 122 | else if (!fileResolver.RebaseTarget && !fileResolver.RebaseUpdated) // Normal binding for Patch Scenario (normal patch, no re-basing logic) |
| 103 | { | 123 | { |
| 104 | // resolve the path to the file | 124 | // resolve the path to the file |
| 105 | objectField.Data = fileResolver.ResolveFile((string)objectField.Data, table.Name, row.SourceLineNumbers, BindStage.Normal); | 125 | var value = fileResolver.ResolveFile(objectField.Path, row.Definition.Name, row.SourceLineNumbers, BindStage.Normal); |
| 126 | field.Set(value); | ||
| 106 | } | 127 | } |
| 128 | #if REVISIT_FOR_PATCHING | ||
| 107 | else // Re-base binding path scenario caused by pyro.exe -bt -bu | 129 | else // Re-base binding path scenario caused by pyro.exe -bt -bu |
| 108 | { | 130 | { |
| 109 | // by default, use the resolved Data for file lookup | 131 | // by default, use the resolved Data for file lookup |
| @@ -122,16 +144,18 @@ namespace WixToolset.Core.Bind | |||
| 122 | } | 144 | } |
| 123 | } | 145 | } |
| 124 | 146 | ||
| 125 | objectField.Data = fileResolver.ResolveFile(filePathToResolve, table.Name, row.SourceLineNumbers, BindStage.Updated); | 147 | objectField.Data = fileResolver.ResolveFile(filePathToResolve, row.Definition.Name, row.SourceLineNumbers, BindStage.Updated); |
| 126 | } | 148 | } |
| 149 | #endif | ||
| 127 | } | 150 | } |
| 128 | catch (WixFileNotFoundException) | 151 | catch (WixFileNotFoundException) |
| 129 | { | 152 | { |
| 130 | // display the error with source line information | 153 | // display the error with source line information |
| 131 | Messaging.Instance.OnMessage(WixErrors.FileNotFound(row.SourceLineNumbers, (string)objectField.Data)); | 154 | Messaging.Instance.OnMessage(WixErrors.FileNotFound(row.SourceLineNumbers, objectField.Path)); |
| 132 | } | 155 | } |
| 133 | } | 156 | } |
| 134 | 157 | ||
| 158 | #if REVISIT_FOR_PATCHING | ||
| 135 | if (null != objectField.PreviousData) | 159 | if (null != objectField.PreviousData) |
| 136 | { | 160 | { |
| 137 | objectField.PreviousData = this.BindVariableResolver.ResolveVariables(row.SourceLineNumbers, objectField.PreviousData, false, out isDefault); | 161 | objectField.PreviousData = this.BindVariableResolver.ResolveVariables(row.SourceLineNumbers, objectField.PreviousData, false, out isDefault); |
| @@ -159,7 +183,7 @@ namespace WixToolset.Core.Bind | |||
| 159 | if (!fileResolver.RebaseTarget && !fileResolver.RebaseUpdated) | 183 | if (!fileResolver.RebaseTarget && !fileResolver.RebaseUpdated) |
| 160 | { | 184 | { |
| 161 | // resolve the path to the file | 185 | // resolve the path to the file |
| 162 | objectField.PreviousData = fileResolver.ResolveFile((string)objectField.PreviousData, table.Name, row.SourceLineNumbers, BindStage.Normal); | 186 | objectField.PreviousData = fileResolver.ResolveFile((string)objectField.PreviousData, row.Definition.Name, row.SourceLineNumbers, BindStage.Normal); |
| 163 | } | 187 | } |
| 164 | else | 188 | else |
| 165 | { | 189 | { |
| @@ -177,7 +201,7 @@ namespace WixToolset.Core.Bind | |||
| 177 | } | 201 | } |
| 178 | 202 | ||
| 179 | // resolve the path to the file | 203 | // resolve the path to the file |
| 180 | objectField.PreviousData = fileResolver.ResolveFile((string)objectField.PreviousData, table.Name, row.SourceLineNumbers, BindStage.Target); | 204 | objectField.PreviousData = fileResolver.ResolveFile((string)objectField.PreviousData, row.Definition.Name, row.SourceLineNumbers, BindStage.Target); |
| 181 | 205 | ||
| 182 | } | 206 | } |
| 183 | } | 207 | } |
| @@ -189,6 +213,7 @@ namespace WixToolset.Core.Bind | |||
| 189 | } | 213 | } |
| 190 | } | 214 | } |
| 191 | } | 215 | } |
| 216 | #endif | ||
| 192 | } | 217 | } |
| 193 | } | 218 | } |
| 194 | } | 219 | } |
