diff options
author | Rob Mensching <rob@firegiant.com> | 2022-07-26 17:20:39 -0700 |
---|---|---|
committer | Rob Mensching <rob@firegiant.com> | 2022-08-01 20:25:19 -0700 |
commit | a627ca9b720047e633a8fe72003ab9bee31006c5 (patch) | |
tree | 2bc8a924bb4141ab718e74d08f6459a0ffe8d573 /src/tools/heat/Data | |
parent | 521eb3c9cf38823a2c4019abb85dc0b3200b92cb (diff) | |
download | wix-a627ca9b720047e633a8fe72003ab9bee31006c5.tar.gz wix-a627ca9b720047e633a8fe72003ab9bee31006c5.tar.bz2 wix-a627ca9b720047e633a8fe72003ab9bee31006c5.zip |
Create WixToolset.Heat.nupkg to distribute heat.exe and Heat targets
Moves Heat functionality to the "tools" layer and packages it all
up in WixToolset.Heat.nupkg for distribution in WiX v4.
Completes 6838
Diffstat (limited to 'src/tools/heat/Data')
-rw-r--r-- | src/tools/heat/Data/HarvesterErrors.cs | 205 | ||||
-rw-r--r-- | src/tools/heat/Data/HarvesterVerboses.cs | 62 | ||||
-rw-r--r-- | src/tools/heat/Data/HarvesterWarnings.cs | 79 | ||||
-rw-r--r-- | src/tools/heat/Data/HeatCommandLineOption.cs | 31 | ||||
-rw-r--r-- | src/tools/heat/Data/IHeatCommandLine.cs | 12 |
5 files changed, 389 insertions, 0 deletions
diff --git a/src/tools/heat/Data/HarvesterErrors.cs b/src/tools/heat/Data/HarvesterErrors.cs new file mode 100644 index 00000000..a8a3055a --- /dev/null +++ b/src/tools/heat/Data/HarvesterErrors.cs | |||
@@ -0,0 +1,205 @@ | |||
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.Harvesters.Data | ||
4 | { | ||
5 | using System; | ||
6 | using System.Resources; | ||
7 | using WixToolset.Data; | ||
8 | |||
9 | #pragma warning disable 1591 // TODO: add documentation | ||
10 | public static class HarvesterErrors | ||
11 | { | ||
12 | public static Message ArgumentRequiresValue(string argument) | ||
13 | { | ||
14 | return Message(null, Ids.ArgumentRequiresValue, "The argument '{0}' does not have a value specified and it is required.", argument); | ||
15 | } | ||
16 | |||
17 | public static Message BuildErrorDuringHarvesting(string buildError) | ||
18 | { | ||
19 | return Message(null, Ids.BuildErrorDuringHarvesting, "Build error during harvesting: {0}", buildError); | ||
20 | } | ||
21 | |||
22 | public static Message BuildFailed() | ||
23 | { | ||
24 | return Message(null, Ids.BuildFailed, "Build failed."); | ||
25 | } | ||
26 | |||
27 | public static Message CannotBuildProject(string projectFile, string innerExceptionMessage) | ||
28 | { | ||
29 | return Message(null, Ids.CannotBuildProject, "Failed to build project {0}: {1}", projectFile, innerExceptionMessage); | ||
30 | } | ||
31 | |||
32 | public static Message CannotHarvestWebSite() | ||
33 | { | ||
34 | return Message(null, Ids.CannotHarvestWebSite, "Cannot harvest website. On Windows Vista, you must install IIS 6 Management Compatibility."); | ||
35 | } | ||
36 | |||
37 | public static Message CannotLoadMSBuildAssembly(string innerExceptionMessage) | ||
38 | { | ||
39 | return Message(null, Ids.CannotLoadMSBuildAssembly, "Failed to load MSBuild assembly: {0}", innerExceptionMessage); | ||
40 | } | ||
41 | |||
42 | public static Message CannotLoadMSBuildEngine(string innerExceptionMessage) | ||
43 | { | ||
44 | return Message(null, Ids.CannotLoadMSBuildEngine, "Failed to load MSBuild engine: {0}", innerExceptionMessage); | ||
45 | } | ||
46 | |||
47 | public static Message CannotLoadMSBuildWrapperAssembly(string innerExceptionMessage) | ||
48 | { | ||
49 | return Message(null, Ids.CannotLoadMSBuildWrapperAssembly, "Failed to load MSBuild wrapper assembly: {0}", innerExceptionMessage); | ||
50 | } | ||
51 | |||
52 | public static Message CannotLoadMSBuildWrapperObject(string innerExceptionMessage) | ||
53 | { | ||
54 | return Message(null, Ids.CannotLoadMSBuildWrapperObject, "Failed to load MSBuild wrapper object: {0}", innerExceptionMessage); | ||
55 | } | ||
56 | |||
57 | public static Message CannotLoadMSBuildWrapperType(string innerExceptionMessage) | ||
58 | { | ||
59 | return Message(null, Ids.CannotLoadMSBuildWrapperType, "Failed to load MSBuild wrapper type: {0}", innerExceptionMessage); | ||
60 | } | ||
61 | |||
62 | public static Message CannotLoadProject(string projectFile, string innerExceptionMessage) | ||
63 | { | ||
64 | return Message(null, Ids.CannotLoadProject, "Failed to load project {0}: {1}", projectFile, innerExceptionMessage); | ||
65 | } | ||
66 | |||
67 | public static Message DirectoryAttributeAccessorBadType(string attributeName) | ||
68 | { | ||
69 | return Message(null, Ids.DirectoryAttributeAccessorBadType, "DirectoryAttributeAccessor tried to access an invalid element type for attribute '{0'}.", attributeName); | ||
70 | } | ||
71 | |||
72 | public static Message DirectoryNotFound(string directory) | ||
73 | { | ||
74 | return Message(null, Ids.DirectoryNotFound, "The directory '{0}' could not be found.", directory); | ||
75 | } | ||
76 | |||
77 | public static Message EmptyDirectory(string directory) | ||
78 | { | ||
79 | return Message(null, Ids.EmptyDirectory, "The directory '{0}' did not contain any files or sub-directories and since empty directories are not being kept, there was nothing to harvest.", directory); | ||
80 | } | ||
81 | |||
82 | public static Message ErrorTransformingHarvestedWiX(string transform, string message) | ||
83 | { | ||
84 | return Message(null, Ids.ErrorTransformingHarvestedWiX, "Error applying transform {0} to harvested WiX: {1}", transform, message); | ||
85 | } | ||
86 | |||
87 | public static Message FileNotFound(string file) | ||
88 | { | ||
89 | return Message(null, Ids.FileNotFound, "The file '{0}' cannot be found.", file); | ||
90 | } | ||
91 | |||
92 | public static Message InsufficientPermissionHarvestWebSite() | ||
93 | { | ||
94 | return Message(null, Ids.InsufficientPermissionHarvestWebSite, "Not enough permissions to harvest website. On Windows Vista, you must run Heat elevated."); | ||
95 | } | ||
96 | |||
97 | public static Message InvalidDirectoryId(string generateType) | ||
98 | { | ||
99 | return Message(null, Ids.InvalidDirectoryId, "Invalid directory ID: {0}. Check that it doesn't start with a hyphen or slash.", generateType); | ||
100 | } | ||
101 | |||
102 | public static Message InvalidDirectoryOutputType(string generateType) | ||
103 | { | ||
104 | return Message(null, Ids.InvalidOutputType, "Invalid generated type: {0}. Must be one of: components, payloadgroup.", generateType); | ||
105 | } | ||
106 | |||
107 | public static Message InvalidOutputGroup(string outputGroup) | ||
108 | { | ||
109 | return Message(null, Ids.InvalidOutputGroup, "Invalid project output group: {0}.", outputGroup); | ||
110 | } | ||
111 | |||
112 | public static Message InvalidProjectOutputType(string generateType) | ||
113 | { | ||
114 | return Message(null, Ids.InvalidOutputType, "Invalid generated type: {0}. Must be one of: components, container, payloadgroup, packagegroup.", generateType); | ||
115 | } | ||
116 | |||
117 | public static Message InvalidProjectName(string generateType) | ||
118 | { | ||
119 | return Message(null, Ids.InvalidProjectName, "Invalid project name: {0}. Check that it doesn't start with a hyphen or slash.", generateType); | ||
120 | } | ||
121 | |||
122 | public static Message MissingProjectOutputGroup(string projectFile, string outputGroup) | ||
123 | { | ||
124 | return Message(null, Ids.MissingProjectOutputGroup, "Missing project output group '{1}' in project {0}.", projectFile, outputGroup); | ||
125 | } | ||
126 | |||
127 | public static Message MsbuildBinPathRequired(string version) | ||
128 | { | ||
129 | return Message(null, Ids.MsbuildBinPathRequired, "MSBuildBinPath required for ToolsVersion '{0}'", version); | ||
130 | } | ||
131 | |||
132 | public static Message NoOutputGroupSpecified() | ||
133 | { | ||
134 | return Message(null, Ids.NoOutputGroupSpecified, "No project output group specified."); | ||
135 | } | ||
136 | |||
137 | public static Message PerformanceCategoryNotFound(string key) | ||
138 | { | ||
139 | return Message(null, Ids.PerformanceCategoryNotFound, "Performance category '{0}' not found.", key); | ||
140 | } | ||
141 | |||
142 | public static Message SpacesNotAllowedInArgumentValue(string arg, string value) | ||
143 | { | ||
144 | return Message(null, Ids.SpacesNotAllowedInArgumentValue, "The switch '{0}' does not allow the spaces from the value. Please remove the spaces in from the value: {1}", arg, value); | ||
145 | } | ||
146 | |||
147 | public static Message UnableToOpenRegistryKey(string key) | ||
148 | { | ||
149 | return Message(null, Ids.UnableToOpenRegistryKey, "Unable to open registry key '{0}'.", key); | ||
150 | } | ||
151 | |||
152 | public static Message UnsupportedPerformanceCounterType(string key) | ||
153 | { | ||
154 | return Message(null, Ids.UnsupportedPerformanceCounterType, "Unsupported performance counter type '{0}'.", key); | ||
155 | } | ||
156 | |||
157 | public static Message WebSiteNotFound(string webSiteDescription) | ||
158 | { | ||
159 | return Message(null, Ids.WebSiteNotFound, "The web site '{0}' could not be found. Please check that the web site exists, and that it is spelled correctly (please note, you must use the correct case).", webSiteDescription); | ||
160 | } | ||
161 | |||
162 | private static Message Message(SourceLineNumber sourceLineNumber, Ids id, string format, params object[] args) | ||
163 | { | ||
164 | return new Message(sourceLineNumber, MessageLevel.Error, (int)id, format, args); | ||
165 | } | ||
166 | |||
167 | private static Message Message(SourceLineNumber sourceLineNumber, Ids id, ResourceManager resourceManager, string resourceName, params object[] args) | ||
168 | { | ||
169 | return new Message(sourceLineNumber, MessageLevel.Error, (int)id, resourceManager, resourceName, args); | ||
170 | } | ||
171 | |||
172 | public enum Ids | ||
173 | { | ||
174 | DirectoryNotFound = 5052, | ||
175 | EmptyDirectory = 5053, | ||
176 | ErrorTransformingHarvestedWiX = 5055, | ||
177 | UnableToOpenRegistryKey = 5056, | ||
178 | SpacesNotAllowedInArgumentValue = 5057, | ||
179 | ArgumentRequiresValue = 5058, | ||
180 | FileNotFound = 5059, | ||
181 | PerformanceCategoryNotFound = 5060, | ||
182 | UnsupportedPerformanceCounterType = 5061, | ||
183 | WebSiteNotFound = 5158, | ||
184 | InsufficientPermissionHarvestWebSite = 5159, | ||
185 | CannotHarvestWebSite = 5160, | ||
186 | InvalidOutputGroup = 5301, | ||
187 | NoOutputGroupSpecified = 5302, | ||
188 | CannotLoadMSBuildAssembly = 5303, | ||
189 | CannotLoadMSBuildEngine = 5304, | ||
190 | CannotLoadProject = 5305, | ||
191 | CannotBuildProject = 5306, | ||
192 | BuildFailed = 5307, | ||
193 | MissingProjectOutputGroup = 5308, | ||
194 | DirectoryAttributeAccessorBadType = 5309, | ||
195 | InvalidOutputType = 5310, | ||
196 | InvalidDirectoryId = 5311, | ||
197 | InvalidProjectName = 5312, | ||
198 | BuildErrorDuringHarvesting = 5313, | ||
199 | CannotLoadMSBuildWrapperAssembly = 5314, | ||
200 | CannotLoadMSBuildWrapperType = 5315, | ||
201 | CannotLoadMSBuildWrapperObject = 5316, | ||
202 | MsbuildBinPathRequired = 5317, | ||
203 | } | ||
204 | } | ||
205 | } | ||
diff --git a/src/tools/heat/Data/HarvesterVerboses.cs b/src/tools/heat/Data/HarvesterVerboses.cs new file mode 100644 index 00000000..72de2351 --- /dev/null +++ b/src/tools/heat/Data/HarvesterVerboses.cs | |||
@@ -0,0 +1,62 @@ | |||
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.Harvesters.Data | ||
4 | { | ||
5 | using System; | ||
6 | using System.Resources; | ||
7 | using WixToolset.Data; | ||
8 | |||
9 | #pragma warning disable 1591 // TODO: add documentation | ||
10 | public static class HarvesterVerboses | ||
11 | { | ||
12 | public static Message FoundToolsVersion(string toolsVersion) | ||
13 | { | ||
14 | return Message(null, Ids.FoundToolsVersion, "Found ToolsVersion {0} inside project file.", toolsVersion); | ||
15 | } | ||
16 | |||
17 | public static Message HarvestingAssembly(string fileName) | ||
18 | { | ||
19 | return Message(null, Ids.HarvestingAssembly, "Trying to harvest {0} as an assembly.", fileName); | ||
20 | } | ||
21 | |||
22 | public static Message HarvestingSelfReg(string fileName) | ||
23 | { | ||
24 | return Message(null, Ids.HarvestingSelfReg, "Trying to harvest self-registration information from native DLL {0}.", fileName); | ||
25 | } | ||
26 | |||
27 | public static Message HarvestingTypeLib(string fileName) | ||
28 | { | ||
29 | return Message(null, Ids.HarvestingTypeLib, "Trying to harvest type-library information from native DLL {0}.", fileName); | ||
30 | } | ||
31 | |||
32 | public static Message LoadingProjectWithBinPath(string msbuildBinPath) | ||
33 | { | ||
34 | return Message(null, Ids.LoadingProjectWithBinPath, "Loading project using MSBuild bin path {0}.", msbuildBinPath); | ||
35 | } | ||
36 | |||
37 | public static Message LoadingProjectWithVersion(string msbuildVersion) | ||
38 | { | ||
39 | return Message(null, Ids.LoadingProjectWithVersion, "Loading project using MSBuild version {0}.", msbuildVersion); | ||
40 | } | ||
41 | |||
42 | private static Message Message(SourceLineNumber sourceLineNumber, Ids id, string format, params object[] args) | ||
43 | { | ||
44 | return new Message(sourceLineNumber, MessageLevel.Verbose, (int)id, format, args); | ||
45 | } | ||
46 | |||
47 | private static Message Message(SourceLineNumber sourceLineNumber, Ids id, ResourceManager resourceManager, string resourceName, params object[] args) | ||
48 | { | ||
49 | return new Message(sourceLineNumber, MessageLevel.Verbose, (int)id, resourceManager, resourceName, args); | ||
50 | } | ||
51 | |||
52 | public enum Ids | ||
53 | { | ||
54 | HarvestingAssembly = 5100, | ||
55 | HarvestingSelfReg = 5101, | ||
56 | HarvestingTypeLib = 5102, | ||
57 | LoadingProjectWithVersion = 5378, | ||
58 | FoundToolsVersion = 5379, | ||
59 | LoadingProjectWithBinPath = 5380, | ||
60 | } | ||
61 | } | ||
62 | } | ||
diff --git a/src/tools/heat/Data/HarvesterWarnings.cs b/src/tools/heat/Data/HarvesterWarnings.cs new file mode 100644 index 00000000..80ee5c31 --- /dev/null +++ b/src/tools/heat/Data/HarvesterWarnings.cs | |||
@@ -0,0 +1,79 @@ | |||
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.Harvesters.Data | ||
4 | { | ||
5 | using System; | ||
6 | using System.Resources; | ||
7 | using WixToolset.Data; | ||
8 | |||
9 | #pragma warning disable 1591 // TODO: add documentation | ||
10 | public static class HarvesterWarnings | ||
11 | { | ||
12 | public static Message AssemblyHarvestFailed(string file, string message) | ||
13 | { | ||
14 | return Message(null, Ids.AssemblyHarvestFailed, "Could not harvest data from a file that was expected to be an assembly: {0}. If this file is not an assembly you can ignore this warning. Otherwise, this error detail may be helpful to diagnose the failure: {1}", file, message); | ||
15 | } | ||
16 | |||
17 | public static Message DuplicateDllRegistryEntry(string registryKey, string componentId) | ||
18 | { | ||
19 | return Message(null, Ids.DuplicateDllRegistryEntry, "Ignoring the registry key '{0}', it has already been added to the component '{1}'.", registryKey, componentId); | ||
20 | } | ||
21 | |||
22 | public static Message DuplicateDllRegistryEntry(string registryKey, string registryKeyValue, string componentId) | ||
23 | { | ||
24 | return Message(null, Ids.DuplicateDllRegistryEntry, "Ignoring the registry key '{0}', it has already been added to the component '{2}'. The registry key value '{1}' will not be harvested.", registryKey, registryKeyValue, componentId); | ||
25 | } | ||
26 | |||
27 | public static Message EncounteredNullDirectoryForWebSite(string directory) | ||
28 | { | ||
29 | return Message(null, Ids.EncounteredNullDirectoryForWebSite, "Could not harvest website directory: {0}. Please update the output with the appropriate directory ID before using.", directory); | ||
30 | } | ||
31 | |||
32 | public static Message NoLogger(string exceptionMessage) | ||
33 | { | ||
34 | return Message(null, Ids.NoLogger, "Failed to set loggers: {0}", exceptionMessage); | ||
35 | } | ||
36 | |||
37 | public static Message NoProjectConfiguration(string exceptionMessage) | ||
38 | { | ||
39 | return Message(null, Ids.NoProjectConfiguration, "Failed to set project configuration and platform: {0}", exceptionMessage); | ||
40 | } | ||
41 | |||
42 | public static Message SelfRegHarvestFailed(string file, string message) | ||
43 | { | ||
44 | return Message(null, Ids.SelfRegHarvestFailed, "Could not harvest data from a file that was expected to be a SelfReg DLL: {0}. If this file does not support SelfReg you can ignore this warning. Otherwise, this error detail may be helpful to diagnose the failure: {1}", file, message); | ||
45 | } | ||
46 | |||
47 | public static Message TypeLibLoadFailed(string file, string message) | ||
48 | { | ||
49 | return Message(null, Ids.TypeLibLoadFailed, "Could not load file that was expected to be a type library based off of file extension: {0}. If this file is not a type library you can ignore this warning. Otherwise, this error detail may be helpful to diagnose the load failure: {1}", file, message); | ||
50 | } | ||
51 | |||
52 | public static Message UnsupportedRegistryType(string registryValue, int regFileLineNumber, string unsupportedType) | ||
53 | { | ||
54 | return Message(null, Ids.UnsupportedRegistryType, "Ignoring the registry value '{0}' found on line {1}, because it is of a type unsupported by Windows Installer ({2}).", registryValue, regFileLineNumber, unsupportedType); | ||
55 | } | ||
56 | |||
57 | private static Message Message(SourceLineNumber sourceLineNumber, Ids id, string format, params object[] args) | ||
58 | { | ||
59 | return new Message(sourceLineNumber, MessageLevel.Warning, (int)id, format, args); | ||
60 | } | ||
61 | |||
62 | private static Message Message(SourceLineNumber sourceLineNumber, Ids id, ResourceManager resourceManager, string resourceName, params object[] args) | ||
63 | { | ||
64 | return new Message(sourceLineNumber, MessageLevel.Warning, (int)id, resourceManager, resourceName, args); | ||
65 | } | ||
66 | |||
67 | public enum Ids | ||
68 | { | ||
69 | SelfRegHarvestFailed = 5150, | ||
70 | AssemblyHarvestFailed = 5151, | ||
71 | TypeLibLoadFailed = 5152, | ||
72 | DuplicateDllRegistryEntry = 5156, | ||
73 | UnsupportedRegistryType = 5157, | ||
74 | NoProjectConfiguration = 5398, | ||
75 | NoLogger = 5399, | ||
76 | EncounteredNullDirectoryForWebSite = 5400, | ||
77 | } | ||
78 | } | ||
79 | } | ||
diff --git a/src/tools/heat/Data/HeatCommandLineOption.cs b/src/tools/heat/Data/HeatCommandLineOption.cs new file mode 100644 index 00000000..5815abf0 --- /dev/null +++ b/src/tools/heat/Data/HeatCommandLineOption.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.Harvesters.Data | ||
4 | { | ||
5 | /// <summary> | ||
6 | /// A command line option. | ||
7 | /// </summary> | ||
8 | public struct HeatCommandLineOption | ||
9 | { | ||
10 | /// <summary> | ||
11 | /// The option name used on the command line. | ||
12 | /// </summary> | ||
13 | public string Option; | ||
14 | |||
15 | /// <summary> | ||
16 | /// Description shown in Help command. | ||
17 | /// </summary> | ||
18 | public string Description; | ||
19 | |||
20 | /// <summary> | ||
21 | /// Instantiates a new CommandLineOption. | ||
22 | /// </summary> | ||
23 | /// <param name="option">The option name.</param> | ||
24 | /// <param name="description">The description of the option.</param> | ||
25 | public HeatCommandLineOption(string option, string description) | ||
26 | { | ||
27 | this.Option = option; | ||
28 | this.Description = description; | ||
29 | } | ||
30 | } | ||
31 | } | ||
diff --git a/src/tools/heat/Data/IHeatCommandLine.cs b/src/tools/heat/Data/IHeatCommandLine.cs new file mode 100644 index 00000000..9198468d --- /dev/null +++ b/src/tools/heat/Data/IHeatCommandLine.cs | |||
@@ -0,0 +1,12 @@ | |||
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.Harvesters.Data | ||
4 | { | ||
5 | using WixToolset.Extensibility.Data; | ||
6 | |||
7 | #pragma warning disable 1591 // TODO: add documentation | ||
8 | public interface IHeatCommandLine | ||
9 | { | ||
10 | ICommandLineCommand ParseStandardCommandLine(ICommandLineArguments arguments); | ||
11 | } | ||
12 | } | ||