diff options
author | Bob Arnson <bob@firegiant.com> | 2020-03-03 16:08:40 -0500 |
---|---|---|
committer | Bob Arnson <bob@firegiant.com> | 2020-03-03 16:12:57 -0500 |
commit | c6456e5a41709997f62656e2406017321b346e48 (patch) | |
tree | 2e767a1305ac0e445a1d1c13a4f16f3bab11efb9 /src | |
parent | df3a0875e67d5c758d1c9ef5fee1f0fcc89c4611 (diff) | |
download | wix-c6456e5a41709997f62656e2406017321b346e48.tar.gz wix-c6456e5a41709997f62656e2406017321b346e48.tar.bz2 wix-c6456e5a41709997f62656e2406017321b346e48.zip |
Add CreateCustomActionReference method
...to simplify creating custom action references following naming conventions.
Diffstat (limited to 'src')
-rw-r--r-- | src/WixToolset.Core/ExtensibilityServices/CustomActionPlatforms.cs | 31 | ||||
-rw-r--r-- | src/WixToolset.Core/ExtensibilityServices/ParseHelper.cs | 48 |
2 files changed, 79 insertions, 0 deletions
diff --git a/src/WixToolset.Core/ExtensibilityServices/CustomActionPlatforms.cs b/src/WixToolset.Core/ExtensibilityServices/CustomActionPlatforms.cs new file mode 100644 index 00000000..17f381ac --- /dev/null +++ b/src/WixToolset.Core/ExtensibilityServices/CustomActionPlatforms.cs | |||
@@ -0,0 +1,31 @@ | |||
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.Core.ExtensibilityServices | ||
4 | { | ||
5 | using System; | ||
6 | |||
7 | /// <summary> | ||
8 | /// Platforms supported by custom actions. | ||
9 | /// </summary> | ||
10 | [Flags] | ||
11 | public enum CustomActionPlatforms | ||
12 | { | ||
13 | /// <summary>Not specified.</summary> | ||
14 | None = 0, | ||
15 | |||
16 | /// <summary>x86.</summary> | ||
17 | X86 = 0x1, | ||
18 | |||
19 | /// <summary>x64.</summary> | ||
20 | X64 = 0x2, | ||
21 | |||
22 | /// <summary>ia64.</summary> | ||
23 | IA64 = 0x4, | ||
24 | |||
25 | /// <summary>arm.</summary> | ||
26 | ARM = 0x8, | ||
27 | |||
28 | /// <summary>arm64.</summary> | ||
29 | ARM64 = 0x10 | ||
30 | } | ||
31 | } | ||
diff --git a/src/WixToolset.Core/ExtensibilityServices/ParseHelper.cs b/src/WixToolset.Core/ExtensibilityServices/ParseHelper.cs index 8fbfdd87..271e5697 100644 --- a/src/WixToolset.Core/ExtensibilityServices/ParseHelper.cs +++ b/src/WixToolset.Core/ExtensibilityServices/ParseHelper.cs | |||
@@ -892,6 +892,54 @@ namespace WixToolset.Core.ExtensibilityServices | |||
892 | return actionTuple; | 892 | return actionTuple; |
893 | } | 893 | } |
894 | 894 | ||
895 | /// <summary> | ||
896 | /// Create a reference in the specified section for a custom action specialized for specific platforms, | ||
897 | /// given standard prefixes for naming and suffixes for platforms. | ||
898 | /// </summary> | ||
899 | /// <param name="sourceLineNumbers">Source line information.</param> | ||
900 | /// <param name="customAction">The custom action base name.</param> | ||
901 | /// <param name="supportedPlatforms">The platforms for which there are specialized custom actions.</param> | ||
902 | public void CreateCustomActionReference(SourceLineNumber sourceLineNumbers, IntermediateSection section, string customAction, Platform platform, CustomActionPlatforms supportedPlatforms) | ||
903 | { | ||
904 | if (!this.Messaging.EncounteredError) | ||
905 | { | ||
906 | var name = String.Concat("Wix4", customAction); | ||
907 | |||
908 | switch (platform) | ||
909 | { | ||
910 | case Platform.X86: | ||
911 | if ((supportedPlatforms & CustomActionPlatforms.X86) == CustomActionPlatforms.X86) | ||
912 | { | ||
913 | name = String.Concat(customAction, "_X86"); | ||
914 | } | ||
915 | break; | ||
916 | case Platform.X64: | ||
917 | if ((supportedPlatforms & CustomActionPlatforms.X64) == CustomActionPlatforms.X64) | ||
918 | { | ||
919 | name = String.Concat(customAction, "_X64"); | ||
920 | } | ||
921 | break; | ||
922 | case Platform.ARM: | ||
923 | if ((supportedPlatforms & CustomActionPlatforms.ARM) == CustomActionPlatforms.ARM) | ||
924 | { | ||
925 | name = String.Concat(customAction, "_A32"); | ||
926 | } | ||
927 | break; | ||
928 | case Platform.ARM64: | ||
929 | if ((supportedPlatforms & CustomActionPlatforms.ARM64) == CustomActionPlatforms.ARM64) | ||
930 | { | ||
931 | name = String.Concat(customAction, "_A64"); | ||
932 | } | ||
933 | break; | ||
934 | case Platform.IA64: | ||
935 | // yeah, no | ||
936 | break; | ||
937 | } | ||
938 | |||
939 | this.CreateSimpleReference(section, sourceLineNumbers, nameof(TupleDefinitionType.CustomAction), name); | ||
940 | } | ||
941 | } | ||
942 | |||
895 | public void UnexpectedAttribute(XElement element, XAttribute attribute) | 943 | public void UnexpectedAttribute(XElement element, XAttribute attribute) |
896 | { | 944 | { |
897 | var sourceLineNumbers = Preprocessor.GetSourceLineNumbers(element); | 945 | var sourceLineNumbers = Preprocessor.GetSourceLineNumbers(element); |