From 38afa9e7bc7eacc021f8805f607368a05751e3c3 Mon Sep 17 00:00:00 2001 From: Rob Mensching Date: Thu, 25 Jun 2020 14:43:50 -0700 Subject: The Great Tuple to Symbol Rename (tm) --- src/WixToolset.Core/Bind/DelayedField.cs | 12 ++--- src/WixToolset.Core/Bind/FileFacade.cs | 58 +++++++++++----------- src/WixToolset.Core/Bind/FileResolver.cs | 16 +++--- .../Bind/ResolveDelayedFieldsCommand.cs | 10 ++-- src/WixToolset.Core/Bind/ResolveFieldsCommand.cs | 38 +++++++------- 5 files changed, 67 insertions(+), 67 deletions(-) (limited to 'src/WixToolset.Core/Bind') diff --git a/src/WixToolset.Core/Bind/DelayedField.cs b/src/WixToolset.Core/Bind/DelayedField.cs index 7d0045e6..25641516 100644 --- a/src/WixToolset.Core/Bind/DelayedField.cs +++ b/src/WixToolset.Core/Bind/DelayedField.cs @@ -6,26 +6,26 @@ namespace WixToolset.Core.Bind using WixToolset.Extensibility.Data; /// - /// Structure used to hold a row and field that contain binder variables, which need to be resolved + /// Holds a symbol and field that contain binder variables, which need to be resolved /// later, once the files have been resolved. /// internal class DelayedField : IDelayedField { /// - /// Basic constructor for struct + /// Creates a delayed field. /// - /// Row for the field. + /// Symbol for the field. /// Field needing further resolution. - public DelayedField(IntermediateTuple row, IntermediateField field) + public DelayedField(IntermediateSymbol symbol, IntermediateField field) { - this.Row = row; + this.Symbol = symbol; this.Field = field; } /// /// The row containing the field. /// - public IntermediateTuple Row { get; } + public IntermediateSymbol Symbol { get; } /// /// The field needing further resolving. diff --git a/src/WixToolset.Core/Bind/FileFacade.cs b/src/WixToolset.Core/Bind/FileFacade.cs index 511f4aab..075d3d34 100644 --- a/src/WixToolset.Core/Bind/FileFacade.cs +++ b/src/WixToolset.Core/Bind/FileFacade.cs @@ -5,25 +5,25 @@ namespace WixToolset.Core.Bind using System; using System.Collections.Generic; using WixToolset.Data; - using WixToolset.Data.Tuples; + using WixToolset.Data.Symbols; using WixToolset.Data.WindowsInstaller; using WixToolset.Data.WindowsInstaller.Rows; public class FileFacade { - public FileFacade(FileTuple file, AssemblyTuple assembly) + public FileFacade(FileSymbol file, AssemblySymbol assembly) { - this.FileTuple = file; - this.AssemblyTuple = assembly; + this.FileSymbol = file; + this.AssemblySymbol = assembly; this.Identifier = file.Id; this.ComponentRef = file.ComponentRef; } - public FileFacade(bool fromModule, FileTuple file) + public FileFacade(bool fromModule, FileSymbol file) { this.FromModule = fromModule; - this.FileTuple = file; + this.FileSymbol = file; this.Identifier = file.Id; this.ComponentRef = file.ComponentRef; @@ -44,9 +44,9 @@ namespace WixToolset.Core.Bind private FileRow FileRow { get; } - private FileTuple FileTuple { get; } + private FileSymbol FileSymbol { get; } - private AssemblyTuple AssemblyTuple { get; } + private AssemblySymbol AssemblySymbol { get; } public string Id => this.Identifier.Id; @@ -56,12 +56,12 @@ namespace WixToolset.Core.Bind public int DiskId { - get => this.FileRow == null ? this.FileTuple.DiskId ?? 1 : this.FileRow.DiskId; + get => this.FileRow == null ? this.FileSymbol.DiskId ?? 1 : this.FileRow.DiskId; set { if (this.FileRow == null) { - this.FileTuple.DiskId = value; + this.FileSymbol.DiskId = value; } else { @@ -70,16 +70,16 @@ namespace WixToolset.Core.Bind } } - public string FileName => this.FileRow == null ? this.FileTuple.Name : this.FileRow.FileName; + public string FileName => this.FileRow == null ? this.FileSymbol.Name : this.FileRow.FileName; public int FileSize { - get => this.FileRow == null ? this.FileTuple.FileSize : this.FileRow.FileSize; + get => this.FileRow == null ? this.FileSymbol.FileSize : this.FileRow.FileSize; set { if (this.FileRow == null) { - this.FileTuple.FileSize = value; + this.FileSymbol.FileSize = value; } else { @@ -90,12 +90,12 @@ namespace WixToolset.Core.Bind public string Language { - get => this.FileRow == null ? this.FileTuple.Language : this.FileRow.Language; + get => this.FileRow == null ? this.FileSymbol.Language : this.FileRow.Language; set { if (this.FileRow == null) { - this.FileTuple.Language = value; + this.FileSymbol.Language = value; } else { @@ -104,16 +104,16 @@ namespace WixToolset.Core.Bind } } - public int? PatchGroup => this.FileRow == null ? this.FileTuple.PatchGroup : null; + public int? PatchGroup => this.FileRow == null ? this.FileSymbol.PatchGroup : null; public int Sequence { - get => this.FileRow == null ? this.FileTuple.Sequence : this.FileRow.Sequence; + get => this.FileRow == null ? this.FileSymbol.Sequence : this.FileRow.Sequence; set { if (this.FileRow == null) { - this.FileTuple.Sequence = value; + this.FileSymbol.Sequence = value; } else { @@ -122,22 +122,22 @@ namespace WixToolset.Core.Bind } } - public SourceLineNumber SourceLineNumber => this.FileRow == null ? this.FileTuple.SourceLineNumbers : this.FileRow.SourceLineNumbers; + public SourceLineNumber SourceLineNumber => this.FileRow == null ? this.FileSymbol.SourceLineNumbers : this.FileRow.SourceLineNumbers; - public string SourcePath => this.FileRow == null ? this.FileTuple.Source.Path : this.FileRow.Source; + public string SourcePath => this.FileRow == null ? this.FileSymbol.Source.Path : this.FileRow.Source; - public bool Compressed => this.FileRow == null ? (this.FileTuple.Attributes & FileTupleAttributes.Compressed) == FileTupleAttributes.Compressed : (this.FileRow.Attributes & WindowsInstallerConstants.MsidbFileAttributesCompressed) == WindowsInstallerConstants.MsidbFileAttributesCompressed; + public bool Compressed => this.FileRow == null ? (this.FileSymbol.Attributes & FileSymbolAttributes.Compressed) == FileSymbolAttributes.Compressed : (this.FileRow.Attributes & WindowsInstallerConstants.MsidbFileAttributesCompressed) == WindowsInstallerConstants.MsidbFileAttributesCompressed; - public bool Uncompressed => this.FileRow == null ? (this.FileTuple.Attributes & FileTupleAttributes.Uncompressed) == FileTupleAttributes.Uncompressed : (this.FileRow.Attributes & WindowsInstallerConstants.MsidbFileAttributesNoncompressed) == WindowsInstallerConstants.MsidbFileAttributesNoncompressed; + public bool Uncompressed => this.FileRow == null ? (this.FileSymbol.Attributes & FileSymbolAttributes.Uncompressed) == FileSymbolAttributes.Uncompressed : (this.FileRow.Attributes & WindowsInstallerConstants.MsidbFileAttributesNoncompressed) == WindowsInstallerConstants.MsidbFileAttributesNoncompressed; public string Version { - get => this.FileRow == null ? this.FileTuple.Version : this.FileRow.Version; + get => this.FileRow == null ? this.FileSymbol.Version : this.FileRow.Version; set { if (this.FileRow == null) { - this.FileTuple.Version = value; + this.FileSymbol.Version = value; } else { @@ -146,22 +146,22 @@ namespace WixToolset.Core.Bind } } - public AssemblyType? AssemblyType => this.FileRow == null ? this.AssemblyTuple?.Type : null; + public AssemblyType? AssemblyType => this.FileRow == null ? this.AssemblySymbol?.Type : null; - public string AssemblyApplicationFileRef => this.FileRow == null ? this.AssemblyTuple?.ApplicationFileRef : throw new NotImplementedException(); + public string AssemblyApplicationFileRef => this.FileRow == null ? this.AssemblySymbol?.ApplicationFileRef : throw new NotImplementedException(); - public string AssemblyManifestFileRef => this.FileRow == null ? this.AssemblyTuple?.ManifestFileRef : throw new NotImplementedException(); + public string AssemblyManifestFileRef => this.FileRow == null ? this.AssemblySymbol?.ManifestFileRef : throw new NotImplementedException(); /// /// Gets the set of MsiAssemblyName rows created for this file. /// /// RowCollection of MsiAssemblyName table. - public List AssemblyNames { get; set; } + public List AssemblyNames { get; set; } /// /// Gets or sets the MsiFileHash row for this file. /// - public MsiFileHashTuple Hash { get; set; } + public MsiFileHashSymbol Hash { get; set; } /// /// Allows direct access to the underlying FileRow as requried for patching. diff --git a/src/WixToolset.Core/Bind/FileResolver.cs b/src/WixToolset.Core/Bind/FileResolver.cs index 6bc5a676..d11fcadc 100644 --- a/src/WixToolset.Core/Bind/FileResolver.cs +++ b/src/WixToolset.Core/Bind/FileResolver.cs @@ -41,13 +41,13 @@ namespace WixToolset.Core.Bind private IEnumerable LibrarianExtensions { get; } - public string Resolve(SourceLineNumber sourceLineNumbers, IntermediateTupleDefinition tupleDefinition, string source) + public string Resolve(SourceLineNumber sourceLineNumbers, IntermediateSymbolDefinition symbolDefinition, string source) { var checkedPaths = new List(); foreach (var extension in this.LibrarianExtensions) { - var resolved = extension.ResolveFile(sourceLineNumbers, tupleDefinition, source); + var resolved = extension.ResolveFile(sourceLineNumbers, symbolDefinition, source); if (resolved?.CheckedPaths != null) { @@ -60,7 +60,7 @@ namespace WixToolset.Core.Bind } } - return this.MustResolveUsingBindPaths(source, tupleDefinition, sourceLineNumbers, BindStage.Normal, checkedPaths); + return this.MustResolveUsingBindPaths(source, symbolDefinition, sourceLineNumbers, BindStage.Normal, checkedPaths); } /// @@ -72,7 +72,7 @@ namespace WixToolset.Core.Bind /// The binding stage used to determine what collection of bind paths will be used /// Optional collection of paths already checked. /// Should return a valid path for the stream to be imported. - public string ResolveFile(string source, IntermediateTupleDefinition tupleDefinition, SourceLineNumber sourceLineNumbers, BindStage bindStage, IEnumerable alreadyCheckedPaths = null) + public string ResolveFile(string source, IntermediateSymbolDefinition symbolDefinition, SourceLineNumber sourceLineNumbers, BindStage bindStage, IEnumerable alreadyCheckedPaths = null) { var checkedPaths = new List(); @@ -83,7 +83,7 @@ namespace WixToolset.Core.Bind foreach (var extension in this.ResolverExtensions) { - var resolved = extension.ResolveFile(source, tupleDefinition, sourceLineNumbers, bindStage); + var resolved = extension.ResolveFile(source, symbolDefinition, sourceLineNumbers, bindStage); if (resolved?.CheckedPaths != null) { @@ -96,10 +96,10 @@ namespace WixToolset.Core.Bind } } - return this.MustResolveUsingBindPaths(source, tupleDefinition, sourceLineNumbers, bindStage, checkedPaths); + return this.MustResolveUsingBindPaths(source, symbolDefinition, sourceLineNumbers, bindStage, checkedPaths); } - private string MustResolveUsingBindPaths(string source, IntermediateTupleDefinition tupleDefinition, SourceLineNumber sourceLineNumbers, BindStage bindStage, List checkedPaths) + private string MustResolveUsingBindPaths(string source, IntermediateSymbolDefinition symbolDefinition, SourceLineNumber sourceLineNumbers, BindStage bindStage, List checkedPaths) { string resolved = null; @@ -180,7 +180,7 @@ namespace WixToolset.Core.Bind if (null == resolved) { - throw new WixException(ErrorMessages.FileNotFound(sourceLineNumbers, source, tupleDefinition.Name, checkedPaths)); + throw new WixException(ErrorMessages.FileNotFound(sourceLineNumbers, source, symbolDefinition.Name, checkedPaths)); } return resolved; diff --git a/src/WixToolset.Core/Bind/ResolveDelayedFieldsCommand.cs b/src/WixToolset.Core/Bind/ResolveDelayedFieldsCommand.cs index be0e4578..a10b98dc 100644 --- a/src/WixToolset.Core/Bind/ResolveDelayedFieldsCommand.cs +++ b/src/WixToolset.Core/Bind/ResolveDelayedFieldsCommand.cs @@ -42,15 +42,15 @@ namespace WixToolset.Core.Bind { try { - var propertyRow = delayedField.Row; + var propertySymbol = delayedField.Symbol; // process properties first in case they refer to other binder variables - if (delayedField.Row.Definition.Type == TupleDefinitionType.Property) + if (delayedField.Symbol.Definition.Type == SymbolDefinitionType.Property) { - var value = ResolveDelayedVariables(propertyRow.SourceLineNumbers, delayedField.Field.AsString(), this.VariableCache); + var value = ResolveDelayedVariables(propertySymbol.SourceLineNumbers, delayedField.Field.AsString(), this.VariableCache); // update the variable cache with the new value - var key = String.Concat("property.", propertyRow.AsString(0)); + var key = String.Concat("property.", propertySymbol.Id.Id); this.VariableCache[key] = value; // update the field data @@ -103,7 +103,7 @@ namespace WixToolset.Core.Bind { try { - var value = ResolveDelayedVariables(delayedField.Row.SourceLineNumbers, delayedField.Field.AsString(), this.VariableCache); + var value = ResolveDelayedVariables(delayedField.Symbol.SourceLineNumbers, delayedField.Field.AsString(), this.VariableCache); delayedField.Field.Set(value); } catch (WixException we) diff --git a/src/WixToolset.Core/Bind/ResolveFieldsCommand.cs b/src/WixToolset.Core/Bind/ResolveFieldsCommand.cs index af7e262a..629e5f28 100644 --- a/src/WixToolset.Core/Bind/ResolveFieldsCommand.cs +++ b/src/WixToolset.Core/Bind/ResolveFieldsCommand.cs @@ -6,7 +6,7 @@ namespace WixToolset.Core.Bind using System.Collections.Generic; using System.Linq; using WixToolset.Data; - using WixToolset.Data.Tuples; + using WixToolset.Data.Symbols; using WixToolset.Extensibility; using WixToolset.Extensibility.Data; using WixToolset.Extensibility.Services; @@ -45,13 +45,13 @@ namespace WixToolset.Core.Bind var fileResolver = new FileResolver(this.BindPaths, this.Extensions); // Build the column lookup only when needed. - Dictionary customColumnsById = null; + Dictionary customColumnsById = null; foreach (var sections in this.Intermediate.Sections) { - foreach (var tuple in sections.Tuples) + foreach (var symbol in sections.Symbols) { - foreach (var field in tuple.Fields) + foreach (var field in symbol.Fields) { if (field.IsNull()) { @@ -63,20 +63,20 @@ namespace WixToolset.Core.Bind // Custom table cells require an extra look up to the column definition as the // cell's data type is always a string (because strings can store anything) but // the column definition may be more specific. - if (tuple.Definition.Type == TupleDefinitionType.WixCustomTableCell) + if (symbol.Definition.Type == SymbolDefinitionType.WixCustomTableCell) { // We only care about the Data in a CustomTable cell. - if (field.Name != nameof(WixCustomTableCellTupleFields.Data)) + if (field.Name != nameof(WixCustomTableCellSymbolFields.Data)) { continue; } if (customColumnsById == null) { - customColumnsById = this.Intermediate.Sections.SelectMany(s => s.Tuples.OfType()).ToDictionary(t => t.Id.Id); + customColumnsById = this.Intermediate.Sections.SelectMany(s => s.Symbols.OfType()).ToDictionary(t => t.Id.Id); } - if (customColumnsById.TryGetValue(tuple.Fields[(int)WixCustomTableCellTupleFields.TableRef].AsString() + "/" + tuple.Fields[(int)WixCustomTableCellTupleFields.ColumnRef].AsString(), out var customColumn)) + if (customColumnsById.TryGetValue(symbol.Fields[(int)WixCustomTableCellSymbolFields.TableRef].AsString() + "/" + symbol.Fields[(int)WixCustomTableCellSymbolFields.ColumnRef].AsString(), out var customColumn)) { fieldType = customColumn.Type; } @@ -93,7 +93,7 @@ namespace WixToolset.Core.Bind var original = field.AsString(); if (!String.IsNullOrEmpty(original)) { - var resolution = this.VariableResolver.ResolveVariables(tuple.SourceLineNumbers, original, !this.AllowUnresolvedVariables); + var resolution = this.VariableResolver.ResolveVariables(symbol.SourceLineNumbers, original, !this.AllowUnresolvedVariables); if (resolution.UpdatedValue) { field.Set(resolution.Value); @@ -101,7 +101,7 @@ namespace WixToolset.Core.Bind if (resolution.DelayedResolve) { - delayedFields.Add(new DelayedField(tuple, field)); + delayedFields.Add(new DelayedField(symbol, field)); } isDefault = resolution.IsDefault; @@ -109,7 +109,7 @@ namespace WixToolset.Core.Bind } } - // Move to next tuple if we've hit an error resolving variables. + // Move to next symbol if we've hit an error resolving variables. if (this.Messaging.EncounteredError) // TODO: make this error handling more specific to just the failure to resolve variables in this field. { continue; @@ -122,7 +122,7 @@ namespace WixToolset.Core.Bind #if TODO_PATCHING // Skip file resolution if the file is to be deleted. - if (RowOperation.Delete == tuple.Operation) + if (RowOperation.Delete == symbol.Operation) { continue; } @@ -151,13 +151,13 @@ namespace WixToolset.Core.Bind #endif // resolve the path to the file - var value = fileResolver.ResolveFile(objectField.Path, tuple.Definition, tuple.SourceLineNumbers, BindStage.Normal); + var value = fileResolver.ResolveFile(objectField.Path, symbol.Definition, symbol.SourceLineNumbers, BindStage.Normal); field.Set(value); } else if (!fileResolver.RebaseTarget && !fileResolver.RebaseUpdated) // Normal binding for Patch Scenario (normal patch, no re-basing logic) { // resolve the path to the file - var value = fileResolver.ResolveFile(objectField.Path, tuple.Definition, tuple.SourceLineNumbers, BindStage.Normal); + var value = fileResolver.ResolveFile(objectField.Path, symbol.Definition, symbol.SourceLineNumbers, BindStage.Normal); field.Set(value); } #if TODO_PATCHING @@ -179,7 +179,7 @@ namespace WixToolset.Core.Bind } } - objectField.Data = fileResolver.ResolveFile(filePathToResolve, tuple.Definition.Name, tuple.SourceLineNumbers, BindStage.Updated); + objectField.Data = fileResolver.ResolveFile(filePathToResolve, symbol.Definition.Name, symbol.SourceLineNumbers, BindStage.Updated); } #endif } @@ -192,7 +192,7 @@ namespace WixToolset.Core.Bind #if TODO_PATCHING if (null != objectField.PreviousData) { - objectField.PreviousData = this.BindVariableResolver.ResolveVariables(tuple.SourceLineNumbers, objectField.PreviousData, false, out isDefault); + objectField.PreviousData = this.BindVariableResolver.ResolveVariables(symbol.SourceLineNumbers, objectField.PreviousData, false, out isDefault); if (!Messaging.Instance.EncounteredError) // TODO: make this error handling more specific to just the failure to resolve variables in this field. { @@ -217,7 +217,7 @@ namespace WixToolset.Core.Bind if (!fileResolver.RebaseTarget && !fileResolver.RebaseUpdated) { // resolve the path to the file - objectField.PreviousData = fileResolver.ResolveFile((string)objectField.PreviousData, tuple.Definition.Name, tuple.SourceLineNumbers, BindStage.Normal); + objectField.PreviousData = fileResolver.ResolveFile((string)objectField.PreviousData, symbol.Definition.Name, symbol.SourceLineNumbers, BindStage.Normal); } else { @@ -235,14 +235,14 @@ namespace WixToolset.Core.Bind } // resolve the path to the file - objectField.PreviousData = fileResolver.ResolveFile((string)objectField.PreviousData, tuple.Definition.Name, tuple.SourceLineNumbers, BindStage.Target); + objectField.PreviousData = fileResolver.ResolveFile((string)objectField.PreviousData, symbol.Definition.Name, symbol.SourceLineNumbers, BindStage.Target); } } catch (WixFileNotFoundException) { // display the error with source line information - Messaging.Instance.Write(WixErrors.FileNotFound(tuple.SourceLineNumbers, (string)objectField.PreviousData)); + Messaging.Instance.Write(WixErrors.FileNotFound(symbol.SourceLineNumbers, (string)objectField.PreviousData)); } } } -- cgit v1.2.3-55-g6feb