diff options
author | Rob Mensching <rob@firegiant.com> | 2023-09-04 23:40:46 -0700 |
---|---|---|
committer | Bob Arnson <github@bobs.org> | 2023-09-05 09:18:40 -0400 |
commit | f18d7e628361cd3f2ff14dd3326cbeea68df004f (patch) | |
tree | af5e4f2495257659308c85f5905ad69c30a3e6f0 /src | |
parent | e29b4aacf89ce060509b20a5f81df200f7d2fbc1 (diff) | |
download | wix-f18d7e628361cd3f2ff14dd3326cbeea68df004f.tar.gz wix-f18d7e628361cd3f2ff14dd3326cbeea68df004f.tar.bz2 wix-f18d7e628361cd3f2ff14dd3326cbeea68df004f.zip |
Correctly process build -outputType switch
Also add a few additional output types to built-in backends.
Fixes 7708
Diffstat (limited to 'src')
14 files changed, 73 insertions, 14 deletions
diff --git a/src/api/wix/WixToolset.Extensibility/Data/IBindContext.cs b/src/api/wix/WixToolset.Extensibility/Data/IBindContext.cs index 9d663c65..25a255c3 100644 --- a/src/api/wix/WixToolset.Extensibility/Data/IBindContext.cs +++ b/src/api/wix/WixToolset.Extensibility/Data/IBindContext.cs | |||
@@ -73,6 +73,11 @@ namespace WixToolset.Extensibility.Data | |||
73 | string OutputPath { get; set; } | 73 | string OutputPath { get; set; } |
74 | 74 | ||
75 | /// <summary> | 75 | /// <summary> |
76 | /// Output type to bind to. | ||
77 | /// </summary> | ||
78 | string OutputType { get; set; } | ||
79 | |||
80 | /// <summary> | ||
76 | /// Type of PDB to create. | 81 | /// Type of PDB to create. |
77 | /// </summary> | 82 | /// </summary> |
78 | PdbType PdbType { get; set; } | 83 | PdbType PdbType { get; set; } |
diff --git a/src/test/burn/TestData/DependencyTests/PatchA/PatchA.wixproj b/src/test/burn/TestData/DependencyTests/PatchA/PatchA.wixproj index 4809934d..bf20b708 100644 --- a/src/test/burn/TestData/DependencyTests/PatchA/PatchA.wixproj +++ b/src/test/burn/TestData/DependencyTests/PatchA/PatchA.wixproj | |||
@@ -1,7 +1,7 @@ | |||
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. --> | 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 | <Project Sdk="WixToolset.Sdk"> | 2 | <Project Sdk="WixToolset.Sdk"> |
3 | <PropertyGroup> | 3 | <PropertyGroup> |
4 | <OutputType>PatchCreation</OutputType> | 4 | <OutputType>Patch</OutputType> |
5 | <TargetExt>.msp</TargetExt> | 5 | <TargetExt>.msp</TargetExt> |
6 | <SuppressSpecificWarnings>1079</SuppressSpecificWarnings> | 6 | <SuppressSpecificWarnings>1079</SuppressSpecificWarnings> |
7 | </PropertyGroup> | 7 | </PropertyGroup> |
diff --git a/src/test/burn/TestData/DependencyTests/PatchB/PatchB.wixproj b/src/test/burn/TestData/DependencyTests/PatchB/PatchB.wixproj index c099f008..5fbdd549 100644 --- a/src/test/burn/TestData/DependencyTests/PatchB/PatchB.wixproj +++ b/src/test/burn/TestData/DependencyTests/PatchB/PatchB.wixproj | |||
@@ -1,7 +1,7 @@ | |||
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. --> | 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 | <Project Sdk="WixToolset.Sdk"> | 2 | <Project Sdk="WixToolset.Sdk"> |
3 | <PropertyGroup> | 3 | <PropertyGroup> |
4 | <OutputType>PatchCreation</OutputType> | 4 | <OutputType>Patch</OutputType> |
5 | <TargetExt>.msp</TargetExt> | 5 | <TargetExt>.msp</TargetExt> |
6 | <SuppressSpecificWarnings>1079</SuppressSpecificWarnings> | 6 | <SuppressSpecificWarnings>1079</SuppressSpecificWarnings> |
7 | </PropertyGroup> | 7 | </PropertyGroup> |
diff --git a/src/test/burn/TestData/PatchTests/PatchA2/PatchA2.wixproj b/src/test/burn/TestData/PatchTests/PatchA2/PatchA2.wixproj index da9acb5e..3deb2263 100644 --- a/src/test/burn/TestData/PatchTests/PatchA2/PatchA2.wixproj +++ b/src/test/burn/TestData/PatchTests/PatchA2/PatchA2.wixproj | |||
@@ -1,7 +1,7 @@ | |||
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. --> | 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 | <Project Sdk="WixToolset.Sdk"> | 2 | <Project Sdk="WixToolset.Sdk"> |
3 | <PropertyGroup> | 3 | <PropertyGroup> |
4 | <OutputType>PatchCreation</OutputType> | 4 | <OutputType>Patch</OutputType> |
5 | <TargetExt>.msp</TargetExt> | 5 | <TargetExt>.msp</TargetExt> |
6 | <SuppressSpecificWarnings>1079</SuppressSpecificWarnings> | 6 | <SuppressSpecificWarnings>1079</SuppressSpecificWarnings> |
7 | </PropertyGroup> | 7 | </PropertyGroup> |
@@ -9,4 +9,4 @@ | |||
9 | <ProjectReference Include="..\PackageAv1\PackageAv1.wixproj" /> | 9 | <ProjectReference Include="..\PackageAv1\PackageAv1.wixproj" /> |
10 | <ProjectReference Include="..\PackageAv1_0_1\PackageAv1_0_1.wixproj" /> | 10 | <ProjectReference Include="..\PackageAv1_0_1\PackageAv1_0_1.wixproj" /> |
11 | </ItemGroup> | 11 | </ItemGroup> |
12 | </Project> \ No newline at end of file | 12 | </Project> |
diff --git a/src/test/burn/TestData/SlipstreamTests/PatchA/PatchA.wixproj b/src/test/burn/TestData/SlipstreamTests/PatchA/PatchA.wixproj index da9acb5e..3deb2263 100644 --- a/src/test/burn/TestData/SlipstreamTests/PatchA/PatchA.wixproj +++ b/src/test/burn/TestData/SlipstreamTests/PatchA/PatchA.wixproj | |||
@@ -1,7 +1,7 @@ | |||
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. --> | 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 | <Project Sdk="WixToolset.Sdk"> | 2 | <Project Sdk="WixToolset.Sdk"> |
3 | <PropertyGroup> | 3 | <PropertyGroup> |
4 | <OutputType>PatchCreation</OutputType> | 4 | <OutputType>Patch</OutputType> |
5 | <TargetExt>.msp</TargetExt> | 5 | <TargetExt>.msp</TargetExt> |
6 | <SuppressSpecificWarnings>1079</SuppressSpecificWarnings> | 6 | <SuppressSpecificWarnings>1079</SuppressSpecificWarnings> |
7 | </PropertyGroup> | 7 | </PropertyGroup> |
@@ -9,4 +9,4 @@ | |||
9 | <ProjectReference Include="..\PackageAv1\PackageAv1.wixproj" /> | 9 | <ProjectReference Include="..\PackageAv1\PackageAv1.wixproj" /> |
10 | <ProjectReference Include="..\PackageAv1_0_1\PackageAv1_0_1.wixproj" /> | 10 | <ProjectReference Include="..\PackageAv1_0_1\PackageAv1_0_1.wixproj" /> |
11 | </ItemGroup> | 11 | </ItemGroup> |
12 | </Project> \ No newline at end of file | 12 | </Project> |
diff --git a/src/test/burn/TestData/SlipstreamTests/PatchAB/PatchAB.wixproj b/src/test/burn/TestData/SlipstreamTests/PatchAB/PatchAB.wixproj index 81fa9e12..5f9ee5f6 100644 --- a/src/test/burn/TestData/SlipstreamTests/PatchAB/PatchAB.wixproj +++ b/src/test/burn/TestData/SlipstreamTests/PatchAB/PatchAB.wixproj | |||
@@ -1,7 +1,7 @@ | |||
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. --> | 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 | <Project Sdk="WixToolset.Sdk"> | 2 | <Project Sdk="WixToolset.Sdk"> |
3 | <PropertyGroup> | 3 | <PropertyGroup> |
4 | <OutputType>PatchCreation</OutputType> | 4 | <OutputType>Patch</OutputType> |
5 | <TargetExt>.msp</TargetExt> | 5 | <TargetExt>.msp</TargetExt> |
6 | <SuppressSpecificWarnings>1079</SuppressSpecificWarnings> | 6 | <SuppressSpecificWarnings>1079</SuppressSpecificWarnings> |
7 | </PropertyGroup> | 7 | </PropertyGroup> |
@@ -11,4 +11,4 @@ | |||
11 | <ProjectReference Include="..\PackageBv1\PackageBv1.wixproj" /> | 11 | <ProjectReference Include="..\PackageBv1\PackageBv1.wixproj" /> |
12 | <ProjectReference Include="..\PackageBv1_0_1\PackageBv1_0_1.wixproj" /> | 12 | <ProjectReference Include="..\PackageBv1_0_1\PackageBv1_0_1.wixproj" /> |
13 | </ItemGroup> | 13 | </ItemGroup> |
14 | </Project> \ No newline at end of file | 14 | </Project> |
diff --git a/src/test/burn/TestData/SlipstreamTests/PatchAB2/PatchAB2.wixproj b/src/test/burn/TestData/SlipstreamTests/PatchAB2/PatchAB2.wixproj index 81fa9e12..5f9ee5f6 100644 --- a/src/test/burn/TestData/SlipstreamTests/PatchAB2/PatchAB2.wixproj +++ b/src/test/burn/TestData/SlipstreamTests/PatchAB2/PatchAB2.wixproj | |||
@@ -1,7 +1,7 @@ | |||
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. --> | 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 | <Project Sdk="WixToolset.Sdk"> | 2 | <Project Sdk="WixToolset.Sdk"> |
3 | <PropertyGroup> | 3 | <PropertyGroup> |
4 | <OutputType>PatchCreation</OutputType> | 4 | <OutputType>Patch</OutputType> |
5 | <TargetExt>.msp</TargetExt> | 5 | <TargetExt>.msp</TargetExt> |
6 | <SuppressSpecificWarnings>1079</SuppressSpecificWarnings> | 6 | <SuppressSpecificWarnings>1079</SuppressSpecificWarnings> |
7 | </PropertyGroup> | 7 | </PropertyGroup> |
@@ -11,4 +11,4 @@ | |||
11 | <ProjectReference Include="..\PackageBv1\PackageBv1.wixproj" /> | 11 | <ProjectReference Include="..\PackageBv1\PackageBv1.wixproj" /> |
12 | <ProjectReference Include="..\PackageBv1_0_1\PackageBv1_0_1.wixproj" /> | 12 | <ProjectReference Include="..\PackageBv1_0_1\PackageBv1_0_1.wixproj" /> |
13 | </ItemGroup> | 13 | </ItemGroup> |
14 | </Project> \ No newline at end of file | 14 | </Project> |
diff --git a/src/wix/WixToolset.Core.Burn/BurnBackendFactory.cs b/src/wix/WixToolset.Core.Burn/BurnBackendFactory.cs index 03013a08..63f52200 100644 --- a/src/wix/WixToolset.Core.Burn/BurnBackendFactory.cs +++ b/src/wix/WixToolset.Core.Burn/BurnBackendFactory.cs | |||
@@ -18,6 +18,7 @@ namespace WixToolset.Core.Burn | |||
18 | switch (outputType.ToLowerInvariant()) | 18 | switch (outputType.ToLowerInvariant()) |
19 | { | 19 | { |
20 | case "bundle": | 20 | case "bundle": |
21 | case "burn": | ||
21 | case ".exe": | 22 | case ".exe": |
22 | backend = new BundleBackend(); | 23 | backend = new BundleBackend(); |
23 | return true; | 24 | return true; |
diff --git a/src/wix/WixToolset.Core.WindowsInstaller/WindowsInstallerBackendFactory.cs b/src/wix/WixToolset.Core.WindowsInstaller/WindowsInstallerBackendFactory.cs index d14743e9..42e1a45d 100644 --- a/src/wix/WixToolset.Core.WindowsInstaller/WindowsInstallerBackendFactory.cs +++ b/src/wix/WixToolset.Core.WindowsInstaller/WindowsInstallerBackendFactory.cs | |||
@@ -18,6 +18,7 @@ namespace WixToolset.Core.WindowsInstaller | |||
18 | switch (outputType?.ToLowerInvariant()) | 18 | switch (outputType?.ToLowerInvariant()) |
19 | { | 19 | { |
20 | case "module": | 20 | case "module": |
21 | case "msm": | ||
21 | case ".msm": | 22 | case ".msm": |
22 | backend = new MsmBackend(); | 23 | backend = new MsmBackend(); |
23 | return true; | 24 | return true; |
@@ -25,11 +26,14 @@ namespace WixToolset.Core.WindowsInstaller | |||
25 | case "msipackage": | 26 | case "msipackage": |
26 | case "package": | 27 | case "package": |
27 | case "product": | 28 | case "product": |
29 | case "msi": | ||
28 | case ".msi": | 30 | case ".msi": |
29 | backend = new MsiBackend(); | 31 | backend = new MsiBackend(); |
30 | return true; | 32 | return true; |
31 | 33 | ||
34 | case "msppackage": | ||
32 | case "patch": | 35 | case "patch": |
36 | case "msp": | ||
33 | case ".msp": | 37 | case ".msp": |
34 | backend = new MspBackend(); | 38 | backend = new MspBackend(); |
35 | return true; | 39 | return true; |
diff --git a/src/wix/WixToolset.Core/BindContext.cs b/src/wix/WixToolset.Core/BindContext.cs index 1c1f7528..50ccdec6 100644 --- a/src/wix/WixToolset.Core/BindContext.cs +++ b/src/wix/WixToolset.Core/BindContext.cs | |||
@@ -42,6 +42,8 @@ namespace WixToolset.Core | |||
42 | 42 | ||
43 | public string OutputPath { get; set; } | 43 | public string OutputPath { get; set; } |
44 | 44 | ||
45 | public string OutputType { get; set; } | ||
46 | |||
45 | public PdbType PdbType { get; set; } | 47 | public PdbType PdbType { get; set; } |
46 | 48 | ||
47 | public string PdbPath { get; set; } | 49 | public string PdbPath { get; set; } |
diff --git a/src/wix/WixToolset.Core/Binder.cs b/src/wix/WixToolset.Core/Binder.cs index 204ab6ee..de2686d5 100644 --- a/src/wix/WixToolset.Core/Binder.cs +++ b/src/wix/WixToolset.Core/Binder.cs | |||
@@ -58,18 +58,18 @@ namespace WixToolset.Core | |||
58 | 58 | ||
59 | var backendFactories = extensionManager.GetServices<IBackendFactory>(); | 59 | var backendFactories = extensionManager.GetServices<IBackendFactory>(); |
60 | 60 | ||
61 | var entrySection = context.IntermediateRepresentation.Sections.First(); | ||
62 | |||
63 | foreach (var factory in backendFactories) | 61 | foreach (var factory in backendFactories) |
64 | { | 62 | { |
65 | if (factory.TryCreateBackend(entrySection.Type.ToString(), context.OutputPath, out var backend)) | 63 | if (factory.TryCreateBackend(context.OutputType, context.OutputPath, out var backend)) |
66 | { | 64 | { |
67 | var result = backend.Bind(context); | 65 | var result = backend.Bind(context); |
68 | return result; | 66 | return result; |
69 | } | 67 | } |
70 | } | 68 | } |
71 | 69 | ||
72 | // TODO: messaging that a backend could not be found to bind the output type? | 70 | var messaging = context.ServiceProvider.GetService<IMessaging>(); |
71 | |||
72 | messaging.Write(CoreErrors.BackendNotFound(context.OutputType, context.OutputPath)); | ||
73 | 73 | ||
74 | return null; | 74 | return null; |
75 | } | 75 | } |
diff --git a/src/wix/WixToolset.Core/CommandLine/BuildCommand.cs b/src/wix/WixToolset.Core/CommandLine/BuildCommand.cs index 965280d0..68dbd768 100644 --- a/src/wix/WixToolset.Core/CommandLine/BuildCommand.cs +++ b/src/wix/WixToolset.Core/CommandLine/BuildCommand.cs | |||
@@ -312,10 +312,18 @@ namespace WixToolset.Core.CommandLine | |||
312 | context.IntermediateFolder = this.IntermediateFolder; | 312 | context.IntermediateFolder = this.IntermediateFolder; |
313 | context.IntermediateRepresentation = resolveResult.IntermediateRepresentation; | 313 | context.IntermediateRepresentation = resolveResult.IntermediateRepresentation; |
314 | context.OutputPath = this.OutputPath; | 314 | context.OutputPath = this.OutputPath; |
315 | context.OutputType = this.commandLine.OutputType; | ||
315 | context.PdbType = inputsOutputs.PdbType; | 316 | context.PdbType = inputsOutputs.PdbType; |
316 | context.PdbPath = inputsOutputs.PdbPath; | 317 | context.PdbPath = inputsOutputs.PdbPath; |
317 | context.CancellationToken = cancellationToken; | 318 | context.CancellationToken = cancellationToken; |
318 | 319 | ||
320 | if (String.IsNullOrEmpty(context.OutputType)) | ||
321 | { | ||
322 | var entrySection = context.IntermediateRepresentation.Sections.First(); | ||
323 | |||
324 | context.OutputType = entrySection.Type.ToString(); | ||
325 | } | ||
326 | |||
319 | var binder = this.ServiceProvider.GetService<IBinder>(); | 327 | var binder = this.ServiceProvider.GetService<IBinder>(); |
320 | bindResult = binder.Bind(context); | 328 | bindResult = binder.Bind(context); |
321 | } | 329 | } |
diff --git a/src/wix/WixToolset.Core/CoreErrors.cs b/src/wix/WixToolset.Core/CoreErrors.cs index 6dbd6c88..16feb9dc 100644 --- a/src/wix/WixToolset.Core/CoreErrors.cs +++ b/src/wix/WixToolset.Core/CoreErrors.cs | |||
@@ -26,6 +26,11 @@ namespace WixToolset.Core | |||
26 | return Message(sourceLineNumbers, Ids.UnableToOpenFile, "Unable to open file: {0}. Error detail: {1}", path, detail); | 26 | return Message(sourceLineNumbers, Ids.UnableToOpenFile, "Unable to open file: {0}. Error detail: {1}", path, detail); |
27 | } | 27 | } |
28 | 28 | ||
29 | public static Message BackendNotFound(string outputType, string outputPath) | ||
30 | { | ||
31 | return Message(null, Ids.BackendNotFound, "Unable to find a backend to process output type: {0} for output file: {1}. Specify a different output type or output file extension.", outputType, outputPath); | ||
32 | } | ||
33 | |||
29 | private static Message Message(SourceLineNumber sourceLineNumber, Ids id, string format, params object[] args) | 34 | private static Message Message(SourceLineNumber sourceLineNumber, Ids id, string format, params object[] args) |
30 | { | 35 | { |
31 | return new Message(sourceLineNumber, MessageLevel.Error, (int)id, format, args); | 36 | return new Message(sourceLineNumber, MessageLevel.Error, (int)id, format, args); |
@@ -37,6 +42,7 @@ namespace WixToolset.Core | |||
37 | UnableToDeleteFile = 7011, | 42 | UnableToDeleteFile = 7011, |
38 | UnableToMoveFile = 7012, | 43 | UnableToMoveFile = 7012, |
39 | UnableToOpenFile = 7013, | 44 | UnableToOpenFile = 7013, |
45 | BackendNotFound = 7014, | ||
40 | } // last available is 7099. 7100 is WindowsInstallerBackendWarnings. | 46 | } // last available is 7099. 7100 is WindowsInstallerBackendWarnings. |
41 | } | 47 | } |
42 | } | 48 | } |
diff --git a/src/wix/test/WixToolsetTest.CoreIntegration/BadInputFixture.cs b/src/wix/test/WixToolsetTest.CoreIntegration/BadInputFixture.cs index f571d13b..ce28faff 100644 --- a/src/wix/test/WixToolsetTest.CoreIntegration/BadInputFixture.cs +++ b/src/wix/test/WixToolsetTest.CoreIntegration/BadInputFixture.cs | |||
@@ -222,6 +222,39 @@ namespace WixToolsetTest.CoreIntegration | |||
222 | } | 222 | } |
223 | 223 | ||
224 | [Fact] | 224 | [Fact] |
225 | public void CannotBuildWithUnknownOutputType() | ||
226 | { | ||
227 | var folder = TestData.Get(@"TestData"); | ||
228 | |||
229 | using (var fs = new DisposableFileSystem()) | ||
230 | { | ||
231 | var baseFolder = fs.GetFolder(); | ||
232 | var intermediateFolder = Path.Combine(baseFolder, "obj"); | ||
233 | var outputPath = Path.Combine(intermediateFolder, @"test.pkg"); | ||
234 | |||
235 | var result = WixRunner.Execute(new[] | ||
236 | { | ||
237 | "build", | ||
238 | Path.Combine(folder, "SimplePackage", "SimplePackage.wxs"), | ||
239 | "-intermediateFolder", intermediateFolder, | ||
240 | "-bindpath", Path.Combine(folder, ".Data"), | ||
241 | "-outputType", "invalid", | ||
242 | "-o", outputPath, | ||
243 | }); | ||
244 | |||
245 | var messages = result.Messages.Select(m => m.ToString()).ToList(); | ||
246 | messages.Sort(); | ||
247 | |||
248 | WixAssert.CompareLineByLine(new[] | ||
249 | { | ||
250 | @"Unable to find a backend to process output type: invalid for output file: <folder>\test.pkg. Specify a different output type or output file extension.", | ||
251 | }, messages.Select(s => s.Replace(intermediateFolder, "<folder>")).ToArray()); | ||
252 | |||
253 | Assert.Equal(7014, result.ExitCode); | ||
254 | } | ||
255 | } | ||
256 | |||
257 | [Fact] | ||
225 | public void GuardsAgainstVariousBundleValuesFromLoc() | 258 | public void GuardsAgainstVariousBundleValuesFromLoc() |
226 | { | 259 | { |
227 | var folder = TestData.Get(@"TestData"); | 260 | var folder = TestData.Get(@"TestData"); |