aboutsummaryrefslogtreecommitdiff
path: root/src/WixToolset.Core
diff options
context:
space:
mode:
authorRob Mensching <rob@firegiant.com>2019-05-23 15:37:56 -0700
committerRob Mensching <rob@firegiant.com>2019-05-23 16:02:37 -0700
commit354f6d5b79404544cb7c0e11a0d9212b4780ce09 (patch)
tree1082ce6dd66604f7da315d6a15c85ac3f56b745a /src/WixToolset.Core
parent3051bf2fc300df125115c9538a0bfc8256bfde6a (diff)
downloadwix-354f6d5b79404544cb7c0e11a0d9212b4780ce09.tar.gz
wix-354f6d5b79404544cb7c0e11a0d9212b4780ce09.tar.bz2
wix-354f6d5b79404544cb7c0e11a0d9212b4780ce09.zip
Integrate latest Data changes for FileTuple and AssemblyTuple
Diffstat (limited to 'src/WixToolset.Core')
-rw-r--r--src/WixToolset.Core/Bind/FileFacade.cs14
-rw-r--r--src/WixToolset.Core/Compiler.cs128
-rw-r--r--src/WixToolset.Core/Compiler_2.cs1
-rw-r--r--src/WixToolset.Core/Linker.cs2
4 files changed, 59 insertions, 86 deletions
diff --git a/src/WixToolset.Core/Bind/FileFacade.cs b/src/WixToolset.Core/Bind/FileFacade.cs
index 825c2c7a..d631a3b5 100644
--- a/src/WixToolset.Core/Bind/FileFacade.cs
+++ b/src/WixToolset.Core/Bind/FileFacade.cs
@@ -7,27 +7,27 @@ namespace WixToolset.Core.Bind
7 7
8 public class FileFacade 8 public class FileFacade
9 { 9 {
10 public FileFacade(FileTuple file, WixFileTuple wixFile, WixDeltaPatchFileTuple deltaPatchFile) 10 public FileFacade(FileTuple file, AssemblyTuple assembly)
11 { 11 {
12 this.File = file; 12 this.File = file;
13 this.WixFile = wixFile; 13 this.Assembly = assembly;
14 this.DeltaPatchFile = deltaPatchFile;
15 } 14 }
16 15
17 public FileFacade(bool fromModule, FileTuple file, WixFileTuple wixFile) 16 public FileFacade(bool fromModule, FileTuple file)
18 { 17 {
19 this.FromModule = fromModule; 18 this.FromModule = fromModule;
20 this.File = file; 19 this.File = file;
21 this.WixFile = wixFile;
22 } 20 }
23 21
24 public bool FromModule { get; } 22 public bool FromModule { get; }
25 23
26 public FileTuple File { get; } 24 public FileTuple File { get; }
27 25
28 public WixFileTuple WixFile { get; } 26 public AssemblyTuple Assembly { get; }
29 27
30 public WixDeltaPatchFileTuple DeltaPatchFile { get; } 28 public int DiskId => this.File.DiskId ?? 0;
29
30 public bool Uncompressed => (this.File.Attributes & FileTupleAttributes.Uncompressed) == FileTupleAttributes.Uncompressed;
31 31
32 /// <summary> 32 /// <summary>
33 /// Gets the set of MsiAssemblyName rows created for this file. 33 /// Gets the set of MsiAssemblyName rows created for this file.
diff --git a/src/WixToolset.Core/Compiler.cs b/src/WixToolset.Core/Compiler.cs
index d543c6b8..0dade46d 100644
--- a/src/WixToolset.Core/Compiler.cs
+++ b/src/WixToolset.Core/Compiler.cs
@@ -32,7 +32,6 @@ namespace WixToolset.Core
32 private bool compilingModule; 32 private bool compilingModule;
33 private bool compilingProduct; 33 private bool compilingProduct;
34 34
35 private bool useShortFileNames;
36 private string activeName; 35 private string activeName;
37 private string activeLanguage; 36 private string activeLanguage;
38 37
@@ -4184,16 +4183,7 @@ namespace WixToolset.Core
4184 } 4183 }
4185 else // add the appropriate part of this directory element to the file source. 4184 else // add the appropriate part of this directory element to the file source.
4186 { 4185 {
4187 string append = null; 4186 string append = String.IsNullOrEmpty(sourceName) ? name : sourceName;
4188 if (this.useShortFileNames)
4189 {
4190 append = !String.IsNullOrEmpty(shortSourceName) ? shortSourceName : shortName;
4191 }
4192
4193 if (String.IsNullOrEmpty(append))
4194 {
4195 append = !String.IsNullOrEmpty(sourceName) ? sourceName : name;
4196 }
4197 4187
4198 if (!String.IsNullOrEmpty(append)) 4188 if (!String.IsNullOrEmpty(append))
4199 { 4189 {
@@ -5486,7 +5476,7 @@ namespace WixToolset.Core
5486 { 5476 {
5487 var sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node); 5477 var sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node);
5488 Identifier id = null; 5478 Identifier id = null;
5489 var assemblyType = FileAssemblyType.NotAnAssembly; 5479 var assemblyType = AssemblyType.NotAnAssembly;
5490 string assemblyApplication = null; 5480 string assemblyApplication = null;
5491 string assemblyManifest = null; 5481 string assemblyManifest = null;
5492 string bindPath = null; 5482 string bindPath = null;
@@ -5538,13 +5528,13 @@ namespace WixToolset.Core
5538 switch (assemblyValue) 5528 switch (assemblyValue)
5539 { 5529 {
5540 case ".net": 5530 case ".net":
5541 assemblyType = FileAssemblyType.DotNetAssembly; 5531 assemblyType = AssemblyType.DotNetAssembly;
5542 break; 5532 break;
5543 case "no": 5533 case "no":
5544 assemblyType = FileAssemblyType.NotAnAssembly; 5534 assemblyType = AssemblyType.NotAnAssembly;
5545 break; 5535 break;
5546 case "win32": 5536 case "win32":
5547 assemblyType = FileAssemblyType.Win32Assembly; 5537 assemblyType = AssemblyType.Win32Assembly;
5548 break; 5538 break;
5549 default: 5539 default:
5550 this.Core.Write(ErrorMessages.IllegalAttributeValue(sourceLineNumbers, "File", "Assembly", assemblyValue, "no", "win32", ".net")); 5540 this.Core.Write(ErrorMessages.IllegalAttributeValue(sourceLineNumbers, "File", "Assembly", assemblyValue, "no", "win32", ".net"));
@@ -5743,7 +5733,7 @@ namespace WixToolset.Core
5743 this.Core.Write(ErrorMessages.IllegalAttributeWithOtherAttribute(sourceLineNumbers, node.Name.LocalName, "DefaultVersion", "CompanionFile", companionFile)); 5733 this.Core.Write(ErrorMessages.IllegalAttributeWithOtherAttribute(sourceLineNumbers, node.Name.LocalName, "DefaultVersion", "CompanionFile", companionFile));
5744 } 5734 }
5745 5735
5746 if (FileAssemblyType.NotAnAssembly == assemblyType) 5736 if (AssemblyType.NotAnAssembly == assemblyType)
5747 { 5737 {
5748 if (null != assemblyManifest) 5738 if (null != assemblyManifest)
5749 { 5739 {
@@ -5757,7 +5747,7 @@ namespace WixToolset.Core
5757 } 5747 }
5758 else 5748 else
5759 { 5749 {
5760 if (FileAssemblyType.Win32Assembly == assemblyType && null == assemblyManifest) 5750 if (AssemblyType.Win32Assembly == assemblyType && null == assemblyManifest)
5761 { 5751 {
5762 this.Core.Write(ErrorMessages.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "AssemblyManifest", "Assembly", "win32")); 5752 this.Core.Write(ErrorMessages.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "AssemblyManifest", "Assembly", "win32"));
5763 } 5753 }
@@ -5765,7 +5755,7 @@ namespace WixToolset.Core
5765 // allow "*" guid components to omit explicit KeyPath as they can have only one file and therefore this file is the keypath 5755 // allow "*" guid components to omit explicit KeyPath as they can have only one file and therefore this file is the keypath
5766 if (YesNoType.Yes != keyPath && "*" != componentGuid) 5756 if (YesNoType.Yes != keyPath && "*" != componentGuid)
5767 { 5757 {
5768 this.Core.Write(ErrorMessages.IllegalAttributeValueWithoutOtherAttribute(sourceLineNumbers, node.Name.LocalName, "Assembly", (FileAssemblyType.DotNetAssembly == assemblyType ? ".net" : "win32"), "KeyPath", "yes")); 5758 this.Core.Write(ErrorMessages.IllegalAttributeValueWithoutOtherAttribute(sourceLineNumbers, node.Name.LocalName, "Assembly", (AssemblyType.DotNetAssembly == assemblyType ? ".net" : "win32"), "KeyPath", "yes"));
5769 } 5759 }
5770 } 5760 }
5771 5761
@@ -5852,90 +5842,72 @@ namespace WixToolset.Core
5852 5842
5853 if (String.IsNullOrEmpty(source)) 5843 if (String.IsNullOrEmpty(source))
5854 { 5844 {
5855 if (!this.useShortFileNames && null != name) 5845 source = name ?? shortName;
5856 {
5857 source = name;
5858 }
5859 else
5860 {
5861 source = shortName;
5862 }
5863 } 5846 }
5864 else if (source.EndsWith(Path.DirectorySeparatorChar.ToString(), StringComparison.Ordinal)) // if source relies on parent directories, append the file name 5847 else if (source.EndsWith(Path.DirectorySeparatorChar.ToString(), StringComparison.Ordinal)) // if source relies on parent directories, append the file name
5865 { 5848 {
5866 if (!this.useShortFileNames && null != name) 5849 source = null == name ? Path.Combine(source, shortName) : Path.Combine(source, name);
5867 {
5868 source = Path.Combine(source, name);
5869 }
5870 else
5871 {
5872 source = Path.Combine(source, shortName);
5873 }
5874 } 5850 }
5875 5851
5852 var attributes = FileTupleAttributes.None;
5853 attributes |= readOnly ? FileTupleAttributes.ReadOnly : 0;
5854 attributes |= hidden ? FileTupleAttributes.Hidden : 0;
5855 attributes |= system ? FileTupleAttributes.System : 0;
5856 attributes |= vital ? FileTupleAttributes.Vital : 0;
5857 attributes |= checksum ? FileTupleAttributes.Checksum : 0;
5858 attributes |= compressed.HasValue && compressed == true ? FileTupleAttributes.Compressed : 0;
5859 attributes |= compressed.HasValue && compressed == false ? FileTupleAttributes.Uncompressed : 0;
5860 attributes |= generatedShortFileName ? FileTupleAttributes.GeneratedShortFileName : 0;
5861
5876 var tuple = new FileTuple(sourceLineNumbers, id) 5862 var tuple = new FileTuple(sourceLineNumbers, id)
5877 { 5863 {
5878 ComponentRef = componentId, 5864 ComponentRef = componentId,
5879 ShortName = shortName,
5880 Name = name, 5865 Name = name,
5866 ShortName = shortName,
5881 FileSize = defaultSize, 5867 FileSize = defaultSize,
5882 Version = companionFile ?? defaultVersion, 5868 Version = companionFile ?? defaultVersion,
5883 Language = defaultLanguage, 5869 Language = defaultLanguage,
5884 ReadOnly = readOnly, 5870 Attributes = attributes,
5885 Hidden = hidden, 5871
5886 System = system, 5872 //ReadOnly = readOnly,
5887 Vital = vital, 5873 //Hidden = hidden,
5888 Checksum = checksum, 5874 //System = system,
5889 Compressed = compressed, 5875 //Vital = vital,
5876 //Checksum = checksum,
5877 //Compressed = compressed,
5878 //GeneratedShortFileName = generatedShortFileName,
5879
5880 DirectoryRef = directoryId,
5881 DiskId = (CompilerConstants.IntegerNotSet == diskId) ? null : (int?)diskId,
5882 Source = new IntermediateFieldPathValue { Path = source },
5883
5890 FontTitle = fontTitle, 5884 FontTitle = fontTitle,
5891 SelfRegCost = selfRegCost, 5885 SelfRegCost = selfRegCost,
5892 BindPath = bindPath, 5886 BindPath = bindPath,
5893 };
5894 5887
5895 this.Core.AddTuple(tuple); 5888 PatchGroup = (CompilerConstants.IntegerNotSet == patchGroup) ? null : (int?)patchGroup,
5889 PatchAttributes = patchAttributes,
5896 5890
5897 // TODO: Remove all this. 5891 // Delta patching information
5898 var wixFileRow = (WixFileTuple)this.Core.CreateTuple(sourceLineNumbers, TupleDefinitionType.WixFile, id);
5899 wixFileRow.AssemblyType = assemblyType;
5900 wixFileRow.AssemblyManifestFileRef = assemblyManifest;
5901 wixFileRow.AssemblyApplicationFileRef = assemblyApplication;
5902 wixFileRow.DirectoryRef = directoryId;
5903 wixFileRow.DiskId = (CompilerConstants.IntegerNotSet == diskId) ? 0 : diskId;
5904 wixFileRow.Source = new IntermediateFieldPathValue { Path = source };
5905 wixFileRow.ProcessorArchitecture = procArch;
5906 wixFileRow.PatchGroup = (CompilerConstants.IntegerNotSet != patchGroup ? patchGroup : -1);
5907 wixFileRow.Attributes = (generatedShortFileName ? 0x1 : 0x0);
5908 wixFileRow.PatchAttributes = patchAttributes;
5909
5910 // Always create a delta patch row for this file since other elements (like Component and Media) may
5911 // want to add symbol paths to it.
5912 this.Core.AddTuple(new WixDeltaPatchFileTuple(sourceLineNumbers, id)
5913 {
5914 RetainLengths = protectLengths, 5892 RetainLengths = protectLengths,
5915 IgnoreOffsets = ignoreOffsets, 5893 IgnoreOffsets = ignoreOffsets,
5916 IgnoreLengths = ignoreLengths, 5894 IgnoreLengths = ignoreLengths,
5917 RetainOffsets = protectOffsets 5895 RetainOffsets = protectOffsets,
5918 }); 5896 SymbolPaths = symbols
5897 };
5919 5898
5920 if (null != symbols) 5899 this.Core.AddTuple(tuple);
5921 {
5922 this.Core.AddTuple(new WixDeltaPatchSymbolPathsTuple(sourceLineNumbers)
5923 {
5924 SymbolType = SymbolPathType.File,
5925 SymbolId = id.Id,
5926 SymbolPaths = symbols
5927 });
5928 }
5929 5900
5930 if (FileAssemblyType.NotAnAssembly != assemblyType) 5901 if (AssemblyType.NotAnAssembly != assemblyType)
5931 { 5902 {
5932 this.Core.AddTuple(new MsiAssemblyTuple(sourceLineNumbers) 5903 this.Core.AddTuple(new AssemblyTuple(sourceLineNumbers, id)
5933 { 5904 {
5934 ComponentRef = componentId, 5905 ComponentRef = componentId,
5935 FeatureRef = Guid.Empty.ToString("B"), 5906 FeatureRef = Guid.Empty.ToString("B"),
5936 ManifestFileRef = assemblyManifest, 5907 ManifestFileRef = assemblyManifest,
5937 ApplicationFileRef = assemblyApplication, 5908 ApplicationFileRef = assemblyApplication,
5938 Type = assemblyType 5909 Type = assemblyType,
5910 ProcessorArchitecture = procArch,
5939 }); 5911 });
5940 } 5912 }
5941 } 5913 }
@@ -7599,7 +7571,7 @@ namespace WixToolset.Core
7599 var sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node); 7571 var sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node);
7600 Identifier id = null; 7572 Identifier id = null;
7601 var configData = String.Empty; 7573 var configData = String.Empty;
7602 bool? fileCompression = null; 7574 FileTupleAttributes attributes = 0;
7603 string language = null; 7575 string language = null;
7604 string sourceFile = null; 7576 string sourceFile = null;
7605 7577
@@ -7617,7 +7589,9 @@ namespace WixToolset.Core
7617 this.Core.CreateSimpleReference(sourceLineNumbers, "Media", diskId.ToString(CultureInfo.InvariantCulture.NumberFormat)); 7589 this.Core.CreateSimpleReference(sourceLineNumbers, "Media", diskId.ToString(CultureInfo.InvariantCulture.NumberFormat));
7618 break; 7590 break;
7619 case "FileCompression": 7591 case "FileCompression":
7620 fileCompression = YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib); 7592 var compress = this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib);
7593 attributes |= compress == YesNoType.Yes ? FileTupleAttributes.Compressed : 0;
7594 attributes |= compress == YesNoType.No ? FileTupleAttributes.Uncompressed : 0;
7621 break; 7595 break;
7622 case "Language": 7596 case "Language":
7623 language = this.Core.GetAttributeLocalizableIntegerValue(sourceLineNumbers, attrib, 0, Int16.MaxValue); 7597 language = this.Core.GetAttributeLocalizableIntegerValue(sourceLineNumbers, attrib, 0, Int16.MaxValue);
@@ -7692,7 +7666,7 @@ namespace WixToolset.Core
7692 SourceFile = sourceFile, 7666 SourceFile = sourceFile,
7693 DiskId = diskId, 7667 DiskId = diskId,
7694 ConfigurationData = configData, 7668 ConfigurationData = configData,
7695 FileCompression = fileCompression, 7669 FileAttributes = attributes,
7696 FeatureRef = Guid.Empty.ToString("B") 7670 FeatureRef = Guid.Empty.ToString("B")
7697 }; 7671 };
7698 7672
diff --git a/src/WixToolset.Core/Compiler_2.cs b/src/WixToolset.Core/Compiler_2.cs
index 9e965465..3ad8acf9 100644
--- a/src/WixToolset.Core/Compiler_2.cs
+++ b/src/WixToolset.Core/Compiler_2.cs
@@ -760,7 +760,6 @@ namespace WixToolset.Core
760 if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) 760 if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib))
761 { 761 {
762 sourceBits |= 1; 762 sourceBits |= 1;
763 this.useShortFileNames = true;
764 } 763 }
765 break; 764 break;
766 case "SummaryCodepage": 765 case "SummaryCodepage":
diff --git a/src/WixToolset.Core/Linker.cs b/src/WixToolset.Core/Linker.cs
index 31b2ef8a..1f28802b 100644
--- a/src/WixToolset.Core/Linker.cs
+++ b/src/WixToolset.Core/Linker.cs
@@ -320,7 +320,7 @@ namespace WixToolset.Core
320 break; 320 break;
321#endif 321#endif
322 322
323 case TupleDefinitionType.MsiAssembly: 323 case TupleDefinitionType.Assembly:
324 if (SectionType.Product == resolvedSection.Type) 324 if (SectionType.Product == resolvedSection.Type)
325 { 325 {
326 this.ResolveFeatures(tuple, 0, 1, componentsToFeatures, multipleFeatureComponents); 326 this.ResolveFeatures(tuple, 0, 1, componentsToFeatures, multipleFeatureComponents);