diff options
author | Rob Mensching <rob@firegiant.com> | 2018-10-24 20:56:32 -0700 |
---|---|---|
committer | Rob Mensching <rob@robmensching.com> | 2018-10-24 21:11:31 -0700 |
commit | 41e60175f6db63cb988a9340c950c224dc472814 (patch) | |
tree | de1740c00840c47596b4c9802c08409a0bfe80df /src | |
parent | ce51350ca9c020312810447f64a3f40145f749bd (diff) | |
download | wix-41e60175f6db63cb988a9340c950c224dc472814.tar.gz wix-41e60175f6db63cb988a9340c950c224dc472814.tar.bz2 wix-41e60175f6db63cb988a9340c950c224dc472814.zip |
Re-introduce "decompile" to backend
Diffstat (limited to '')
6 files changed, 121 insertions, 35 deletions
diff --git a/src/WixToolset.Extensibility/Data/DecompileResult.cs b/src/WixToolset.Extensibility/Data/DecompileResult.cs new file mode 100644 index 00000000..29da4887 --- /dev/null +++ b/src/WixToolset.Extensibility/Data/DecompileResult.cs | |||
@@ -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 | } | ||
diff --git a/src/WixToolset.Extensibility/Data/IDecompileContext.cs b/src/WixToolset.Extensibility/Data/IDecompileContext.cs new file mode 100644 index 00000000..fb846878 --- /dev/null +++ b/src/WixToolset.Extensibility/Data/IDecompileContext.cs | |||
@@ -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 | } | ||
diff --git a/src/WixToolset.Extensibility/DecompilerConstants.cs b/src/WixToolset.Extensibility/DecompilerConstants.cs index 58742182..8cd6b19c 100644 --- a/src/WixToolset.Extensibility/DecompilerConstants.cs +++ b/src/WixToolset.Extensibility/DecompilerConstants.cs | |||
@@ -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. | 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 | 2 | ||
3 | namespace WixToolset | 3 | namespace WixToolset.Extensibility |
4 | { | 4 | { |
5 | using System; | ||
6 | |||
7 | /// <summary> | 5 | /// <summary> |
8 | /// Constants used by decompiler. | 6 | /// Constants used by decompiler. |
9 | /// </summary> | 7 | /// </summary> |
diff --git a/src/WixToolset.Extensibility/IBackend.cs b/src/WixToolset.Extensibility/IBackend.cs index 80f885c3..df693561 100644 --- a/src/WixToolset.Extensibility/IBackend.cs +++ b/src/WixToolset.Extensibility/IBackend.cs | |||
@@ -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 | 2 | ||
3 | namespace WixToolset.Extensibility | 3 | namespace WixToolset.Extensibility |
4 | { | 4 | { |
@@ -9,6 +9,8 @@ namespace WixToolset.Extensibility | |||
9 | { | 9 | { |
10 | BindResult Bind(IBindContext context); | 10 | BindResult Bind(IBindContext context); |
11 | 11 | ||
12 | DecompileResult Decompile(IDecompileContext context); | ||
13 | |||
12 | Intermediate Unbind(IUnbindContext context); | 14 | Intermediate Unbind(IUnbindContext context); |
13 | 15 | ||
14 | bool Inscribe(IInscribeContext context); | 16 | bool Inscribe(IInscribeContext context); |
diff --git a/src/WixToolset.Extensibility/IDecompilerExtension.cs b/src/WixToolset.Extensibility/IDecompilerExtension.cs index e2b80089..9ea4290b 100644 --- a/src/WixToolset.Extensibility/IDecompilerExtension.cs +++ b/src/WixToolset.Extensibility/IDecompilerExtension.cs | |||
@@ -2,46 +2,21 @@ | |||
2 | 2 | ||
3 | namespace WixToolset.Extensibility | 3 | namespace WixToolset.Extensibility |
4 | { | 4 | { |
5 | using WixToolset.Extensibility.Data; | ||
6 | |||
5 | /// <summary> | 7 | /// <summary> |
6 | /// Base class for creating a decompiler extension. | 8 | /// Base class for creating a decompiler extension. |
7 | /// </summary> | 9 | /// </summary> |
8 | public interface IDecompilerExtension | 10 | public interface IDecompilerExtension |
9 | { | 11 | { |
10 | /// <summary> | 12 | /// <summary> |
11 | /// Gets or sets the decompiler core for the extension. | 13 | /// Called before decompiling occurs. |
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. | ||
37 | /// </summary> | 14 | /// </summary> |
38 | /// <param name="table">The table to decompile.</param> | 15 | void PreDecompile(IDecompileContext context); |
39 | //void DecompileTable(Table table); | ||
40 | 16 | ||
41 | /// <summary> | 17 | /// <summary> |
42 | /// Finalize decompilation. | 18 | /// Called after all decompiling occurs. |
43 | /// </summary> | 19 | /// </summary> |
44 | /// <param name="tables">The collection of all tables.</param> | 20 | void PostDecompile(DecompileResult result); |
45 | //void Finish(TableIndexedCollection tables); | ||
46 | } | 21 | } |
47 | } | 22 | } |
diff --git a/src/WixToolset.Extensibility/IWindowsInstallerBackendDecompilerExtension.cs b/src/WixToolset.Extensibility/IWindowsInstallerBackendDecompilerExtension.cs new file mode 100644 index 00000000..05899c1f --- /dev/null +++ b/src/WixToolset.Extensibility/IWindowsInstallerBackendDecompilerExtension.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 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 | } | ||