diff options
author | Rob Mensching <rob@firegiant.com> | 2021-04-22 06:14:17 -0700 |
---|---|---|
committer | Rob Mensching <rob@firegiant.com> | 2021-04-29 16:23:52 -0700 |
commit | 7417dc10c4cf9da821984cbe9930d93ed879962e (patch) | |
tree | aea5be766ba7da33b2ecc194baeb2cccfdd6682f /src/api | |
parent | 679a1da6b60acd9dc992658ec53c41f6ae2fccdf (diff) | |
download | wix-7417dc10c4cf9da821984cbe9930d93ed879962e.tar.gz wix-7417dc10c4cf9da821984cbe9930d93ed879962e.tar.bz2 wix-7417dc10c4cf9da821984cbe9930d93ed879962e.zip |
Move Extensiblity into API/wix
Diffstat (limited to 'src/api')
102 files changed, 4509 insertions, 0 deletions
diff --git a/src/api/wix/CSharp.Build.props b/src/api/wix/CSharp.Build.props new file mode 100644 index 00000000..81d24ad1 --- /dev/null +++ b/src/api/wix/CSharp.Build.props | |||
@@ -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 | Do NOT modify this file. Update the canonical version in Home\repo-template\src\CSharp.Build.props | ||
4 | then update all of the repos. | ||
5 | --> | ||
6 | <Project> | ||
7 | <PropertyGroup> | ||
8 | <CheckForOverflowUnderflow>true</CheckForOverflowUnderflow> | ||
9 | <SignAssembly>true</SignAssembly> | ||
10 | <AssemblyOriginatorKeyFile>$([System.IO.Path]::GetFullPath($(MSBuildThisFileDirectory)wix.snk))</AssemblyOriginatorKeyFile> | ||
11 | <NBGV_EmitThisAssemblyClass>false</NBGV_EmitThisAssemblyClass> | ||
12 | </PropertyGroup> | ||
13 | </Project> | ||
diff --git a/src/api/wix/Custom.Build.props b/src/api/wix/Custom.Build.props new file mode 100644 index 00000000..889fb62e --- /dev/null +++ b/src/api/wix/Custom.Build.props | |||
@@ -0,0 +1,6 @@ | |||
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> | ||
3 | <PropertyGroup Condition="'$(Configuration)'=='Release'"> | ||
4 | <TreatWarningsAsErrors>true</TreatWarningsAsErrors> | ||
5 | </PropertyGroup> | ||
6 | </Project> | ||
diff --git a/src/api/wix/Directory.Build.props b/src/api/wix/Directory.Build.props new file mode 100644 index 00000000..f83cc154 --- /dev/null +++ b/src/api/wix/Directory.Build.props | |||
@@ -0,0 +1,29 @@ | |||
1 | <?xml version="1.0" encoding="utf-8"?> | ||
2 | <!-- 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. --> | ||
3 | <!-- | ||
4 | Do NOT modify this file. Update the canonical version in Home\repo-template\src\Directory.Build.props | ||
5 | then update all of the repos. | ||
6 | --> | ||
7 | <Project> | ||
8 | <PropertyGroup> | ||
9 | <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> | ||
10 | <EnableSourceLink Condition=" '$(NCrunch)' == '1' ">false</EnableSourceLink> | ||
11 | <MSBuildWarningsAsMessages>MSB3246</MSBuildWarningsAsMessages> | ||
12 | |||
13 | <ProjectName Condition=" '$(ProjectName)' == '' ">$(MSBuildProjectName)</ProjectName> | ||
14 | <BaseOutputPath>$([System.IO.Path]::GetFullPath($(MSBuildThisFileDirectory)..\build\))</BaseOutputPath> | ||
15 | <BaseIntermediateOutputPath>$(BaseOutputPath)obj\$(ProjectName)\</BaseIntermediateOutputPath> | ||
16 | <OutputPath>$(BaseOutputPath)$(Configuration)\</OutputPath> | ||
17 | |||
18 | <Authors>WiX Toolset Team</Authors> | ||
19 | <Company>WiX Toolset</Company> | ||
20 | <Copyright>Copyright (c) .NET Foundation and contributors. All rights reserved.</Copyright> | ||
21 | <PackageLicenseExpression>MS-RL</PackageLicenseExpression> | ||
22 | <Product>WiX Toolset</Product> | ||
23 | </PropertyGroup> | ||
24 | |||
25 | <Import Project="CSharp.Build.props" Condition=" '$(MSBuildProjectExtension)'=='.csproj' and Exists('CSharp.Build.props') " /> | ||
26 | <Import Project="Cpp.Build.props" Condition=" Exists('Cpp.Build.props') And '$(MSBuildProjectExtension)'=='.vcxproj' " /> | ||
27 | <Import Project="Wix.Build.props" Condition=" Exists('Wix.Build.props') And '$(MSBuildProjectExtension)'=='.wixproj' " /> | ||
28 | <Import Project="Custom.Build.props" Condition=" Exists('Custom.Build.props') " /> | ||
29 | </Project> | ||
diff --git a/src/api/wix/Directory.Build.targets b/src/api/wix/Directory.Build.targets new file mode 100644 index 00000000..cb988931 --- /dev/null +++ b/src/api/wix/Directory.Build.targets | |||
@@ -0,0 +1,56 @@ | |||
1 | <?xml version="1.0" encoding="utf-8"?> | ||
2 | <!-- 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. --> | ||
3 | <!-- | ||
4 | Do NOT modify this file. Update the canonical version in Home\repo-template\src\Directory.Build.targets | ||
5 | then update all of the repos. | ||
6 | --> | ||
7 | <!-- | ||
8 | Replace PackageReferences with ProjectReferences when the projects can be found in .sln. | ||
9 | See the original here: https://github.com/dotnet/sdk/issues/1151#issuecomment-385133284 | ||
10 | --> | ||
11 | <Project> | ||
12 | <PropertyGroup> | ||
13 | <CreateDocumentation Condition=" '$(CreateDocumentationFile)'!='true' ">false</CreateDocumentation> | ||
14 | <DocumentationFile Condition=" '$(CreateDocumentationFile)'=='true' ">$(OutputPath)\$(AssemblyName).xml</DocumentationFile> | ||
15 | </PropertyGroup> | ||
16 | |||
17 | <PropertyGroup> | ||
18 | <ReplacePackageReferences>true</ReplacePackageReferences> | ||
19 | <TheSolutionPath Condition=" '$(NCrunch)'=='' ">$(SolutionPath)</TheSolutionPath> | ||
20 | <TheSolutionPath Condition=" '$(NCrunch)'=='1' ">$(NCrunchOriginalSolutionPath)</TheSolutionPath> | ||
21 | </PropertyGroup> | ||
22 | |||
23 | <Choose> | ||
24 | <When Condition="$(ReplacePackageReferences) AND '$(TheSolutionPath)' != '' AND '$(TheSolutionPath)' != '*undefined*' AND Exists('$(TheSolutionPath)')"> | ||
25 | |||
26 | <PropertyGroup> | ||
27 | <SolutionFileContent>$([System.IO.File]::ReadAllText($(TheSolutionPath)))</SolutionFileContent> | ||
28 | <SmartSolutionDir>$([System.IO.Path]::GetDirectoryName( $(TheSolutionPath) ))</SmartSolutionDir> | ||
29 | <RegexPattern>(?<="[PackageName]", ")(.*)(?=", ")</RegexPattern> | ||
30 | </PropertyGroup> | ||
31 | |||
32 | <ItemGroup> | ||
33 | <!-- Keep the identity of the PackageReference --> | ||
34 | <SmartPackageReference Include="@(PackageReference)"> | ||
35 | <PackageName>%(Identity)</PackageName> | ||
36 | <InSolution>$(SolutionFileContent.Contains('\%(Identity).csproj'))</InSolution> | ||
37 | </SmartPackageReference> | ||
38 | |||
39 | <!-- Filter them by mapping them to another ItemGroup using the WithMetadataValue item function --> | ||
40 | <PackageInSolution Include="@(SmartPackageReference->WithMetadataValue('InSolution', True))"> | ||
41 | <Pattern>$(RegexPattern.Replace('[PackageName]','%(PackageName)') )</Pattern> | ||
42 | <SmartPath>$([System.Text.RegularExpressions.Regex]::Match('$(SolutionFileContent)', '%(Pattern)'))</SmartPath> | ||
43 | </PackageInSolution> | ||
44 | |||
45 | <ProjectReference Include="@(PackageInSolution->'$(SmartSolutionDir)\%(SmartPath)' )"/> | ||
46 | |||
47 | <!-- Remove the package references that are now referenced as projects --> | ||
48 | <PackageReference Remove="@(PackageInSolution->'%(PackageName)' )"/> | ||
49 | </ItemGroup> | ||
50 | |||
51 | </When> | ||
52 | </Choose> | ||
53 | |||
54 | <Import Project="Wix.Build.targets" Condition=" Exists('Wix.Build.targets') And '$(MSBuildProjectExtension)'=='.wixproj' " /> | ||
55 | <Import Project="Custom.Build.targets" Condition=" Exists('Custom.Build.targets') " /> | ||
56 | </Project> | ||
diff --git a/src/api/wix/README-Extensibility.md b/src/api/wix/README-Extensibility.md new file mode 100644 index 00000000..003acd4d --- /dev/null +++ b/src/api/wix/README-Extensibility.md | |||
@@ -0,0 +1,2 @@ | |||
1 | # Extensibility | ||
2 | WixToolset.Extensibility - interfaces to extend the WiX Toolset | ||
diff --git a/src/api/wix/WixToolset.Extensibility.sln b/src/api/wix/WixToolset.Extensibility.sln new file mode 100644 index 00000000..94ce905c --- /dev/null +++ b/src/api/wix/WixToolset.Extensibility.sln | |||
@@ -0,0 +1,36 @@ | |||
1 | Microsoft Visual Studio Solution File, Format Version 12.00 | ||
2 | # Visual Studio 15 | ||
3 | VisualStudioVersion = 15.0.26730.8 | ||
4 | MinimumVisualStudioVersion = 15.0.26124.0 | ||
5 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WixToolset.Extensibility", "src\WixToolset.Extensibility\WixToolset.Extensibility.csproj", "{AA049009-D7D9-4C63-8E0D-83206ADCFBD1}" | ||
6 | EndProject | ||
7 | Global | ||
8 | GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||
9 | Debug|Any CPU = Debug|Any CPU | ||
10 | Debug|x64 = Debug|x64 | ||
11 | Debug|x86 = Debug|x86 | ||
12 | Release|Any CPU = Release|Any CPU | ||
13 | Release|x64 = Release|x64 | ||
14 | Release|x86 = Release|x86 | ||
15 | EndGlobalSection | ||
16 | GlobalSection(ProjectConfigurationPlatforms) = postSolution | ||
17 | {AA049009-D7D9-4C63-8E0D-83206ADCFBD1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
18 | {AA049009-D7D9-4C63-8E0D-83206ADCFBD1}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
19 | {AA049009-D7D9-4C63-8E0D-83206ADCFBD1}.Debug|x64.ActiveCfg = Debug|Any CPU | ||
20 | {AA049009-D7D9-4C63-8E0D-83206ADCFBD1}.Debug|x64.Build.0 = Debug|Any CPU | ||
21 | {AA049009-D7D9-4C63-8E0D-83206ADCFBD1}.Debug|x86.ActiveCfg = Debug|Any CPU | ||
22 | {AA049009-D7D9-4C63-8E0D-83206ADCFBD1}.Debug|x86.Build.0 = Debug|Any CPU | ||
23 | {AA049009-D7D9-4C63-8E0D-83206ADCFBD1}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
24 | {AA049009-D7D9-4C63-8E0D-83206ADCFBD1}.Release|Any CPU.Build.0 = Release|Any CPU | ||
25 | {AA049009-D7D9-4C63-8E0D-83206ADCFBD1}.Release|x64.ActiveCfg = Release|Any CPU | ||
26 | {AA049009-D7D9-4C63-8E0D-83206ADCFBD1}.Release|x64.Build.0 = Release|Any CPU | ||
27 | {AA049009-D7D9-4C63-8E0D-83206ADCFBD1}.Release|x86.ActiveCfg = Release|Any CPU | ||
28 | {AA049009-D7D9-4C63-8E0D-83206ADCFBD1}.Release|x86.Build.0 = Release|Any CPU | ||
29 | EndGlobalSection | ||
30 | GlobalSection(SolutionProperties) = preSolution | ||
31 | HideSolutionNode = FALSE | ||
32 | EndGlobalSection | ||
33 | GlobalSection(ExtensibilityGlobals) = postSolution | ||
34 | SolutionGuid = {BB8820D5-723D-426D-B4A0-4D221603C5FA} | ||
35 | EndGlobalSection | ||
36 | EndGlobal | ||
diff --git a/src/api/wix/WixToolset.Extensibility/AssemblyInfo.cs b/src/api/wix/WixToolset.Extensibility/AssemblyInfo.cs new file mode 100644 index 00000000..b3740b2a --- /dev/null +++ b/src/api/wix/WixToolset.Extensibility/AssemblyInfo.cs | |||
@@ -0,0 +1,9 @@ | |||
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 | using System; | ||
4 | using System.Reflection; | ||
5 | using System.Runtime.InteropServices; | ||
6 | |||
7 | [assembly: AssemblyCulture("")] | ||
8 | [assembly: CLSCompliant(true)] | ||
9 | [assembly: ComVisible(false)] | ||
diff --git a/src/api/wix/WixToolset.Extensibility/BaseBinderExtension.cs b/src/api/wix/WixToolset.Extensibility/BaseBinderExtension.cs new file mode 100644 index 00000000..3869d1ed --- /dev/null +++ b/src/api/wix/WixToolset.Extensibility/BaseBinderExtension.cs | |||
@@ -0,0 +1,47 @@ | |||
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.Extensibility.Data; | ||
6 | using WixToolset.Extensibility.Services; | ||
7 | |||
8 | /// <summary> | ||
9 | /// Base class for creating a resolver extension. | ||
10 | /// </summary> | ||
11 | public abstract class BaseBinderExtension : IBinderExtension | ||
12 | { | ||
13 | /// <summary> | ||
14 | /// Context for use by the extension. | ||
15 | /// </summary> | ||
16 | protected IBindContext Context { get; private set; } | ||
17 | |||
18 | /// <summary> | ||
19 | /// Messaging for use by the extension. | ||
20 | /// </summary> | ||
21 | protected IMessaging Messaging { get; private set; } | ||
22 | |||
23 | /// <summary> | ||
24 | /// BackendHelper for use by the extension. | ||
25 | /// </summary> | ||
26 | protected IBackendHelper BackendHelper { get; private set; } | ||
27 | |||
28 | /// <summary> | ||
29 | /// Called at the beginning of bind. | ||
30 | /// </summary> | ||
31 | public virtual void PreBind(IBindContext context) | ||
32 | { | ||
33 | this.Context = context; | ||
34 | |||
35 | this.Messaging = context.ServiceProvider.GetService<IMessaging>(); | ||
36 | |||
37 | this.BackendHelper = context.ServiceProvider.GetService<IBackendHelper>(); | ||
38 | } | ||
39 | |||
40 | /// <summary> | ||
41 | /// Called at the end of bind. | ||
42 | /// </summary> | ||
43 | public virtual void PostBind(IBindResult result) | ||
44 | { | ||
45 | } | ||
46 | } | ||
47 | } | ||
diff --git a/src/api/wix/WixToolset.Extensibility/BaseBurnBackendBinderExtension.cs b/src/api/wix/WixToolset.Extensibility/BaseBurnBackendBinderExtension.cs new file mode 100644 index 00000000..da570af0 --- /dev/null +++ b/src/api/wix/WixToolset.Extensibility/BaseBurnBackendBinderExtension.cs | |||
@@ -0,0 +1,94 @@ | |||
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.Linq; | ||
8 | using WixToolset.Data; | ||
9 | using WixToolset.Data.Burn; | ||
10 | using WixToolset.Extensibility.Data; | ||
11 | using WixToolset.Extensibility.Services; | ||
12 | |||
13 | /// <summary> | ||
14 | /// Base class for creating a Burn backend extension. | ||
15 | /// </summary> | ||
16 | public abstract class BaseBurnBackendBinderExtension : IBurnBackendBinderExtension | ||
17 | { | ||
18 | /// <summary> | ||
19 | /// Context for use by the extension. | ||
20 | /// </summary> | ||
21 | protected IBindContext Context { get; private set; } | ||
22 | |||
23 | /// <summary> | ||
24 | /// Messaging for use by the extension. | ||
25 | /// </summary> | ||
26 | protected IMessaging Messaging { get; private set; } | ||
27 | |||
28 | /// <summary> | ||
29 | /// Backend helper for use by the extension. | ||
30 | /// </summary> | ||
31 | protected IBurnBackendHelper BackendHelper { get; private set; } | ||
32 | |||
33 | /// <summary> | ||
34 | /// Optional symbol definitions. | ||
35 | /// </summary> | ||
36 | protected virtual IReadOnlyCollection<IntermediateSymbolDefinition> SymbolDefinitions => Array.Empty<IntermediateSymbolDefinition>(); | ||
37 | |||
38 | /// <summary> | ||
39 | /// See <see cref="IBurnBackendBinderExtension.PreBackendBind(IBindContext)"/> | ||
40 | /// </summary> | ||
41 | public virtual void PreBackendBind(IBindContext context) | ||
42 | { | ||
43 | this.Context = context; | ||
44 | this.Messaging = context.ServiceProvider.GetService<IMessaging>(); | ||
45 | this.BackendHelper = context.ServiceProvider.GetService<IBurnBackendHelper>(); | ||
46 | } | ||
47 | |||
48 | /// <summary> | ||
49 | /// See <see cref="IBurnBackendBinderExtension.ResolveRelatedFile(String, String, String, SourceLineNumber)"/> | ||
50 | /// </summary> | ||
51 | public virtual IResolveFileResult ResolveRelatedFile(string source, string relatedSource, string type, SourceLineNumber sourceLineNumbers) | ||
52 | { | ||
53 | return null; | ||
54 | } | ||
55 | |||
56 | /// <summary> | ||
57 | /// See <see cref="IBurnBackendBinderExtension.SymbolsFinalized(IntermediateSection)"/> | ||
58 | /// </summary> | ||
59 | public virtual void SymbolsFinalized(IntermediateSection section) | ||
60 | { | ||
61 | } | ||
62 | |||
63 | /// <summary> | ||
64 | /// See <see cref="IBurnBackendBinderExtension.ResolveUrl(String, String, String, String, String)"/> | ||
65 | /// </summary> | ||
66 | public virtual string ResolveUrl(string url, string fallbackUrl, string packageId, string payloadId, string fileName) | ||
67 | { | ||
68 | return null; | ||
69 | } | ||
70 | |||
71 | /// <summary> | ||
72 | /// See <see cref="IBurnBackendBinderExtension.TryProcessSymbol(IntermediateSection, IntermediateSymbol)"/> | ||
73 | /// </summary> | ||
74 | public virtual bool TryProcessSymbol(IntermediateSection section, IntermediateSymbol symbol) | ||
75 | { | ||
76 | if (this.SymbolDefinitions.Any(t => t == symbol.Definition) && | ||
77 | symbol.Definition.HasTag(BurnConstants.BootstrapperApplicationDataSymbolDefinitionTag)) | ||
78 | { | ||
79 | this.BackendHelper.AddBootstrapperApplicationData(symbol); | ||
80 | return true; | ||
81 | } | ||
82 | |||
83 | return false; | ||
84 | } | ||
85 | |||
86 | /// <summary> | ||
87 | /// See <see cref="IBurnBackendBinderExtension.PostBackendBind(IBindResult)"/> | ||
88 | /// </summary> | ||
89 | /// <param name="result"></param> | ||
90 | public virtual void PostBackendBind(IBindResult result) | ||
91 | { | ||
92 | } | ||
93 | } | ||
94 | } | ||
diff --git a/src/api/wix/WixToolset.Extensibility/BaseCompilerExtension.cs b/src/api/wix/WixToolset.Extensibility/BaseCompilerExtension.cs new file mode 100644 index 00000000..3e185e14 --- /dev/null +++ b/src/api/wix/WixToolset.Extensibility/BaseCompilerExtension.cs | |||
@@ -0,0 +1,87 @@ | |||
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 | using WixToolset.Extensibility.Data; | ||
10 | using WixToolset.Extensibility.Services; | ||
11 | |||
12 | /// <summary> | ||
13 | /// Base class for creating a compiler extension. | ||
14 | /// </summary> | ||
15 | public abstract class BaseCompilerExtension : ICompilerExtension | ||
16 | { | ||
17 | /// <summary> | ||
18 | /// Context for use by the extension. | ||
19 | /// </summary> | ||
20 | protected ICompileContext Context { get; private set; } | ||
21 | |||
22 | /// <summary> | ||
23 | /// Messaging for use by the extension. | ||
24 | /// </summary> | ||
25 | protected IMessaging Messaging { get; private set; } | ||
26 | |||
27 | /// <summary> | ||
28 | /// ParserHelper for use by the extension. | ||
29 | /// </summary> | ||
30 | protected IParseHelper ParseHelper { get; private set; } | ||
31 | |||
32 | /// <summary> | ||
33 | /// Gets the schema namespace for this extension. | ||
34 | /// </summary> | ||
35 | /// <value>Schema namespace supported by this extension.</value> | ||
36 | public abstract XNamespace Namespace { get; } | ||
37 | |||
38 | /// <summary> | ||
39 | /// Creates a component key path. | ||
40 | /// </summary> | ||
41 | protected IComponentKeyPath CreateComponentKeyPath() => this.Context.ServiceProvider.GetService<IComponentKeyPath>(); | ||
42 | |||
43 | /// <summary> | ||
44 | /// Called at the beginning of the compilation of a source file. | ||
45 | /// </summary> | ||
46 | public virtual void PreCompile(ICompileContext context) | ||
47 | { | ||
48 | this.Context = context; | ||
49 | |||
50 | this.Messaging = context.ServiceProvider.GetService<IMessaging>(); | ||
51 | |||
52 | this.ParseHelper = context.ServiceProvider.GetService<IParseHelper>(); | ||
53 | } | ||
54 | |||
55 | /// <summary> | ||
56 | /// See <see cref="ICompilerExtension.ParseAttribute(Intermediate, IntermediateSection, XElement, XAttribute, IDictionary{String, String})"/> | ||
57 | /// </summary> | ||
58 | public virtual void ParseAttribute(Intermediate intermediate, IntermediateSection section, XElement parentElement, XAttribute attribute, IDictionary<string, string> context) | ||
59 | { | ||
60 | this.ParseHelper.UnexpectedAttribute(parentElement, attribute); | ||
61 | } | ||
62 | |||
63 | /// <summary> | ||
64 | /// See <see cref="ICompilerExtension.ParseElement(Intermediate, IntermediateSection, XElement, XElement, IDictionary{String, String})"/> | ||
65 | /// </summary> | ||
66 | public virtual void ParseElement(Intermediate intermediate, IntermediateSection section, XElement parentElement, XElement element, IDictionary<string, string> context) | ||
67 | { | ||
68 | this.ParseHelper.UnexpectedElement(parentElement, element); | ||
69 | } | ||
70 | |||
71 | /// <summary> | ||
72 | /// See <see cref="ICompilerExtension.ParsePossibleKeyPathElement(Intermediate, IntermediateSection, XElement, XElement, IDictionary{String, String})"/> | ||
73 | /// </summary> | ||
74 | public virtual IComponentKeyPath ParsePossibleKeyPathElement(Intermediate intermediate, IntermediateSection section, XElement parentElement, XElement element, IDictionary<string, string> context) | ||
75 | { | ||
76 | this.ParseElement(intermediate, section, parentElement, element, context); | ||
77 | return null; | ||
78 | } | ||
79 | |||
80 | /// <summary> | ||
81 | /// Called at the end of the compilation of a source file. | ||
82 | /// </summary> | ||
83 | public virtual void PostCompile(Intermediate intermediate) | ||
84 | { | ||
85 | } | ||
86 | } | ||
87 | } | ||
diff --git a/src/api/wix/WixToolset.Extensibility/BaseExtensionCommandLine.cs b/src/api/wix/WixToolset.Extensibility/BaseExtensionCommandLine.cs new file mode 100644 index 00000000..c716ac7e --- /dev/null +++ b/src/api/wix/WixToolset.Extensibility/BaseExtensionCommandLine.cs | |||
@@ -0,0 +1,51 @@ | |||
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 WixToolset.Extensibility.Data; | ||
8 | using WixToolset.Extensibility.Services; | ||
9 | |||
10 | /// <summary> | ||
11 | /// Base class for extensions to be able to parse the command-line. | ||
12 | /// </summary> | ||
13 | public abstract class BaseExtensionCommandLine : IExtensionCommandLine | ||
14 | { | ||
15 | /// <summary> | ||
16 | /// See <see cref="IExtensionCommandLine.CommandLineSwitches" /> | ||
17 | /// </summary> | ||
18 | public virtual IReadOnlyCollection<ExtensionCommandLineSwitch> CommandLineSwitches => Array.Empty<ExtensionCommandLineSwitch>(); | ||
19 | |||
20 | /// <summary> | ||
21 | /// See <see cref="IExtensionCommandLine.PostParse" /> | ||
22 | /// </summary> | ||
23 | public virtual void PostParse() | ||
24 | { | ||
25 | } | ||
26 | |||
27 | /// <summary> | ||
28 | /// See <see cref="IExtensionCommandLine.PreParse" /> | ||
29 | /// </summary> | ||
30 | public virtual void PreParse(ICommandLineContext context) | ||
31 | { | ||
32 | } | ||
33 | |||
34 | /// <summary> | ||
35 | /// See <see cref="IExtensionCommandLine.TryParseArgument" /> | ||
36 | /// </summary> | ||
37 | public virtual bool TryParseArgument(ICommandLineParser parser, string argument) | ||
38 | { | ||
39 | return false; | ||
40 | } | ||
41 | |||
42 | /// <summary> | ||
43 | /// See <see cref="IExtensionCommandLine.TryParseCommand" /> | ||
44 | /// </summary> | ||
45 | public virtual bool TryParseCommand(ICommandLineParser parser, string argument, out ICommandLineCommand command) | ||
46 | { | ||
47 | command = null; | ||
48 | return false; | ||
49 | } | ||
50 | } | ||
51 | } | ||
diff --git a/src/api/wix/WixToolset.Extensibility/BaseExtensionData.cs b/src/api/wix/WixToolset.Extensibility/BaseExtensionData.cs new file mode 100644 index 00000000..e4a10fd9 --- /dev/null +++ b/src/api/wix/WixToolset.Extensibility/BaseExtensionData.cs | |||
@@ -0,0 +1,34 @@ | |||
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 | |||
7 | /// <summary> | ||
8 | /// Base class for creating a resolver extension. | ||
9 | /// </summary> | ||
10 | public abstract class BaseExtensionData : IExtensionData | ||
11 | { | ||
12 | /// <summary> | ||
13 | /// See <see cref="IExtensionData.DefaultCulture"/> | ||
14 | /// </summary> | ||
15 | public virtual string DefaultCulture => null; | ||
16 | |||
17 | /// <summary> | ||
18 | /// See <see cref="IExtensionData.GetLibrary"/> | ||
19 | /// </summary> | ||
20 | public virtual Intermediate GetLibrary(ISymbolDefinitionCreator symbolDefinitions) | ||
21 | { | ||
22 | return null; | ||
23 | } | ||
24 | |||
25 | /// <summary> | ||
26 | /// See <see cref="IExtensionData.TryGetSymbolDefinitionByName"/> | ||
27 | /// </summary> | ||
28 | public virtual bool TryGetSymbolDefinitionByName(string name, out IntermediateSymbolDefinition symbolDefinition) | ||
29 | { | ||
30 | symbolDefinition = null; | ||
31 | return false; | ||
32 | } | ||
33 | } | ||
34 | } | ||
diff --git a/src/api/wix/WixToolset.Extensibility/BaseExtensionFactory.cs b/src/api/wix/WixToolset.Extensibility/BaseExtensionFactory.cs new file mode 100644 index 00000000..8b6dc566 --- /dev/null +++ b/src/api/wix/WixToolset.Extensibility/BaseExtensionFactory.cs | |||
@@ -0,0 +1,39 @@ | |||
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 | |||
8 | /// <summary> | ||
9 | /// Base class for extension factories. | ||
10 | /// | ||
11 | /// Implementations may request an IWixToolsetCoreServiceProvider at instantiation by having a single parameter constructor for it. | ||
12 | /// </summary> | ||
13 | public abstract class BaseExtensionFactory : IExtensionFactory | ||
14 | { | ||
15 | /// <summary> | ||
16 | /// The extension types of the WiX extension. | ||
17 | /// </summary> | ||
18 | protected abstract IReadOnlyCollection<Type> ExtensionTypes { get; } | ||
19 | |||
20 | /// <summary> | ||
21 | /// See <see cref="IExtensionFactory.TryCreateExtension(Type, out object)"/> | ||
22 | /// </summary> | ||
23 | public virtual bool TryCreateExtension(Type extensionType, out object extension) | ||
24 | { | ||
25 | extension = null; | ||
26 | |||
27 | foreach (var type in this.ExtensionTypes) | ||
28 | { | ||
29 | if (extensionType.IsAssignableFrom(type)) | ||
30 | { | ||
31 | extension = Activator.CreateInstance(type); | ||
32 | break; | ||
33 | } | ||
34 | } | ||
35 | |||
36 | return extension != null; | ||
37 | } | ||
38 | } | ||
39 | } | ||
diff --git a/src/api/wix/WixToolset.Extensibility/BaseLayoutExtension.cs b/src/api/wix/WixToolset.Extensibility/BaseLayoutExtension.cs new file mode 100644 index 00000000..21b932ff --- /dev/null +++ b/src/api/wix/WixToolset.Extensibility/BaseLayoutExtension.cs | |||
@@ -0,0 +1,62 @@ | |||
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.Extensibility.Data; | ||
6 | using WixToolset.Extensibility.Services; | ||
7 | |||
8 | /// <summary> | ||
9 | /// Base class for creating a resolver extension. | ||
10 | /// </summary> | ||
11 | public abstract class BaseLayoutExtension : ILayoutExtension | ||
12 | { | ||
13 | /// <summary> | ||
14 | /// Context for use by the extension. | ||
15 | /// </summary> | ||
16 | protected ILayoutContext Context { get; private set; } | ||
17 | |||
18 | /// <summary> | ||
19 | /// Messaging for use by the extension. | ||
20 | /// </summary> | ||
21 | protected IMessaging Messaging { get; private set; } | ||
22 | |||
23 | /// <summary> | ||
24 | /// Called at the beginning of layout. | ||
25 | /// </summary> | ||
26 | public virtual void PreLayout(ILayoutContext context) | ||
27 | { | ||
28 | this.Context = context; | ||
29 | |||
30 | this.Messaging = context.ServiceProvider.GetService<IMessaging>(); | ||
31 | } | ||
32 | |||
33 | /// <summary> | ||
34 | /// See <see cref="ILayoutExtension.CopyFile(string, string)"/> | ||
35 | /// </summary> | ||
36 | /// <param name="source"></param> | ||
37 | /// <param name="destination"></param> | ||
38 | /// <returns></returns> | ||
39 | public virtual bool CopyFile(string source, string destination) | ||
40 | { | ||
41 | return false; | ||
42 | } | ||
43 | |||
44 | /// <summary> | ||
45 | /// See <see cref="ILayoutExtension.MoveFile(string, string)"/> | ||
46 | /// </summary> | ||
47 | /// <param name="source"></param> | ||
48 | /// <param name="destination"></param> | ||
49 | /// <returns></returns> | ||
50 | public virtual bool MoveFile(string source, string destination) | ||
51 | { | ||
52 | return false; | ||
53 | } | ||
54 | |||
55 | /// <summary> | ||
56 | /// Called at the end of ayout. | ||
57 | /// </summary> | ||
58 | public virtual void PostLayout() | ||
59 | { | ||
60 | } | ||
61 | } | ||
62 | } | ||
diff --git a/src/api/wix/WixToolset.Extensibility/BaseLibrarianExtension.cs b/src/api/wix/WixToolset.Extensibility/BaseLibrarianExtension.cs new file mode 100644 index 00000000..cbc9e4ba --- /dev/null +++ b/src/api/wix/WixToolset.Extensibility/BaseLibrarianExtension.cs | |||
@@ -0,0 +1,71 @@ | |||
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.Collections.Generic; | ||
6 | using WixToolset.Data; | ||
7 | using WixToolset.Extensibility.Data; | ||
8 | using WixToolset.Extensibility.Services; | ||
9 | |||
10 | /// <summary> | ||
11 | /// Base class for creating a librarian extension. | ||
12 | /// </summary> | ||
13 | public abstract class BaseLibrarianExtension : ILibrarianExtension | ||
14 | { | ||
15 | /// <summary> | ||
16 | /// Context for use by the extension. | ||
17 | /// </summary> | ||
18 | protected ILibraryContext Context { get; private set; } | ||
19 | |||
20 | /// <summary> | ||
21 | /// Messaging for use by the extension. | ||
22 | /// </summary> | ||
23 | protected IMessaging Messaging { get; private set; } | ||
24 | |||
25 | /// <summary> | ||
26 | /// Called at the beginning of combining. | ||
27 | /// </summary> | ||
28 | /// <param name="context">Librarian context.</param> | ||
29 | public virtual void PreCombine(ILibraryContext context) | ||
30 | { | ||
31 | this.Context = context; | ||
32 | |||
33 | this.Messaging = context.ServiceProvider.GetService<IMessaging>(); | ||
34 | } | ||
35 | |||
36 | /// <summary> | ||
37 | /// Resolves a path to a file path on disk. | ||
38 | /// </summary> | ||
39 | /// <param name="sourceLineNumber">Source line number for the path to resolve.</param> | ||
40 | /// <param name="symbolDefinition">Symbol related to the path to resolve.</param> | ||
41 | /// <param name="path">Path to resolve.</param> | ||
42 | /// <returns>Optional resolved file result.</returns> | ||
43 | public virtual IResolveFileResult ResolveFile(SourceLineNumber sourceLineNumber, IntermediateSymbolDefinition symbolDefinition, string path) | ||
44 | { | ||
45 | return null; | ||
46 | } | ||
47 | |||
48 | /// <summary> | ||
49 | /// Called at the end of combining. | ||
50 | /// </summary> | ||
51 | /// <param name="library">Combined library intermediate.</param> | ||
52 | public virtual void PostCombine(Intermediate library) | ||
53 | { | ||
54 | } | ||
55 | |||
56 | /// <summary> | ||
57 | /// Creates an IResolveFileResult. | ||
58 | /// </summary> | ||
59 | /// <param name="path">Optional resolved path to file.</param> | ||
60 | /// <param name="checkedPaths">Optional collection of paths checked for the file.</param> | ||
61 | /// <returns>Resolved file result.</returns> | ||
62 | protected IResolveFileResult CreateResolveFileResult(string path = null, IReadOnlyCollection<string> checkedPaths = null) | ||
63 | { | ||
64 | var result = this.Context.ServiceProvider.GetService<IResolveFileResult>(); | ||
65 | result.Path = path; | ||
66 | result.CheckedPaths = checkedPaths; | ||
67 | |||
68 | return result; | ||
69 | } | ||
70 | } | ||
71 | } | ||
diff --git a/src/api/wix/WixToolset.Extensibility/BaseLinkerExtension.cs b/src/api/wix/WixToolset.Extensibility/BaseLinkerExtension.cs new file mode 100644 index 00000000..91aefc2f --- /dev/null +++ b/src/api/wix/WixToolset.Extensibility/BaseLinkerExtension.cs | |||
@@ -0,0 +1,41 @@ | |||
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.Data; | ||
7 | using WixToolset.Extensibility.Services; | ||
8 | |||
9 | /// <summary> | ||
10 | /// Base class for creating a linker extension. | ||
11 | /// </summary> | ||
12 | public abstract class BaseLinkerExtension : ILinkerExtension | ||
13 | { | ||
14 | /// <summary> | ||
15 | /// Context for use by the extension. | ||
16 | /// </summary> | ||
17 | protected ILinkContext Context { get; private set; } | ||
18 | |||
19 | /// <summary> | ||
20 | /// Messaging for use by the extension. | ||
21 | /// </summary> | ||
22 | protected IMessaging Messaging { get; private set; } | ||
23 | |||
24 | /// <summary> | ||
25 | /// Called at the beginning of the linking. | ||
26 | /// </summary> | ||
27 | public virtual void PreLink(ILinkContext context) | ||
28 | { | ||
29 | this.Context = context; | ||
30 | |||
31 | this.Messaging = context.ServiceProvider.GetService<IMessaging>(); | ||
32 | } | ||
33 | |||
34 | /// <summary> | ||
35 | /// Called at the end of the linking. | ||
36 | /// </summary> | ||
37 | public virtual void PostLink(Intermediate intermediate) | ||
38 | { | ||
39 | } | ||
40 | } | ||
41 | } | ||
diff --git a/src/api/wix/WixToolset.Extensibility/BasePreprocessorExtension.cs b/src/api/wix/WixToolset.Extensibility/BasePreprocessorExtension.cs new file mode 100644 index 00000000..b9a856ec --- /dev/null +++ b/src/api/wix/WixToolset.Extensibility/BasePreprocessorExtension.cs | |||
@@ -0,0 +1,91 @@ | |||
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.Xml.Linq; | ||
6 | using WixToolset.Extensibility.Data; | ||
7 | using WixToolset.Extensibility.Services; | ||
8 | |||
9 | /// <summary> | ||
10 | /// Base class for creating a preprocessor extension. | ||
11 | /// </summary> | ||
12 | public abstract class BasePreprocessorExtension : IPreprocessorExtension | ||
13 | { | ||
14 | /// <summary> | ||
15 | /// Context for use by the extension. | ||
16 | /// </summary> | ||
17 | protected IPreprocessContext Context { get; private set; } | ||
18 | |||
19 | /// <summary> | ||
20 | /// Messaging for use by the extension. | ||
21 | /// </summary> | ||
22 | protected IMessaging Messaging { get; private set; } | ||
23 | |||
24 | /// <summary> | ||
25 | /// PreprocessHelper for use by the extension. | ||
26 | /// </summary> | ||
27 | protected IPreprocessHelper PreprocessHelper { get; private set; } | ||
28 | |||
29 | /// <summary> | ||
30 | /// Gets or sets the variable prefixes for the extension. | ||
31 | /// </summary> | ||
32 | /// <value>The variable prefixes for the extension.</value> | ||
33 | public string[] Prefixes { get; protected set; } | ||
34 | |||
35 | /// <summary> | ||
36 | /// Called at the beginning of the preprocessing of a source file. | ||
37 | /// </summary> | ||
38 | public virtual void PrePreprocess(IPreprocessContext context) | ||
39 | { | ||
40 | this.Context = context; | ||
41 | |||
42 | this.Messaging = context.ServiceProvider.GetService<IMessaging>(); | ||
43 | |||
44 | this.PreprocessHelper = context.ServiceProvider.GetService<IPreprocessHelper>(); | ||
45 | } | ||
46 | |||
47 | /// <summary> | ||
48 | /// Gets the value of a variable whose prefix matches the extension. | ||
49 | /// </summary> | ||
50 | /// <param name="prefix">The prefix of the variable to be processed by the extension.</param> | ||
51 | /// <param name="name">The name of the variable.</param> | ||
52 | /// <returns>The value of the variable or null if the variable is undefined.</returns> | ||
53 | public virtual string GetVariableValue(string prefix, string name) | ||
54 | { | ||
55 | return null; | ||
56 | } | ||
57 | |||
58 | /// <summary> | ||
59 | /// Evaluates a function defined in the extension. | ||
60 | /// </summary> | ||
61 | /// <param name="prefix">The prefix of the function to be processed by the extension.</param> | ||
62 | /// <param name="function">The name of the function.</param> | ||
63 | /// <param name="args">The list of arguments.</param> | ||
64 | /// <returns>The value of the function or null if the function is not defined.</returns> | ||
65 | public virtual string EvaluateFunction(string prefix, string function, string[] args) | ||
66 | { | ||
67 | return null; | ||
68 | } | ||
69 | |||
70 | /// <summary> | ||
71 | /// Processes a pragma defined in the extension. | ||
72 | /// </summary> | ||
73 | /// <param name="prefix">The prefix of the pragma to be processed by the extension.</param> | ||
74 | /// <param name="pragma">The name of the pragma.</param> | ||
75 | /// <param name="args">The pragma's arguments.</param> | ||
76 | /// <param name="parent">The parent node of the pragma.</param> | ||
77 | /// <returns>false if the pragma is not defined.</returns> | ||
78 | /// <comments>Don't return false for any condition except for unrecognized pragmas. Throw errors that are fatal to the compile. use core.OnMessage for warnings and messages.</comments> | ||
79 | public virtual bool ProcessPragma(string prefix, string pragma, string args, XContainer parent) | ||
80 | { | ||
81 | return false; | ||
82 | } | ||
83 | |||
84 | /// <summary> | ||
85 | /// Called at the end of the preprocessing of a source file. | ||
86 | /// </summary> | ||
87 | public virtual void PostPreprocess(IPreprocessResult result) | ||
88 | { | ||
89 | } | ||
90 | } | ||
91 | } | ||
diff --git a/src/api/wix/WixToolset.Extensibility/BaseResolverExtension.cs b/src/api/wix/WixToolset.Extensibility/BaseResolverExtension.cs new file mode 100644 index 00000000..72dc5c41 --- /dev/null +++ b/src/api/wix/WixToolset.Extensibility/BaseResolverExtension.cs | |||
@@ -0,0 +1,59 @@ | |||
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.Data; | ||
7 | using WixToolset.Extensibility.Services; | ||
8 | |||
9 | /// <summary> | ||
10 | /// Base class for creating a resolver extension. | ||
11 | /// </summary> | ||
12 | public abstract class BaseResolverExtension : IResolverExtension | ||
13 | { | ||
14 | /// <summary> | ||
15 | /// Context for use by the extension. | ||
16 | /// </summary> | ||
17 | protected IResolveContext Context { get; private set; } | ||
18 | |||
19 | /// <summary> | ||
20 | /// Messaging for use by the extension. | ||
21 | /// </summary> | ||
22 | protected IMessaging Messaging { get; private set; } | ||
23 | |||
24 | /// <summary> | ||
25 | /// Creates a resolve file result. | ||
26 | /// </summary> | ||
27 | protected IResolveFileResult CreateResolveFileResult() => this.Context.ServiceProvider.GetService<IResolveFileResult>(); | ||
28 | |||
29 | /// <summary> | ||
30 | /// Called at the beginning of the resolving variables and files. | ||
31 | /// </summary> | ||
32 | public virtual void PreResolve(IResolveContext context) | ||
33 | { | ||
34 | this.Context = context; | ||
35 | |||
36 | this.Messaging = context.ServiceProvider.GetService<IMessaging>(); | ||
37 | } | ||
38 | |||
39 | /// <summary> | ||
40 | /// See <see cref="IResolverExtension.ResolveFile(string, IntermediateSymbolDefinition, SourceLineNumber, BindStage)"/> | ||
41 | /// </summary> | ||
42 | /// <param name="source"></param> | ||
43 | /// <param name="symbolDefinition"></param> | ||
44 | /// <param name="sourceLineNumbers"></param> | ||
45 | /// <param name="bindStage"></param> | ||
46 | /// <returns></returns> | ||
47 | public virtual IResolveFileResult ResolveFile(string source, IntermediateSymbolDefinition symbolDefinition, SourceLineNumber sourceLineNumbers, BindStage bindStage) | ||
48 | { | ||
49 | return null; | ||
50 | } | ||
51 | |||
52 | /// <summary> | ||
53 | /// Called at the end of resolve. | ||
54 | /// </summary> | ||
55 | public virtual void PostResolve(IResolveResult result) | ||
56 | { | ||
57 | } | ||
58 | } | ||
59 | } | ||
diff --git a/src/api/wix/WixToolset.Extensibility/BaseWindowsInstallerBackendBinderExtension.cs b/src/api/wix/WixToolset.Extensibility/BaseWindowsInstallerBackendBinderExtension.cs new file mode 100644 index 00000000..ffff186b --- /dev/null +++ b/src/api/wix/WixToolset.Extensibility/BaseWindowsInstallerBackendBinderExtension.cs | |||
@@ -0,0 +1,93 @@ | |||
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.Linq; | ||
8 | using WixToolset.Data; | ||
9 | using WixToolset.Data.Symbols; | ||
10 | using WixToolset.Data.WindowsInstaller; | ||
11 | using WixToolset.Extensibility.Data; | ||
12 | using WixToolset.Extensibility.Services; | ||
13 | |||
14 | /// <summary> | ||
15 | /// Base class for creating a preprocessor extension. | ||
16 | /// </summary> | ||
17 | public abstract class BaseWindowsInstallerBackendBinderExtension : IWindowsInstallerBackendBinderExtension | ||
18 | { | ||
19 | /// <summary> | ||
20 | /// Context for use by the extension. | ||
21 | /// </summary> | ||
22 | protected IBindContext Context { get; private set; } | ||
23 | |||
24 | /// <summary> | ||
25 | /// Messaging for use by the extension. | ||
26 | /// </summary> | ||
27 | protected IMessaging Messaging { get; private set; } | ||
28 | |||
29 | /// <summary> | ||
30 | /// Backend helper for use by the extension. | ||
31 | /// </summary> | ||
32 | protected IWindowsInstallerBackendHelper BackendHelper { get; private set; } | ||
33 | |||
34 | /// <summary> | ||
35 | /// Optional table definitions. | ||
36 | /// </summary> | ||
37 | public virtual IReadOnlyCollection<TableDefinition> TableDefinitions => Array.Empty<TableDefinition>(); | ||
38 | |||
39 | /// <summary> | ||
40 | /// Creates a resolved cabinet result. | ||
41 | /// </summary> | ||
42 | protected IResolvedCabinet CreateResolvedCabinet() => this.Context.ServiceProvider.GetService<IResolvedCabinet>(); | ||
43 | |||
44 | /// <summary> | ||
45 | /// See <see cref="IWindowsInstallerBackendBinderExtension.PreBackendBind(IBindContext)"/> | ||
46 | /// </summary> | ||
47 | public virtual void PreBackendBind(IBindContext context) | ||
48 | { | ||
49 | this.Context = context; | ||
50 | |||
51 | this.Messaging = context.ServiceProvider.GetService<IMessaging>(); | ||
52 | |||
53 | this.BackendHelper = context.ServiceProvider.GetService<IWindowsInstallerBackendHelper>(); | ||
54 | } | ||
55 | |||
56 | /// <summary> | ||
57 | /// See <see cref="IWindowsInstallerBackendBinderExtension.SymbolsFinalized(IntermediateSection)"/> | ||
58 | /// </summary> | ||
59 | public virtual void SymbolsFinalized(IntermediateSection section) | ||
60 | { | ||
61 | } | ||
62 | |||
63 | /// <summary> | ||
64 | /// See <see cref="IWindowsInstallerBackendBinderExtension.PreBackendBind(IBindContext)"/> | ||
65 | /// </summary> | ||
66 | public virtual IResolvedCabinet ResolveCabinet(string cabinetPath, IEnumerable<IBindFileWithPath> files) => null; | ||
67 | |||
68 | /// <summary> | ||
69 | /// See <see cref="IWindowsInstallerBackendBinderExtension.PreBackendBind(IBindContext)"/> | ||
70 | /// </summary> | ||
71 | public virtual string ResolveMedia(MediaSymbol mediaRow, string mediaLayoutDirectory, string layoutDirectory) => null; | ||
72 | |||
73 | /// <summary> | ||
74 | /// See <see cref="IWindowsInstallerBackendBinderExtension.TryProcessSymbol(IntermediateSection, IntermediateSymbol, WindowsInstallerData, TableDefinitionCollection)"/> | ||
75 | /// </summary> | ||
76 | public virtual bool TryProcessSymbol(IntermediateSection section, IntermediateSymbol symbol, WindowsInstallerData data, TableDefinitionCollection tableDefinitions) | ||
77 | { | ||
78 | if (this.TableDefinitions.Any(t => t.SymbolDefinition == symbol.Definition)) | ||
79 | { | ||
80 | return this.BackendHelper.TryAddSymbolToMatchingTableDefinitions(section, symbol, data, tableDefinitions); | ||
81 | } | ||
82 | |||
83 | return false; | ||
84 | } | ||
85 | |||
86 | /// <summary> | ||
87 | /// See <see cref="IWindowsInstallerBackendBinderExtension.PreBackendBind(IBindContext)"/> | ||
88 | /// </summary> | ||
89 | public virtual void PostBackendBind(IBindResult result) | ||
90 | { | ||
91 | } | ||
92 | } | ||
93 | } | ||
diff --git a/src/api/wix/WixToolset.Extensibility/CompilerConstants.cs b/src/api/wix/WixToolset.Extensibility/CompilerConstants.cs new file mode 100644 index 00000000..73ff685c --- /dev/null +++ b/src/api/wix/WixToolset.Extensibility/CompilerConstants.cs | |||
@@ -0,0 +1,42 @@ | |||
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 | |||
7 | /// <summary> | ||
8 | /// Constants used by compiler. | ||
9 | /// </summary> | ||
10 | public static class CompilerConstants | ||
11 | { | ||
12 | /// <summary> | ||
13 | /// | ||
14 | /// </summary> | ||
15 | public const int IntegerNotSet = int.MinValue; | ||
16 | |||
17 | /// <summary> | ||
18 | /// | ||
19 | /// </summary> | ||
20 | public const int IllegalInteger = int.MinValue + 1; | ||
21 | |||
22 | /// <summary> | ||
23 | /// | ||
24 | /// </summary> | ||
25 | public const long LongNotSet = long.MinValue; | ||
26 | |||
27 | /// <summary> | ||
28 | /// | ||
29 | /// </summary> | ||
30 | public const long IllegalLong = long.MinValue + 1; | ||
31 | |||
32 | /// <summary> | ||
33 | /// | ||
34 | /// </summary> | ||
35 | public const string IllegalGuid = "IllegalGuid"; | ||
36 | |||
37 | /// <summary> | ||
38 | /// | ||
39 | /// </summary> | ||
40 | public static readonly Version IllegalVersion = new Version(Int32.MaxValue, Int32.MaxValue, Int32.MaxValue, Int32.MaxValue); | ||
41 | } | ||
42 | } | ||
diff --git a/src/api/wix/WixToolset.Extensibility/Data/BindStage.cs b/src/api/wix/WixToolset.Extensibility/Data/BindStage.cs new file mode 100644 index 00000000..a690a896 --- /dev/null +++ b/src/api/wix/WixToolset.Extensibility/Data/BindStage.cs | |||
@@ -0,0 +1,25 @@ | |||
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 | /// <summary> | ||
6 | /// | ||
7 | /// </summary> | ||
8 | public enum BindStage | ||
9 | { | ||
10 | /// <summary> | ||
11 | /// Normal binding | ||
12 | /// </summary> | ||
13 | Normal, | ||
14 | |||
15 | /// <summary> | ||
16 | /// Bind the file path of the target build file | ||
17 | /// </summary> | ||
18 | Target, | ||
19 | |||
20 | /// <summary> | ||
21 | /// Bind the file path of the updated build file | ||
22 | /// </summary> | ||
23 | Updated, | ||
24 | } | ||
25 | } | ||
diff --git a/src/api/wix/WixToolset.Extensibility/Data/BurnPlatforms.cs b/src/api/wix/WixToolset.Extensibility/Data/BurnPlatforms.cs new file mode 100644 index 00000000..ab4beb7d --- /dev/null +++ b/src/api/wix/WixToolset.Extensibility/Data/BurnPlatforms.cs | |||
@@ -0,0 +1,25 @@ | |||
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 | |||
7 | /// <summary> | ||
8 | /// Platforms that have been supported by Burn. | ||
9 | /// </summary> | ||
10 | [Flags] | ||
11 | public enum BurnPlatforms | ||
12 | { | ||
13 | /// <summary>Not specified.</summary> | ||
14 | None = 0, | ||
15 | |||
16 | /// <summary>x86.</summary> | ||
17 | X86 = 0x1, | ||
18 | |||
19 | /// <summary>x64.</summary> | ||
20 | X64 = 0x2, | ||
21 | |||
22 | /// <summary>arm64.</summary> | ||
23 | ARM64 = 0x4, | ||
24 | } | ||
25 | } | ||
diff --git a/src/api/wix/WixToolset.Extensibility/Data/CabinetBuildOption.cs b/src/api/wix/WixToolset.Extensibility/Data/CabinetBuildOption.cs new file mode 100644 index 00000000..f9938814 --- /dev/null +++ b/src/api/wix/WixToolset.Extensibility/Data/CabinetBuildOption.cs | |||
@@ -0,0 +1,25 @@ | |||
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 | /// <summary> | ||
6 | /// Options for building the cabinet. | ||
7 | /// </summary> | ||
8 | public enum CabinetBuildOption | ||
9 | { | ||
10 | /// <summary> | ||
11 | /// Build the cabinet and move it to the target location. | ||
12 | /// </summary> | ||
13 | BuildAndMove, | ||
14 | |||
15 | /// <summary> | ||
16 | /// Build the cabinet and copy it to the target location. | ||
17 | /// </summary> | ||
18 | BuildAndCopy, | ||
19 | |||
20 | /// <summary> | ||
21 | /// Just copy the cabinet to the target location. | ||
22 | /// </summary> | ||
23 | Copy | ||
24 | } | ||
25 | } | ||
diff --git a/src/api/wix/WixToolset.Extensibility/Data/CustomActionPlatforms.cs b/src/api/wix/WixToolset.Extensibility/Data/CustomActionPlatforms.cs new file mode 100644 index 00000000..eea8a419 --- /dev/null +++ b/src/api/wix/WixToolset.Extensibility/Data/CustomActionPlatforms.cs | |||
@@ -0,0 +1,25 @@ | |||
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 | |||
7 | /// <summary> | ||
8 | /// Platforms supported by custom actions. | ||
9 | /// </summary> | ||
10 | [Flags] | ||
11 | public enum CustomActionPlatforms | ||
12 | { | ||
13 | /// <summary>Not specified.</summary> | ||
14 | None = 0, | ||
15 | |||
16 | /// <summary>x86.</summary> | ||
17 | X86 = 0x1, | ||
18 | |||
19 | /// <summary>x64.</summary> | ||
20 | X64 = 0x2, | ||
21 | |||
22 | /// <summary>arm64.</summary> | ||
23 | ARM64 = 0x4, | ||
24 | } | ||
25 | } | ||
diff --git a/src/api/wix/WixToolset.Extensibility/Data/ExtensionCommandLineSwitch.cs b/src/api/wix/WixToolset.Extensibility/Data/ExtensionCommandLineSwitch.cs new file mode 100644 index 00000000..14b5dabb --- /dev/null +++ b/src/api/wix/WixToolset.Extensibility/Data/ExtensionCommandLineSwitch.cs | |||
@@ -0,0 +1,20 @@ | |||
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 | /// <summary> | ||
6 | /// A command line option. | ||
7 | /// </summary> | ||
8 | public struct ExtensionCommandLineSwitch | ||
9 | { | ||
10 | /// <summary> | ||
11 | /// | ||
12 | /// </summary> | ||
13 | public string Switch { get; set; } | ||
14 | |||
15 | /// <summary> | ||
16 | /// | ||
17 | /// </summary> | ||
18 | public string Description { get; set; } | ||
19 | } | ||
20 | } | ||
diff --git a/src/api/wix/WixToolset.Extensibility/Data/IBindContext.cs b/src/api/wix/WixToolset.Extensibility/Data/IBindContext.cs new file mode 100644 index 00000000..d0c65683 --- /dev/null +++ b/src/api/wix/WixToolset.Extensibility/Data/IBindContext.cs | |||
@@ -0,0 +1,120 @@ | |||
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 System.Threading; | ||
8 | using WixToolset.Data; | ||
9 | |||
10 | /// <summary> | ||
11 | /// Bind context. | ||
12 | /// </summary> | ||
13 | public interface IBindContext | ||
14 | { | ||
15 | /// <summary> | ||
16 | /// Service provider. | ||
17 | /// </summary> | ||
18 | IServiceProvider ServiceProvider { get; } | ||
19 | |||
20 | /// <summary> | ||
21 | /// Counnt of threads to use in cabbing. | ||
22 | /// </summary> | ||
23 | int CabbingThreadCount { get; set; } | ||
24 | |||
25 | /// <summary> | ||
26 | /// Cabinet cache path. | ||
27 | /// </summary> | ||
28 | string CabCachePath { get; set; } | ||
29 | |||
30 | /// <summary> | ||
31 | /// Default compression level. | ||
32 | /// </summary> | ||
33 | CompressionLevel? DefaultCompressionLevel { get; set; } | ||
34 | |||
35 | /// <summary> | ||
36 | /// Delayed fields that need to be resolved again. | ||
37 | /// </summary> | ||
38 | IReadOnlyCollection<IDelayedField> DelayedFields { get; set; } | ||
39 | |||
40 | /// <summary> | ||
41 | /// Embedded files to extract. | ||
42 | /// </summary> | ||
43 | IReadOnlyCollection<IExpectedExtractFile> ExpectedEmbeddedFiles { get; set; } | ||
44 | |||
45 | /// <summary> | ||
46 | /// Binder extensions. | ||
47 | /// </summary> | ||
48 | IReadOnlyCollection<IBinderExtension> Extensions { get; set; } | ||
49 | |||
50 | /// <summary> | ||
51 | /// File system extensions. | ||
52 | /// </summary> | ||
53 | IReadOnlyCollection<IFileSystemExtension> FileSystemExtensions { get; set; } | ||
54 | |||
55 | /// <summary> | ||
56 | /// Set of ICEs to execute. | ||
57 | /// </summary> | ||
58 | IReadOnlyCollection<string> Ices { get; set; } | ||
59 | |||
60 | /// <summary> | ||
61 | /// Intermedaite folder. | ||
62 | /// </summary> | ||
63 | string IntermediateFolder { get; set; } | ||
64 | |||
65 | /// <summary> | ||
66 | /// Intermediate representation to bind. | ||
67 | /// </summary> | ||
68 | Intermediate IntermediateRepresentation { get; set; } | ||
69 | |||
70 | /// <summary> | ||
71 | /// Output path to bind to. | ||
72 | /// </summary> | ||
73 | string OutputPath { get; set; } | ||
74 | |||
75 | /// <summary> | ||
76 | /// Type of PDB to create. | ||
77 | /// </summary> | ||
78 | PdbType PdbType { get; set; } | ||
79 | |||
80 | /// <summary> | ||
81 | /// Output path for PDB. | ||
82 | /// </summary> | ||
83 | string PdbPath { get; set; } | ||
84 | |||
85 | /// <summary> | ||
86 | /// Codepage from resolve. | ||
87 | /// </summary> | ||
88 | int? ResolvedCodepage { get; set; } | ||
89 | |||
90 | /// <summary> | ||
91 | /// Summary information codepage from resolve. | ||
92 | /// </summary> | ||
93 | int? ResolvedSummaryInformationCodepage { get; set; } | ||
94 | |||
95 | /// <summary> | ||
96 | /// LCID from resolve. | ||
97 | /// </summary> | ||
98 | int? ResolvedLcid { get; set; } | ||
99 | |||
100 | /// <summary> | ||
101 | /// Set of ICEs to skip. | ||
102 | /// </summary> | ||
103 | IReadOnlyCollection<string> SuppressIces { get; set; } | ||
104 | |||
105 | /// <summary> | ||
106 | /// Skip all ICEs. | ||
107 | /// </summary> | ||
108 | bool SuppressValidation { get; set; } | ||
109 | |||
110 | /// <summary> | ||
111 | /// Skip creation of output. | ||
112 | /// </summary> | ||
113 | bool SuppressLayout { get; set; } | ||
114 | |||
115 | /// <summary> | ||
116 | /// Cancellation token. | ||
117 | /// </summary> | ||
118 | CancellationToken CancellationToken { get; set; } | ||
119 | } | ||
120 | } | ||
diff --git a/src/api/wix/WixToolset.Extensibility/Data/IBindFileWithPath.cs b/src/api/wix/WixToolset.Extensibility/Data/IBindFileWithPath.cs new file mode 100644 index 00000000..69036113 --- /dev/null +++ b/src/api/wix/WixToolset.Extensibility/Data/IBindFileWithPath.cs | |||
@@ -0,0 +1,12 @@ | |||
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 | #pragma warning disable 1591 // TODO: add documentation | ||
6 | public interface IBindFileWithPath | ||
7 | { | ||
8 | string Id { get; set; } | ||
9 | |||
10 | string Path { get; set; } | ||
11 | } | ||
12 | } | ||
diff --git a/src/api/wix/WixToolset.Extensibility/Data/IBindPath.cs b/src/api/wix/WixToolset.Extensibility/Data/IBindPath.cs new file mode 100644 index 00000000..46895e89 --- /dev/null +++ b/src/api/wix/WixToolset.Extensibility/Data/IBindPath.cs | |||
@@ -0,0 +1,25 @@ | |||
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 | /// <summary> | ||
6 | /// Interface for a bind path. | ||
7 | /// </summary> | ||
8 | public interface IBindPath | ||
9 | { | ||
10 | /// <summary> | ||
11 | /// Name of the bind path or String.Empty if the path is unnamed. | ||
12 | /// </summary> | ||
13 | string Name { get; set; } | ||
14 | |||
15 | /// <summary> | ||
16 | /// Path for the bind path. | ||
17 | /// </summary> | ||
18 | string Path { get; set; } | ||
19 | |||
20 | /// <summary> | ||
21 | /// Stage for the bind path. | ||
22 | /// </summary> | ||
23 | BindStage Stage { get; set; } | ||
24 | } | ||
25 | } | ||
diff --git a/src/api/wix/WixToolset.Extensibility/Data/IBindResult.cs b/src/api/wix/WixToolset.Extensibility/Data/IBindResult.cs new file mode 100644 index 00000000..3738ef17 --- /dev/null +++ b/src/api/wix/WixToolset.Extensibility/Data/IBindResult.cs | |||
@@ -0,0 +1,29 @@ | |||
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 | /// <summary> | ||
10 | /// Result of bind operation. | ||
11 | /// </summary> | ||
12 | public interface IBindResult : IDisposable | ||
13 | { | ||
14 | /// <summary> | ||
15 | /// Collection of file transfers to complete. | ||
16 | /// </summary> | ||
17 | IReadOnlyCollection<IFileTransfer> FileTransfers { get; set; } | ||
18 | |||
19 | /// <summary> | ||
20 | /// Collection of files tracked during binding. | ||
21 | /// </summary> | ||
22 | IReadOnlyCollection<ITrackedFile> TrackedFiles { get; set; } | ||
23 | |||
24 | /// <summary> | ||
25 | /// Output of binding. | ||
26 | /// </summary> | ||
27 | WixOutput Wixout { get; set; } | ||
28 | } | ||
29 | } | ||
diff --git a/src/api/wix/WixToolset.Extensibility/Data/ICommandLineArguments.cs b/src/api/wix/WixToolset.Extensibility/Data/ICommandLineArguments.cs new file mode 100644 index 00000000..32ee4c09 --- /dev/null +++ b/src/api/wix/WixToolset.Extensibility/Data/ICommandLineArguments.cs | |||
@@ -0,0 +1,39 @@ | |||
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 WixToolset.Extensibility.Services; | ||
6 | |||
7 | /// <summary> | ||
8 | /// Parsed command-line arguments. | ||
9 | /// </summary> | ||
10 | public interface ICommandLineArguments | ||
11 | { | ||
12 | #pragma warning disable 1591 // TODO: add documentation | ||
13 | string[] OriginalArguments { get; set; } | ||
14 | |||
15 | string[] Arguments { get; set; } | ||
16 | |||
17 | string[] Extensions { get; set; } | ||
18 | |||
19 | string ErrorArgument { get; set; } | ||
20 | |||
21 | /// <summary> | ||
22 | /// Populate this argument from a string. | ||
23 | /// </summary> | ||
24 | /// <param name="commandLine">String to parse.</param> | ||
25 | void Populate(string commandLine); | ||
26 | |||
27 | /// <summary> | ||
28 | /// Populate this argument from array of strings. | ||
29 | /// </summary> | ||
30 | /// <param name="args">Array of strings.</param> | ||
31 | void Populate(string[] args); | ||
32 | |||
33 | /// <summary> | ||
34 | /// Parses this arguments after it is populated. | ||
35 | /// </summary> | ||
36 | /// <returns>Parser for this arguments.</returns> | ||
37 | ICommandLineParser Parse(); | ||
38 | } | ||
39 | } | ||
diff --git a/src/api/wix/WixToolset.Extensibility/Data/ICommandLineCommand.cs b/src/api/wix/WixToolset.Extensibility/Data/ICommandLineCommand.cs new file mode 100644 index 00000000..b03a18f4 --- /dev/null +++ b/src/api/wix/WixToolset.Extensibility/Data/ICommandLineCommand.cs | |||
@@ -0,0 +1,39 @@ | |||
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.Threading; | ||
6 | using System.Threading.Tasks; | ||
7 | using WixToolset.Extensibility.Services; | ||
8 | |||
9 | /// <summary> | ||
10 | /// Custom command. | ||
11 | /// </summary> | ||
12 | public interface ICommandLineCommand | ||
13 | { | ||
14 | /// <summary> | ||
15 | /// Indicates the command-line should show the command-line logo. | ||
16 | /// </summary> | ||
17 | bool ShowLogo { get; } | ||
18 | |||
19 | /// <summary> | ||
20 | /// Indicates the command-line parsing can stop. | ||
21 | /// </summary> | ||
22 | bool StopParsing { get; } | ||
23 | |||
24 | /// <summary> | ||
25 | /// Executes the command. | ||
26 | /// </summary> | ||
27 | /// <param name="cancellationToken">Cancellation token.</param> | ||
28 | /// <returns>Exit code for the command.</returns> | ||
29 | Task<int> ExecuteAsync(CancellationToken cancellationToken); | ||
30 | |||
31 | /// <summary> | ||
32 | /// Allows the command to parse command-line arguments. | ||
33 | /// </summary> | ||
34 | /// <param name="parser">Parser to help parse the argument and additional arguments.</param> | ||
35 | /// <param name="argument">Argument to parse.</param> | ||
36 | /// <returns>True if the argument is recognized; otherwise false to allow another extension to process it.</returns> | ||
37 | bool TryParseArgument(ICommandLineParser parser, string argument); | ||
38 | } | ||
39 | } | ||
diff --git a/src/api/wix/WixToolset.Extensibility/Data/ICommandLineContext.cs b/src/api/wix/WixToolset.Extensibility/Data/ICommandLineContext.cs new file mode 100644 index 00000000..d8c9469e --- /dev/null +++ b/src/api/wix/WixToolset.Extensibility/Data/ICommandLineContext.cs | |||
@@ -0,0 +1,17 @@ | |||
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 WixToolset.Extensibility.Services; | ||
7 | |||
8 | #pragma warning disable 1591 // TODO: add documentation | ||
9 | public interface ICommandLineContext | ||
10 | { | ||
11 | IServiceProvider ServiceProvider { get; } | ||
12 | |||
13 | IExtensionManager ExtensionManager { get; set; } | ||
14 | |||
15 | ICommandLineArguments Arguments { get; set; } | ||
16 | } | ||
17 | } | ||
diff --git a/src/api/wix/WixToolset.Extensibility/Data/ICompileContext.cs b/src/api/wix/WixToolset.Extensibility/Data/ICompileContext.cs new file mode 100644 index 00000000..2ee8f2a1 --- /dev/null +++ b/src/api/wix/WixToolset.Extensibility/Data/ICompileContext.cs | |||
@@ -0,0 +1,52 @@ | |||
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 System.Threading; | ||
8 | using System.Xml.Linq; | ||
9 | using WixToolset.Data; | ||
10 | |||
11 | /// <summary> | ||
12 | /// Context provided to the compiler. | ||
13 | /// </summary> | ||
14 | public interface ICompileContext | ||
15 | { | ||
16 | /// <summary> | ||
17 | /// Service provider made available to the compiler and its extensions. | ||
18 | /// </summary> | ||
19 | IServiceProvider ServiceProvider { get; } | ||
20 | |||
21 | /// <summary> | ||
22 | /// Unique identifier for the compilation. | ||
23 | /// </summary> | ||
24 | string CompilationId { get; set; } | ||
25 | |||
26 | /// <summary> | ||
27 | /// Set of extensions provided to the compiler. | ||
28 | /// </summary> | ||
29 | IReadOnlyCollection<ICompilerExtension> Extensions { get; set; } | ||
30 | |||
31 | /// <summary> | ||
32 | /// Gets or sets the platform which the compiler will use when defaulting 64-bit attributes and elements. | ||
33 | /// </summary> | ||
34 | /// <value>The platform which the compiler will use when defaulting 64-bit attributes and elements.</value> | ||
35 | Platform Platform { get; set; } | ||
36 | |||
37 | /// <summary> | ||
38 | /// Calculates whether the target platform for the compilation is 64-bit or not. | ||
39 | /// </summary> | ||
40 | bool IsCurrentPlatform64Bit { get; } | ||
41 | |||
42 | /// <summary> | ||
43 | /// Source document being compiled. | ||
44 | /// </summary> | ||
45 | XDocument Source { get; set; } | ||
46 | |||
47 | /// <summary> | ||
48 | /// Cancellation token to abort cancellation. | ||
49 | /// </summary> | ||
50 | CancellationToken CancellationToken { get; set; } | ||
51 | } | ||
52 | } | ||
diff --git a/src/api/wix/WixToolset.Extensibility/Data/IComponentKeyPath.cs b/src/api/wix/WixToolset.Extensibility/Data/IComponentKeyPath.cs new file mode 100644 index 00000000..2de9c028 --- /dev/null +++ b/src/api/wix/WixToolset.Extensibility/Data/IComponentKeyPath.cs | |||
@@ -0,0 +1,14 @@ | |||
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 | #pragma warning disable 1591 // TODO: add documentation | ||
6 | public interface IComponentKeyPath | ||
7 | { | ||
8 | bool Explicit { get; set; } | ||
9 | |||
10 | string Id { get; set; } | ||
11 | |||
12 | PossibleKeyPathType Type { get; set; } | ||
13 | } | ||
14 | } | ||
diff --git a/src/api/wix/WixToolset.Extensibility/Data/IDecompileContext.cs b/src/api/wix/WixToolset.Extensibility/Data/IDecompileContext.cs new file mode 100644 index 00000000..fe7d0465 --- /dev/null +++ b/src/api/wix/WixToolset.Extensibility/Data/IDecompileContext.cs | |||
@@ -0,0 +1,59 @@ | |||
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 | using WixToolset.Extensibility.Services; | ||
9 | |||
10 | #pragma warning disable 1591 // TODO: add documentation | ||
11 | public interface IDecompileContext | ||
12 | { | ||
13 | IServiceProvider ServiceProvider { get; } | ||
14 | |||
15 | string DecompilePath { get; set; } | ||
16 | |||
17 | OutputType DecompileType { get; set; } | ||
18 | |||
19 | IReadOnlyCollection<IDecompilerExtension> Extensions { get; set; } | ||
20 | |||
21 | string ExtractFolder { get; set; } | ||
22 | |||
23 | string CabinetExtractFolder { get; set; } | ||
24 | |||
25 | /// <summary> | ||
26 | /// Optional gets or sets the base path for the File/@Source. | ||
27 | /// </summary> | ||
28 | /// <remarks>Default value is "SourceDir" to enable use of BindPaths.</remarks> | ||
29 | string BaseSourcePath { get; set; } | ||
30 | |||
31 | string IntermediateFolder { get; set; } | ||
32 | |||
33 | bool IsAdminImage { get; set; } | ||
34 | |||
35 | string OutputPath { get; set; } | ||
36 | |||
37 | /// <summary> | ||
38 | /// Gets or sets the option to suppress custom tables. | ||
39 | /// </summary> | ||
40 | bool SuppressCustomTables { get; set; } | ||
41 | |||
42 | /// <summary> | ||
43 | /// Gets or sets the option to suppress dropping empty tables. | ||
44 | /// </summary> | ||
45 | bool SuppressDroppingEmptyTables { get; set; } | ||
46 | |||
47 | bool SuppressExtractCabinets { get; set; } | ||
48 | |||
49 | /// <summary> | ||
50 | /// Gets or sets the option to suppress decompiling UI-related tables. | ||
51 | /// </summary> | ||
52 | bool SuppressUI { get; set; } | ||
53 | |||
54 | /// <summary> | ||
55 | /// Gets or sets whether the decompiler should use module logic on a product output. | ||
56 | /// </summary> | ||
57 | bool TreatProductAsModule { get; set; } | ||
58 | } | ||
59 | } | ||
diff --git a/src/api/wix/WixToolset.Extensibility/Data/IDecompileResult.cs b/src/api/wix/WixToolset.Extensibility/Data/IDecompileResult.cs new file mode 100644 index 00000000..cffd0976 --- /dev/null +++ b/src/api/wix/WixToolset.Extensibility/Data/IDecompileResult.cs | |||
@@ -0,0 +1,18 @@ | |||
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 | using System.Xml.Linq; | ||
7 | using WixToolset.Data; | ||
8 | |||
9 | #pragma warning disable 1591 // TODO: add documentation | ||
10 | public interface IDecompileResult | ||
11 | { | ||
12 | XDocument Document { get; set; } | ||
13 | |||
14 | IReadOnlyCollection<string> ExtractedFilePaths { get; set; } | ||
15 | |||
16 | Platform? Platform { get; set; } | ||
17 | } | ||
18 | } | ||
diff --git a/src/api/wix/WixToolset.Extensibility/Data/IDelayedField.cs b/src/api/wix/WixToolset.Extensibility/Data/IDelayedField.cs new file mode 100644 index 00000000..59a578a6 --- /dev/null +++ b/src/api/wix/WixToolset.Extensibility/Data/IDelayedField.cs | |||
@@ -0,0 +1,14 @@ | |||
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 WixToolset.Data; | ||
6 | |||
7 | #pragma warning disable 1591 // TODO: add documentation | ||
8 | public interface IDelayedField | ||
9 | { | ||
10 | IntermediateField Field { get; } | ||
11 | |||
12 | IntermediateSymbol Symbol { get; } | ||
13 | } | ||
14 | } | ||
diff --git a/src/api/wix/WixToolset.Extensibility/Data/IExpectedExtractFile.cs b/src/api/wix/WixToolset.Extensibility/Data/IExpectedExtractFile.cs new file mode 100644 index 00000000..4bc8cd96 --- /dev/null +++ b/src/api/wix/WixToolset.Extensibility/Data/IExpectedExtractFile.cs | |||
@@ -0,0 +1,16 @@ | |||
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 | |||
7 | #pragma warning disable 1591 // TODO: add documentation | ||
8 | public interface IExpectedExtractFile | ||
9 | { | ||
10 | Uri Uri { get; set; } | ||
11 | |||
12 | string EmbeddedFileId { get; set; } | ||
13 | |||
14 | string OutputPath { get; set; } | ||
15 | } | ||
16 | } \ No newline at end of file | ||
diff --git a/src/api/wix/WixToolset.Extensibility/Data/IFileFacade.cs b/src/api/wix/WixToolset.Extensibility/Data/IFileFacade.cs new file mode 100644 index 00000000..fea00d4e --- /dev/null +++ b/src/api/wix/WixToolset.Extensibility/Data/IFileFacade.cs | |||
@@ -0,0 +1,126 @@ | |||
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 | using WixToolset.Data; | ||
7 | using WixToolset.Data.Symbols; | ||
8 | using WixToolset.Data.WindowsInstaller.Rows; | ||
9 | |||
10 | /// <summary> | ||
11 | /// Interface that provides a common facade over <c>FileSymbol</c> and <c>FileRow</c>. | ||
12 | /// </summary> | ||
13 | public interface IFileFacade | ||
14 | { | ||
15 | /// <summary> | ||
16 | /// Reference to assembly application for this file. | ||
17 | /// </summary> | ||
18 | string AssemblyApplicationFileRef { get; } | ||
19 | |||
20 | /// <summary> | ||
21 | /// Reference to assembly manifest for this file. | ||
22 | /// </summary> | ||
23 | string AssemblyManifestFileRef { get; } | ||
24 | |||
25 | /// <summary> | ||
26 | /// List of assembly name values in the file. | ||
27 | /// </summary> | ||
28 | List<MsiAssemblyNameSymbol> AssemblyNames { get; set; } | ||
29 | |||
30 | /// <summary> | ||
31 | /// Optionally indicates what sort of assembly the file is. | ||
32 | /// </summary> | ||
33 | AssemblyType? AssemblyType { get; } | ||
34 | |||
35 | /// <summary> | ||
36 | /// Component containing the file. | ||
37 | /// </summary> | ||
38 | string ComponentRef { get; } | ||
39 | |||
40 | /// <summary> | ||
41 | /// Indicates whether the file is compressed. | ||
42 | /// </summary> | ||
43 | bool Compressed { get; } | ||
44 | |||
45 | /// <summary> | ||
46 | /// Disk Id for the file. | ||
47 | /// </summary> | ||
48 | int DiskId { get; set; } | ||
49 | |||
50 | /// <summary> | ||
51 | /// Name of the file. | ||
52 | /// </summary> | ||
53 | string FileName { get; } | ||
54 | |||
55 | /// <summary> | ||
56 | /// Size of the file. | ||
57 | /// </summary> | ||
58 | int FileSize { get; set; } | ||
59 | |||
60 | /// <summary> | ||
61 | /// Indicates whether the file came from a merge module. | ||
62 | /// </summary> | ||
63 | bool FromModule { get; } | ||
64 | |||
65 | /// <summary> | ||
66 | /// Indicates whether the file came from a transform. | ||
67 | /// </summary> | ||
68 | bool FromTransform { get; } | ||
69 | |||
70 | /// <summary> | ||
71 | /// Hash symbol of the file. | ||
72 | /// </summary> | ||
73 | MsiFileHashSymbol Hash { get; set; } | ||
74 | |||
75 | /// <summary> | ||
76 | /// Underlying identifier of the file. | ||
77 | /// </summary> | ||
78 | Identifier Identifier { get; } | ||
79 | |||
80 | /// <summary> | ||
81 | /// Helper accessor for the Id of the Identifier. | ||
82 | /// </summary> | ||
83 | string Id { get; } | ||
84 | |||
85 | /// <summary> | ||
86 | /// Language of the file. | ||
87 | /// </summary> | ||
88 | string Language { get; set; } | ||
89 | |||
90 | /// <summary> | ||
91 | /// Optional patch group for the file. | ||
92 | /// </summary> | ||
93 | int? PatchGroup { get; } | ||
94 | |||
95 | /// <summary> | ||
96 | /// Sequence of the file. | ||
97 | /// </summary> | ||
98 | int Sequence { get; set; } | ||
99 | |||
100 | /// <summary> | ||
101 | /// Source line number that define the file. | ||
102 | /// </summary> | ||
103 | SourceLineNumber SourceLineNumber { get; } | ||
104 | |||
105 | /// <summary> | ||
106 | /// Source to the file. | ||
107 | /// </summary> | ||
108 | string SourcePath { get; } | ||
109 | |||
110 | /// <summary> | ||
111 | /// Indicates whether the file is to be uncompressed. | ||
112 | /// </summary> | ||
113 | bool Uncompressed { get; } | ||
114 | |||
115 | /// <summary> | ||
116 | /// Version of the file. | ||
117 | /// </summary> | ||
118 | string Version { get; set; } | ||
119 | |||
120 | /// <summary> | ||
121 | /// Gets the underlying <c>FileRow</c> if one is present. | ||
122 | /// </summary> | ||
123 | /// <returns><c>FileRow</c> if one is present, otherwise throws.</returns> | ||
124 | FileRow GetFileRow(); | ||
125 | } | ||
126 | } | ||
diff --git a/src/api/wix/WixToolset.Extensibility/Data/IFileSystemContext.cs b/src/api/wix/WixToolset.Extensibility/Data/IFileSystemContext.cs new file mode 100644 index 00000000..2e58059a --- /dev/null +++ b/src/api/wix/WixToolset.Extensibility/Data/IFileSystemContext.cs | |||
@@ -0,0 +1,24 @@ | |||
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 WixToolset.Data; | ||
7 | using WixToolset.Extensibility.Services; | ||
8 | |||
9 | #pragma warning disable 1591 // TODO: add documentation | ||
10 | public interface IFileSystemContext | ||
11 | { | ||
12 | IServiceProvider ServiceProvider { get; } | ||
13 | |||
14 | string CabCachePath { get; set; } | ||
15 | |||
16 | string IntermediateFolder { get; set; } | ||
17 | |||
18 | Intermediate IntermediateRepresentation { get; set; } | ||
19 | |||
20 | string OutputPath { get; set; } | ||
21 | |||
22 | string OutputPdbPath { get; set; } | ||
23 | } | ||
24 | } | ||
diff --git a/src/api/wix/WixToolset.Extensibility/Data/IFileTransfer.cs b/src/api/wix/WixToolset.Extensibility/Data/IFileTransfer.cs new file mode 100644 index 00000000..6f521536 --- /dev/null +++ b/src/api/wix/WixToolset.Extensibility/Data/IFileTransfer.cs | |||
@@ -0,0 +1,27 @@ | |||
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 WixToolset.Data; | ||
6 | |||
7 | /// <summary> | ||
8 | /// Structure used for all file transfer information. | ||
9 | /// </summary> | ||
10 | public interface IFileTransfer | ||
11 | { | ||
12 | /// <summary>Destination path for file.</summary> | ||
13 | string Destination { get; set; } | ||
14 | |||
15 | /// <summary>Flag if file should be moved (optimal).</summary> | ||
16 | bool Move { get; set; } | ||
17 | |||
18 | /// <summary>Set during layout of media when the file transfer when the source and target resolve to the same path.</summary> | ||
19 | bool Redundant { get; set; } | ||
20 | |||
21 | /// <summary>Source path to file.</summary> | ||
22 | string Source { get; set; } | ||
23 | |||
24 | /// <summary>Optional source line numbers where this file transfer orginated.</summary> | ||
25 | SourceLineNumber SourceLineNumbers { get; set; } | ||
26 | } | ||
27 | } | ||
diff --git a/src/api/wix/WixToolset.Extensibility/Data/IIncludedFile.cs b/src/api/wix/WixToolset.Extensibility/Data/IIncludedFile.cs new file mode 100644 index 00000000..e25c9f7e --- /dev/null +++ b/src/api/wix/WixToolset.Extensibility/Data/IIncludedFile.cs | |||
@@ -0,0 +1,24 @@ | |||
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 WixToolset.Data; | ||
6 | |||
7 | /// <summary> | ||
8 | /// Interface for an included file. | ||
9 | /// </summary> | ||
10 | public interface IIncludedFile | ||
11 | { | ||
12 | /// <summary> | ||
13 | /// Gets the full path of the included file. | ||
14 | /// </summary> | ||
15 | /// <value>The full path of the included file.</value> | ||
16 | string Path { get; set; } | ||
17 | |||
18 | /// <summary> | ||
19 | /// Gets the source line numbers. | ||
20 | /// </summary> | ||
21 | /// <value>The source line numbers.</value> | ||
22 | SourceLineNumber SourceLineNumbers { get; set; } | ||
23 | } | ||
24 | } | ||
diff --git a/src/api/wix/WixToolset.Extensibility/Data/IInscribeContext.cs b/src/api/wix/WixToolset.Extensibility/Data/IInscribeContext.cs new file mode 100644 index 00000000..31c66aad --- /dev/null +++ b/src/api/wix/WixToolset.Extensibility/Data/IInscribeContext.cs | |||
@@ -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.Data | ||
4 | { | ||
5 | using System; | ||
6 | using WixToolset.Extensibility.Services; | ||
7 | |||
8 | #pragma warning disable 1591 // TODO: add documentation | ||
9 | public interface IInscribeContext | ||
10 | { | ||
11 | IServiceProvider ServiceProvider { get; } | ||
12 | |||
13 | string InputFilePath { get; set; } | ||
14 | |||
15 | string IntermediateFolder { get; set; } | ||
16 | |||
17 | string OutputFile { get; set; } | ||
18 | |||
19 | string SignedEngineFile { get; set; } | ||
20 | } | ||
21 | } | ||
diff --git a/src/api/wix/WixToolset.Extensibility/Data/ILayoutContext.cs b/src/api/wix/WixToolset.Extensibility/Data/ILayoutContext.cs new file mode 100644 index 00000000..b11b4d13 --- /dev/null +++ b/src/api/wix/WixToolset.Extensibility/Data/ILayoutContext.cs | |||
@@ -0,0 +1,64 @@ | |||
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 System.Threading; | ||
8 | |||
9 | /// <summary> | ||
10 | /// Context for laying out files. | ||
11 | /// </summary> | ||
12 | public interface ILayoutContext | ||
13 | { | ||
14 | /// <summary> | ||
15 | /// Service provider. | ||
16 | /// </summary> | ||
17 | IServiceProvider ServiceProvider { get; } | ||
18 | |||
19 | /// <summary> | ||
20 | /// Extensions for use during layout. | ||
21 | /// </summary> | ||
22 | IReadOnlyCollection<ILayoutExtension> Extensions { get; set; } | ||
23 | |||
24 | /// <summary> | ||
25 | /// Set of tracked of files created during processing to be cleaned up. | ||
26 | /// </summary> | ||
27 | IReadOnlyCollection<ITrackedFile> TrackedFiles { get; set; } | ||
28 | |||
29 | /// <summary> | ||
30 | /// Set of files to transfer. | ||
31 | /// </summary> | ||
32 | IReadOnlyCollection<IFileTransfer> FileTransfers { get; set; } | ||
33 | |||
34 | /// <summary> | ||
35 | /// File to capture list of content files. | ||
36 | /// </summary> | ||
37 | string ContentsFile { get; set; } | ||
38 | |||
39 | /// <summary> | ||
40 | /// File to capture list of output files. | ||
41 | /// </summary> | ||
42 | string OutputsFile { get; set; } | ||
43 | |||
44 | /// <summary> | ||
45 | /// Intermediate folder. | ||
46 | /// </summary> | ||
47 | string IntermediateFolder { get; set; } | ||
48 | |||
49 | /// <summary> | ||
50 | /// List of built output files. | ||
51 | /// </summary> | ||
52 | string BuiltOutputsFile { get; set; } | ||
53 | |||
54 | /// <summary> | ||
55 | /// Reset ACLs on file transfers. | ||
56 | /// </summary> | ||
57 | bool ResetAcls { get; set; } | ||
58 | |||
59 | /// <summary> | ||
60 | /// Cancellation token. | ||
61 | /// </summary> | ||
62 | CancellationToken CancellationToken { get; set; } | ||
63 | } | ||
64 | } | ||
diff --git a/src/api/wix/WixToolset.Extensibility/Data/ILibraryContext.cs b/src/api/wix/WixToolset.Extensibility/Data/ILibraryContext.cs new file mode 100644 index 00000000..208b6f73 --- /dev/null +++ b/src/api/wix/WixToolset.Extensibility/Data/ILibraryContext.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 System.Threading; | ||
8 | using WixToolset.Data; | ||
9 | |||
10 | /// <summary> | ||
11 | /// Context provided during library creation operations. | ||
12 | /// </summary> | ||
13 | public interface ILibraryContext | ||
14 | { | ||
15 | /// <summary> | ||
16 | /// Service provider. | ||
17 | /// </summary> | ||
18 | IServiceProvider ServiceProvider { get; } | ||
19 | |||
20 | /// <summary> | ||
21 | /// Indicates whether files should be bound into the library. | ||
22 | /// </summary> | ||
23 | bool BindFiles { get; set; } | ||
24 | |||
25 | /// <summary> | ||
26 | /// Collection of bindpaths used to bind files. | ||
27 | /// </summary> | ||
28 | IReadOnlyCollection<IBindPath> BindPaths { get; set; } | ||
29 | |||
30 | /// <summary> | ||
31 | /// Collection of extensions used during creation of library. | ||
32 | /// </summary> | ||
33 | IReadOnlyCollection<ILibrarianExtension> Extensions { get; set; } | ||
34 | |||
35 | /// <summary> | ||
36 | /// Identifier of the library. | ||
37 | /// </summary> | ||
38 | string LibraryId { get; set; } | ||
39 | |||
40 | /// <summary> | ||
41 | /// Collection of localization files to use in the library. | ||
42 | /// </summary> | ||
43 | IReadOnlyCollection<Localization> Localizations { get; set; } | ||
44 | |||
45 | /// <summary> | ||
46 | /// Collection of intermediates to include in the library. | ||
47 | /// </summary> | ||
48 | IReadOnlyCollection<Intermediate> Intermediates { get; set; } | ||
49 | |||
50 | /// <summary> | ||
51 | /// Cancellation token. | ||
52 | /// </summary> | ||
53 | CancellationToken CancellationToken { get; set; } | ||
54 | } | ||
55 | } | ||
diff --git a/src/api/wix/WixToolset.Extensibility/Data/ILinkContext.cs b/src/api/wix/WixToolset.Extensibility/Data/ILinkContext.cs new file mode 100644 index 00000000..d56866f7 --- /dev/null +++ b/src/api/wix/WixToolset.Extensibility/Data/ILinkContext.cs | |||
@@ -0,0 +1,50 @@ | |||
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 System.Threading; | ||
8 | using WixToolset.Data; | ||
9 | |||
10 | /// <summary> | ||
11 | /// Context provided during linking. | ||
12 | /// </summary> | ||
13 | public interface ILinkContext | ||
14 | { | ||
15 | /// <summary> | ||
16 | /// Service provider. | ||
17 | /// </summary> | ||
18 | IServiceProvider ServiceProvider { get; } | ||
19 | |||
20 | /// <summary> | ||
21 | /// Collection of extensions to use during linking. | ||
22 | /// </summary> | ||
23 | IReadOnlyCollection<ILinkerExtension> Extensions { get; set; } | ||
24 | |||
25 | /// <summary> | ||
26 | /// Collection of extension data to use during linking. | ||
27 | /// </summary> | ||
28 | IReadOnlyCollection<IExtensionData> ExtensionData { get; set; } | ||
29 | |||
30 | /// <summary> | ||
31 | /// Expected output type. | ||
32 | /// </summary> | ||
33 | OutputType ExpectedOutputType { get; set; } | ||
34 | |||
35 | /// <summary> | ||
36 | /// Collection of intermediates to link. | ||
37 | /// </summary> | ||
38 | IReadOnlyCollection<Intermediate> Intermediates { get; set; } | ||
39 | |||
40 | /// <summary> | ||
41 | /// Symbol definition creator used to load extension data. | ||
42 | /// </summary> | ||
43 | ISymbolDefinitionCreator SymbolDefinitionCreator { get; set; } | ||
44 | |||
45 | /// <summary> | ||
46 | /// Cancellation token. | ||
47 | /// </summary> | ||
48 | CancellationToken CancellationToken { get; set; } | ||
49 | } | ||
50 | } | ||
diff --git a/src/api/wix/WixToolset.Extensibility/Data/IPreprocessContext.cs b/src/api/wix/WixToolset.Extensibility/Data/IPreprocessContext.cs new file mode 100644 index 00000000..69057c33 --- /dev/null +++ b/src/api/wix/WixToolset.Extensibility/Data/IPreprocessContext.cs | |||
@@ -0,0 +1,56 @@ | |||
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 System.Threading; | ||
8 | using WixToolset.Data; | ||
9 | |||
10 | /// <summary> | ||
11 | /// Preprocessor context. | ||
12 | /// </summary> | ||
13 | public interface IPreprocessContext | ||
14 | { | ||
15 | /// <summary> | ||
16 | /// Service provider. | ||
17 | /// </summary> | ||
18 | IServiceProvider ServiceProvider { get; } | ||
19 | |||
20 | /// <summary> | ||
21 | /// Collection of extensions to use during preprocessing. | ||
22 | /// </summary> | ||
23 | IReadOnlyCollection<IPreprocessorExtension> Extensions { get; set; } | ||
24 | |||
25 | /// <summary> | ||
26 | /// Collection of search paths to find include files. | ||
27 | /// </summary> | ||
28 | IReadOnlyCollection<string> IncludeSearchPaths { get; set; } | ||
29 | |||
30 | /// <summary> | ||
31 | /// Gets the platform which the compiler will use when defaulting 64-bit attributes and elements. | ||
32 | /// </summary> | ||
33 | /// <value>The platform which the compiler will use when defaulting 64-bit attributes and elements.</value> | ||
34 | Platform Platform { get; set; } | ||
35 | |||
36 | /// <summary> | ||
37 | /// Path to the source file being preprocessed. | ||
38 | /// </summary> | ||
39 | string SourcePath { get; set; } | ||
40 | |||
41 | /// <summary> | ||
42 | /// Collection of name/value pairs used as preprocessor variables. | ||
43 | /// </summary> | ||
44 | IDictionary<string, string> Variables { get; set; } | ||
45 | |||
46 | /// <summary> | ||
47 | /// Current source line number of the preprocessor. | ||
48 | /// </summary> | ||
49 | SourceLineNumber CurrentSourceLineNumber { get; set; } | ||
50 | |||
51 | /// <summary> | ||
52 | /// Cancellation token. | ||
53 | /// </summary> | ||
54 | CancellationToken CancellationToken { get; set; } | ||
55 | } | ||
56 | } | ||
diff --git a/src/api/wix/WixToolset.Extensibility/Data/IPreprocessResult.cs b/src/api/wix/WixToolset.Extensibility/Data/IPreprocessResult.cs new file mode 100644 index 00000000..af224c1e --- /dev/null +++ b/src/api/wix/WixToolset.Extensibility/Data/IPreprocessResult.cs | |||
@@ -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.Data | ||
4 | { | ||
5 | using System.Collections.Generic; | ||
6 | using System.Xml.Linq; | ||
7 | |||
8 | /// <summary> | ||
9 | /// Result of preprocessing. | ||
10 | /// </summary> | ||
11 | public interface IPreprocessResult | ||
12 | { | ||
13 | /// <summary> | ||
14 | /// Document result of preprocessor. | ||
15 | /// </summary> | ||
16 | XDocument Document { get; set; } | ||
17 | |||
18 | /// <summary> | ||
19 | /// Collection of files included during preprocessing. | ||
20 | /// </summary> | ||
21 | IReadOnlyCollection<IIncludedFile> IncludedFiles { get; set; } | ||
22 | } | ||
23 | } | ||
diff --git a/src/api/wix/WixToolset.Extensibility/Data/IResolveContext.cs b/src/api/wix/WixToolset.Extensibility/Data/IResolveContext.cs new file mode 100644 index 00000000..63159ccb --- /dev/null +++ b/src/api/wix/WixToolset.Extensibility/Data/IResolveContext.cs | |||
@@ -0,0 +1,65 @@ | |||
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 System.Threading; | ||
8 | using WixToolset.Data; | ||
9 | |||
10 | /// <summary> | ||
11 | /// Context for resolve. | ||
12 | /// </summary> | ||
13 | public interface IResolveContext | ||
14 | { | ||
15 | /// <summary> | ||
16 | /// Service provider. | ||
17 | /// </summary> | ||
18 | IServiceProvider ServiceProvider { get; } | ||
19 | |||
20 | /// <summary> | ||
21 | /// Bind paths used during resolution. | ||
22 | /// </summary> | ||
23 | IReadOnlyCollection<IBindPath> BindPaths { get; set; } | ||
24 | |||
25 | /// <summary> | ||
26 | /// Resolve extensions. | ||
27 | /// </summary> | ||
28 | IReadOnlyCollection<IResolverExtension> Extensions { get; set; } | ||
29 | |||
30 | /// <summary> | ||
31 | /// Extension data. | ||
32 | /// </summary> | ||
33 | IReadOnlyCollection<IExtensionData> ExtensionData { get; set; } | ||
34 | |||
35 | /// <summary> | ||
36 | /// List of cultures to filter the localizations. | ||
37 | /// </summary> | ||
38 | IReadOnlyCollection<string> FilterCultures { get; set; } | ||
39 | |||
40 | /// <summary> | ||
41 | /// Intermediate folder. | ||
42 | /// </summary> | ||
43 | string IntermediateFolder { get; set; } | ||
44 | |||
45 | /// <summary> | ||
46 | /// Intermediate to resolve. | ||
47 | /// </summary> | ||
48 | Intermediate IntermediateRepresentation { get; set; } | ||
49 | |||
50 | /// <summary> | ||
51 | /// Localizations used to resolve. | ||
52 | /// </summary> | ||
53 | IReadOnlyCollection<Localization> Localizations { get; set; } | ||
54 | |||
55 | /// <summary> | ||
56 | /// Indicates whether to allow localization and bind variables to remain unresolved. | ||
57 | /// </summary> | ||
58 | bool AllowUnresolvedVariables { get; set; } | ||
59 | |||
60 | /// <summary> | ||
61 | /// Cancellation token. | ||
62 | /// </summary> | ||
63 | CancellationToken CancellationToken { get; set; } | ||
64 | } | ||
65 | } | ||
diff --git a/src/api/wix/WixToolset.Extensibility/Data/IResolveFileResult.cs b/src/api/wix/WixToolset.Extensibility/Data/IResolveFileResult.cs new file mode 100644 index 00000000..2f0df96c --- /dev/null +++ b/src/api/wix/WixToolset.Extensibility/Data/IResolveFileResult.cs | |||
@@ -0,0 +1,22 @@ | |||
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 | /// <summary> | ||
8 | /// Result of resolving a file. | ||
9 | /// </summary> | ||
10 | public interface IResolveFileResult | ||
11 | { | ||
12 | /// <summary> | ||
13 | /// Collection of paths checked to find file. | ||
14 | /// </summary> | ||
15 | IReadOnlyCollection<string> CheckedPaths { get; set; } | ||
16 | |||
17 | /// <summary> | ||
18 | /// Path to found file, if found. | ||
19 | /// </summary> | ||
20 | string Path { get; set; } | ||
21 | } | ||
22 | } | ||
diff --git a/src/api/wix/WixToolset.Extensibility/Data/IResolveResult.cs b/src/api/wix/WixToolset.Extensibility/Data/IResolveResult.cs new file mode 100644 index 00000000..0c5e0ccf --- /dev/null +++ b/src/api/wix/WixToolset.Extensibility/Data/IResolveResult.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.Data | ||
4 | { | ||
5 | using System.Collections.Generic; | ||
6 | using WixToolset.Data; | ||
7 | |||
8 | /// <summary> | ||
9 | /// Result of resolving localization and bind variables. | ||
10 | /// </summary> | ||
11 | public interface IResolveResult | ||
12 | { | ||
13 | /// <summary> | ||
14 | /// Resolved codepage, if provided. | ||
15 | /// </summary> | ||
16 | int? Codepage { get; set; } | ||
17 | |||
18 | /// <summary> | ||
19 | /// Resolved summary information codepage, if provided. | ||
20 | /// </summary> | ||
21 | int? SummaryInformationCodepage { get; set; } | ||
22 | |||
23 | /// <summary> | ||
24 | /// Resolved package language, if provided. | ||
25 | /// </summary> | ||
26 | int? PackageLcid { get; set; } | ||
27 | |||
28 | /// <summary> | ||
29 | /// Fields still requiring resolution. | ||
30 | /// </summary> | ||
31 | IReadOnlyCollection<IDelayedField> DelayedFields { get; set; } | ||
32 | |||
33 | /// <summary> | ||
34 | /// Files to extract from embedded .wixlibs. | ||
35 | /// </summary> | ||
36 | IReadOnlyCollection<IExpectedExtractFile> ExpectedEmbeddedFiles { get; set; } | ||
37 | |||
38 | /// <summary> | ||
39 | /// Resolved intermediate. | ||
40 | /// </summary> | ||
41 | Intermediate IntermediateRepresentation { get; set; } | ||
42 | } | ||
43 | } | ||
diff --git a/src/api/wix/WixToolset.Extensibility/Data/IResolvedCabinet.cs b/src/api/wix/WixToolset.Extensibility/Data/IResolvedCabinet.cs new file mode 100644 index 00000000..0c07d387 --- /dev/null +++ b/src/api/wix/WixToolset.Extensibility/Data/IResolvedCabinet.cs | |||
@@ -0,0 +1,12 @@ | |||
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 | #pragma warning disable 1591 // TODO: add documentation | ||
6 | public interface IResolvedCabinet | ||
7 | { | ||
8 | CabinetBuildOption BuildOption { get; set; } | ||
9 | |||
10 | string Path { get; set; } | ||
11 | } | ||
12 | } | ||
diff --git a/src/api/wix/WixToolset.Extensibility/Data/IResolvedDirectory.cs b/src/api/wix/WixToolset.Extensibility/Data/IResolvedDirectory.cs new file mode 100644 index 00000000..59de6e78 --- /dev/null +++ b/src/api/wix/WixToolset.Extensibility/Data/IResolvedDirectory.cs | |||
@@ -0,0 +1,19 @@ | |||
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 | /// <summary> | ||
6 | /// Used for resolved directory information. | ||
7 | /// </summary> | ||
8 | public interface IResolvedDirectory | ||
9 | { | ||
10 | /// <summary>The directory parent.</summary> | ||
11 | string DirectoryParent { get; set; } | ||
12 | |||
13 | /// <summary>The name of this directory.</summary> | ||
14 | string Name { get; set; } | ||
15 | |||
16 | /// <summary>The path of this directory.</summary> | ||
17 | string Path { get; set; } | ||
18 | } | ||
19 | } | ||
diff --git a/src/api/wix/WixToolset.Extensibility/Data/ITrackedFile.cs b/src/api/wix/WixToolset.Extensibility/Data/ITrackedFile.cs new file mode 100644 index 00000000..df36bd2b --- /dev/null +++ b/src/api/wix/WixToolset.Extensibility/Data/ITrackedFile.cs | |||
@@ -0,0 +1,32 @@ | |||
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 WixToolset.Data; | ||
6 | |||
7 | /// <summary> | ||
8 | /// Interface used to track all files processed. | ||
9 | /// </summary> | ||
10 | public interface ITrackedFile | ||
11 | { | ||
12 | /// <summary> | ||
13 | /// Indicates whether the tracked file should be cleaned by the project. | ||
14 | /// </summary> | ||
15 | bool Clean { get; set; } | ||
16 | |||
17 | /// <summary> | ||
18 | /// Path to tracked file. | ||
19 | /// </summary> | ||
20 | string Path { get; set; } | ||
21 | |||
22 | /// <summary> | ||
23 | /// Optional source line numbers where the tracked file was created. | ||
24 | /// </summary> | ||
25 | SourceLineNumber SourceLineNumbers { get; set; } | ||
26 | |||
27 | /// <summary> | ||
28 | /// Type of tracked file. | ||
29 | /// </summary> | ||
30 | TrackedFileType Type { get; set; } | ||
31 | } | ||
32 | } | ||
diff --git a/src/api/wix/WixToolset.Extensibility/Data/IUnbindContext.cs b/src/api/wix/WixToolset.Extensibility/Data/IUnbindContext.cs new file mode 100644 index 00000000..6427422f --- /dev/null +++ b/src/api/wix/WixToolset.Extensibility/Data/IUnbindContext.cs | |||
@@ -0,0 +1,24 @@ | |||
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 | |||
7 | #pragma warning disable 1591 // TODO: add documentation | ||
8 | public interface IUnbindContext | ||
9 | { | ||
10 | IServiceProvider ServiceProvider { get; } | ||
11 | |||
12 | string ExportBasePath { get; set; } | ||
13 | |||
14 | string InputFilePath { get; set; } | ||
15 | |||
16 | string IntermediateFolder { get; set; } | ||
17 | |||
18 | bool IsAdminImage { get; set; } | ||
19 | |||
20 | bool SuppressDemodularization { get; set; } | ||
21 | |||
22 | bool SuppressExtractCabinets { get; set; } | ||
23 | } | ||
24 | } \ No newline at end of file | ||
diff --git a/src/api/wix/WixToolset.Extensibility/Data/PossibleKeyPathType.cs b/src/api/wix/WixToolset.Extensibility/Data/PossibleKeyPathType.cs new file mode 100644 index 00000000..08e927e4 --- /dev/null +++ b/src/api/wix/WixToolset.Extensibility/Data/PossibleKeyPathType.cs | |||
@@ -0,0 +1,40 @@ | |||
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 | /// <summary> | ||
6 | /// Key path types. | ||
7 | /// </summary> | ||
8 | public enum PossibleKeyPathType | ||
9 | { | ||
10 | /// <summary> | ||
11 | /// Not a key path. | ||
12 | /// </summary> | ||
13 | None, | ||
14 | |||
15 | /// <summary> | ||
16 | /// File resource as a key path. | ||
17 | /// </summary> | ||
18 | File, | ||
19 | |||
20 | /// <summary> | ||
21 | /// Folder as a key path. | ||
22 | /// </summary> | ||
23 | Directory, | ||
24 | |||
25 | /// <summary> | ||
26 | /// ODBC data source as a key path. | ||
27 | /// </summary> | ||
28 | OdbcDataSource, | ||
29 | |||
30 | /// <summary> | ||
31 | /// A simple registry key acting as a key path. | ||
32 | /// </summary> | ||
33 | Registry, | ||
34 | |||
35 | /// <summary> | ||
36 | /// A registry key that contains a formatted property acting as a key path. | ||
37 | /// </summary> | ||
38 | RegistryFormatted | ||
39 | } | ||
40 | } | ||
diff --git a/src/api/wix/WixToolset.Extensibility/Data/TrackedFileType.cs b/src/api/wix/WixToolset.Extensibility/Data/TrackedFileType.cs new file mode 100644 index 00000000..e7f53842 --- /dev/null +++ b/src/api/wix/WixToolset.Extensibility/Data/TrackedFileType.cs | |||
@@ -0,0 +1,33 @@ | |||
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 | /// <summary> | ||
6 | /// Tracked file types. | ||
7 | /// </summary> | ||
8 | public enum TrackedFileType | ||
9 | { | ||
10 | /// <summary> | ||
11 | /// File tracked as input (like content included in an .msi). | ||
12 | /// </summary> | ||
13 | Input, | ||
14 | |||
15 | /// <summary> | ||
16 | /// Temporary file (like an .idt or any other temporary file). | ||
17 | /// These are to be deleted before the build completes. | ||
18 | /// </summary> | ||
19 | Temporary, | ||
20 | |||
21 | /// <summary> | ||
22 | /// Intermediate file (like a .cab in the cabcache). | ||
23 | /// These are left for subsequent builds. | ||
24 | /// </summary> | ||
25 | Intermediate, | ||
26 | |||
27 | /// <summary> | ||
28 | /// Final output (like a .msi, .cab or .wixpdb). | ||
29 | /// These are the whole point of the build process. | ||
30 | /// </summary> | ||
31 | Final, | ||
32 | } | ||
33 | } | ||
diff --git a/src/api/wix/WixToolset.Extensibility/DecompilerConstants.cs b/src/api/wix/WixToolset.Extensibility/DecompilerConstants.cs new file mode 100644 index 00000000..22e8530d --- /dev/null +++ b/src/api/wix/WixToolset.Extensibility/DecompilerConstants.cs | |||
@@ -0,0 +1,20 @@ | |||
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 | /// <summary> | ||
6 | /// Constants used by decompiler. | ||
7 | /// </summary> | ||
8 | public static class DecompilerConstants | ||
9 | { | ||
10 | /// <summary> | ||
11 | /// | ||
12 | /// </summary> | ||
13 | public const char PrimaryKeyDelimiter = '/'; | ||
14 | |||
15 | /// <summary> | ||
16 | /// | ||
17 | /// </summary> | ||
18 | public const string PrimaryKeyDelimiterString = "/"; | ||
19 | } | ||
20 | } | ||
diff --git a/src/api/wix/WixToolset.Extensibility/DecompilerExtension.cs b/src/api/wix/WixToolset.Extensibility/DecompilerExtension.cs new file mode 100644 index 00000000..b492cf3a --- /dev/null +++ b/src/api/wix/WixToolset.Extensibility/DecompilerExtension.cs | |||
@@ -0,0 +1,61 @@ | |||
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 | |||
7 | #if BRING_BACK_LATER | ||
8 | /// <summary> | ||
9 | /// Base class for creating a decompiler extension. | ||
10 | /// </summary> | ||
11 | public abstract class DecompilerExtension : IDecompilerExtension | ||
12 | { | ||
13 | /// <summary> | ||
14 | /// Gets or sets the decompiler core for the extension. | ||
15 | /// </summary> | ||
16 | /// <value>The decompiler core for the extension.</value> | ||
17 | public IDecompilerCore Core { get; set; } | ||
18 | |||
19 | /// <summary> | ||
20 | /// Gets the table definitions this extension decompiles. | ||
21 | /// </summary> | ||
22 | /// <value>Table definitions this extension decompiles.</value> | ||
23 | public virtual TableDefinitionCollection TableDefinitions { get; protected set; } | ||
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 | public virtual Library GetLibraryToRemove(TableDefinitionCollection tableDefinitions) | ||
31 | { | ||
32 | return null; | ||
33 | } | ||
34 | |||
35 | /// <summary> | ||
36 | /// Called at the beginning of the decompilation of a database. | ||
37 | /// </summary> | ||
38 | /// <param name="tables">The collection of all tables.</param> | ||
39 | public virtual void Initialize(TableIndexedCollection tables) | ||
40 | { | ||
41 | } | ||
42 | |||
43 | /// <summary> | ||
44 | /// Decompiles an extension table. | ||
45 | /// </summary> | ||
46 | /// <param name="table">The table to decompile.</param> | ||
47 | public virtual void DecompileTable(Table table) | ||
48 | { | ||
49 | this.Core.UnexpectedTable(table); | ||
50 | } | ||
51 | |||
52 | /// <summary> | ||
53 | /// Finalize decompilation. | ||
54 | /// </summary> | ||
55 | /// <param name="tables">The collection of all tables.</param> | ||
56 | public virtual void Finish(TableIndexedCollection tables) | ||
57 | { | ||
58 | } | ||
59 | } | ||
60 | #endif | ||
61 | } | ||
diff --git a/src/api/wix/WixToolset.Extensibility/ExtensionHelper.cs b/src/api/wix/WixToolset.Extensibility/ExtensionHelper.cs new file mode 100644 index 00000000..6b938a65 --- /dev/null +++ b/src/api/wix/WixToolset.Extensibility/ExtensionHelper.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 | ||
4 | { | ||
5 | using System; | ||
6 | using System.Collections.Specialized; | ||
7 | using System.IO; | ||
8 | using System.Reflection; | ||
9 | using System.Xml; | ||
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> | ||
17 | public static class ExtensionHelper | ||
18 | { | ||
19 | /// <summary> | ||
20 | /// Help for loading a library from an embedded resource. | ||
21 | /// </summary> | ||
22 | /// <param name="assembly">The assembly containing the embedded resource.</param> | ||
23 | /// <param name="resourceName">The name of the embedded resource being requested.</param> | ||
24 | /// <param name="tableDefinitions">The table definitions to use while loading the library.</param> | ||
25 | /// <returns>The loaded library.</returns> | ||
26 | public static Library LoadLibraryHelper(Assembly assembly, string resourceName, TableDefinitionCollection tableDefinitions) | ||
27 | { | ||
28 | using (Stream resourceStream = assembly.GetManifestResourceStream(resourceName)) | ||
29 | { | ||
30 | UriBuilder uriBuilder = new UriBuilder(); | ||
31 | uriBuilder.Scheme = "embeddedresource"; | ||
32 | uriBuilder.Path = assembly.Location; | ||
33 | uriBuilder.Fragment = resourceName; | ||
34 | |||
35 | return Library.Load(resourceStream, uriBuilder.Uri, tableDefinitions, false); | ||
36 | } | ||
37 | } | ||
38 | |||
39 | /// <summary> | ||
40 | /// Helper for loading table definitions from an embedded resource. | ||
41 | /// </summary> | ||
42 | /// <param name="assembly">The assembly containing the embedded resource.</param> | ||
43 | /// <param name="resourceName">The name of the embedded resource being requested.</param> | ||
44 | /// <returns>The loaded table definitions.</returns> | ||
45 | public static TableDefinitionCollection LoadTableDefinitionHelper(Assembly assembly, string resourceName) | ||
46 | { | ||
47 | using (Stream resourceStream = assembly.GetManifestResourceStream(resourceName)) | ||
48 | using (XmlReader reader = XmlReader.Create(resourceStream)) | ||
49 | { | ||
50 | return TableDefinitionCollection.Load(reader); | ||
51 | } | ||
52 | } | ||
53 | } | ||
54 | #endif | ||
55 | } | ||
diff --git a/src/api/wix/WixToolset.Extensibility/IBackend.cs b/src/api/wix/WixToolset.Extensibility/IBackend.cs new file mode 100644 index 00000000..9579c3ca --- /dev/null +++ b/src/api/wix/WixToolset.Extensibility/IBackend.cs | |||
@@ -0,0 +1,19 @@ | |||
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.Data; | ||
7 | |||
8 | #pragma warning disable 1591 // TODO: add documentation | ||
9 | public interface IBackend | ||
10 | { | ||
11 | IBindResult Bind(IBindContext context); | ||
12 | |||
13 | IDecompileResult Decompile(IDecompileContext context); | ||
14 | |||
15 | Intermediate Unbind(IUnbindContext context); | ||
16 | |||
17 | bool Inscribe(IInscribeContext context); | ||
18 | } | ||
19 | } | ||
diff --git a/src/api/wix/WixToolset.Extensibility/IBackendFactory.cs b/src/api/wix/WixToolset.Extensibility/IBackendFactory.cs new file mode 100644 index 00000000..99a6704f --- /dev/null +++ b/src/api/wix/WixToolset.Extensibility/IBackendFactory.cs | |||
@@ -0,0 +1,10 @@ | |||
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 | #pragma warning disable 1591 // TODO: add documentation | ||
6 | public interface IBackendFactory | ||
7 | { | ||
8 | bool TryCreateBackend(string outputType, string outputPath, out IBackend backend); | ||
9 | } | ||
10 | } | ||
diff --git a/src/api/wix/WixToolset.Extensibility/IBinderExtension.cs b/src/api/wix/WixToolset.Extensibility/IBinderExtension.cs new file mode 100644 index 00000000..dba09845 --- /dev/null +++ b/src/api/wix/WixToolset.Extensibility/IBinderExtension.cs | |||
@@ -0,0 +1,22 @@ | |||
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.Extensibility.Data; | ||
6 | |||
7 | /// <summary> | ||
8 | /// Interface all binder extensions implement. | ||
9 | /// </summary> | ||
10 | public interface IBinderExtension | ||
11 | { | ||
12 | /// <summary> | ||
13 | /// Called before binding occurs. | ||
14 | /// </summary> | ||
15 | void PreBind(IBindContext context); | ||
16 | |||
17 | /// <summary> | ||
18 | /// Called after all binding occurs. | ||
19 | /// </summary> | ||
20 | void PostBind(IBindResult result); | ||
21 | } | ||
22 | } | ||
diff --git a/src/api/wix/WixToolset.Extensibility/IBurnBackendBinderExtension.cs b/src/api/wix/WixToolset.Extensibility/IBurnBackendBinderExtension.cs new file mode 100644 index 00000000..1dd4d9b1 --- /dev/null +++ b/src/api/wix/WixToolset.Extensibility/IBurnBackendBinderExtension.cs | |||
@@ -0,0 +1,64 @@ | |||
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.Data; | ||
7 | |||
8 | /// <summary> | ||
9 | /// Interface all Burn backend extensions implement. | ||
10 | /// </summary> | ||
11 | public interface IBurnBackendBinderExtension | ||
12 | { | ||
13 | /// <summary> | ||
14 | /// Called before binding occurs. | ||
15 | /// </summary> | ||
16 | void PreBackendBind(IBindContext context); | ||
17 | |||
18 | /// <summary> | ||
19 | /// Called to find a file related to another source in the authoring. For example, most often used | ||
20 | /// to find cabinets and uncompressed files for an MSI package. | ||
21 | /// </summary> | ||
22 | /// <param name="source">Path to the source package.</param> | ||
23 | /// <param name="relatedSource">Expected path to the related file.</param> | ||
24 | /// <param name="type">Type of related file, such as "File" or "Cabinet"</param> | ||
25 | /// <param name="sourceLineNumbers">Source line number of source package.</param> | ||
26 | /// <returns><c>IResolveFileResult</c> if the related file was found, or null for default handling.</returns> | ||
27 | IResolveFileResult ResolveRelatedFile(string source, string relatedSource, string type, SourceLineNumber sourceLineNumbers); | ||
28 | |||
29 | /// <summary> | ||
30 | /// Called right before the output is bound into its final format. | ||
31 | /// </summary> | ||
32 | /// <param name="section">The finalized intermediate section.</param> | ||
33 | void SymbolsFinalized(IntermediateSection section); | ||
34 | |||
35 | /// <summary> | ||
36 | /// Called to customize the DownloadUrl provided in source cde. | ||
37 | /// </summary> | ||
38 | /// <param name="url">The value from the source code. May not actually be a URL.</param> | ||
39 | /// <param name="fallbackUrl">The default URL if the extension does not return a value.</param> | ||
40 | /// <param name="packageId">Identifier of the package.</param> | ||
41 | /// <param name="payloadId">Identifier of the payload.</param> | ||
42 | /// <param name="fileName">Filename of the payload.</param> | ||
43 | /// <returns>Url to override, or null to use default value.</returns> | ||
44 | string ResolveUrl(string url, string fallbackUrl, string packageId, string payloadId, string fileName); | ||
45 | |||
46 | /// <summary> | ||
47 | /// Called for each extension symbol that hasn't been handled yet. | ||
48 | /// Use IBurnBackendHelper to add data. | ||
49 | /// </summary> | ||
50 | /// <param name="section">The linked section.</param> | ||
51 | /// <param name="symbol">The current symbol.</param> | ||
52 | /// <returns> | ||
53 | /// True if the extension handled the symbol, false otherwise. | ||
54 | /// The Burn backend will warn on all unhandled symbols. | ||
55 | /// </returns> | ||
56 | bool TryProcessSymbol(IntermediateSection section, IntermediateSymbol symbol); | ||
57 | |||
58 | /// <summary> | ||
59 | /// Called after output is bound into its final format. | ||
60 | /// </summary> | ||
61 | /// <param name="result"></param> | ||
62 | void PostBackendBind(IBindResult result); | ||
63 | } | ||
64 | } | ||
diff --git a/src/api/wix/WixToolset.Extensibility/ICompilerExtension.cs b/src/api/wix/WixToolset.Extensibility/ICompilerExtension.cs new file mode 100644 index 00000000..55ef683a --- /dev/null +++ b/src/api/wix/WixToolset.Extensibility/ICompilerExtension.cs | |||
@@ -0,0 +1,61 @@ | |||
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.Collections.Generic; | ||
6 | using System.Xml.Linq; | ||
7 | using WixToolset.Data; | ||
8 | using WixToolset.Extensibility.Data; | ||
9 | |||
10 | /// <summary> | ||
11 | /// Interface all compiler extensions implement. | ||
12 | /// </summary> | ||
13 | public interface ICompilerExtension | ||
14 | { | ||
15 | /// <summary> | ||
16 | /// Gets the schema namespace for this extension. | ||
17 | /// </summary> | ||
18 | /// <value>Schema namespace supported by this extension.</value> | ||
19 | XNamespace Namespace { get; } | ||
20 | |||
21 | /// <summary> | ||
22 | /// Called at the beginning of the compilation of a source file. | ||
23 | /// </summary> | ||
24 | void PreCompile(ICompileContext context); | ||
25 | |||
26 | /// <summary> | ||
27 | /// Processes an attribute for the Compiler. | ||
28 | /// </summary> | ||
29 | /// <param name="intermediate">Parent intermediate.</param> | ||
30 | /// <param name="section">Parent section.</param> | ||
31 | /// <param name="parentElement">Parent element of attribute.</param> | ||
32 | /// <param name="attribute">Attribute to process.</param> | ||
33 | /// <param name="context">Extra information about the context in which this element is being parsed.</param> | ||
34 | void ParseAttribute(Intermediate intermediate, IntermediateSection section, XElement parentElement, XAttribute attribute, IDictionary<string, string> context); | ||
35 | |||
36 | /// <summary> | ||
37 | /// Processes an element for the Compiler. | ||
38 | /// </summary> | ||
39 | /// <param name="intermediate">Parent intermediate.</param> | ||
40 | /// <param name="section">Parent section.</param> | ||
41 | /// <param name="parentElement">Parent element of element to process.</param> | ||
42 | /// <param name="element">Element to process.</param> | ||
43 | /// <param name="context">Extra information about the context in which this element is being parsed.</param> | ||
44 | void ParseElement(Intermediate intermediate, IntermediateSection section, XElement parentElement, XElement element, IDictionary<string, string> context); | ||
45 | |||
46 | /// <summary> | ||
47 | /// Processes an element for the Compiler, with the ability to supply a component keypath. | ||
48 | /// </summary> | ||
49 | /// <param name="intermediate">Parent intermediate.</param> | ||
50 | /// <param name="section">Parent section.</param> | ||
51 | /// <param name="parentElement">Parent element of element to process.</param> | ||
52 | /// <param name="element">Element to process.</param> | ||
53 | /// <param name="context">Extra information about the context in which this element is being parsed.</param> | ||
54 | IComponentKeyPath ParsePossibleKeyPathElement(Intermediate intermediate, IntermediateSection section, XElement parentElement, XElement element, IDictionary<string, string> context); | ||
55 | |||
56 | /// <summary> | ||
57 | /// Called at the end of the compilation of a source file. | ||
58 | /// </summary> | ||
59 | void PostCompile(Intermediate intermediate); | ||
60 | } | ||
61 | } | ||
diff --git a/src/api/wix/WixToolset.Extensibility/IDecompilerExtension.cs b/src/api/wix/WixToolset.Extensibility/IDecompilerExtension.cs new file mode 100644 index 00000000..24ef3bff --- /dev/null +++ b/src/api/wix/WixToolset.Extensibility/IDecompilerExtension.cs | |||
@@ -0,0 +1,22 @@ | |||
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.Extensibility.Data; | ||
6 | |||
7 | /// <summary> | ||
8 | /// Base class for creating a decompiler extension. | ||
9 | /// </summary> | ||
10 | public interface IDecompilerExtension | ||
11 | { | ||
12 | /// <summary> | ||
13 | /// Called before decompiling occurs. | ||
14 | /// </summary> | ||
15 | void PreDecompile(IDecompileContext context); | ||
16 | |||
17 | /// <summary> | ||
18 | /// Called after all decompiling occurs. | ||
19 | /// </summary> | ||
20 | void PostDecompile(IDecompileResult result); | ||
21 | } | ||
22 | } | ||
diff --git a/src/api/wix/WixToolset.Extensibility/IExtensionCommandLine.cs b/src/api/wix/WixToolset.Extensibility/IExtensionCommandLine.cs new file mode 100644 index 00000000..f7b19955 --- /dev/null +++ b/src/api/wix/WixToolset.Extensibility/IExtensionCommandLine.cs | |||
@@ -0,0 +1,48 @@ | |||
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.Collections.Generic; | ||
6 | using WixToolset.Extensibility.Data; | ||
7 | using WixToolset.Extensibility.Services; | ||
8 | |||
9 | /// <summary> | ||
10 | /// Interface extensions implement to be able to parse the command-line. | ||
11 | /// </summary> | ||
12 | public interface IExtensionCommandLine | ||
13 | { | ||
14 | /// <summary> | ||
15 | /// Gets the supported command line types for this extension. | ||
16 | /// </summary> | ||
17 | /// <value>The supported command line types for this extension.</value> | ||
18 | IReadOnlyCollection<ExtensionCommandLineSwitch> CommandLineSwitches { get; } | ||
19 | |||
20 | /// <summary> | ||
21 | /// Called before the command-line is parsed. | ||
22 | /// </summary> | ||
23 | /// <param name="context">Information about the command-line to be parsed.</param> | ||
24 | void PreParse(ICommandLineContext context); | ||
25 | |||
26 | /// <summary> | ||
27 | /// Gives the extension an opportunity pass a command-line argument for another command. | ||
28 | /// </summary> | ||
29 | /// <param name="parser">Parser to help parse the argument and additional arguments.</param> | ||
30 | /// <param name="argument">Argument to parse.</param> | ||
31 | /// <returns>True if the argument is recognized; otherwise false to allow another extension to process it.</returns> | ||
32 | bool TryParseArgument(ICommandLineParser parser, string argument); | ||
33 | |||
34 | /// <summary> | ||
35 | /// Gives the extension an opportunity to provide a command. | ||
36 | /// </summary> | ||
37 | /// <param name="parser">Parser to help parse the argument and additional arguments.</param> | ||
38 | /// <param name="argument">Argument to parse.</param> | ||
39 | /// <param name="command"></param> | ||
40 | /// <returns>True if the argument is recognized as a command; otherwise false to allow another extension to process it.</returns> | ||
41 | bool TryParseCommand(ICommandLineParser parser, string argument, out ICommandLineCommand command); | ||
42 | |||
43 | /// <summary> | ||
44 | /// Called after the command-line is parsed. | ||
45 | /// </summary> | ||
46 | void PostParse(); | ||
47 | } | ||
48 | } | ||
diff --git a/src/api/wix/WixToolset.Extensibility/IExtensionData.cs b/src/api/wix/WixToolset.Extensibility/IExtensionData.cs new file mode 100644 index 00000000..823e2beb --- /dev/null +++ b/src/api/wix/WixToolset.Extensibility/IExtensionData.cs | |||
@@ -0,0 +1,33 @@ | |||
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 | |||
7 | /// <summary> | ||
8 | /// Interface extensions implement to provide data. | ||
9 | /// </summary> | ||
10 | public interface IExtensionData | ||
11 | { | ||
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="symbolDefinition"></param> | ||
23 | /// <returns>True </returns> | ||
24 | bool TryGetSymbolDefinitionByName(string name, out IntermediateSymbolDefinition symbolDefinition); | ||
25 | |||
26 | /// <summary> | ||
27 | /// Gets the library associated with this extension. | ||
28 | /// </summary> | ||
29 | /// <param name="symbolDefinitions">The symbol definitions to use while loading the library.</param> | ||
30 | /// <returns>The library for this extension or null if there is no library.</returns> | ||
31 | Intermediate GetLibrary(ISymbolDefinitionCreator symbolDefinitions); | ||
32 | } | ||
33 | } | ||
diff --git a/src/api/wix/WixToolset.Extensibility/IExtensionFactory.cs b/src/api/wix/WixToolset.Extensibility/IExtensionFactory.cs new file mode 100644 index 00000000..f86fdde0 --- /dev/null +++ b/src/api/wix/WixToolset.Extensibility/IExtensionFactory.cs | |||
@@ -0,0 +1,20 @@ | |||
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 | |||
7 | /// <summary> | ||
8 | /// Implementations may request an IWixToolsetCoreServiceProvider at instantiation by having a single parameter constructor for it. | ||
9 | /// </summary> | ||
10 | public interface IExtensionFactory | ||
11 | { | ||
12 | /// <summary> | ||
13 | /// Request to create an extension of the specified type. | ||
14 | /// </summary> | ||
15 | /// <param name="extensionType">Extension type to create.</param> | ||
16 | /// <param name="extension">Extension created.</param> | ||
17 | /// <returns>True if extension was created; otherwise false.</returns> | ||
18 | bool TryCreateExtension(Type extensionType, out object extension); | ||
19 | } | ||
20 | } | ||
diff --git a/src/api/wix/WixToolset.Extensibility/IFileSystemExtension.cs b/src/api/wix/WixToolset.Extensibility/IFileSystemExtension.cs new file mode 100644 index 00000000..9807e8b9 --- /dev/null +++ b/src/api/wix/WixToolset.Extensibility/IFileSystemExtension.cs | |||
@@ -0,0 +1,17 @@ | |||
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.Extensibility.Data; | ||
6 | |||
7 | /// <summary> | ||
8 | /// Interface all file system extensions implement. | ||
9 | /// </summary> | ||
10 | public interface IFileSystemExtension | ||
11 | { | ||
12 | #pragma warning disable 1591 // TODO: add documentation | ||
13 | void Initialize(IFileSystemContext context); | ||
14 | |||
15 | bool? CompareFiles(string targetFile, string updatedFile); | ||
16 | } | ||
17 | } | ||
diff --git a/src/api/wix/WixToolset.Extensibility/IInspectorCore.cs b/src/api/wix/WixToolset.Extensibility/IInspectorCore.cs new file mode 100644 index 00000000..9420ea05 --- /dev/null +++ b/src/api/wix/WixToolset.Extensibility/IInspectorCore.cs | |||
@@ -0,0 +1,15 @@ | |||
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 | /// <summary> | ||
6 | /// Core facilities for inspector extensions. | ||
7 | /// </summary> | ||
8 | public interface IInspectorCore | ||
9 | { | ||
10 | /// <summary> | ||
11 | /// Gets whether an error occured. | ||
12 | /// </summary> | ||
13 | bool EncounteredError { get; } | ||
14 | } | ||
15 | } | ||
diff --git a/src/api/wix/WixToolset.Extensibility/IInspectorExtension.cs b/src/api/wix/WixToolset.Extensibility/IInspectorExtension.cs new file mode 100644 index 00000000..7c488a89 --- /dev/null +++ b/src/api/wix/WixToolset.Extensibility/IInspectorExtension.cs | |||
@@ -0,0 +1,60 @@ | |||
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.IO; | ||
7 | using WixToolset.Data; | ||
8 | |||
9 | /// <summary> | ||
10 | /// Interface for inspector extensions. | ||
11 | /// </summary> | ||
12 | /// <remarks> | ||
13 | /// The inspector methods are stateless, but extensions are loaded once. If you want to maintain state, you should check | ||
14 | /// if your data is loaded for each method and, if not, load it. | ||
15 | /// </remarks> | ||
16 | public interface IInspectorExtension | ||
17 | { | ||
18 | /// <summary> | ||
19 | /// Gets or sets the <see cref="IInspectorCore"/> for inspector extensions to use. | ||
20 | /// </summary> | ||
21 | IInspectorCore Core { get; set; } | ||
22 | |||
23 | /// <summary> | ||
24 | /// Inspect the source before preprocessing. | ||
25 | /// </summary> | ||
26 | /// <param name="source">The source to preprocess.</param> | ||
27 | void InspectSource(Stream source); | ||
28 | |||
29 | /// <summary> | ||
30 | /// Inspect the compiled output. | ||
31 | /// </summary> | ||
32 | /// <param name="intermediate">The compiled output.</param> | ||
33 | void InspectIntermediate(Intermediate intermediate); | ||
34 | |||
35 | #if REWRITE | ||
36 | /// <summary> | ||
37 | /// Inspect the output. | ||
38 | /// </summary> | ||
39 | /// <param name="output">The output. May be called after linking or binding.</param> | ||
40 | /// <remarks> | ||
41 | /// To inspect a patch's filtered transforms, enumerate <see cref="Output.SubStorages"/>. | ||
42 | /// Transforms where the <see cref="SubStorage.Name"/> begins with "#" are | ||
43 | /// called patch transforms and instruct Windows Installer how to apply the | ||
44 | /// authored transforms - those that do not begin with "#". The authored | ||
45 | /// transforms are the primary transforms you'll typically want to inspect | ||
46 | /// and contain your changes to target products. | ||
47 | /// </remarks> | ||
48 | #endif | ||
49 | /// <summary /> | ||
50 | void InspectOutput(Intermediate output); | ||
51 | |||
52 | /// <summary> | ||
53 | /// Inspect the final output after binding. | ||
54 | /// </summary> | ||
55 | /// <param name="filePath">The file path to the final bound output.</param> | ||
56 | /// <param name="pdb">The <see cref="Intermediate"/> that contains source line numbers | ||
57 | /// for the database and all rows.</param> | ||
58 | void InspectDatabase(string filePath, Intermediate pdb); | ||
59 | } | ||
60 | } | ||
diff --git a/src/api/wix/WixToolset.Extensibility/ILayoutExtension.cs b/src/api/wix/WixToolset.Extensibility/ILayoutExtension.cs new file mode 100644 index 00000000..ecd7d8f1 --- /dev/null +++ b/src/api/wix/WixToolset.Extensibility/ILayoutExtension.cs | |||
@@ -0,0 +1,28 @@ | |||
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.Extensibility.Data; | ||
6 | |||
7 | /// <summary> | ||
8 | /// Interface all layout extensions implement. | ||
9 | /// </summary> | ||
10 | public interface ILayoutExtension | ||
11 | { | ||
12 | /// <summary> | ||
13 | /// Called before layout occurs. | ||
14 | /// </summary> | ||
15 | void PreLayout(ILayoutContext context); | ||
16 | |||
17 | #pragma warning disable 1591 // TODO: add documentation | ||
18 | bool CopyFile(string source, string destination); | ||
19 | |||
20 | bool MoveFile(string source, string destination); | ||
21 | #pragma warning restore 1591 | ||
22 | |||
23 | /// <summary> | ||
24 | /// Called after all layout occurs. | ||
25 | /// </summary> | ||
26 | void PostLayout(); | ||
27 | } | ||
28 | } | ||
diff --git a/src/api/wix/WixToolset.Extensibility/ILibrarianExtension.cs b/src/api/wix/WixToolset.Extensibility/ILibrarianExtension.cs new file mode 100644 index 00000000..d9b04cd2 --- /dev/null +++ b/src/api/wix/WixToolset.Extensibility/ILibrarianExtension.cs | |||
@@ -0,0 +1,17 @@ | |||
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.Data; | ||
7 | |||
8 | #pragma warning disable 1591 // TODO: add documentation | ||
9 | public interface ILibrarianExtension | ||
10 | { | ||
11 | void PreCombine(ILibraryContext context); | ||
12 | |||
13 | IResolveFileResult ResolveFile(SourceLineNumber sourceLineNumber, IntermediateSymbolDefinition symbolDefinition, string path); | ||
14 | |||
15 | void PostCombine(Intermediate library); | ||
16 | } | ||
17 | } | ||
diff --git a/src/api/wix/WixToolset.Extensibility/ILinkerExtension.cs b/src/api/wix/WixToolset.Extensibility/ILinkerExtension.cs new file mode 100644 index 00000000..febca1df --- /dev/null +++ b/src/api/wix/WixToolset.Extensibility/ILinkerExtension.cs | |||
@@ -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.Data; | ||
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 | } | ||
diff --git a/src/api/wix/WixToolset.Extensibility/IMessageListener.cs b/src/api/wix/WixToolset.Extensibility/IMessageListener.cs new file mode 100644 index 00000000..a04e9c98 --- /dev/null +++ b/src/api/wix/WixToolset.Extensibility/IMessageListener.cs | |||
@@ -0,0 +1,34 @@ | |||
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 | /// Message listener. | ||
10 | /// </summary> | ||
11 | public interface IMessageListener | ||
12 | { | ||
13 | /// <summary> | ||
14 | /// Calculate a new level for a message. | ||
15 | /// </summary> | ||
16 | /// <param name="messaging">Messaging object.</param> | ||
17 | /// <param name="message">Message to evaluate.</param> | ||
18 | /// <param name="defaultMessageLevel">Current message level.</param> | ||
19 | /// <returns></returns> | ||
20 | MessageLevel CalculateMessageLevel(IMessaging messaging, Message message, MessageLevel defaultMessageLevel); | ||
21 | |||
22 | /// <summary> | ||
23 | /// Writes a message. | ||
24 | /// </summary> | ||
25 | /// <param name="message">Message to write.</param> | ||
26 | void Write(Message message); | ||
27 | |||
28 | /// <summary> | ||
29 | /// Writes a string message. | ||
30 | /// </summary> | ||
31 | /// <param name="message">String message to write.</param> | ||
32 | void Write(string message); | ||
33 | } | ||
34 | } | ||
diff --git a/src/api/wix/WixToolset.Extensibility/IPreprocessorExtension.cs b/src/api/wix/WixToolset.Extensibility/IPreprocessorExtension.cs new file mode 100644 index 00000000..919ff1ae --- /dev/null +++ b/src/api/wix/WixToolset.Extensibility/IPreprocessorExtension.cs | |||
@@ -0,0 +1,57 @@ | |||
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.Xml.Linq; | ||
6 | using WixToolset.Extensibility.Data; | ||
7 | |||
8 | /// <summary> | ||
9 | /// Interface for extending the WiX toolset preprocessor. | ||
10 | /// </summary> | ||
11 | public interface IPreprocessorExtension | ||
12 | { | ||
13 | /// <summary> | ||
14 | /// Gets the variable prefixes for the extension. | ||
15 | /// </summary> | ||
16 | /// <value>The variable prefixes for the extension.</value> | ||
17 | string[] Prefixes { get; } | ||
18 | |||
19 | /// <summary> | ||
20 | /// Called at the beginning of the preprocessing of a source file. | ||
21 | /// </summary> | ||
22 | void PrePreprocess(IPreprocessContext context); | ||
23 | |||
24 | /// <summary> | ||
25 | /// Gets the value of a variable whose prefix matches the extension. | ||
26 | /// </summary> | ||
27 | /// <param name="prefix">The prefix of the variable to be processed by the extension.</param> | ||
28 | /// <param name="name">The name of the variable.</param> | ||
29 | /// <returns>The value of the variable or null if the variable is undefined.</returns> | ||
30 | string GetVariableValue(string prefix, string name); | ||
31 | |||
32 | /// <summary> | ||
33 | /// Evaluates a function defined in the extension. | ||
34 | /// </summary> | ||
35 | /// <param name="prefix">The prefix of the function to be processed by the extension.</param> | ||
36 | /// <param name="function">The name of the function.</param> | ||
37 | /// <param name="args">The list of arguments.</param> | ||
38 | /// <returns>The value of the function or null if the function is not defined.</returns> | ||
39 | string EvaluateFunction(string prefix, string function, string[] args); | ||
40 | |||
41 | /// <summary> | ||
42 | /// Processes a pragma defined in the extension. | ||
43 | /// </summary> | ||
44 | /// <param name="prefix">The prefix of the pragma to be processed by the extension.</param> | ||
45 | /// <param name="pragma">The name of the pragma.</param> | ||
46 | /// <param name="args">The pragma's arguments.</param> | ||
47 | /// <param name="parent">The parent node of the pragma.</param> | ||
48 | /// <returns>false if the pragma is not defined.</returns> | ||
49 | /// <comments>Don't return false for any condition except for unrecognized pragmas. Use Core.OnMessage for errors, warnings and messages.</comments> | ||
50 | bool ProcessPragma(string prefix, string pragma, string args, XContainer parent); | ||
51 | |||
52 | /// <summary> | ||
53 | /// Called at the end of the preprocessing of a source file. | ||
54 | /// </summary> | ||
55 | void PostPreprocess(IPreprocessResult result); | ||
56 | } | ||
57 | } | ||
diff --git a/src/api/wix/WixToolset.Extensibility/IResolverExtension.cs b/src/api/wix/WixToolset.Extensibility/IResolverExtension.cs new file mode 100644 index 00000000..f77581a0 --- /dev/null +++ b/src/api/wix/WixToolset.Extensibility/IResolverExtension.cs | |||
@@ -0,0 +1,28 @@ | |||
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.Data; | ||
7 | |||
8 | /// <summary> | ||
9 | /// Interface all resolver extensions implement. | ||
10 | /// </summary> | ||
11 | public interface IResolverExtension | ||
12 | { | ||
13 | /// <summary> | ||
14 | /// Called before resolving occurs. | ||
15 | /// </summary> | ||
16 | void PreResolve(IResolveContext context); | ||
17 | |||
18 | /// <summary> | ||
19 | /// Called to attempt to resolve source to a file. | ||
20 | /// </summary> | ||
21 | IResolveFileResult ResolveFile(string source, IntermediateSymbolDefinition symbolDefinition, SourceLineNumber sourceLineNumbers, BindStage bindStage); | ||
22 | |||
23 | /// <summary> | ||
24 | /// Called after all resolving occurs. | ||
25 | /// </summary> | ||
26 | void PostResolve(IResolveResult result); | ||
27 | } | ||
28 | } | ||
diff --git a/src/api/wix/WixToolset.Extensibility/IUnbinderExtension.cs b/src/api/wix/WixToolset.Extensibility/IUnbinderExtension.cs new file mode 100644 index 00000000..0e9a2504 --- /dev/null +++ b/src/api/wix/WixToolset.Extensibility/IUnbinderExtension.cs | |||
@@ -0,0 +1,18 @@ | |||
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 WixToolset.Data; | ||
7 | |||
8 | /// <summary> | ||
9 | /// Base class for creating an unbinder extension. | ||
10 | /// </summary> | ||
11 | public interface IUnbinderExtension | ||
12 | { | ||
13 | /// <summary> | ||
14 | /// Called during the generation of sectionIds for an admin image. | ||
15 | /// </summary> | ||
16 | void GenerateSectionIds(Intermediate output); | ||
17 | } | ||
18 | } | ||
diff --git a/src/api/wix/WixToolset.Extensibility/IWindowsInstallerBackendBinderExtension.cs b/src/api/wix/WixToolset.Extensibility/IWindowsInstallerBackendBinderExtension.cs new file mode 100644 index 00000000..067745c2 --- /dev/null +++ b/src/api/wix/WixToolset.Extensibility/IWindowsInstallerBackendBinderExtension.cs | |||
@@ -0,0 +1,65 @@ | |||
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.Collections.Generic; | ||
6 | using WixToolset.Data; | ||
7 | using WixToolset.Data.Symbols; | ||
8 | using WixToolset.Data.WindowsInstaller; | ||
9 | using WixToolset.Extensibility.Data; | ||
10 | |||
11 | /// <summary> | ||
12 | /// Interface all binder extensions implement. | ||
13 | /// </summary> | ||
14 | public interface IWindowsInstallerBackendBinderExtension | ||
15 | { | ||
16 | /// <summary> | ||
17 | /// Table definitions provided by the extension. | ||
18 | /// </summary> | ||
19 | IReadOnlyCollection<TableDefinition> TableDefinitions { get; } | ||
20 | |||
21 | /// <summary> | ||
22 | /// Called before binding occurs. | ||
23 | /// </summary> | ||
24 | void PreBackendBind(IBindContext context); | ||
25 | |||
26 | /// <summary> | ||
27 | /// Extension can process the intermediate before the Windows Installer data is created. | ||
28 | /// </summary> | ||
29 | /// <param name="section">The finalized intermediate section.</param> | ||
30 | void SymbolsFinalized(IntermediateSection section); | ||
31 | |||
32 | /// <summary> | ||
33 | /// Finds an existing cabinet that contains the provided files. | ||
34 | /// </summary> | ||
35 | /// <param name="cabinetPath">Path to the cabinet.</param> | ||
36 | /// <param name="files">Files contained in the cabinet.</param> | ||
37 | /// <returns>Resolved cabinet options or null if the cabinet could not be found.</returns> | ||
38 | IResolvedCabinet ResolveCabinet(string cabinetPath, IEnumerable<IBindFileWithPath> files); | ||
39 | |||
40 | /// <summary> | ||
41 | /// Override layout location for a media. | ||
42 | /// </summary> | ||
43 | /// <param name="mediaSymbol">Media symbol.</param> | ||
44 | /// <param name="mediaLayoutDirectory">Default media specific layout directory.</param> | ||
45 | /// <param name="layoutDirectory">Default overall layout directory.</param> | ||
46 | /// <returns>Layout location or null to use the default processing.</returns> | ||
47 | string ResolveMedia(MediaSymbol mediaSymbol, string mediaLayoutDirectory, string layoutDirectory); | ||
48 | |||
49 | /// <summary> | ||
50 | /// Called for each extension symbol that hasn't been handled yet. | ||
51 | /// </summary> | ||
52 | /// <param name="section">The linked section.</param> | ||
53 | /// <param name="symbol">The current symbol.</param> | ||
54 | /// <param name="data">Windows Installer data </param> | ||
55 | /// <param name="tableDefinitions">Collection of table definitions available for the output.</param> | ||
56 | /// <returns>True if the symbol was handled, or false if not.</returns> | ||
57 | bool TryProcessSymbol(IntermediateSection section, IntermediateSymbol symbol, WindowsInstallerData data, TableDefinitionCollection tableDefinitions); | ||
58 | |||
59 | /// <summary> | ||
60 | /// Called after all output changes occur and right before the output is bound into its final format. | ||
61 | /// </summary> | ||
62 | /// <param name="result">Bind result to process.</param> | ||
63 | void PostBackendBind(IBindResult result); | ||
64 | } | ||
65 | } | ||
diff --git a/src/api/wix/WixToolset.Extensibility/IWindowsInstallerBackendDecompilerExtension.cs b/src/api/wix/WixToolset.Extensibility/IWindowsInstallerBackendDecompilerExtension.cs new file mode 100644 index 00000000..a56b63c3 --- /dev/null +++ b/src/api/wix/WixToolset.Extensibility/IWindowsInstallerBackendDecompilerExtension.cs | |||
@@ -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 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 | // TODO: Redesign this interface to be useful. | ||
20 | |||
21 | /// <summary> | ||
22 | /// Called after all output changes occur and right before the output is bound into its final format. | ||
23 | /// </summary> | ||
24 | void PostBackendDecompile(IDecompileResult result); | ||
25 | } | ||
26 | } | ||
diff --git a/src/api/wix/WixToolset.Extensibility/InspectorExtension.cs b/src/api/wix/WixToolset.Extensibility/InspectorExtension.cs new file mode 100644 index 00000000..49c3f9de --- /dev/null +++ b/src/api/wix/WixToolset.Extensibility/InspectorExtension.cs | |||
@@ -0,0 +1,63 @@ | |||
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.IO; | ||
7 | using WixToolset.Data; | ||
8 | |||
9 | #if BRING_THIS_BACK | ||
10 | /// <summary> | ||
11 | /// Opitonal base class for inspector extensions. | ||
12 | /// </summary> | ||
13 | public class InspectorExtension : IInspectorExtension | ||
14 | { | ||
15 | /// <summary> | ||
16 | /// Gets the <see cref="InspectorCore"/> for inspector extensions to use. | ||
17 | /// </summary> | ||
18 | public IInspectorCore Core { get; set; } | ||
19 | |||
20 | /// <summary> | ||
21 | /// Inspect the source before preprocessing. | ||
22 | /// </summary> | ||
23 | /// <param name="source">The source to preprocess.</param> | ||
24 | public virtual void InspectSource(Stream source) | ||
25 | { | ||
26 | } | ||
27 | |||
28 | /// <summary> | ||
29 | /// Inspect the compiled output. | ||
30 | /// </summary> | ||
31 | /// <param name="intermediate">The compiled output.</param> | ||
32 | public virtual void InspectIntermediate(Intermediate intermediate) | ||
33 | { | ||
34 | } | ||
35 | |||
36 | /// <summary> | ||
37 | /// Inspect the output. | ||
38 | /// </summary> | ||
39 | /// <param name="output">The output. May be called after linking or binding.</param> | ||
40 | /// <remarks> | ||
41 | /// To inspect a patch's filtered transforms, enumerate <see cref="Output.SubStorages"/>. | ||
42 | /// Transforms where the <see cref="SubStorage.Name"/> begins with "#" are | ||
43 | /// called patch transforms and instruct Windows Installer how to apply the | ||
44 | /// authored transforms - those that do not begin with "#". The authored | ||
45 | /// transforms are the primary transforms you'll typically want to inspect | ||
46 | /// and contain your changes to target products. | ||
47 | /// </remarks> | ||
48 | public virtual void InspectOutput(Output output) | ||
49 | { | ||
50 | } | ||
51 | |||
52 | /// <summary> | ||
53 | /// Inspect the final output after binding. | ||
54 | /// </summary> | ||
55 | /// <param name="filePath">The file path to the final bound output.</param> | ||
56 | /// <param name="pdb">The <see cref="Pdb"/> that contains source line numbers | ||
57 | /// for the database and all rows.</param> | ||
58 | public virtual void InspectDatabase(string filePath, Pdb pdb) | ||
59 | { | ||
60 | } | ||
61 | } | ||
62 | #endif | ||
63 | } | ||
diff --git a/src/api/wix/WixToolset.Extensibility/Services/IBackendHelper.cs b/src/api/wix/WixToolset.Extensibility/Services/IBackendHelper.cs new file mode 100644 index 00000000..5c4d9a68 --- /dev/null +++ b/src/api/wix/WixToolset.Extensibility/Services/IBackendHelper.cs | |||
@@ -0,0 +1,183 @@ | |||
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 | using WixToolset.Data.Symbols; | ||
9 | using WixToolset.Data.WindowsInstaller.Rows; | ||
10 | using WixToolset.Extensibility.Data; | ||
11 | |||
12 | /// <summary> | ||
13 | /// Interface provided to help backend extensions. | ||
14 | /// </summary> | ||
15 | public interface IBackendHelper | ||
16 | { | ||
17 | /// <summary> | ||
18 | /// Creates a file facade from a <c>FileSymbol</c> and possible <c>AssemblySymbol</c>. | ||
19 | /// </summary> | ||
20 | /// <param name="file"><c>FileSymbol</c> backing the facade.</param> | ||
21 | /// <param name="assembly"><c>AssemblySymbol</c> backing the facade.</param> | ||
22 | /// <returns></returns> | ||
23 | IFileFacade CreateFileFacade(FileSymbol file, AssemblySymbol assembly); | ||
24 | |||
25 | /// <summary> | ||
26 | /// Creates a file facade from a File row. | ||
27 | /// </summary> | ||
28 | /// <param name="fileRow"><c>FileRow</c> </param> | ||
29 | /// <returns>New <c>IFileFacade</c>.</returns> | ||
30 | IFileFacade CreateFileFacade(FileRow fileRow); | ||
31 | |||
32 | /// <summary> | ||
33 | /// Creates a file facade from a Merge Module's File symbol. | ||
34 | /// </summary> | ||
35 | /// <param name="fileSymbol"><c>FileSymbol</c> created from a Merge Module.</param> | ||
36 | /// <returns>New <c>IFileFacade</c>.</returns> | ||
37 | IFileFacade CreateFileFacadeFromMergeModule(FileSymbol fileSymbol); | ||
38 | |||
39 | /// <summary> | ||
40 | /// Creates a file transfer and marks it redundant if the source and destination are identical. | ||
41 | /// </summary> | ||
42 | /// <param name="source">Source for the file transfer.</param> | ||
43 | /// <param name="destination">Destination for the file transfer.</param> | ||
44 | /// <param name="move">Indicates whether to move or copy the source file.</param> | ||
45 | /// <param name="sourceLineNumbers">Optional source line numbers that requested the file transfer.</param> | ||
46 | IFileTransfer CreateFileTransfer(string source, string destination, bool move, SourceLineNumber sourceLineNumbers = null); | ||
47 | |||
48 | /// <summary> | ||
49 | /// Creates a MSI compatible GUID. | ||
50 | /// </summary> | ||
51 | /// <returns>Creates an uppercase GUID with braces.</returns> | ||
52 | string CreateGuid(); | ||
53 | |||
54 | /// <summary> | ||
55 | /// Creates a version 3 name-based UUID. | ||
56 | /// </summary> | ||
57 | /// <param name="namespaceGuid">The namespace UUID.</param> | ||
58 | /// <param name="value">The value.</param> | ||
59 | /// <returns>The generated GUID for the given namespace and value.</returns> | ||
60 | string CreateGuid(Guid namespaceGuid, string value); | ||
61 | |||
62 | /// <summary> | ||
63 | /// Creates a resolved directory. | ||
64 | /// </summary> | ||
65 | /// <param name="directoryParent">Directory parent identifier.</param> | ||
66 | /// <param name="name">Name of directory.</param> | ||
67 | /// <returns>Resolved directory.</returns> | ||
68 | IResolvedDirectory CreateResolvedDirectory(string directoryParent, string name); | ||
69 | |||
70 | /// <summary> | ||
71 | /// Extracts embedded files. | ||
72 | /// </summary> | ||
73 | /// <param name="embeddedFiles">Embedded files to extract.</param> | ||
74 | /// <returns><c>ITrackedFile</c> for each embedded file extracted.</returns> | ||
75 | IReadOnlyList<ITrackedFile> ExtractEmbeddedFiles(IEnumerable<IExpectedExtractFile> embeddedFiles); | ||
76 | |||
77 | /// <summary> | ||
78 | /// Generate an identifier by hashing data from the row. | ||
79 | /// </summary> | ||
80 | /// <param name="prefix">Three letter or less prefix for generated row identifier.</param> | ||
81 | /// <param name="args">Information to hash.</param> | ||
82 | /// <returns>The generated identifier.</returns> | ||
83 | string GenerateIdentifier(string prefix, params string[] args); | ||
84 | |||
85 | /// <summary> | ||
86 | /// Validates path is relative and canonicalizes it. | ||
87 | /// For example, "a\..\c\.\d.exe" => "c\d.exe". | ||
88 | /// </summary> | ||
89 | /// <param name="sourceLineNumbers"></param> | ||
90 | /// <param name="elementName"></param> | ||
91 | /// <param name="attributeName"></param> | ||
92 | /// <param name="relativePath"></param> | ||
93 | /// <returns>The original value if not relative, otherwise the canonicalized relative path.</returns> | ||
94 | string GetCanonicalRelativePath(SourceLineNumber sourceLineNumbers, string elementName, string attributeName, string relativePath); | ||
95 | |||
96 | /// <summary> | ||
97 | /// Gets a valid code page from the given web name or integer value. | ||
98 | /// </summary> | ||
99 | /// <param name="value">A code page web name or integer value as a string.</param> | ||
100 | /// <param name="allowNoChange">Whether to allow -1 which does not change the database code pages. This may be the case with wxl files.</param> | ||
101 | /// <param name="onlyAnsi">Whether to allow Unicode (UCS) or UTF code pages.</param> | ||
102 | /// <param name="sourceLineNumbers">Source line information for the current authoring.</param> | ||
103 | /// <returns>A valid code page number.</returns> | ||
104 | /// <exception cref="ArgumentOutOfRangeException">The value is an integer less than 0 or greater than 65535.</exception> | ||
105 | /// <exception cref="ArgumentNullException"><paramref name="value"/> is null.</exception> | ||
106 | /// <exception cref="NotSupportedException">The value doesn't not represent a valid code page name or integer value.</exception> | ||
107 | /// <exception cref="WixException">The code page is invalid for summary information.</exception> | ||
108 | int GetValidCodePage(string value, bool allowNoChange = false, bool onlyAnsi = false, SourceLineNumber sourceLineNumbers = null); | ||
109 | |||
110 | /// <summary> | ||
111 | /// Get a source/target and short/long file name from an MSI Filename column. | ||
112 | /// </summary> | ||
113 | /// <param name="value">The Filename value.</param> | ||
114 | /// <param name="source">true to get a source name; false to get a target name</param> | ||
115 | /// <param name="longName">true to get a long name; false to get a short name</param> | ||
116 | /// <returns>The name.</returns> | ||
117 | string GetMsiFileName(string value, bool source, bool longName); | ||
118 | |||
119 | /// <summary> | ||
120 | /// Verifies if an identifier is a valid binder variable name. | ||
121 | /// </summary> | ||
122 | /// <param name="variable">Binder variable name to verify.</param> | ||
123 | /// <returns>True if the identifier is a valid binder variable name.</returns> | ||
124 | bool IsValidBinderVariable(string variable); | ||
125 | |||
126 | /// <summary> | ||
127 | /// Verifies the given string is a valid 4-part version module or bundle version. | ||
128 | /// </summary> | ||
129 | /// <param name="version">The version to verify.</param> | ||
130 | /// <returns>True if version is a valid module or bundle version.</returns> | ||
131 | bool IsValidFourPartVersion(string version); | ||
132 | |||
133 | /// <summary> | ||
134 | /// Determines if value is a valid identifier. | ||
135 | /// </summary> | ||
136 | /// <param name="id">Identifier to validate.</param> | ||
137 | /// <returns>True if valid identifier, otherwise false.</returns> | ||
138 | bool IsValidIdentifier(string id); | ||
139 | |||
140 | /// <summary> | ||
141 | /// Verifies the given string is a valid long filename. | ||
142 | /// </summary> | ||
143 | /// <param name="filename">The filename to verify.</param> | ||
144 | /// <param name="allowWildcards">Allow wildcards in the filename.</param> | ||
145 | /// <param name="allowRelative">Allow long file name to be a relative path.</param> | ||
146 | /// <returns>True if filename is a valid long filename.</returns> | ||
147 | bool IsValidLongFilename(string filename, bool allowWildcards, bool allowRelative); | ||
148 | |||
149 | /// <summary> | ||
150 | /// Verifies the given string is a valid short filename. | ||
151 | /// </summary> | ||
152 | /// <param name="filename">The filename to verify.</param> | ||
153 | /// <param name="allowWildcards">Allow wildcards in the filename.</param> | ||
154 | /// <returns>True if filename is a valid short filename.</returns> | ||
155 | bool IsValidShortFilename(string filename, bool allowWildcards); | ||
156 | |||
157 | /// <summary> | ||
158 | /// Resolve delayed fields. | ||
159 | /// </summary> | ||
160 | /// <param name="delayedFields">The fields which had resolution delayed.</param> | ||
161 | /// <param name="variableCache">The cached variable values used when resolving delayed fields.</param> | ||
162 | void ResolveDelayedFields(IEnumerable<IDelayedField> delayedFields, Dictionary<string, string> variableCache); | ||
163 | |||
164 | /// <summary> | ||
165 | /// Get the source/target and short/long file names from an MSI Filename column. | ||
166 | /// </summary> | ||
167 | /// <param name="value">The Filename value.</param> | ||
168 | /// <returns>An array of strings of length 4. The contents are: short target, long target, short source, and long source.</returns> | ||
169 | /// <remarks> | ||
170 | /// If any particular file name part is not parsed, its set to null in the appropriate location of the returned array of strings. | ||
171 | /// Thus the returned array will always be of length 4. | ||
172 | /// </remarks> | ||
173 | string[] SplitMsiFileName(string value); | ||
174 | |||
175 | /// <summary> | ||
176 | /// Creates a tracked file. | ||
177 | /// </summary> | ||
178 | /// <param name="path">Destination path for the build output.</param> | ||
179 | /// <param name="type">Type of tracked file to create.</param> | ||
180 | /// <param name="sourceLineNumbers">Optional source line numbers that requested the tracked file.</param> | ||
181 | ITrackedFile TrackFile(string path, TrackedFileType type, SourceLineNumber sourceLineNumbers = null); | ||
182 | } | ||
183 | } | ||
diff --git a/src/api/wix/WixToolset.Extensibility/Services/IBurnBackendHelper.cs b/src/api/wix/WixToolset.Extensibility/Services/IBurnBackendHelper.cs new file mode 100644 index 00000000..ef5fcc65 --- /dev/null +++ b/src/api/wix/WixToolset.Extensibility/Services/IBurnBackendHelper.cs | |||
@@ -0,0 +1,50 @@ | |||
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 WixToolset.Data; | ||
6 | |||
7 | /// <summary> | ||
8 | /// Interface provided to help Burn backend extensions. | ||
9 | /// </summary> | ||
10 | public interface IBurnBackendHelper : IBackendHelper | ||
11 | { | ||
12 | /// <summary> | ||
13 | /// Adds the given XML to the BootstrapperApplicationData manifest. | ||
14 | /// </summary> | ||
15 | /// <param name="xml">A valid XML fragment.</param> | ||
16 | void AddBootstrapperApplicationData(string xml); | ||
17 | |||
18 | /// <summary> | ||
19 | /// Adds an XML element for the given symbol to the BootstrapperApplicationData manifest. | ||
20 | /// The symbol's name is used for the element's name. | ||
21 | /// All of the symbol's fields are used for the element's attributes. | ||
22 | /// </summary> | ||
23 | /// <param name="symbol">The symbol to create the element from.</param> | ||
24 | /// <param name="symbolIdIsIdAttribute"> | ||
25 | /// If true and the symbol has an Id, | ||
26 | /// then an Id attribute is created with a value of the symbol's Id. | ||
27 | /// </param> | ||
28 | void AddBootstrapperApplicationData(IntermediateSymbol symbol, bool symbolIdIsIdAttribute = false); | ||
29 | |||
30 | /// <summary> | ||
31 | /// Adds the given XML to the BundleExtensionData manifest for the given bundle extension. | ||
32 | /// </summary> | ||
33 | /// <param name="extensionId">The bundle extension's id.</param> | ||
34 | /// <param name="xml">A valid XML fragment.</param> | ||
35 | void AddBundleExtensionData(string extensionId, string xml); | ||
36 | |||
37 | /// <summary> | ||
38 | /// Adds an XML element for the given symbol to the BundleExtensionData manifest for the given bundle extension. | ||
39 | /// The symbol's name is used for the element's name. | ||
40 | /// All of the symbol's fields are used for the element's attributes. | ||
41 | /// </summary> | ||
42 | /// <param name="extensionId">The bundle extension's id.</param> | ||
43 | /// <param name="symbol">The symbol to create the element from.</param> | ||
44 | /// <param name="symbolIdIsIdAttribute"> | ||
45 | /// If true and the symbol has an Id, | ||
46 | /// then an Id attribute is created with a value of the symbol's Id. | ||
47 | /// </param> | ||
48 | void AddBundleExtensionData(string extensionId, IntermediateSymbol symbol, bool symbolIdIsIdAttribute = false); | ||
49 | } | ||
50 | } | ||
diff --git a/src/api/wix/WixToolset.Extensibility/Services/ICommandLine.cs b/src/api/wix/WixToolset.Extensibility/Services/ICommandLine.cs new file mode 100644 index 00000000..2b841af0 --- /dev/null +++ b/src/api/wix/WixToolset.Extensibility/Services/ICommandLine.cs | |||
@@ -0,0 +1,33 @@ | |||
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 WixToolset.Extensibility.Data; | ||
6 | |||
7 | /// <summary> | ||
8 | /// Command-line parsing mechanism. | ||
9 | /// </summary> | ||
10 | public interface ICommandLine | ||
11 | { | ||
12 | /// <summary> | ||
13 | /// Simple way to parse arguments and create a command. | ||
14 | /// </summary> | ||
15 | /// <param name="args">Unparsed arguments.</param> | ||
16 | /// <returns>Command if the command-line arguments can be parsed, otherwise null.</returns> | ||
17 | ICommandLineCommand CreateCommand(string[] args); | ||
18 | |||
19 | /// <summary> | ||
20 | /// Simple way to parse arguments and create a command. | ||
21 | /// </summary> | ||
22 | /// <param name="commandLine">Unparsed arguments.</param> | ||
23 | /// <returns>Command if the command-line arguments can be parsed, otherwise null.</returns> | ||
24 | ICommandLineCommand CreateCommand(string commandLine); | ||
25 | |||
26 | /// <summary> | ||
27 | /// Creates a command from populated arguments. | ||
28 | /// </summary> | ||
29 | /// <param name="arguments">Parsed arguments.</param> | ||
30 | /// <returns>Command if the command-line arguments can be parsed, otherwise null.</returns> | ||
31 | ICommandLineCommand ParseStandardCommandLine(ICommandLineArguments arguments); | ||
32 | } | ||
33 | } | ||
diff --git a/src/api/wix/WixToolset.Extensibility/Services/ICommandLineParser.cs b/src/api/wix/WixToolset.Extensibility/Services/ICommandLineParser.cs new file mode 100644 index 00000000..cd17f100 --- /dev/null +++ b/src/api/wix/WixToolset.Extensibility/Services/ICommandLineParser.cs | |||
@@ -0,0 +1,40 @@ | |||
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.Collections.Generic; | ||
6 | using WixToolset.Data; | ||
7 | |||
8 | #pragma warning disable 1591 // TODO: add documentation | ||
9 | public interface ICommandLineParser | ||
10 | { | ||
11 | string ErrorArgument { get; } | ||
12 | |||
13 | /// <summary> | ||
14 | /// Validates that a valid switch (starts with "/" or "-"), and returns a bool indicating its validity | ||
15 | /// </summary> | ||
16 | /// <param name="arg">The string check.</param> | ||
17 | /// <returns>True if a valid switch, otherwise false.</returns> | ||
18 | bool IsSwitch(string arg); | ||
19 | |||
20 | string GetArgumentAsFilePathOrError(string argument, string fileType); | ||
21 | |||
22 | void GetArgumentAsFilePathOrError(string argument, string fileType, IList<string> paths); | ||
23 | |||
24 | string GetNextArgumentOrError(string commandLineSwitch); | ||
25 | |||
26 | bool GetNextArgumentOrError(string commandLineSwitch, IList<string> argument); | ||
27 | |||
28 | string GetNextArgumentAsDirectoryOrError(string commandLineSwitch); | ||
29 | |||
30 | bool GetNextArgumentAsDirectoryOrError(string commandLineSwitch, IList<string> directories); | ||
31 | |||
32 | string GetNextArgumentAsFilePathOrError(string commandLineSwitch); | ||
33 | |||
34 | bool GetNextArgumentAsFilePathOrError(string commandLineSwitch, string fileType, IList<string> paths); | ||
35 | |||
36 | void ReportErrorArgument(string argument, Message message = null); | ||
37 | |||
38 | bool TryGetNextSwitchOrArgument(out string arg); | ||
39 | } | ||
40 | } | ||
diff --git a/src/api/wix/WixToolset.Extensibility/Services/IExtensionManager.cs b/src/api/wix/WixToolset.Extensibility/Services/IExtensionManager.cs new file mode 100644 index 00000000..8e49c38d --- /dev/null +++ b/src/api/wix/WixToolset.Extensibility/Services/IExtensionManager.cs | |||
@@ -0,0 +1,42 @@ | |||
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.Collections.Generic; | ||
6 | using System.Reflection; | ||
7 | |||
8 | /// <summary> | ||
9 | /// Loads extensions and uses the extensions' factories to provide services. | ||
10 | /// </summary> | ||
11 | public interface IExtensionManager | ||
12 | { | ||
13 | /// <summary> | ||
14 | /// Adds an extension assembly directly to the manager. | ||
15 | /// </summary> | ||
16 | /// <param name="extensionAssembly">Extension assembly.</param> | ||
17 | void Add(Assembly extensionAssembly); | ||
18 | |||
19 | /// <summary> | ||
20 | /// Loads an extension assembly from an extension reference string. | ||
21 | /// </summary> | ||
22 | /// <param name="extensionReference">Reference to the extension.</param> | ||
23 | /// <returns>The loaded assembly. This assembly can be ignored since the extension manager maintains the list of loaded assemblies internally.</returns> | ||
24 | /// <remarks> | ||
25 | /// <paramref name="extensionReference"/> can be in several different forms: | ||
26 | /// <list type="number"> | ||
27 | /// <item><term>Full path to an extension file (C:\MyExtensions\MyExtension.Example.wixext.dll)</term></item> | ||
28 | /// <item><term>Reference to latest version of an extension in the cache (MyExtension.Example.wixext)</term></item> | ||
29 | /// <item><term>Versioned reference to specific extension in the cache (MyExtension.Example.wixext/1.0.2)</term></item> | ||
30 | /// <item><term>Relative path to an extension file (..\..\MyExtensions\MyExtension.Example.wixext.dll)</term></item> | ||
31 | /// </list> | ||
32 | /// </remarks> | ||
33 | void Load(string extensionReference); | ||
34 | |||
35 | /// <summary> | ||
36 | /// Gets extensions of specified type from factories loaded into the extension manager. | ||
37 | /// </summary> | ||
38 | /// <typeparam name="T">Type of extension to get.</typeparam> | ||
39 | /// <returns>Extensions of the specified type.</returns> | ||
40 | IReadOnlyCollection<T> GetServices<T>() where T : class; | ||
41 | } | ||
42 | } | ||
diff --git a/src/api/wix/WixToolset.Extensibility/Services/IMessaging.cs b/src/api/wix/WixToolset.Extensibility/Services/IMessaging.cs new file mode 100644 index 00000000..fe77f2a4 --- /dev/null +++ b/src/api/wix/WixToolset.Extensibility/Services/IMessaging.cs | |||
@@ -0,0 +1,73 @@ | |||
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 WixToolset.Data; | ||
6 | |||
7 | /// <summary> | ||
8 | /// Interface for handling messages (error/warning/verbose). | ||
9 | /// </summary> | ||
10 | public interface IMessaging | ||
11 | { | ||
12 | /// <summary> | ||
13 | /// Indicates whether an error has been found. | ||
14 | /// </summary> | ||
15 | /// <value>A bool indicating whether an error has been found.</value> | ||
16 | bool EncounteredError { get; } | ||
17 | |||
18 | /// <summary> | ||
19 | /// Gets the last error code encountered during messaging. | ||
20 | /// </summary> | ||
21 | /// <value>The exit code for the process.</value> | ||
22 | int LastErrorNumber { get; } | ||
23 | |||
24 | /// <summary> | ||
25 | /// Gets or sets the option to show verbose messages. | ||
26 | /// </summary> | ||
27 | /// <value>The option to show verbose messages.</value> | ||
28 | bool ShowVerboseMessages { get; set; } | ||
29 | |||
30 | /// <summary> | ||
31 | /// Gets or sets the option to suppress all warning messages. | ||
32 | /// </summary> | ||
33 | /// <value>The option to suppress all warning messages.</value> | ||
34 | bool SuppressAllWarnings { get; set; } | ||
35 | |||
36 | /// <summary> | ||
37 | /// Gets and sets the option to treat warnings as errors. | ||
38 | /// </summary> | ||
39 | /// <value>The option to treat warnings as errors.</value> | ||
40 | bool WarningsAsError { get; set; } | ||
41 | |||
42 | /// <summary> | ||
43 | /// Sets the listener for messaging. | ||
44 | /// </summary> | ||
45 | /// <param name="listener"></param> | ||
46 | void SetListener(IMessageListener listener); | ||
47 | |||
48 | /// <summary> | ||
49 | /// Adds a warning message id to be elevated to an error message. | ||
50 | /// </summary> | ||
51 | /// <param name="warningNumber">Id of the message to elevate.</param> | ||
52 | void ElevateWarningMessage(int warningNumber); | ||
53 | |||
54 | /// <summary> | ||
55 | /// Adds a warning message id to be suppressed in message output. | ||
56 | /// </summary> | ||
57 | /// <param name="warningNumber">Id of the message to suppress.</param> | ||
58 | void SuppressWarningMessage(int warningNumber); | ||
59 | |||
60 | /// <summary> | ||
61 | /// Sends a message with the given arguments. | ||
62 | /// </summary> | ||
63 | /// <param name="message">Message to write.</param> | ||
64 | void Write(Message message); | ||
65 | |||
66 | /// <summary> | ||
67 | /// Sends a message with the given arguments. | ||
68 | /// </summary> | ||
69 | /// <param name="message">Message to write.</param> | ||
70 | /// <param name="verbose">Indicates where to write a verbose message.</param> | ||
71 | void Write(string message, bool verbose = false); | ||
72 | } | ||
73 | } | ||
diff --git a/src/api/wix/WixToolset.Extensibility/Services/IParseHelper.cs b/src/api/wix/WixToolset.Extensibility/Services/IParseHelper.cs new file mode 100644 index 00000000..fbe5aae4 --- /dev/null +++ b/src/api/wix/WixToolset.Extensibility/Services/IParseHelper.cs | |||
@@ -0,0 +1,466 @@ | |||
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 System.Xml.Linq; | ||
8 | using WixToolset.Data; | ||
9 | using WixToolset.Data.Symbols; | ||
10 | using WixToolset.Data.WindowsInstaller; | ||
11 | using WixToolset.Extensibility.Data; | ||
12 | |||
13 | /// <summary> | ||
14 | /// Interface provided to help compiler extensions parse. | ||
15 | /// </summary> | ||
16 | public interface IParseHelper | ||
17 | { | ||
18 | /// <summary> | ||
19 | /// Creates a version 3 name-based UUID. | ||
20 | /// </summary> | ||
21 | /// <param name="namespaceGuid">The namespace UUID.</param> | ||
22 | /// <param name="value">The value.</param> | ||
23 | /// <returns>The generated GUID for the given namespace and value.</returns> | ||
24 | string CreateGuid(Guid namespaceGuid, string value); | ||
25 | |||
26 | /// <summary> | ||
27 | /// Create an identifier by hashing data from the row. | ||
28 | /// </summary> | ||
29 | /// <param name="prefix">Three letter or less prefix for generated row identifier.</param> | ||
30 | /// <param name="args">Information to hash.</param> | ||
31 | /// <returns>The new identifier.</returns> | ||
32 | Identifier CreateIdentifier(string prefix, params string[] args); | ||
33 | |||
34 | /// <summary> | ||
35 | /// Create an identifier based on passed file name | ||
36 | /// </summary> | ||
37 | /// <param name="filename">File name to generate identifier from</param> | ||
38 | /// <returns>The new identifier.</returns> | ||
39 | Identifier CreateIdentifierFromFilename(string filename); | ||
40 | |||
41 | /// <summary> | ||
42 | /// Append a suffix to the given name based on the current platform. | ||
43 | /// If the current platform is not in the supported platforms, then it returns null. | ||
44 | /// </summary> | ||
45 | /// <param name="name">The base name for the identifier.</param> | ||
46 | /// <param name="currentPlatform">The platform being compiled.</param> | ||
47 | /// <param name="supportedPlatforms">The platforms for which there are specialized implementations.</param> | ||
48 | /// <returns>The generated identifier value, or null if the current platform isn't supported.</returns> | ||
49 | string CreateIdentifierValueFromPlatform(string name, Platform currentPlatform, BurnPlatforms supportedPlatforms); | ||
50 | |||
51 | /// <summary> | ||
52 | /// Creates a symbol in the section. | ||
53 | /// </summary> | ||
54 | /// <param name="section">Section to add the new symbol to.</param> | ||
55 | /// <param name="sourceLineNumbers">Source and line number of current symbol.</param> | ||
56 | /// <param name="symbolName">Name of symbol definition.</param> | ||
57 | /// <param name="identifier">Optional identifier for the symbol.</param> | ||
58 | /// <returns>New symbol.</returns> | ||
59 | IntermediateSymbol CreateSymbol(IntermediateSection section, SourceLineNumber sourceLineNumbers, string symbolName, Identifier identifier = null); | ||
60 | |||
61 | /// <summary> | ||
62 | /// Creates a symbol in the section. | ||
63 | /// </summary> | ||
64 | /// <param name="section">Section to add the new symbol to.</param> | ||
65 | /// <param name="sourceLineNumbers">Source and line number of current symbol.</param> | ||
66 | /// <param name="symbolDefinition">Symbol definition to create from.</param> | ||
67 | /// <param name="identifier">Optional identifier for the symbol.</param> | ||
68 | /// <returns>New symbol.</returns> | ||
69 | IntermediateSymbol CreateSymbol(IntermediateSection section, SourceLineNumber sourceLineNumbers, IntermediateSymbolDefinition symbolDefinition, Identifier identifier = null); | ||
70 | |||
71 | /// <summary> | ||
72 | /// Creates a directory row from a name. | ||
73 | /// </summary> | ||
74 | /// <param name="section">Section to add the new symbol to.</param> | ||
75 | /// <param name="sourceLineNumbers">Source line information.</param> | ||
76 | /// <param name="id">Optional identifier for the new row.</param> | ||
77 | /// <param name="parentId">Optional identifier for the parent row.</param> | ||
78 | /// <param name="name">Long name of the directory.</param> | ||
79 | /// <param name="shortName">Optional short name of the directory.</param> | ||
80 | /// <param name="sourceName">Optional source name for the directory.</param> | ||
81 | /// <param name="shortSourceName">Optional short source name for the directory.</param> | ||
82 | /// <returns>Identifier for the newly created row.</returns> | ||
83 | Identifier CreateDirectorySymbol(IntermediateSection section, SourceLineNumber sourceLineNumbers, Identifier id, string parentId, string name, string shortName = null, string sourceName = null, string shortSourceName = null); | ||
84 | |||
85 | /// <summary> | ||
86 | /// Creates directories using the inline directory syntax. | ||
87 | /// </summary> | ||
88 | /// <param name="section">Section to add the new symbol to.</param> | ||
89 | /// <param name="sourceLineNumbers">Source line information.</param> | ||
90 | /// <param name="attribute">Attribute containing the inline syntax.</param> | ||
91 | /// <param name="parentId">Optional identifier of parent directory.</param> | ||
92 | /// <param name="inlineSyntax">Optional inline syntax to override attribute's value.</param> | ||
93 | /// <param name="sectionCachedInlinedDirectoryIds">Mapping of inline directory syntax to ids for the section.</param> | ||
94 | /// <returns>Identifier of the leaf directory created.</returns> | ||
95 | string CreateDirectoryReferenceFromInlineSyntax(IntermediateSection section, SourceLineNumber sourceLineNumbers, XAttribute attribute, string parentId, string inlineSyntax, IDictionary<string, string> sectionCachedInlinedDirectoryIds); | ||
96 | |||
97 | /// <summary> | ||
98 | /// Creates a Registry symbol in the active section. | ||
99 | /// </summary> | ||
100 | /// <param name="section">Active section.</param> | ||
101 | /// <param name="sourceLineNumbers">Source and line number of the current symbol.</param> | ||
102 | /// <param name="root">The registry entry root.</param> | ||
103 | /// <param name="key">The registry entry key.</param> | ||
104 | /// <param name="name">The registry entry name.</param> | ||
105 | /// <param name="value">The registry entry value.</param> | ||
106 | /// <param name="componentId">The component which will control installation/uninstallation of the registry entry.</param> | ||
107 | /// <param name="escapeLeadingHash">If true, "escape" leading '#' characters so the value is written as a REG_SZ.</param> | ||
108 | Identifier CreateRegistrySymbol(IntermediateSection section, SourceLineNumber sourceLineNumbers, RegistryRootType root, string key, string name, string value, string componentId, bool escapeLeadingHash); | ||
109 | |||
110 | /// <summary> | ||
111 | /// Create a WixSimpleReference symbol in the active section. | ||
112 | /// </summary> | ||
113 | /// <param name="section">Active section.</param> | ||
114 | /// <param name="sourceLineNumbers">Source line information for the row.</param> | ||
115 | /// <param name="symbolName">The symbol name of the simple reference.</param> | ||
116 | /// <param name="primaryKey">The primary key of the simple reference.</param> | ||
117 | void CreateSimpleReference(IntermediateSection section, SourceLineNumber sourceLineNumbers, string symbolName, string primaryKey); | ||
118 | |||
119 | /// <summary> | ||
120 | /// Create a WixSimpleReference symbol in the active section. | ||
121 | /// </summary> | ||
122 | /// <param name="section">Active section.</param> | ||
123 | /// <param name="sourceLineNumbers">Source line information for the row.</param> | ||
124 | /// <param name="symbolName">The symbol name of the simple reference.</param> | ||
125 | /// <param name="primaryKeys">The primary keys of the simple reference.</param> | ||
126 | void CreateSimpleReference(IntermediateSection section, SourceLineNumber sourceLineNumbers, string symbolName, params string[] primaryKeys); | ||
127 | |||
128 | /// <summary> | ||
129 | /// Create a WixSimpleReference symbol in the active section. | ||
130 | /// </summary> | ||
131 | /// <param name="section">Active section.</param> | ||
132 | /// <param name="sourceLineNumbers">Source line information for the row.</param> | ||
133 | /// <param name="symbolDefinition">The symbol definition of the simple reference.</param> | ||
134 | /// <param name="primaryKey">The primary key of the simple reference.</param> | ||
135 | void CreateSimpleReference(IntermediateSection section, SourceLineNumber sourceLineNumbers, IntermediateSymbolDefinition symbolDefinition, string primaryKey); | ||
136 | |||
137 | /// <summary> | ||
138 | /// Create a WixSimpleReference symbol in the active section. | ||
139 | /// </summary> | ||
140 | /// <param name="section">Active section.</param> | ||
141 | /// <param name="sourceLineNumbers">Source line information for the row.</param> | ||
142 | /// <param name="symbolDefinition">The symbol definition of the simple reference.</param> | ||
143 | /// <param name="primaryKeys">The primary keys of the simple reference.</param> | ||
144 | void CreateSimpleReference(IntermediateSection section, SourceLineNumber sourceLineNumbers, IntermediateSymbolDefinition symbolDefinition, params string[] primaryKeys); | ||
145 | |||
146 | /// <summary> | ||
147 | /// Create a reference in the specified section for a custom action specialized for specific platforms, | ||
148 | /// given standard prefixes for naming and suffixes for platforms. | ||
149 | /// </summary> | ||
150 | /// <param name="sourceLineNumbers">Source line information.</param> | ||
151 | /// <param name="section">Section to create the reference in.</param> | ||
152 | /// <param name="customAction">The custom action base name.</param> | ||
153 | /// <param name="platform">The platform being compiled.</param> | ||
154 | /// <param name="supportedPlatforms">The platforms for which there are specialized custom actions.</param> | ||
155 | void CreateCustomActionReference(SourceLineNumber sourceLineNumbers, IntermediateSection section, string customAction, Platform platform, CustomActionPlatforms supportedPlatforms); | ||
156 | |||
157 | /// <summary> | ||
158 | /// Creates WixComplexReference and WixGroup symbols in the active section. | ||
159 | /// </summary> | ||
160 | /// <param name="section">Section to create the reference in.</param> | ||
161 | /// <param name="sourceLineNumbers">Source line information.</param> | ||
162 | /// <param name="parentType">The parent type.</param> | ||
163 | /// <param name="parentId">The parent id.</param> | ||
164 | /// <param name="parentLanguage">The parent language.</param> | ||
165 | /// <param name="childType">The child type.</param> | ||
166 | /// <param name="childId">The child id.</param> | ||
167 | /// <param name="isPrimary">Whether the child is primary.</param> | ||
168 | void CreateComplexReference(IntermediateSection section, SourceLineNumber sourceLineNumbers, ComplexReferenceParentType parentType, string parentId, string parentLanguage, ComplexReferenceChildType childType, string childId, bool isPrimary); | ||
169 | |||
170 | /// <summary> | ||
171 | /// A symbol in the WixGroup table is added for this child node and its parent node. | ||
172 | /// </summary> | ||
173 | /// <param name="section">Section to create the reference in.</param> | ||
174 | /// <param name="sourceLineNumbers">Source line information for the row.</param> | ||
175 | /// <param name="parentType">Type of child's complex reference parent.</param> | ||
176 | /// <param name="parentId">Id of the parenet node.</param> | ||
177 | /// <param name="childType">Complex reference type of child</param> | ||
178 | /// <param name="childId">Id of the Child Node.</param> | ||
179 | void CreateWixGroupSymbol(IntermediateSection section, SourceLineNumber sourceLineNumbers, ComplexReferenceParentType parentType, string parentId, ComplexReferenceChildType childType, string childId); | ||
180 | |||
181 | /// <summary> | ||
182 | /// Creates a symbol in the WixSearch table. | ||
183 | /// </summary> | ||
184 | /// <param name="section">Section to create the reference in.</param> | ||
185 | /// <param name="sourceLineNumbers">Source line number for the search element.</param> | ||
186 | /// <param name="elementName">Name of search element.</param> | ||
187 | /// <param name="id">Identifier of the search.</param> | ||
188 | /// <param name="variable">The Burn variable to store the result into.</param> | ||
189 | /// <param name="condition">A condition to test before evaluating the search.</param> | ||
190 | /// <param name="after">The search that this one will execute after.</param> | ||
191 | /// <param name="bundleExtensionId">The id of the bundle extension that handles this search.</param> | ||
192 | void CreateWixSearchSymbol(IntermediateSection section, SourceLineNumber sourceLineNumbers, string elementName, Identifier id, string variable, string condition, string after, string bundleExtensionId); | ||
193 | |||
194 | /// <summary> | ||
195 | /// | ||
196 | /// </summary> | ||
197 | /// <param name="section">Section to create the reference in.</param> | ||
198 | /// <param name="sourceLineNumbers">Source line number for the parent element.</param> | ||
199 | /// <param name="id">Identifier of the search (key into the WixSearch table)</param> | ||
200 | /// <param name="parentId">Identifier of the search that comes before (key into the WixSearch table)</param> | ||
201 | /// <param name="attributes">Further details about the relation between id and parentId.</param> | ||
202 | void CreateWixSearchRelationSymbol(IntermediateSection section, SourceLineNumber sourceLineNumbers, Identifier id, string parentId, int attributes); | ||
203 | |||
204 | /// <summary> | ||
205 | /// Checks if the string contains a property (i.e. "foo[Property]bar") | ||
206 | /// </summary> | ||
207 | /// <param name="possibleProperty">String to evaluate for properties.</param> | ||
208 | /// <returns>True if a property is found in the string.</returns> | ||
209 | bool ContainsProperty(string possibleProperty); | ||
210 | |||
211 | /// <summary> | ||
212 | /// Add the appropriate symbols to make sure that the given table shows up in the resulting output. | ||
213 | /// </summary> | ||
214 | /// <param name="section">Active section.</param> | ||
215 | /// <param name="sourceLineNumbers">Source line numbers.</param> | ||
216 | /// <param name="tableName">Name of the table to ensure existance of.</param> | ||
217 | void EnsureTable(IntermediateSection section, SourceLineNumber sourceLineNumbers, string tableName); | ||
218 | |||
219 | /// <summary> | ||
220 | /// Add the appropriate symbols to make sure that the given table shows up in the resulting output. | ||
221 | /// </summary> | ||
222 | /// <param name="section">Active section.</param> | ||
223 | /// <param name="sourceLineNumbers">Source line numbers.</param> | ||
224 | /// <param name="tableDefinition">Definition of the table to ensure existance of.</param> | ||
225 | void EnsureTable(IntermediateSection section, SourceLineNumber sourceLineNumbers, TableDefinition tableDefinition); | ||
226 | |||
227 | /// <summary> | ||
228 | /// Get an attribute value and displays an error if the value is empty by default. | ||
229 | /// </summary> | ||
230 | /// <param name="sourceLineNumbers">Source line information about the owner element.</param> | ||
231 | /// <param name="attribute">The attribute containing the value to get.</param> | ||
232 | /// <param name="emptyRule">A rule for the contents of the value. If the contents do not follow the rule, an error is thrown.</param> | ||
233 | /// <returns>The attribute's value.</returns> | ||
234 | string GetAttributeValue(SourceLineNumber sourceLineNumbers, XAttribute attribute, EmptyRule emptyRule = EmptyRule.CanBeWhitespaceOnly); | ||
235 | |||
236 | /// <summary> | ||
237 | /// Get a guid attribute value and displays an error for an illegal guid value. | ||
238 | /// </summary> | ||
239 | /// <param name="sourceLineNumbers">Source line information about the owner element.</param> | ||
240 | /// <param name="attribute">The attribute containing the value to get.</param> | ||
241 | /// <param name="generatable">Determines whether the guid can be automatically generated.</param> | ||
242 | /// <param name="canBeEmpty">If true, no error is raised on empty value. If false, an error is raised.</param> | ||
243 | /// <returns>The attribute's guid value or a special value if an error occurred.</returns> | ||
244 | string GetAttributeGuidValue(SourceLineNumber sourceLineNumbers, XAttribute attribute, bool generatable = false, bool canBeEmpty = false); | ||
245 | |||
246 | /// <summary> | ||
247 | /// Get an identifier attribute value and displays an error for an illegal identifier value. | ||
248 | /// </summary> | ||
249 | /// <param name="sourceLineNumbers">Source line information about the owner element.</param> | ||
250 | /// <param name="attribute">The attribute containing the value to get.</param> | ||
251 | /// <returns>The attribute's identifier value or a special value if an error occurred.</returns> | ||
252 | Identifier GetAttributeIdentifier(SourceLineNumber sourceLineNumbers, XAttribute attribute); | ||
253 | |||
254 | /// <summary> | ||
255 | /// Get an identifier attribute value and displays an error for an illegal identifier value. | ||
256 | /// </summary> | ||
257 | /// <param name="sourceLineNumbers">Source line information about the owner element.</param> | ||
258 | /// <param name="attribute">The attribute containing the value to get.</param> | ||
259 | /// <returns>The attribute's identifier value or a special value if an error occurred.</returns> | ||
260 | string GetAttributeIdentifierValue(SourceLineNumber sourceLineNumbers, XAttribute attribute); | ||
261 | |||
262 | /// <summary> | ||
263 | /// Get an integer attribute value and displays an error for an illegal integer value. | ||
264 | /// </summary> | ||
265 | /// <param name="sourceLineNumbers">Source line information about the owner element.</param> | ||
266 | /// <param name="attribute">The attribute containing the value to get.</param> | ||
267 | /// <param name="minimum">The minimum legal value.</param> | ||
268 | /// <param name="maximum">The maximum legal value.</param> | ||
269 | /// <returns>The attribute's integer value or a special value if an error occurred during conversion.</returns> | ||
270 | int GetAttributeIntegerValue(SourceLineNumber sourceLineNumbers, XAttribute attribute, int minimum, int maximum); | ||
271 | |||
272 | /// <summary> | ||
273 | /// Get a long integral attribute value and displays an error for an illegal long value. | ||
274 | /// </summary> | ||
275 | /// <param name="sourceLineNumbers">Source line information about the owner element.</param> | ||
276 | /// <param name="attribute">The attribute containing the value to get.</param> | ||
277 | /// <param name="minimum">The minimum legal value.</param> | ||
278 | /// <param name="maximum">The maximum legal value.</param> | ||
279 | /// <returns>The attribute's long value or a special value if an error occurred during conversion.</returns> | ||
280 | long GetAttributeLongValue(SourceLineNumber sourceLineNumbers, XAttribute attribute, long minimum, long maximum); | ||
281 | |||
282 | /// <summary> | ||
283 | /// Gets a long filename value and displays an error for an illegal long filename value. | ||
284 | /// </summary> | ||
285 | /// <param name="sourceLineNumbers">Source line information about the owner element.</param> | ||
286 | /// <param name="attribute">The attribute containing the value to get.</param> | ||
287 | /// <param name="allowWildcards">true if wildcards are allowed in the filename.</param> | ||
288 | /// <param name="allowRelative">true if relative paths are allowed in the filename.</param> | ||
289 | /// <returns>The attribute's long filename value.</returns> | ||
290 | string GetAttributeLongFilename(SourceLineNumber sourceLineNumbers, XAttribute attribute, bool allowWildcards = false, bool allowRelative = false); | ||
291 | |||
292 | /// <summary> | ||
293 | /// Gets a RegistryRootType value and displays an error for an illegal value. | ||
294 | /// </summary> | ||
295 | /// <param name="sourceLineNumbers">Source line information about the owner element.</param> | ||
296 | /// <param name="attribute">The attribute containing the value to get.</param> | ||
297 | /// <param name="allowHkmu">Whether HKMU is returned as -1 (true), or treated as an error (false).</param> | ||
298 | /// <returns>The attribute's RegisitryRootType value.</returns> | ||
299 | RegistryRootType? GetAttributeRegistryRootValue(SourceLineNumber sourceLineNumbers, XAttribute attribute, bool allowHkmu); | ||
300 | |||
301 | /// <summary> | ||
302 | /// Gets a version value or possibly a binder variable and displays an error for an illegal version value. | ||
303 | /// </summary> | ||
304 | /// <param name="sourceLineNumbers">Source line information about the owner element.</param> | ||
305 | /// <param name="attribute">The attribute containing the value to get.</param> | ||
306 | /// <returns>The attribute's version value.</returns> | ||
307 | string GetAttributeVersionValue(SourceLineNumber sourceLineNumbers, XAttribute attribute); | ||
308 | |||
309 | /// <summary> | ||
310 | /// Gets a yes/no value and displays an error for an illegal yes/no value. | ||
311 | /// </summary> | ||
312 | /// <param name="sourceLineNumbers">Source line information about the owner element.</param> | ||
313 | /// <param name="attribute">The attribute containing the value to get.</param> | ||
314 | /// <returns>The attribute's YesNoType value.</returns> | ||
315 | YesNoType GetAttributeYesNoValue(SourceLineNumber sourceLineNumbers, XAttribute attribute); | ||
316 | |||
317 | /// <summary> | ||
318 | /// Gets a yes/no/default value and displays an error for an illegal yes/no/default value. | ||
319 | /// </summary> | ||
320 | /// <param name="sourceLineNumbers">Source line information about the owner element.</param> | ||
321 | /// <param name="attribute">The attribute containing the value to get.</param> | ||
322 | /// <returns>The attribute's YesNoType value.</returns> | ||
323 | YesNoDefaultType GetAttributeYesNoDefaultValue(SourceLineNumber sourceLineNumbers, XAttribute attribute); | ||
324 | |||
325 | /// <summary> | ||
326 | /// Validates path is relative and canonicalizes it. | ||
327 | /// For example, "a\..\c\.\d.exe" => "c\d.exe". | ||
328 | /// </summary> | ||
329 | /// <param name="sourceLineNumbers"></param> | ||
330 | /// <param name="elementName"></param> | ||
331 | /// <param name="attributeName"></param> | ||
332 | /// <param name="relativePath"></param> | ||
333 | /// <returns>The original value if not relative, otherwise the canonicalized relative path.</returns> | ||
334 | string GetCanonicalRelativePath(SourceLineNumber sourceLineNumbers, string elementName, string attributeName, string relativePath); | ||
335 | |||
336 | /// <summary> | ||
337 | /// Gets a source line number for an element. | ||
338 | /// </summary> | ||
339 | /// <param name="element">Element to get source line number.</param> | ||
340 | /// <returns>Source line number.</returns> | ||
341 | SourceLineNumber GetSourceLineNumbers(XElement element); | ||
342 | |||
343 | /// <summary> | ||
344 | /// Gets node's inner text and ensure's it is safe for use in a condition by trimming any extra whitespace. | ||
345 | /// </summary> | ||
346 | /// <param name="node">The node to ensure inner text is a condition.</param> | ||
347 | /// <returns>The value converted into a safe condition.</returns> | ||
348 | [Obsolete] | ||
349 | string GetConditionInnerText(XElement node); | ||
350 | |||
351 | /// <summary> | ||
352 | /// Get an element's inner text and trims any extra whitespace. | ||
353 | /// </summary> | ||
354 | /// <param name="element">The element with inner text to be trimmed.</param> | ||
355 | /// <returns>The node's inner text trimmed.</returns> | ||
356 | [Obsolete] | ||
357 | string GetTrimmedInnerText(XElement element); | ||
358 | |||
359 | /// <summary> | ||
360 | /// Validates that the element does not contain inner text. | ||
361 | /// </summary> | ||
362 | /// <param name="element">Element to check for inner text.</param> | ||
363 | void InnerTextDisallowed(XElement element); | ||
364 | |||
365 | /// <summary> | ||
366 | /// Verifies that a value is a legal identifier. | ||
367 | /// </summary> | ||
368 | /// <param name="value">The value to verify.</param> | ||
369 | /// <returns>true if the value is an identifier; false otherwise.</returns> | ||
370 | bool IsValidIdentifier(string value); | ||
371 | |||
372 | /// <summary> | ||
373 | /// Verifies if an identifier is a valid loc identifier. | ||
374 | /// </summary> | ||
375 | /// <param name="identifier">Identifier to verify.</param> | ||
376 | /// <returns>True if the identifier is a valid loc identifier.</returns> | ||
377 | bool IsValidLocIdentifier(string identifier); | ||
378 | |||
379 | /// <summary> | ||
380 | /// Verifies if a filename is a valid long filename. | ||
381 | /// </summary> | ||
382 | /// <param name="filename">Filename to verify.</param> | ||
383 | /// <param name="allowWildcards">true if wildcards are allowed in the filename.</param> | ||
384 | /// <param name="allowRelative">true if relative paths are allowed in the filename.</param> | ||
385 | /// <returns>True if the filename is a valid long filename</returns> | ||
386 | bool IsValidLongFilename(string filename, bool allowWildcards = false, bool allowRelative = false); | ||
387 | |||
388 | /// <summary> | ||
389 | /// Verifies if a filename is a valid short filename. | ||
390 | /// </summary> | ||
391 | /// <param name="filename">Filename to verify.</param> | ||
392 | /// <param name="allowWildcards">Indicates whether wildcards are allowed in the filename.</param> | ||
393 | /// <returns>True if the filename is a valid short filename</returns> | ||
394 | bool IsValidShortFilename(string filename, bool allowWildcards); | ||
395 | |||
396 | /// <summary> | ||
397 | /// Attempts to use an extension to parse the attribute. | ||
398 | /// </summary> | ||
399 | /// <param name="extensions"></param> | ||
400 | /// <param name="intermediate">Parent intermediate.</param> | ||
401 | /// <param name="section">Parent section.</param> | ||
402 | /// <param name="element">Element containing attribute to be parsed.</param> | ||
403 | /// <param name="attribute">Attribute to be parsed.</param> | ||
404 | /// <param name="context">Extra information about the context in which this element is being parsed.</param> | ||
405 | void ParseExtensionAttribute(IEnumerable<ICompilerExtension> extensions, Intermediate intermediate, IntermediateSection section, XElement element, XAttribute attribute, IDictionary<string, string> context = null); | ||
406 | |||
407 | /// <summary> | ||
408 | /// Attempts to use an extension to parse the element. | ||
409 | /// </summary> | ||
410 | /// <param name="extensions"></param> | ||
411 | /// <param name="intermediate">Parent intermediate.</param> | ||
412 | /// <param name="section">Parent section.</param> | ||
413 | /// <param name="parentElement">Element containing element to be parsed.</param> | ||
414 | /// <param name="element">Element to be parsed.</param> | ||
415 | /// <param name="context">Extra information about the context in which this element is being parsed.</param> | ||
416 | void ParseExtensionElement(IEnumerable<ICompilerExtension> extensions, Intermediate intermediate, IntermediateSection section, XElement parentElement, XElement element, IDictionary<string, string> context = null); | ||
417 | |||
418 | /// <summary> | ||
419 | /// Attempts to use an extension to parse the element, with support for setting component keypath. | ||
420 | /// </summary> | ||
421 | /// <param name="extensions"></param> | ||
422 | /// <param name="intermediate">Parent intermediate.</param> | ||
423 | /// <param name="section">Parent section.</param> | ||
424 | /// <param name="parentElement">Element containing element to be parsed.</param> | ||
425 | /// <param name="element">Element to be parsed.</param> | ||
426 | /// <param name="context">Extra information about the context in which this element is being parsed.</param> | ||
427 | IComponentKeyPath ParsePossibleKeyPathExtensionElement(IEnumerable<ICompilerExtension> extensions, Intermediate intermediate, IntermediateSection section, XElement parentElement, XElement element, IDictionary<string, string> context); | ||
428 | |||
429 | /// <summary> | ||
430 | /// Process all children of the element looking for extensions and erroring on the unexpected. | ||
431 | /// </summary> | ||
432 | /// <param name="extensions"></param> | ||
433 | /// <param name="intermediate">Parent intermediate.</param> | ||
434 | /// <param name="section">Parent section.</param> | ||
435 | /// <param name="element">Element to parse children.</param> | ||
436 | void ParseForExtensionElements(IEnumerable<ICompilerExtension> extensions, Intermediate intermediate, IntermediateSection section, XElement element); | ||
437 | |||
438 | /// <summary> | ||
439 | /// Schedules an action symbol. | ||
440 | /// </summary> | ||
441 | /// <param name="section">Section to add the symbol to.</param> | ||
442 | /// <param name="sourceLineNumbers">Source line information about the owner element.</param> | ||
443 | /// <param name="access">Access modifier for the scheduled action.</param> | ||
444 | /// <param name="sequence">Sequence to add the action to.</param> | ||
445 | /// <param name="name">Name of action.</param> | ||
446 | /// <param name="condition">Optional condition of action.</param> | ||
447 | /// <param name="beforeAction">Optional action to schedule before.</param> | ||
448 | /// <param name="afterAction">Option action to schedule after.</param> | ||
449 | /// <param name="overridable">Optional overridable flag.</param> | ||
450 | WixActionSymbol ScheduleActionSymbol(IntermediateSection section, SourceLineNumber sourceLineNumbers, AccessModifier access, SequenceTable sequence, string name, string condition, string beforeAction, string afterAction, bool overridable = false); | ||
451 | |||
452 | /// <summary> | ||
453 | /// Called when the compiler encounters an unexpected attribute. | ||
454 | /// </summary> | ||
455 | /// <param name="element">Parent element that found unexpected attribute.</param> | ||
456 | /// <param name="attribute">Unexpected attribute.</param> | ||
457 | void UnexpectedAttribute(XElement element, XAttribute attribute); | ||
458 | |||
459 | /// <summary> | ||
460 | /// Called when the compiler encounters an unexpected child element. | ||
461 | /// </summary> | ||
462 | /// <param name="parentElement">Parent element that found unexpected child.</param> | ||
463 | /// <param name="childElement">Unexpected child element.</param> | ||
464 | void UnexpectedElement(XElement parentElement, XElement childElement); | ||
465 | } | ||
466 | } | ||
diff --git a/src/api/wix/WixToolset.Extensibility/Services/IPathResolver.cs b/src/api/wix/WixToolset.Extensibility/Services/IPathResolver.cs new file mode 100644 index 00000000..64362174 --- /dev/null +++ b/src/api/wix/WixToolset.Extensibility/Services/IPathResolver.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.Services | ||
4 | { | ||
5 | using System.Collections.Generic; | ||
6 | using WixToolset.Data; | ||
7 | using WixToolset.Extensibility.Data; | ||
8 | |||
9 | /// <summary> | ||
10 | /// Support for processing paths. | ||
11 | /// </summary> | ||
12 | public interface IPathResolver | ||
13 | { | ||
14 | /// <summary> | ||
15 | /// Get the canonical source path of a directory. | ||
16 | /// </summary> | ||
17 | /// <param name="directories">All cached directories.</param> | ||
18 | /// <param name="componentIdGenSeeds">Hash table of Component GUID generation seeds indexed by directory id.</param> | ||
19 | /// <param name="directory">Directory identifier.</param> | ||
20 | /// <param name="platform">Current platform.</param> | ||
21 | /// <returns>Source path of a directory.</returns> | ||
22 | string GetCanonicalDirectoryPath(Dictionary<string, IResolvedDirectory> directories, Dictionary<string, string> componentIdGenSeeds, string directory, Platform platform); | ||
23 | |||
24 | /// <summary> | ||
25 | /// Get the source path of a directory. | ||
26 | /// </summary> | ||
27 | /// <param name="directories">All cached directories.</param> | ||
28 | /// <param name="directory">Directory identifier.</param> | ||
29 | /// <returns>Source path of a directory.</returns> | ||
30 | string GetDirectoryPath(Dictionary<string, IResolvedDirectory> directories, string directory); | ||
31 | |||
32 | /// <summary> | ||
33 | /// Gets the source path of a file. | ||
34 | /// </summary> | ||
35 | /// <param name="directories">All cached directories in <see cref="IResolvedDirectory"/>.</param> | ||
36 | /// <param name="directoryId">Parent directory identifier.</param> | ||
37 | /// <param name="fileName">File name (in long|source format).</param> | ||
38 | /// <param name="compressed">Specifies the package is compressed.</param> | ||
39 | /// <param name="useLongName">Specifies the package uses long file names.</param> | ||
40 | /// <returns>Source path of file relative to package directory.</returns> | ||
41 | string GetFileSourcePath(Dictionary<string, IResolvedDirectory> directories, string directoryId, string fileName, bool compressed, bool useLongName); | ||
42 | } | ||
43 | } | ||
diff --git a/src/api/wix/WixToolset.Extensibility/Services/IPreprocessHelper.cs b/src/api/wix/WixToolset.Extensibility/Services/IPreprocessHelper.cs new file mode 100644 index 00000000..f7973ac2 --- /dev/null +++ b/src/api/wix/WixToolset.Extensibility/Services/IPreprocessHelper.cs | |||
@@ -0,0 +1,90 @@ | |||
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.Xml.Linq; | ||
6 | using WixToolset.Extensibility.Data; | ||
7 | |||
8 | /// <summary> | ||
9 | /// Interface provided to help preprocessor extensions. | ||
10 | /// </summary> | ||
11 | public interface IPreprocessHelper | ||
12 | { | ||
13 | /// <summary> | ||
14 | /// Add a variable. | ||
15 | /// </summary> | ||
16 | /// <param name="context">The preprocess context.</param> | ||
17 | /// <param name="name">The variable name.</param> | ||
18 | /// <param name="value">The variable value.</param> | ||
19 | void AddVariable(IPreprocessContext context, string name, string value); | ||
20 | |||
21 | /// <summary> | ||
22 | /// Add a variable. | ||
23 | /// </summary> | ||
24 | /// <param name="context">The preprocess context.</param> | ||
25 | /// <param name="name">The variable name.</param> | ||
26 | /// <param name="value">The variable value.</param> | ||
27 | /// <param name="showWarning">Set to true to show variable overwrite warning.</param> | ||
28 | void AddVariable(IPreprocessContext context, string name, string value, bool showWarning); | ||
29 | |||
30 | /// <summary> | ||
31 | /// Evaluate a function. | ||
32 | /// </summary> | ||
33 | /// <param name="context">The preprocess context.</param> | ||
34 | /// <param name="function">The function expression including the prefix and name.</param> | ||
35 | /// <returns>The function value.</returns> | ||
36 | string EvaluateFunction(IPreprocessContext context, string function); | ||
37 | |||
38 | /// <summary> | ||
39 | /// Evaluate a function. | ||
40 | /// </summary> | ||
41 | /// <param name="context">The preprocess context.</param> | ||
42 | /// <param name="prefix">The function prefix.</param> | ||
43 | /// <param name="function">The function name.</param> | ||
44 | /// <param name="args">The arguments for the function.</param> | ||
45 | /// <returns>The function value or null if the function is not defined.</returns> | ||
46 | string EvaluateFunction(IPreprocessContext context, string prefix, string function, string[] args); | ||
47 | |||
48 | /// <summary> | ||
49 | /// Get the value of a variable expression like var.name. | ||
50 | /// </summary> | ||
51 | /// <param name="context">The preprocess context.</param> | ||
52 | /// <param name="variable">The variable expression including the optional prefix and name.</param> | ||
53 | /// <param name="allowMissingPrefix">true to allow the variable prefix to be missing.</param> | ||
54 | /// <returns>The variable value.</returns> | ||
55 | string GetVariableValue(IPreprocessContext context, string variable, bool allowMissingPrefix); | ||
56 | |||
57 | /// <summary> | ||
58 | /// Get the value of a variable. | ||
59 | /// </summary> | ||
60 | /// <param name="context">The preprocess context.</param> | ||
61 | /// <param name="prefix">The variable prefix.</param> | ||
62 | /// <param name="name">The variable name.</param> | ||
63 | /// <returns>The variable value or null if the variable is not set.</returns> | ||
64 | string GetVariableValue(IPreprocessContext context, string prefix, string name); | ||
65 | |||
66 | /// <summary> | ||
67 | /// Evaluate a Pragma. | ||
68 | /// </summary> | ||
69 | /// <param name="context">The preprocess context.</param> | ||
70 | /// <param name="pragmaName">The pragma's full name (<prefix>.<pragma>).</param> | ||
71 | /// <param name="args">The arguments to the pragma.</param> | ||
72 | /// <param name="parent">The parent element of the pragma.</param> | ||
73 | void PreprocessPragma(IPreprocessContext context, string pragmaName, string args, XContainer parent); | ||
74 | |||
75 | /// <summary> | ||
76 | /// Replaces parameters in the source text. | ||
77 | /// </summary> | ||
78 | /// <param name="context">The preprocess context.</param> | ||
79 | /// <param name="value">Text that may contain parameters to replace.</param> | ||
80 | /// <returns>Text after parameters have been replaced.</returns> | ||
81 | string PreprocessString(IPreprocessContext context, string value); | ||
82 | |||
83 | /// <summary> | ||
84 | /// Remove a variable. | ||
85 | /// </summary> | ||
86 | /// <param name="context">The preprocess context.</param> | ||
87 | /// <param name="name">The variable name.</param> | ||
88 | void RemoveVariable(IPreprocessContext context, string name); | ||
89 | } | ||
90 | } | ||
diff --git a/src/api/wix/WixToolset.Extensibility/Services/IVariableResolution.cs b/src/api/wix/WixToolset.Extensibility/Services/IVariableResolution.cs new file mode 100644 index 00000000..adcec47f --- /dev/null +++ b/src/api/wix/WixToolset.Extensibility/Services/IVariableResolution.cs | |||
@@ -0,0 +1,30 @@ | |||
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 | /// <summary> | ||
6 | /// Result when resolving a variable. | ||
7 | /// </summary> | ||
8 | public interface IVariableResolution | ||
9 | { | ||
10 | /// <summary> | ||
11 | /// Indicates if the value contains variables that cannot be resolved yet. | ||
12 | /// </summary> | ||
13 | bool DelayedResolve { get; set; } | ||
14 | |||
15 | /// <summary> | ||
16 | /// Indicates whether a bind variables default value was used in the resolution. | ||
17 | /// </summary> | ||
18 | bool IsDefault { get; set; } | ||
19 | |||
20 | /// <summary> | ||
21 | /// Indicates whether the resolution updated the value. | ||
22 | /// </summary> | ||
23 | bool UpdatedValue { get; set; } | ||
24 | |||
25 | /// <summary> | ||
26 | /// The resolved value. | ||
27 | /// </summary> | ||
28 | string Value { get; set; } | ||
29 | } | ||
30 | } | ||
diff --git a/src/api/wix/WixToolset.Extensibility/Services/IVariableResolver.cs b/src/api/wix/WixToolset.Extensibility/Services/IVariableResolver.cs new file mode 100644 index 00000000..285f1fd1 --- /dev/null +++ b/src/api/wix/WixToolset.Extensibility/Services/IVariableResolver.cs | |||
@@ -0,0 +1,48 @@ | |||
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 WixToolset.Data; | ||
6 | |||
7 | #pragma warning disable 1591 // TODO: add documentation | ||
8 | public interface IVariableResolver | ||
9 | { | ||
10 | void AddLocalization(Localization localization); | ||
11 | #pragma warning restore 1591 | ||
12 | |||
13 | /// <summary> | ||
14 | /// Add a variable. | ||
15 | /// </summary> | ||
16 | /// <param name="sourceLineNumber">The source line information for the value.</param> | ||
17 | /// <param name="name">The name of the variable.</param> | ||
18 | /// <param name="value">The value of the variable.</param> | ||
19 | /// <param name="overridable">Indicates whether the variable can be overridden by an existing variable.</param> | ||
20 | void AddVariable(SourceLineNumber sourceLineNumber, string name, string value, bool overridable); | ||
21 | |||
22 | /// <summary> | ||
23 | /// Resolve the wix variables in a value. | ||
24 | /// </summary> | ||
25 | /// <param name="sourceLineNumbers">The source line information for the value.</param> | ||
26 | /// <param name="value">The value to resolve.</param> | ||
27 | /// <returns>The resolved result.</returns> | ||
28 | IVariableResolution ResolveVariables(SourceLineNumber sourceLineNumbers, string value); | ||
29 | |||
30 | /// <summary> | ||
31 | /// Resolve the wix variables in a value. | ||
32 | /// </summary> | ||
33 | /// <param name="sourceLineNumbers">The source line information for the value.</param> | ||
34 | /// <param name="value">The value to resolve.</param> | ||
35 | /// <param name="errorOnUnknown">true if unknown variables should throw errors.</param> | ||
36 | /// <returns>The resolved value.</returns> | ||
37 | IVariableResolution ResolveVariables(SourceLineNumber sourceLineNumbers, string value, bool errorOnUnknown); | ||
38 | |||
39 | /// <summary> | ||
40 | /// Try to find localization information for dialog and (optional) control. | ||
41 | /// </summary> | ||
42 | /// <param name="dialog">Dialog identifier.</param> | ||
43 | /// <param name="control">Optional control identifier.</param> | ||
44 | /// <param name="localizedControl">Found localization information.</param> | ||
45 | /// <returns>True if localized control was found, otherwise false.</returns> | ||
46 | bool TryGetLocalizedControl(string dialog, string control, out LocalizedControl localizedControl); | ||
47 | } | ||
48 | } | ||
diff --git a/src/api/wix/WixToolset.Extensibility/Services/IWindowsInstallerBackendHelper.cs b/src/api/wix/WixToolset.Extensibility/Services/IWindowsInstallerBackendHelper.cs new file mode 100644 index 00000000..81325131 --- /dev/null +++ b/src/api/wix/WixToolset.Extensibility/Services/IWindowsInstallerBackendHelper.cs | |||
@@ -0,0 +1,35 @@ | |||
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 WixToolset.Data; | ||
6 | using WixToolset.Data.WindowsInstaller; | ||
7 | |||
8 | /// <summary> | ||
9 | /// Interface provided to help Windows Installer backend extensions. | ||
10 | /// </summary> | ||
11 | public interface IWindowsInstallerBackendHelper : IBackendHelper | ||
12 | { | ||
13 | /// <summary> | ||
14 | /// Creates a <see cref="Row"/> in the specified table. | ||
15 | /// </summary> | ||
16 | /// <param name="section">Parent section.</param> | ||
17 | /// <param name="symbol">Symbol with line information for the row.</param> | ||
18 | /// <param name="data">Windows Installer data.</param> | ||
19 | /// <param name="tableDefinition">Table definition for the row.</param> | ||
20 | /// <returns>Row created in the <paramref name="data"/>.</returns> | ||
21 | Row CreateRow(IntermediateSection section, IntermediateSymbol symbol, WindowsInstallerData data, TableDefinition tableDefinition); | ||
22 | |||
23 | /// <summary> | ||
24 | /// Looks up the registered <see cref="TableDefinition"/> for the given <see cref="IntermediateSymbol"/> and creates a <see cref="Row"/> in that table. | ||
25 | /// Goes sequentially through each field in the symbol and assigns the value to the column with the same index as the field. | ||
26 | /// If the symbol's Id is registered as the primary key then that is used for the first column and the column data is offset by 1. | ||
27 | /// </summary> | ||
28 | /// <param name="section">Parent section.</param> | ||
29 | /// <param name="symbol">Symbol to create the row from.</param> | ||
30 | /// <param name="data">Windows Installer data.</param> | ||
31 | /// <param name="tableDefinitions">Table definitions that have been registered with the binder.</param> | ||
32 | /// <returns>True if a row was created.</returns> | ||
33 | bool TryAddSymbolToMatchingTableDefinitions(IntermediateSection section, IntermediateSymbol symbol, WindowsInstallerData data, TableDefinitionCollection tableDefinitions); | ||
34 | } | ||
35 | } | ||
diff --git a/src/api/wix/WixToolset.Extensibility/Services/IWixBranding.cs b/src/api/wix/WixToolset.Extensibility/Services/IWixBranding.cs new file mode 100644 index 00000000..4bac9ccd --- /dev/null +++ b/src/api/wix/WixToolset.Extensibility/Services/IWixBranding.cs | |||
@@ -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.Services | ||
4 | { | ||
5 | using System.Reflection; | ||
6 | |||
7 | /// <summary> | ||
8 | /// WiX branding interface. | ||
9 | /// </summary> | ||
10 | public interface IWixBranding | ||
11 | { | ||
12 | /// <summary> | ||
13 | /// Gets the value for CreatingApplication field (MSI Summary Information Stream). | ||
14 | /// </summary> | ||
15 | /// <returns>String for creating application.</returns> | ||
16 | string GetCreatingApplication(); | ||
17 | |||
18 | /// <summary> | ||
19 | /// Replaces branding placeholders in original string. | ||
20 | /// </summary> | ||
21 | /// <param name="original">Original string containing placeholders to replace.</param> | ||
22 | /// <param name="assembly">Optional assembly with branding information, if not specified core branding is used.</param> | ||
23 | /// <returns></returns> | ||
24 | string ReplacePlaceholders(string original, Assembly assembly = null); | ||
25 | } | ||
26 | } | ||
diff --git a/src/api/wix/WixToolset.Extensibility/Services/IWixtoolsetCoreServiceProvider.cs b/src/api/wix/WixToolset.Extensibility/Services/IWixtoolsetCoreServiceProvider.cs new file mode 100644 index 00000000..f5fb28fb --- /dev/null +++ b/src/api/wix/WixToolset.Extensibility/Services/IWixtoolsetCoreServiceProvider.cs | |||
@@ -0,0 +1,34 @@ | |||
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 | |||
8 | /// <summary> | ||
9 | /// The core of the service provider used to add services to the service provider. | ||
10 | /// </summary> | ||
11 | public interface IWixToolsetCoreServiceProvider : IServiceProvider | ||
12 | { | ||
13 | /// <summary> | ||
14 | /// Adds a service to the service locator. | ||
15 | /// </summary> | ||
16 | /// <param name="serviceType">Type of the service to add.</param> | ||
17 | /// <param name="creationFunction"> | ||
18 | /// A function that creates the service. The create function is provided the service provider | ||
19 | /// itself to resolve additional services and a type dictionary that stores singleton services | ||
20 | /// the creation function can add its service to. | ||
21 | /// </param> | ||
22 | void AddService(Type serviceType, Func<IWixToolsetCoreServiceProvider, Dictionary<Type, object>, object> creationFunction); | ||
23 | |||
24 | /// <summary> | ||
25 | /// Adds a service to the service locator. | ||
26 | /// </summary> | ||
27 | /// <param name="creationFunction"> | ||
28 | /// A function that creates the service. The create function is provided the service provider | ||
29 | /// itself to resolve additional services and a type dictionary that stores singleton services | ||
30 | /// the creation function can add its service to. | ||
31 | /// </param> | ||
32 | void AddService<T>(Func<IWixToolsetCoreServiceProvider, Dictionary<Type, object>, T> creationFunction) where T : class; | ||
33 | } | ||
34 | } | ||
diff --git a/src/api/wix/WixToolset.Extensibility/Services/ServiceProviderExtensions.cs b/src/api/wix/WixToolset.Extensibility/Services/ServiceProviderExtensions.cs new file mode 100644 index 00000000..68484d09 --- /dev/null +++ b/src/api/wix/WixToolset.Extensibility/Services/ServiceProviderExtensions.cs | |||
@@ -0,0 +1,48 @@ | |||
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 | |||
7 | /// <summary> | ||
8 | /// Service provider extensions. | ||
9 | /// </summary> | ||
10 | public static class ServiceProviderExtensions | ||
11 | { | ||
12 | /// <summary> | ||
13 | /// Gets a service from the service provider. | ||
14 | /// </summary> | ||
15 | /// <typeparam name="T">Type of service to get.</typeparam> | ||
16 | /// <param name="provider">Service provider.</param> | ||
17 | public static T GetService<T>(this IServiceProvider provider) where T : class | ||
18 | { | ||
19 | return provider.GetService(typeof(T)) as T; | ||
20 | } | ||
21 | |||
22 | /// <summary> | ||
23 | /// Gets a service from the service provider. | ||
24 | /// </summary> | ||
25 | /// <param name="provider">Service provider.</param> | ||
26 | /// <param name="serviceType">Type of service to get.</param> | ||
27 | /// <param name="service">Retrieved service.</param> | ||
28 | /// <returns>True if the service was found, otherwise false</returns> | ||
29 | public static bool TryGetService(this IServiceProvider provider, Type serviceType, out object service) | ||
30 | { | ||
31 | service = provider.GetService(serviceType); | ||
32 | return service != null; | ||
33 | } | ||
34 | |||
35 | /// <summary> | ||
36 | /// Gets a service from the service provider. | ||
37 | /// </summary> | ||
38 | /// <typeparam name="T">Type of service to get.</typeparam> | ||
39 | /// <param name="provider">Service provider.</param> | ||
40 | /// <param name="service">Retrieved service.</param> | ||
41 | /// <returns>True if the service was found, otherwise false</returns> | ||
42 | public static bool TryGetService<T>(this IServiceProvider provider, out T service) where T : class | ||
43 | { | ||
44 | service = provider.GetService(typeof(T)) as T; | ||
45 | return service != null; | ||
46 | } | ||
47 | } | ||
48 | } | ||
diff --git a/src/api/wix/WixToolset.Extensibility/WixToolset.Extensibility.csproj b/src/api/wix/WixToolset.Extensibility/WixToolset.Extensibility.csproj new file mode 100644 index 00000000..8b18c0ed --- /dev/null +++ b/src/api/wix/WixToolset.Extensibility/WixToolset.Extensibility.csproj | |||
@@ -0,0 +1,23 @@ | |||
1 | <?xml version="1.0" encoding="utf-8"?> | ||
2 | <!-- 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. --> | ||
3 | |||
4 | <Project Sdk="Microsoft.NET.Sdk"> | ||
5 | <PropertyGroup> | ||
6 | <TargetFrameworks>netstandard2.0</TargetFrameworks> | ||
7 | <TargetFrameworks Condition=" '$(Configuration)'=='Release' ">$(TargetFrameworks);net461;net472</TargetFrameworks> | ||
8 | <Title>WiX Toolset Extensibility</Title> | ||
9 | <Description></Description> | ||
10 | <DebugType>embedded</DebugType> | ||
11 | <PublishRepositoryUrl>true</PublishRepositoryUrl> | ||
12 | <CreateDocumentationFile>true</CreateDocumentationFile> | ||
13 | </PropertyGroup> | ||
14 | |||
15 | <ItemGroup> | ||
16 | <PackageReference Include="WixToolset.Data" Version="4.0.*" /> | ||
17 | </ItemGroup> | ||
18 | |||
19 | <ItemGroup> | ||
20 | <PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0" PrivateAssets="All" /> | ||
21 | <PackageReference Include="Nerdbank.GitVersioning" Version="3.3.37" PrivateAssets="all" /> | ||
22 | </ItemGroup> | ||
23 | </Project> | ||
diff --git a/src/api/wix/WixToolset.Extensibility/WixToolset.Extensibility.v3.ncrunchproject b/src/api/wix/WixToolset.Extensibility/WixToolset.Extensibility.v3.ncrunchproject new file mode 100644 index 00000000..c6001ebe --- /dev/null +++ b/src/api/wix/WixToolset.Extensibility/WixToolset.Extensibility.v3.ncrunchproject | |||
@@ -0,0 +1,7 @@ | |||
1 | <ProjectConfiguration> | ||
2 | <Settings> | ||
3 | <AdditionalFilesToIncludeForProject> | ||
4 | <Value>..\..\version.json</Value> | ||
5 | </AdditionalFilesToIncludeForProject> | ||
6 | </Settings> | ||
7 | </ProjectConfiguration> \ No newline at end of file | ||
diff --git a/src/api/wix/appveyor-Extensibility.cmd b/src/api/wix/appveyor-Extensibility.cmd new file mode 100644 index 00000000..e0dfe33f --- /dev/null +++ b/src/api/wix/appveyor-Extensibility.cmd | |||
@@ -0,0 +1,7 @@ | |||
1 | @setlocal | ||
2 | @pushd %~dp0 | ||
3 | |||
4 | dotnet pack -c Release | ||
5 | |||
6 | @popd | ||
7 | @endlocal \ No newline at end of file | ||
diff --git a/src/api/wix/appveyor-Extensibility.yml b/src/api/wix/appveyor-Extensibility.yml new file mode 100644 index 00000000..7c686b04 --- /dev/null +++ b/src/api/wix/appveyor-Extensibility.yml | |||
@@ -0,0 +1,40 @@ | |||
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 | # Do NOT modify this file. Update the canonical version in Home\repo-template\src\appveyor.yml | ||
4 | # then update all of the repos. | ||
5 | |||
6 | branches: | ||
7 | only: | ||
8 | - master | ||
9 | - develop | ||
10 | |||
11 | image: Visual Studio 2019 | ||
12 | |||
13 | version: 0.0.0.{build} | ||
14 | configuration: Release | ||
15 | |||
16 | environment: | ||
17 | DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true | ||
18 | DOTNET_CLI_TELEMETRY_OPTOUT: 1 | ||
19 | NUGET_XMLDOC_MODE: skip | ||
20 | |||
21 | build_script: | ||
22 | - appveyor.cmd | ||
23 | |||
24 | pull_requests: | ||
25 | do_not_increment_build_number: true | ||
26 | |||
27 | nuget: | ||
28 | disable_publish_on_pr: true | ||
29 | |||
30 | skip_branch_with_pr: true | ||
31 | skip_tags: true | ||
32 | |||
33 | artifacts: | ||
34 | - path: build\Release\**\*.nupkg | ||
35 | name: nuget | ||
36 | |||
37 | notifications: | ||
38 | - provider: Slack | ||
39 | incoming_webhook: | ||
40 | secure: p5xuu+4x2JHfwGDMDe5KcG1k7gZxqYc4jWVwvyNZv5cvkubPD2waJs5yXMAXZNN7Z63/3PWHb7q4KoY/99AjauYa1nZ4c5qYqRPFRBKTHfA= | ||
diff --git a/src/api/wix/nuget-Extensibility.config b/src/api/wix/nuget-Extensibility.config new file mode 100644 index 00000000..6ab85be3 --- /dev/null +++ b/src/api/wix/nuget-Extensibility.config | |||
@@ -0,0 +1,9 @@ | |||
1 | <?xml version="1.0" encoding="utf-8"?> | ||
2 | <configuration> | ||
3 | <packageSources> | ||
4 | <clear /> | ||
5 | <add key="wixtoolset-data" value="https://ci.appveyor.com/nuget/wixtoolset-data" /> | ||
6 | <add key="wixbuildtools" value="https://ci.appveyor.com/nuget/wixbuildtools" /> | ||
7 | <add key="api.nuget.org" value="https://api.nuget.org/v3/index.json" protocolVersion="3" /> | ||
8 | </packageSources> | ||
9 | </configuration> \ No newline at end of file | ||