diff options
| author | Bob Arnson <bob@firegiant.com> | 2023-10-13 18:16:08 -0400 |
|---|---|---|
| committer | Bob Arnson <github@bobs.org> | 2024-02-26 09:18:20 -0500 |
| commit | 6067839ba180f2f4bcd5eac67f839f68f513ccd2 (patch) | |
| tree | f371b51c9435fe031314a882f1b68b2348ee8450 /src/api | |
| parent | 4f1209d8e795ddeb4c639c96081bcfebbfa8e1e2 (diff) | |
| download | wix-6067839ba180f2f4bcd5eac67f839f68f513ccd2.tar.gz wix-6067839ba180f2f4bcd5eac67f839f68f513ccd2.tar.bz2 wix-6067839ba180f2f4bcd5eac67f839f68f513ccd2.zip | |
Add `Files` file harvesting.
Implements https://github.com/wixtoolset/issues/issues/7857.
Like [naked files](https://github.com/wixtoolset/issues/issues/7696),
`Files` elements can appear where `Component` elements do in WiX v4. The
optimizer enumerates files and directories, generating single-file
components as it goes. MSBuild-like wildcards (including `**`) are
supported. `Excludes` child elements lets you exclude files that would
otherwise be captured by wildcards.
Diffstat (limited to 'src/api')
4 files changed, 91 insertions, 1 deletions
diff --git a/src/api/wix/WixToolset.Data/ErrorMessages.cs b/src/api/wix/WixToolset.Data/ErrorMessages.cs index 79b835cd..d604e94f 100644 --- a/src/api/wix/WixToolset.Data/ErrorMessages.cs +++ b/src/api/wix/WixToolset.Data/ErrorMessages.cs | |||
| @@ -368,6 +368,11 @@ namespace WixToolset.Data | |||
| 368 | return Message(sourceLineNumbers, Ids.ExpectedAttribute, "The {0}/@{1} attribute was not found; it is required unless the attribute {2} has a value of '{3}'.", elementName, attributeName, otherAttributeName, otherAttributeValue, otherAttributeValueUnless); | 368 | return Message(sourceLineNumbers, Ids.ExpectedAttribute, "The {0}/@{1} attribute was not found; it is required unless the attribute {2} has a value of '{3}'.", elementName, attributeName, otherAttributeName, otherAttributeValue, otherAttributeValueUnless); |
| 369 | } | 369 | } |
| 370 | 370 | ||
| 371 | public static Message ExpectedAttributeInElementOrParent(SourceLineNumber sourceLineNumbers, string elementName, string attributeName) | ||
| 372 | { | ||
| 373 | return Message(sourceLineNumbers, Ids.ExpectedAttributeInElementOrParent, "The {0}/@{1} attribute was not found or empty; it is required unless it is specified in the parent element.", elementName, attributeName); | ||
| 374 | } | ||
| 375 | |||
| 371 | public static Message ExpectedAttributeInElementOrParent(SourceLineNumber sourceLineNumbers, string elementName, string attributeName, string parentElementName) | 376 | public static Message ExpectedAttributeInElementOrParent(SourceLineNumber sourceLineNumbers, string elementName, string attributeName, string parentElementName) |
| 372 | { | 377 | { |
| 373 | return Message(sourceLineNumbers, Ids.ExpectedAttributeInElementOrParent, "The {0}/@{1} attribute was not found or empty; it is required, or it can be specified in the parent {2} element.", elementName, attributeName, parentElementName); | 378 | return Message(sourceLineNumbers, Ids.ExpectedAttributeInElementOrParent, "The {0}/@{1} attribute was not found or empty; it is required, or it can be specified in the parent {2} element.", elementName, attributeName, parentElementName); |
diff --git a/src/api/wix/WixToolset.Data/Symbols/HarvestFilesSymbol.cs b/src/api/wix/WixToolset.Data/Symbols/HarvestFilesSymbol.cs new file mode 100644 index 00000000..a3123fc1 --- /dev/null +++ b/src/api/wix/WixToolset.Data/Symbols/HarvestFilesSymbol.cs | |||
| @@ -0,0 +1,84 @@ | |||
| 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.Data | ||
| 4 | { | ||
| 5 | using WixToolset.Data.Symbols; | ||
| 6 | |||
| 7 | public static partial class SymbolDefinitions | ||
| 8 | { | ||
| 9 | public static readonly IntermediateSymbolDefinition HarvestFiles = new IntermediateSymbolDefinition( | ||
| 10 | SymbolDefinitionType.HarvestFiles, | ||
| 11 | new[] | ||
| 12 | { | ||
| 13 | new IntermediateFieldDefinition(nameof(HarvestFilesSymbolFields.DirectoryRef), IntermediateFieldType.String), | ||
| 14 | new IntermediateFieldDefinition(nameof(HarvestFilesSymbolFields.Inclusions), IntermediateFieldType.String), | ||
| 15 | new IntermediateFieldDefinition(nameof(HarvestFilesSymbolFields.Exclusions), IntermediateFieldType.String), | ||
| 16 | new IntermediateFieldDefinition(nameof(HarvestFilesSymbolFields.ComplexReferenceParentType), IntermediateFieldType.String), | ||
| 17 | new IntermediateFieldDefinition(nameof(HarvestFilesSymbolFields.ParentId), IntermediateFieldType.String), | ||
| 18 | new IntermediateFieldDefinition(nameof(HarvestFilesSymbolFields.SourcePath), IntermediateFieldType.String), | ||
| 19 | }, | ||
| 20 | typeof(HarvestFilesSymbol)); | ||
| 21 | } | ||
| 22 | } | ||
| 23 | |||
| 24 | namespace WixToolset.Data.Symbols | ||
| 25 | { | ||
| 26 | public enum HarvestFilesSymbolFields | ||
| 27 | { | ||
| 28 | DirectoryRef, | ||
| 29 | Inclusions, | ||
| 30 | Exclusions, | ||
| 31 | ComplexReferenceParentType, | ||
| 32 | ParentId, | ||
| 33 | SourcePath, | ||
| 34 | } | ||
| 35 | |||
| 36 | public class HarvestFilesSymbol : IntermediateSymbol | ||
| 37 | { | ||
| 38 | public HarvestFilesSymbol() : base(SymbolDefinitions.HarvestFiles, null, null) | ||
| 39 | { | ||
| 40 | } | ||
| 41 | |||
| 42 | public HarvestFilesSymbol(SourceLineNumber sourceLineNumber, Identifier id = null) : base(SymbolDefinitions.HarvestFiles, sourceLineNumber, id) | ||
| 43 | { | ||
| 44 | } | ||
| 45 | |||
| 46 | public IntermediateField this[HarvestFilesSymbolFields index] => this.Fields[(int)index]; | ||
| 47 | |||
| 48 | public string DirectoryRef | ||
| 49 | { | ||
| 50 | get => (string)this.Fields[(int)HarvestFilesSymbolFields.DirectoryRef]; | ||
| 51 | set => this.Set((int)HarvestFilesSymbolFields.DirectoryRef, value); | ||
| 52 | } | ||
| 53 | |||
| 54 | public string Inclusions | ||
| 55 | { | ||
| 56 | get => (string)this.Fields[(int)HarvestFilesSymbolFields.Inclusions]; | ||
| 57 | set => this.Set((int)HarvestFilesSymbolFields.Inclusions, value); | ||
| 58 | } | ||
| 59 | |||
| 60 | public string Exclusions | ||
| 61 | { | ||
| 62 | get => (string)this.Fields[(int)HarvestFilesSymbolFields.Exclusions]; | ||
| 63 | set => this.Set((int)HarvestFilesSymbolFields.Exclusions, value); | ||
| 64 | } | ||
| 65 | |||
| 66 | public string ComplexReferenceParentType | ||
| 67 | { | ||
| 68 | get => (string)this.Fields[(int)HarvestFilesSymbolFields.ComplexReferenceParentType]; | ||
| 69 | set => this.Set((int)HarvestFilesSymbolFields.ComplexReferenceParentType, value); | ||
| 70 | } | ||
| 71 | |||
| 72 | public string ParentId | ||
| 73 | { | ||
| 74 | get => (string)this.Fields[(int)HarvestFilesSymbolFields.ParentId]; | ||
| 75 | set => this.Set((int)HarvestFilesSymbolFields.ParentId, value); | ||
| 76 | } | ||
| 77 | |||
| 78 | public string SourcePath | ||
| 79 | { | ||
| 80 | get => (string)this.Fields[(int)HarvestFilesSymbolFields.SourcePath]; | ||
| 81 | set => this.Set((int)HarvestFilesSymbolFields.SourcePath, value); | ||
| 82 | } | ||
| 83 | } | ||
| 84 | } | ||
diff --git a/src/api/wix/WixToolset.Data/Symbols/SymbolDefinitions.cs b/src/api/wix/WixToolset.Data/Symbols/SymbolDefinitions.cs index 3b545a71..67c00431 100644 --- a/src/api/wix/WixToolset.Data/Symbols/SymbolDefinitions.cs +++ b/src/api/wix/WixToolset.Data/Symbols/SymbolDefinitions.cs | |||
| @@ -40,6 +40,7 @@ namespace WixToolset.Data | |||
| 40 | FeatureComponents, | 40 | FeatureComponents, |
| 41 | File, | 41 | File, |
| 42 | FileSFPCatalog, | 42 | FileSFPCatalog, |
| 43 | HarvestFiles, | ||
| 43 | Icon, | 44 | Icon, |
| 44 | ImageFamilies, | 45 | ImageFamilies, |
| 45 | IniFile, | 46 | IniFile, |
diff --git a/src/api/wix/WixToolset.Extensibility/Services/IParseHelper.cs b/src/api/wix/WixToolset.Extensibility/Services/IParseHelper.cs index 3c20c14b..e7856c7c 100644 --- a/src/api/wix/WixToolset.Extensibility/Services/IParseHelper.cs +++ b/src/api/wix/WixToolset.Extensibility/Services/IParseHelper.cs | |||
| @@ -11,7 +11,7 @@ namespace WixToolset.Extensibility.Services | |||
| 11 | using WixToolset.Extensibility.Data; | 11 | using WixToolset.Extensibility.Data; |
| 12 | 12 | ||
| 13 | /// <summary> | 13 | /// <summary> |
| 14 | /// Interface provided to help compiler extensions parse. | 14 | /// Interface provided to help compiler and optimizer extensions parse. |
| 15 | /// </summary> | 15 | /// </summary> |
| 16 | public interface IParseHelper | 16 | public interface IParseHelper |
| 17 | { | 17 | { |
