@joebigelow / wix-1 / commits / 41e60175

Re-introduce "decompile" to backend

Rob Mensching committed Oct 24, 2018 at 20:56 UTC 41e60175f6db63cb988a9340c950c224dc472814
6 files changed +121 -35
src/WixToolset.Extensibility/Data/DecompileResult.cs new
+13
@@ -0,0 +1,13 @@
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.Extensibility.Data
4 +{
5 + using System.Collections.Generic;
6 +
7 + public class DecompileResult
8 + {
9 + public string SourceDocumentPath { get; set; }
10 +
11 + public IEnumerable<string> ExtractedFilePaths { get; set; }
12 + }
13 +}
src/WixToolset.Extensibility/Data/IDecompileContext.cs new
+55
@@ -0,0 +1,55 @@
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.Extensibility.Data
4 +{
5 + using System;
6 + using System.Collections.Generic;
7 + using WixToolset.Data;
8 +
9 + public interface IDecompileContext
10 + {
11 + IServiceProvider ServiceProvider { get; }
12 +
13 + string DecompilePath { get; set; }
14 +
15 + OutputType DecompileType { get; set; }
16 +
17 + IEnumerable<IDecompilerExtension> Extensions { get; set; }
18 +
19 + string ExtractFolder { get; set; }
20 +
21 + /// <summary>
22 + /// Optional gets or sets the base path for the File/@Source.
23 + /// </summary>
24 + /// <remarks>Default value is "SourceDir" to enable use of BindPaths.</remarks>
25 + string BaseSourcePath { get; set; }
26 +
27 + string IntermediateFolder { get; set; }
28 +
29 + bool IsAdminImage { get; set; }
30 +
31 + string OutputPath { get; set; }
32 +
33 + /// <summary>
34 + /// Gets or sets the option to suppress custom tables.
35 + /// </summary>
36 + bool SuppressCustomTables { get; set; }
37 +
38 + /// <summary>
39 + /// Gets or sets the option to suppress dropping empty tables.
40 + /// </summary>
41 + bool SuppressDroppingEmptyTables { get; set; }
42 +
43 + bool SuppressExtractCabinets { get; set; }
44 +
45 + /// <summary>
46 + /// Gets or sets the option to suppress decompiling UI-related tables.
47 + /// </summary>
48 + bool SuppressUI { get; set; }
49 +
50 + /// <summary>
51 + /// Gets or sets whether the decompiler should use module logic on a product output.
52 + /// </summary>
53 + bool TreatProductAsModule { get; set; }
54 + }
55 +}
src/WixToolset.Extensibility/DecompilerConstants.cs
+1 -3
@@ -1,9 +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.
2
3 -namespace WixToolset
3 +namespace WixToolset.Extensibility
4 {
5 - using System;
6 -
5 /// <summary>
6 /// Constants used by decompiler.
7 /// </summary>
src/WixToolset.Extensibility/IBackend.cs
+3 -1
@@ -1,4 +1,4 @@
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
3 namespace WixToolset.Extensibility
4 {
@@ -9,6 +9,8 @@ namespace WixToolset.Extensibility
9 {
10 BindResult Bind(IBindContext context);
11
12 + DecompileResult Decompile(IDecompileContext context);
13 +
14 Intermediate Unbind(IUnbindContext context);
15
16 bool Inscribe(IInscribeContext context);
src/WixToolset.Extensibility/IDecompilerExtension.cs
+6 -31
@@ -2,46 +2,21 @@
2
3 namespace WixToolset.Extensibility
4 {
5 + using WixToolset.Extensibility.Data;
6 +
7 /// <summary>
8 /// Base class for creating a decompiler extension.
9 /// </summary>
10 public interface IDecompilerExtension
11 {
12 /// <summary>
11 - /// Gets or sets the decompiler core for the extension.
12 - /// </summary>
13 - /// <value>The decompiler core for the extension.</value>
14 - IDecompilerCore Core { get; set; }
15 -
16 - /// <summary>
17 - /// Gets the table definitions this extension decompiles.
18 - /// </summary>
19 - /// <value>Table definitions this extension decompiles.</value>
20 - //TableDefinitionCollection TableDefinitions { get; }
21 -
22 - /// <summary>
23 - /// Gets the library that this decompiler wants removed from the decomipiled output.
24 - /// </summary>
25 - /// <param name="tableDefinitions">The table definitions to use while loading the library.</param>
26 - /// <returns>The library for this extension or null if there is no library to be removed.</returns>
27 - //Library GetLibraryToRemove(TableDefinitionCollection tableDefinitions);
28 -
29 - /// <summary>
30 - /// Called at the beginning of the decompilation of a database.
31 - /// </summary>
32 - /// <param name="tables">The collection of all tables.</param>
33 - //void Initialize(TableIndexedCollection tables);
34 -
35 - /// <summary>
36 - /// Decompiles an extension table.
13 + /// Called before decompiling occurs.
14 /// </summary>
38 - /// <param name="table">The table to decompile.</param>
39 - //void DecompileTable(Table table);
15 + void PreDecompile(IDecompileContext context);
16
17 /// <summary>
42 - /// Finalize decompilation.
18 + /// Called after all decompiling occurs.
19 /// </summary>
44 - /// <param name="tables">The collection of all tables.</param>
45 - //void Finish(TableIndexedCollection tables);
20 + void PostDecompile(DecompileResult result);
21 }
22 }
src/WixToolset.Extensibility/IWindowsInstallerBackendDecompilerExtension.cs new
+43
@@ -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 WixToolset.Extensibility
4 +{
5 + using WixToolset.Data;
6 + using WixToolset.Data.WindowsInstaller;
7 + using WixToolset.Extensibility.Data;
8 +
9 + /// <summary>
10 + /// Interface all binder extensions implement.
11 + /// </summary>
12 + public interface IWindowsInstallerBackendDecompilerExtension
13 + {
14 + /// <summary>
15 + /// Called before decompiling occurs.
16 + /// </summary>
17 + void PreBackendDecompile(IDecompileContext context);
18 +
19 + /// <summary>
20 + /// Gets the table definitions this extension decompiles.
21 + /// </summary>
22 + /// <value>Table definitions this extension decompiles.</value>
23 + TableDefinitionCollection TableDefinitions { get; }
24 +
25 + /// <summary>
26 + /// Gets the library that this decompiler wants removed from the decomipiled output.
27 + /// </summary>
28 + /// <param name="tableDefinitions">The table definitions to use while loading the library.</param>
29 + /// <returns>The library for this extension or null if there is no library to be removed.</returns>
30 + Library GetLibraryToRemove(TableDefinitionCollection tableDefinitions);
31 +
32 + /// <summary>
33 + /// Decompiles an extension table.
34 + /// </summary>
35 + /// <param name="table">The table to decompile.</param>
36 + void DecompileTable(Table table);
37 +
38 + /// <summary>
39 + /// Called after all output changes occur and right before the output is bound into its final format.
40 + /// </summary>
41 + void PostBackendDecompile(DecompileResult result);
42 + }
43 +}