Update to WiX Intermediate Representation
Rob Mensching committed
Nov 1, 2017 at 10:59 UTC
f87ec715a88a78a6d7788503da2ebec786544e75
26 files changed
+133
-40
src/WixToolset.Extensibility/BinderExtensionBase.cs
+1
-1
@@ -21,7 +21,7 @@ namespace WixToolset.Extensibility
21
/// <summary>
22
/// Called after variable resolution occurs.
23
/// </summary>
24
- public virtual void AfterResolvedFields(Output output)
24
+ public virtual void AfterResolvedFields(Intermediate intermediate)
25
{
26
}
27
src/WixToolset.Extensibility/CompilerExtension.cs
+3
-2
@@ -4,6 +4,7 @@ namespace WixToolset.Extensibility
4
{
5
using System.Collections.Generic;
6
using System.Xml.Linq;
7
+ using WixToolset.Data;
8
9
/// <summary>
10
/// Base class for creating a compiler extension.
@@ -25,7 +26,7 @@ namespace WixToolset.Extensibility
26
/// <summary>
27
/// Called at the beginning of the compilation of a source file.
28
/// </summary>
28
- public virtual void Initialize()
29
+ public virtual void PreCompile(ICompileContext context)
30
{
31
}
32
@@ -67,7 +68,7 @@ namespace WixToolset.Extensibility
68
/// <summary>
69
/// Called at the end of the compilation of a source file.
70
/// </summary>
70
- public virtual void Finish()
71
+ public virtual void PostCompile(Intermediate intermediate)
72
{
73
}
74
}
src/WixToolset.Extensibility/DecompilerExtension.cs
+2
@@ -4,6 +4,7 @@ namespace WixToolset.Extensibility
4
{
5
using WixToolset.Data;
6
7
+#if BRING_BACK_LATER
8
/// <summary>
9
/// Base class for creating a decompiler extension.
10
/// </summary>
@@ -56,4 +57,5 @@ namespace WixToolset.Extensibility
57
{
58
}
59
}
60
+#endif
61
}
src/WixToolset.Extensibility/ExtensionData.cs
+2
@@ -8,6 +8,7 @@ namespace WixToolset.Extensibility
8
using System.Xml;
9
using WixToolset.Data;
10
11
+#if BRING_BACK_LATER
12
public abstract class ExtensionData : IExtensionData
13
{
14
/// <summary>
@@ -72,4 +73,5 @@ namespace WixToolset.Extensibility
73
}
74
}
75
}
76
+#endif
77
}
src/WixToolset.Extensibility/ExtensionHelper.cs
+2
@@ -10,6 +10,7 @@ namespace WixToolset.Extensibility
10
using WixToolset.Data;
11
using WixToolset.Extensibility;
12
13
+#if BRING_BACK_LATER
14
/// <summary>
15
/// The main class for a WiX extension.
16
/// </summary>
@@ -50,4 +51,5 @@ namespace WixToolset.Extensibility
51
}
52
}
53
}
54
+#endif
55
}
src/WixToolset.Extensibility/IBackend.cs
+1
-1
@@ -10,7 +10,7 @@ namespace WixToolset.Extensibility
10
{
11
BindResult Bind(IBindContext context);
12
13
- Output Unbind(IUnbindContext context);
13
+ Intermediate Unbind(IUnbindContext context);
14
15
bool Inscribe(IInscribeContext context);
16
}
src/WixToolset.Extensibility/IBindVariableResolver.cs
+2
-2
@@ -3,7 +3,7 @@
3
namespace WixToolset.Extensibility
4
{
5
using WixToolset.Data;
6
- using WixToolset.Data.Rows;
6
+ using WixToolset.Data.Tuples;
7
8
public interface IBindVariableResolver
9
{
@@ -11,7 +11,7 @@ namespace WixToolset.Extensibility
11
12
void AddVariable(string name, string value);
13
14
- void AddVariable(WixVariableRow wixVariableRow);
14
+ void AddVariable(WixVariableTuple wixVariableRow);
15
16
string ResolveVariables(SourceLineNumber sourceLineNumbers, string value, bool localizationOnly);
17
src/WixToolset.Extensibility/IBinderCore.cs
+1
-1
@@ -22,7 +22,7 @@ namespace WixToolset.Extensibility
22
/// Gets the table definitions used by the Binder.
23
/// </summary>
24
/// <value>Table definitions used by the binder.</value>
25
- TableDefinitionCollection TableDefinitions { get; }
25
+ //TableDefinitionCollection TableDefinitions { get; }
26
27
/// <summary>
28
/// Generate an identifier by hashing data from the row.
src/WixToolset.Extensibility/IBinderExtension.cs
+1
-1
@@ -19,7 +19,7 @@ namespace WixToolset.Extensibility
19
/// <summary>
20
/// Called after variable resolution occurs.
21
/// </summary>
22
- void AfterResolvedFields(Output output);
22
+ void AfterResolvedFields(Intermediate intermediate);
23
24
string ResolveFile(string source, string type, SourceLineNumber sourceLineNumbers, BindStage bindStage);
25
src/WixToolset.Extensibility/IBinderFileManagerCore.cs
+2
-2
@@ -18,13 +18,13 @@ namespace WixToolset.Extensibility
18
/// Gets or sets the active subStorage used for binding.
19
/// </summary>
20
/// <value>The subStorage object.</value>
21
- SubStorage ActiveSubStorage { get; }
21
+ //SubStorage ActiveSubStorage { get; }
22
23
/// <summary>
24
/// Gets or sets the output object used for binding.
25
/// </summary>
26
/// <value>The output object.</value>
27
- Output Output { get; }
27
+ Intermediate Intermediate { get; }
28
29
/// <summary>
30
/// Gets or sets the path to the temp files location.
src/WixToolset.Extensibility/ICompileContext.cs
new
+26
@@ -0,0 +1,26 @@
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 System;
6
+ using System.Collections.Generic;
7
+ using System.Xml.Linq;
8
+ using WixToolset.Data;
9
+
10
+ public interface ICompileContext
11
+ {
12
+ IServiceProvider ServiceProvider { get; }
13
+
14
+ Messaging Messaging { get; set; }
15
+
16
+ string CompilationId { get; set; }
17
+
18
+ IEnumerable<ICompilerExtension> Extensions { get; set; }
19
+
20
+ string OutputPath { get; set; }
21
+
22
+ Platform Platform { get; set; }
23
+
24
+ XDocument Source { get; set; }
25
+ }
26
+}
src/WixToolset.Extensibility/ICompilerCore.cs
+1
-1
@@ -62,7 +62,7 @@ namespace WixToolset.Extensibility
62
/// <param name="tableName">Name of table to create row in.</param>
63
/// <param name="identifier">Optional identifier for the row.</param>
64
/// <returns>New row.</returns>
65
- Row CreateRow(SourceLineNumber sourceLineNumbers, string tableName, Identifier identifier = null);
65
+ IntermediateTuple CreateRow(SourceLineNumber sourceLineNumbers, string tableName, Identifier identifier = null);
66
67
/// <summary>
68
/// Creates directories using the inline directory syntax.
src/WixToolset.Extensibility/ICompilerExtension.cs
+6
-3
@@ -4,18 +4,21 @@ namespace WixToolset.Extensibility
4
{
5
using System.Collections.Generic;
6
using System.Xml.Linq;
7
+ using WixToolset.Data;
8
+ using WixToolset.Extensibility.Services;
9
10
/// <summary>
11
/// Interface all compiler extensions implement.
12
/// </summary>
13
public interface ICompilerExtension
14
{
15
+#if false
16
/// <summary>
17
/// Gets or sets the compiler core for the extension.
18
/// </summary>
19
/// <value>Compiler core for the extension.</value>
20
ICompilerCore Core { get; set; }
18
-
21
+#endif
22
/// <summary>
23
/// Gets the schema namespace for this extension.
24
/// </summary>
@@ -25,7 +28,7 @@ namespace WixToolset.Extensibility
28
/// <summary>
29
/// Called at the beginning of the compilation of a source file.
30
/// </summary>
28
- void Initialize();
31
+ void PreCompile(ICompileContext context);
32
33
/// <summary>
34
/// Processes an attribute for the Compiler.
@@ -54,6 +57,6 @@ namespace WixToolset.Extensibility
57
/// <summary>
58
/// Called at the end of the compilation of a source file.
59
/// </summary>
57
- void Finish();
60
+ void PostCompile(Intermediate intermediate);
61
}
62
}
src/WixToolset.Extensibility/IDecompilerCore.cs
+4
-4
@@ -47,7 +47,7 @@ namespace WixToolset.Extensibility
47
/// </summary>
48
/// <param name="row">The row corresponding to the element.</param>
49
/// <returns>The indexed element.</returns>
50
- Wix.ISchemaElement GetIndexedElement(Row row);
50
+ Wix.ISchemaElement GetIndexedElement(IntermediateTuple row);
51
52
/// <summary>
53
/// Gets the element corresponding to the primary key of the given table.
@@ -62,12 +62,12 @@ namespace WixToolset.Extensibility
62
/// </summary>
63
/// <param name="row">The row corresponding to the element.</param>
64
/// <param name="element">The element to index.</param>
65
- void IndexElement(Row row, Wix.ISchemaElement element);
65
+ void IndexElement(IntermediateTuple row, Wix.ISchemaElement element);
66
67
- /// <summary>
67
+ /// <summary>
68
/// Indicates the decompiler encountered and unexpected table to decompile.
69
/// </summary>
70
/// <param name="table">Unknown decompiled table.</param>
71
- void UnexpectedTable(Table table);
71
+ void UnexpectedTable(string table);
72
}
73
}
src/WixToolset.Extensibility/IDecompilerExtension.cs
+5
-5
@@ -19,31 +19,31 @@ namespace WixToolset.Extensibility
19
/// Gets the table definitions this extension decompiles.
20
/// </summary>
21
/// <value>Table definitions this extension decompiles.</value>
22
- TableDefinitionCollection TableDefinitions { get; }
22
+ //TableDefinitionCollection TableDefinitions { get; }
23
24
/// <summary>
25
/// Gets the library that this decompiler wants removed from the decomipiled output.
26
/// </summary>
27
/// <param name="tableDefinitions">The table definitions to use while loading the library.</param>
28
/// <returns>The library for this extension or null if there is no library to be removed.</returns>
29
- Library GetLibraryToRemove(TableDefinitionCollection tableDefinitions);
29
+ //Library GetLibraryToRemove(TableDefinitionCollection tableDefinitions);
30
31
/// <summary>
32
/// Called at the beginning of the decompilation of a database.
33
/// </summary>
34
/// <param name="tables">The collection of all tables.</param>
35
- void Initialize(TableIndexedCollection tables);
35
+ //void Initialize(TableIndexedCollection tables);
36
37
/// <summary>
38
/// Decompiles an extension table.
39
/// </summary>
40
/// <param name="table">The table to decompile.</param>
41
- void DecompileTable(Table table);
41
+ //void DecompileTable(Table table);
42
43
/// <summary>
44
/// Finalize decompilation.
45
/// </summary>
46
/// <param name="tables">The collection of all tables.</param>
47
- void Finish(TableIndexedCollection tables);
47
+ //void Finish(TableIndexedCollection tables);
48
}
49
}
src/WixToolset.Extensibility/IDelayedField.cs
+2
-2
@@ -6,8 +6,8 @@ namespace WixToolset.Extensibility
6
7
public interface IDelayedField
8
{
9
- Field Field { get; }
9
+ IntermediateField Field { get; }
10
11
- Row Row { get; }
11
+ IntermediateTuple Row { get; }
12
}
13
}
\ No newline at end of file
src/WixToolset.Extensibility/IExtensionData.cs
+9
-7
@@ -9,23 +9,25 @@ namespace WixToolset.Extensibility
9
/// </summary>
10
public interface IExtensionData
11
{
12
- /// <summary>
13
- /// Gets the table definitions for this extension.
14
- /// </summary>
15
- /// <value>Table definisions for this extension or null if there are no table definitions.</value>
16
- TableDefinitionCollection TableDefinitions { get; }
17
-
12
/// <summary>
13
/// Gets the optional default culture.
14
/// </summary>
15
/// <value>The optional default culture.</value>
16
string DefaultCulture { get; }
17
18
+ /// <summary>
19
+ ///
20
+ /// </summary>
21
+ /// <param name="name"></param>
22
+ /// <param name="tupleDefinition"></param>
23
+ /// <returns>True </returns>
24
+ bool TryGetTupleDefinitionByName(string name, out IntermediateTupleDefinition tupleDefinition);
25
+
26
/// <summary>
27
/// Gets the library associated with this extension.
28
/// </summary>
29
/// <param name="tableDefinitions">The table definitions to use while loading the library.</param>
30
/// <returns>The library for this extension or null if there is no library.</returns>
29
- Library GetLibrary(TableDefinitionCollection tableDefinitions);
31
+ Library GetLibrary(ITupleDefinitionCreator tupleDefinitions);
32
}
33
}
src/WixToolset.Extensibility/IInspectorExtension.cs
+2
-2
@@ -46,7 +46,7 @@ namespace WixToolset.Extensibility
46
/// transforms are the primary transforms you'll typically want to inspect
47
/// and contain your changes to target products.
48
/// </remarks>
49
- void InspectOutput(Output output);
49
+ void InspectOutput(Intermediate output);
50
51
/// <summary>
52
/// Inspect the final output after binding.
@@ -54,6 +54,6 @@ namespace WixToolset.Extensibility
54
/// <param name="filePath">The file path to the final bound output.</param>
55
/// <param name="pdb">The <see cref="Pdb"/> that contains source line numbers
56
/// for the database and all rows.</param>
57
- void InspectDatabase(string filePath, Pdb pdb);
57
+ void InspectDatabase(string filePath, Intermediate pdb);
58
}
59
}
src/WixToolset.Extensibility/ILibrarianExtension.cs
+1
-1
@@ -10,6 +10,6 @@ namespace WixToolset.Extensibility
10
11
string Resolve(SourceLineNumber sourceLineNumber, string table, string path);
12
13
- void PostCombine(Library library);
13
+ void PostCombine(Intermediate library);
14
}
15
}
src/WixToolset.Extensibility/ILibraryContext.cs
+10
-1
@@ -2,18 +2,27 @@
2
3
namespace WixToolset.Extensibility
4
{
5
+ using System;
6
using System.Collections.Generic;
7
using WixToolset.Data;
8
9
public interface ILibraryContext
10
{
11
+ IServiceProvider ServiceProvider { get; }
12
+
13
+ Messaging Messaging { get; set; }
14
+
15
bool BindFiles { get; set; }
16
17
+ IEnumerable<BindPath> BindPaths { get; set; }
18
+
19
IEnumerable<ILibrarianExtension> Extensions { get; set; }
20
21
+ string LibraryId { get; set; }
22
+
23
IEnumerable<Localization> Localizations { get; set; }
24
16
- IEnumerable<Section> Sections { get; set; }
25
+ IEnumerable<Intermediate> Intermediates { get; set; }
26
27
IBindVariableResolver WixVariableResolver { get; set; }
28
}
src/WixToolset.Extensibility/ILinkerExtension.cs
new
+23
@@ -0,0 +1,23 @@
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.Extensibility.Services;
7
+
8
+ /// <summary>
9
+ /// Interface all binder extensions implement.
10
+ /// </summary>
11
+ public interface ILinkerExtension
12
+ {
13
+ /// <summary>
14
+ /// Called before linking occurs.
15
+ /// </summary>
16
+ void PreLink(ILinkContext context);
17
+
18
+ /// <summary>
19
+ /// Called after all linking occurs.
20
+ /// </summary>
21
+ void PostLink(Intermediate intermediate);
22
+ }
23
+}
src/WixToolset.Extensibility/IUnbinderExtension.cs
+1
-1
@@ -13,6 +13,6 @@ namespace WixToolset.Extensibility
13
/// <summary>
14
/// Called during the generation of sectionIds for an admin image.
15
/// </summary>
16
- void GenerateSectionIds(Output output);
16
+ void GenerateSectionIds(Intermediate output);
17
}
18
}
src/WixToolset.Extensibility/IWindowsInstallerBackendExtension.cs
+2
-2
@@ -3,8 +3,8 @@
3
namespace WixToolset.Extensibility
4
{
5
using System.Collections.Generic;
6
- using WixToolset.Data.Rows;
6
using WixToolset.Data.Bind;
7
+ using WixToolset.Data.Tuples;
8
using WixToolset.Extensibility.Services;
9
10
/// <summary>
@@ -19,7 +19,7 @@ namespace WixToolset.Extensibility
19
20
ResolvedCabinet ResolveCabinet(string cabinetPath, IEnumerable<BindFileWithPath> files);
21
22
- string ResolveMedia(MediaRow mediaRow, string mediaLayoutDirectory, string layoutDirectory);
22
+ string ResolveMedia(MediaTuple mediaRow, string mediaLayoutDirectory, string layoutDirectory);
23
24
/// <summary>
25
/// Called after all output changes occur and right before the output is bound into its final format.
src/WixToolset.Extensibility/InspectorExtension.cs
+2
@@ -6,6 +6,7 @@ namespace WixToolset.Extensibility
6
using System.IO;
7
using WixToolset.Data;
8
9
+#if BRING_THIS_BACK
10
/// <summary>
11
/// Opitonal base class for inspector extensions.
12
/// </summary>
@@ -58,4 +59,5 @@ namespace WixToolset.Extensibility
59
{
60
}
61
}
62
+#endif
63
}
src/WixToolset.Extensibility/Services/IBindContext.cs
+1
-1
@@ -34,7 +34,7 @@ namespace WixToolset.Extensibility.Services
34
35
string IntermediateFolder { get; set; }
36
37
- Output IntermediateRepresentation { get; set; }
37
+ Intermediate IntermediateRepresentation { get; set; }
38
39
string OutputPath { get; set; }
40
src/WixToolset.Extensibility/Services/ILinkContext.cs
new
+21
@@ -0,0 +1,21 @@
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.Services
4
+{
5
+ using System;
6
+ using System.Collections.Generic;
7
+ using WixToolset.Data;
8
+
9
+ public interface ILinkContext
10
+ {
11
+ IServiceProvider ServiceProvider { get; }
12
+
13
+ Messaging Messaging { get; set; }
14
+
15
+ IEnumerable<ILinkerExtension> Extensions { get; set; }
16
+
17
+ OutputType ExpectedOutputType { get; set; }
18
+
19
+ IEnumerable<Intermediate> Intermediates { get; set; }
20
+ }
21
+}