diff options
Diffstat (limited to 'src/test/burn/ForTestingUseOnlyExtension/ForTestingUseOnlyBurnBackendExtension.cs')
-rw-r--r-- | src/test/burn/ForTestingUseOnlyExtension/ForTestingUseOnlyBurnBackendExtension.cs | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/src/test/burn/ForTestingUseOnlyExtension/ForTestingUseOnlyBurnBackendExtension.cs b/src/test/burn/ForTestingUseOnlyExtension/ForTestingUseOnlyBurnBackendExtension.cs new file mode 100644 index 00000000..fff23274 --- /dev/null +++ b/src/test/burn/ForTestingUseOnlyExtension/ForTestingUseOnlyBurnBackendExtension.cs | |||
@@ -0,0 +1,43 @@ | |||
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 ForTestingUseOnly | ||
4 | { | ||
5 | using System.Collections.Generic; | ||
6 | using System.Linq; | ||
7 | using ForTestingUseOnly.Symbols; | ||
8 | using WixToolset.Data; | ||
9 | using WixToolset.Data.Symbols; | ||
10 | using WixToolset.Extensibility; | ||
11 | |||
12 | /// <summary> | ||
13 | /// Extension for doing completely unsupported things in the name of testing. | ||
14 | /// </summary> | ||
15 | public class ForTestingUseOnlyBurnBackendExtension : BaseBurnBackendBinderExtension | ||
16 | { | ||
17 | private static readonly IntermediateSymbolDefinition[] BurnSymbolDefinitions = | ||
18 | { | ||
19 | ForTestingUseOnlySymbolDefinitions.ForTestingUseOnlyBundle, | ||
20 | }; | ||
21 | |||
22 | protected override IReadOnlyCollection<IntermediateSymbolDefinition> SymbolDefinitions => BurnSymbolDefinitions; | ||
23 | |||
24 | public override void SymbolsFinalized(IntermediateSection section) | ||
25 | { | ||
26 | base.SymbolsFinalized(section); | ||
27 | |||
28 | this.FinalizeBundleSymbol(section); | ||
29 | } | ||
30 | |||
31 | private void FinalizeBundleSymbol(IntermediateSection section) | ||
32 | { | ||
33 | var forTestingUseOnlyBundleSymbol = section.Symbols.OfType<ForTestingUseOnlyBundleSymbol>().SingleOrDefault(); | ||
34 | if (null == forTestingUseOnlyBundleSymbol) | ||
35 | { | ||
36 | return; | ||
37 | } | ||
38 | |||
39 | var bundleSymbol = section.Symbols.OfType<WixBundleSymbol>().Single(); | ||
40 | bundleSymbol.ProviderKey = bundleSymbol.BundleId = forTestingUseOnlyBundleSymbol.BundleId; | ||
41 | } | ||
42 | } | ||
43 | } | ||