From f51bc71c340c2eb16ef87532fb9539e3f512e6a9 Mon Sep 17 00:00:00 2001 From: Rob Mensching Date: Thu, 10 Aug 2017 21:19:06 -0700 Subject: Initial commit --- README.md | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 00000000..003acd4d --- /dev/null +++ b/README.md @@ -0,0 +1,2 @@ +# Extensibility +WixToolset.Extensibility - interfaces to extend the WiX Toolset -- cgit v1.2.3-55-g6feb From abe691a24c640bfb87710eac45ca36345535ef21 Mon Sep 17 00:00:00 2001 From: Rob Mensching Date: Sun, 20 Aug 2017 00:34:32 -0700 Subject: Initialize repo --- .gitattributes | 2 + .gitignore | 295 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 297 insertions(+) create mode 100644 .gitattributes create mode 100644 .gitignore diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 00000000..dfe07704 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,2 @@ +# Auto detect text files and perform LF normalization +* text=auto diff --git a/.gitignore b/.gitignore new file mode 100644 index 00000000..3c6208a8 --- /dev/null +++ b/.gitignore @@ -0,0 +1,295 @@ +## Ignore Visual Studio temporary files, build results, and +## files generated by popular Visual Studio add-ons. +## +## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore + +# User-specific files +*.suo +*.user +*.userosscache +*.sln.docstates + +# User-specific files (MonoDevelop/Xamarin Studio) +*.userprefs + +# Build results +[Dd]ebug/ +[Dd]ebugPublic/ +[Rr]elease/ +[Rr]eleases/ +x64/ +x86/ +bld/ +[Bb]in/ +[Oo]bj/ +[Ll]og/ + +# Visual Studio 2015 cache/options directory +.vs/ +# Uncomment if you have tasks that create the project's static files in wwwroot +#wwwroot/ + +# MSTest test Results +[Tt]est[Rr]esult*/ +[Bb]uild[Ll]og.* + +# NUNIT +*.VisualState.xml +TestResult.xml + +# Build Results of an ATL Project +[Dd]ebugPS/ +[Rr]eleasePS/ +dlldata.c + +# Benchmark Results +BenchmarkDotNet.Artifacts/ + +# .NET Core +project.lock.json +project.fragment.lock.json +artifacts/ +**/Properties/launchSettings.json + +*_i.c +*_p.c +*_i.h +*.ilk +*.meta +*.obj +*.pch +*.pdb +*.pgc +*.pgd +*.rsp +*.sbr +*.tlb +*.tli +*.tlh +*.tmp +*.tmp_proj +*.log +*.vspscc +*.vssscc +.builds +*.pidb +*.svclog +*.scc + +# Chutzpah Test files +_Chutzpah* + +# Visual C++ cache files +ipch/ +*.aps +*.ncb +*.opendb +*.opensdf +*.sdf +*.cachefile +*.VC.db +*.VC.VC.opendb + +# Visual Studio profiler +*.psess +*.vsp +*.vspx +*.sap + +# TFS 2012 Local Workspace +$tf/ + +# Guidance Automation Toolkit +*.gpState + +# ReSharper is a .NET coding add-in +_ReSharper*/ +*.[Rr]e[Ss]harper +*.DotSettings.user + +# JustCode is a .NET coding add-in +.JustCode + +# TeamCity is a build add-in +_TeamCity* + +# DotCover is a Code Coverage Tool +*.dotCover + +# Visual Studio code coverage results +*.coverage +*.coveragexml + +# NCrunch +_NCrunch_* +.*crunch*.local.xml +nCrunchTemp_* + +# MightyMoose +*.mm.* +AutoTest.Net/ + +# Web workbench (sass) +.sass-cache/ + +# Installshield output folder +[Ee]xpress/ + +# DocProject is a documentation generator add-in +DocProject/buildhelp/ +DocProject/Help/*.HxT +DocProject/Help/*.HxC +DocProject/Help/*.hhc +DocProject/Help/*.hhk +DocProject/Help/*.hhp +DocProject/Help/Html2 +DocProject/Help/html + +# Click-Once directory +publish/ + +# Publish Web Output +*.[Pp]ublish.xml +*.azurePubxml +# Note: Comment the next line if you want to checkin your web deploy settings, +# but database connection strings (with potential passwords) will be unencrypted +*.pubxml +*.publishproj + +# Microsoft Azure Web App publish settings. Comment the next line if you want to +# checkin your Azure Web App publish settings, but sensitive information contained +# in these scripts will be unencrypted +PublishScripts/ + +# NuGet Packages +*.nupkg +# The packages folder can be ignored because of Package Restore +**/packages/* +# except build/, which is used as an MSBuild target. +!**/packages/build/ +# Uncomment if necessary however generally it will be regenerated when needed +#!**/packages/repositories.config +# NuGet v3's project.json files produces more ignorable files +*.nuget.props +*.nuget.targets + +# Microsoft Azure Build Output +csx/ +*.build.csdef + +# Microsoft Azure Emulator +ecf/ +rcf/ + +# Windows Store app package directories and files +AppPackages/ +BundleArtifacts/ +Package.StoreAssociation.xml +_pkginfo.txt +*.appx + +# Visual Studio cache files +# files ending in .cache can be ignored +*.[Cc]ache +# but keep track of directories ending in .cache +!*.[Cc]ache/ + +# Others +ClientBin/ +~$* +*~ +*.dbmdl +*.dbproj.schemaview +*.jfm +*.pfx +*.publishsettings +orleans.codegen.cs + +# Since there are multiple workflows, uncomment next line to ignore bower_components +# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) +#bower_components/ + +# RIA/Silverlight projects +Generated_Code/ + +# Backup & report files from converting an old project file +# to a newer Visual Studio version. Backup files are not needed, +# because we have git ;-) +_UpgradeReport_Files/ +Backup*/ +UpgradeLog*.XML +UpgradeLog*.htm + +# SQL Server files +*.mdf +*.ldf +*.ndf + +# Business Intelligence projects +*.rdl.data +*.bim.layout +*.bim_*.settings + +# Microsoft Fakes +FakesAssemblies/ + +# GhostDoc plugin setting file +*.GhostDoc.xml + +# Node.js Tools for Visual Studio +.ntvs_analysis.dat +node_modules/ + +# Typescript v1 declaration files +typings/ + +# Visual Studio 6 build log +*.plg + +# Visual Studio 6 workspace options file +*.opt + +# Visual Studio 6 auto-generated workspace file (contains which files were open etc.) +*.vbw + +# Visual Studio LightSwitch build output +**/*.HTMLClient/GeneratedArtifacts +**/*.DesktopClient/GeneratedArtifacts +**/*.DesktopClient/ModelManifest.xml +**/*.Server/GeneratedArtifacts +**/*.Server/ModelManifest.xml +_Pvt_Extensions + +# Paket dependency manager +.paket/paket.exe +paket-files/ + +# FAKE - F# Make +.fake/ + +# JetBrains Rider +.idea/ +*.sln.iml + +# CodeRush +.cr/ + +# Python Tools for Visual Studio (PTVS) +__pycache__/ +*.pyc + +# Cake - Uncomment if you are using it +# tools/** +# !tools/packages.config + +# Tabs Studio +*.tss + +# Telerik's JustMock configuration file +*.jmconfig + +# BizTalk build output +*.btp.cs +*.btm.cs +*.odx.cs +*.xsd.cs \ No newline at end of file -- cgit v1.2.3-55-g6feb From 80993d947d3d2db00979b82567d50e45587eea97 Mon Sep 17 00:00:00 2001 From: Rob Mensching Date: Sun, 20 Aug 2017 00:35:25 -0700 Subject: Add license --- LICENSE.TXT | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 LICENSE.TXT diff --git a/LICENSE.TXT b/LICENSE.TXT new file mode 100644 index 00000000..d4d316ef --- /dev/null +++ b/LICENSE.TXT @@ -0,0 +1,28 @@ +Copyright (c) .NET Foundation and contributors. +This software is released under the Microsoft Reciprocal License (MS-RL) (the "License"); you may not use the software except in compliance with the License. + +The text of the Microsoft Reciprocal License (MS-RL) can be found online at: + http://opensource.org/licenses/ms-rl + + +Microsoft Reciprocal License (MS-RL) + +This license governs use of the accompanying software. If you use the software, you accept this license. If you do not accept the license, do not use the software. + +1. Definitions + The terms "reproduce," "reproduction," "derivative works," and "distribution" have the same meaning here as under U.S. copyright law. + A "contribution" is the original software, or any additions or changes to the software. + A "contributor" is any person that distributes its contribution under this license. + "Licensed patents" are a contributor's patent claims that read directly on its contribution. + +2. Grant of Rights + (A) Copyright Grant- Subject to the terms of this license, including the license conditions and limitations in section 3, each contributor grants you a non-exclusive, worldwide, royalty-free copyright license to reproduce its contribution, prepare derivative works of its contribution, and distribute its contribution or any derivative works that you create. + (B) Patent Grant- Subject to the terms of this license, including the license conditions and limitations in section 3, each contributor grants you a non-exclusive, worldwide, royalty-free license under its licensed patents to make, have made, use, sell, offer for sale, import, and/or otherwise dispose of its contribution in the software or derivative works of the contribution in the software. + +3. Conditions and Limitations + (A) Reciprocal Grants- For any file you distribute that contains code from the software (in source code or binary format), you must provide recipients the source code to that file along with a copy of this license, which license will govern that file. You may license other files that are entirely your own work and do not contain code from the software under any terms you choose. + (B) No Trademark License- This license does not grant you rights to use any contributors' name, logo, or trademarks. + (C) If you bring a patent claim against any contributor over patents that you claim are infringed by the software, your patent license from such contributor to the software ends automatically. + (D) If you distribute any portion of the software, you must retain all copyright, patent, trademark, and attribution notices that are present in the software. + (E) If you distribute any portion of the software in source code form, you may do so only under this license by including a complete copy of this license with your distribution. If you distribute any portion of the software in compiled or object code form, you may only do so under a license that complies with this license. + (F) The software is licensed "as-is." You bear the risk of using it. The contributors give no express warranties, guarantees or conditions. You may have additional consumer rights under your local laws which this license cannot change. To the extent permitted under your local laws, the contributors exclude the implied warranties of merchantability, fitness for a particular purpose and non-infringement. -- cgit v1.2.3-55-g6feb From 6dee3b45cb679786bd49a5db8fde9006d283b3e2 Mon Sep 17 00:00:00 2001 From: Rob Mensching Date: Sun, 20 Aug 2017 00:38:59 -0700 Subject: Add root configuration files --- appveyor.yml | 24 ++++++++++++++++++++++++ nuget.config | 9 +++++++++ version.json | 11 +++++++++++ 3 files changed, 44 insertions(+) create mode 100644 appveyor.yml create mode 100644 nuget.config create mode 100644 version.json diff --git a/appveyor.yml b/appveyor.yml new file mode 100644 index 00000000..aa6bcaae --- /dev/null +++ b/appveyor.yml @@ -0,0 +1,24 @@ +image: Visual Studio 2017 + +version: 0.0.0.{build} +configuration: Release + +environment: + DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true + DOTNET_CLI_TELEMETRY_OPTOUT: 1 + NUGET_XMLDOC_MODE: skip + +build_script: +- dotnet pack + +pull_requests: + do_not_increment_build_number: true + +nuget: + disable_publish_on_pr: true + +skip_tags: true + +artifacts: +- path: build\Release\**\*.nupkg + name: nuget diff --git a/nuget.config b/nuget.config new file mode 100644 index 00000000..6ab85be3 --- /dev/null +++ b/nuget.config @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/version.json b/version.json new file mode 100644 index 00000000..5f857771 --- /dev/null +++ b/version.json @@ -0,0 +1,11 @@ +{ + "version": "4.0", + "publicReleaseRefSpec": [ + "^refs/heads/master$" + ], + "cloudBuild": { + "buildNumber": { + "enabled": true + } + } +} -- cgit v1.2.3-55-g6feb From 3e1c5e3fa80a2498f7d6aac5c0f8ca9e3bd7c66c Mon Sep 17 00:00:00 2001 From: Rob Mensching Date: Sun, 20 Aug 2017 14:22:07 -0700 Subject: Move to .NET Core 2.0 --- WixToolset.Extensibility.sln | 36 +++ src/Directory.Build.props | 18 ++ src/WixToolset.Extensibility/AssemblyInfo.cs | 9 + src/WixToolset.Extensibility/BindFileWithPath.cs | 20 ++ src/WixToolset.Extensibility/BindPath.cs | 52 ++++ src/WixToolset.Extensibility/BindStage.cs | 27 ++ src/WixToolset.Extensibility/BinderExtension.cs | 40 +++ src/WixToolset.Extensibility/CabinetBuildOption.cs | 25 ++ src/WixToolset.Extensibility/CompilerConstants.cs | 19 ++ src/WixToolset.Extensibility/CompilerExtension.cs | 74 +++++ src/WixToolset.Extensibility/ComponentKeyPath.cs | 57 ++++ .../DecompilerConstants.cs | 15 + .../DecompilerExtension.cs | 59 ++++ src/WixToolset.Extensibility/ExtensionData.cs | 75 +++++ src/WixToolset.Extensibility/ExtensionHelper.cs | 53 ++++ src/WixToolset.Extensibility/IBinderCore.cs | 35 +++ src/WixToolset.Extensibility/IBinderExtension.cs | 33 ++ src/WixToolset.Extensibility/IBinderFileManager.cs | 29 ++ .../IBinderFileManagerCore.cs | 54 ++++ src/WixToolset.Extensibility/ICompilerCore.cs | 339 +++++++++++++++++++++ src/WixToolset.Extensibility/ICompilerExtension.cs | 59 ++++ src/WixToolset.Extensibility/IDecompilerCore.cs | 73 +++++ .../IDecompilerExtension.cs | 49 +++ .../IExtensionCommandLine.cs | 42 +++ src/WixToolset.Extensibility/IExtensionData.cs | 31 ++ src/WixToolset.Extensibility/IInspectorCore.cs | 17 ++ .../IInspectorExtension.cs | 59 ++++ src/WixToolset.Extensibility/IPreprocessorCore.cs | 21 ++ .../IPreprocessorExtension.cs | 79 +++++ src/WixToolset.Extensibility/IUnbinderExtension.cs | 18 ++ src/WixToolset.Extensibility/Identifier.cs | 31 ++ src/WixToolset.Extensibility/InspectorExtension.cs | 61 ++++ .../PreprocessorExtension.cs | 99 ++++++ src/WixToolset.Extensibility/ResolvedCabinet.cs | 20 ++ .../WixToolset.Extensibility.csproj | 17 ++ 35 files changed, 1745 insertions(+) create mode 100644 WixToolset.Extensibility.sln create mode 100644 src/Directory.Build.props create mode 100644 src/WixToolset.Extensibility/AssemblyInfo.cs create mode 100644 src/WixToolset.Extensibility/BindFileWithPath.cs create mode 100644 src/WixToolset.Extensibility/BindPath.cs create mode 100644 src/WixToolset.Extensibility/BindStage.cs create mode 100644 src/WixToolset.Extensibility/BinderExtension.cs create mode 100644 src/WixToolset.Extensibility/CabinetBuildOption.cs create mode 100644 src/WixToolset.Extensibility/CompilerConstants.cs create mode 100644 src/WixToolset.Extensibility/CompilerExtension.cs create mode 100644 src/WixToolset.Extensibility/ComponentKeyPath.cs create mode 100644 src/WixToolset.Extensibility/DecompilerConstants.cs create mode 100644 src/WixToolset.Extensibility/DecompilerExtension.cs create mode 100644 src/WixToolset.Extensibility/ExtensionData.cs create mode 100644 src/WixToolset.Extensibility/ExtensionHelper.cs create mode 100644 src/WixToolset.Extensibility/IBinderCore.cs create mode 100644 src/WixToolset.Extensibility/IBinderExtension.cs create mode 100644 src/WixToolset.Extensibility/IBinderFileManager.cs create mode 100644 src/WixToolset.Extensibility/IBinderFileManagerCore.cs create mode 100644 src/WixToolset.Extensibility/ICompilerCore.cs create mode 100644 src/WixToolset.Extensibility/ICompilerExtension.cs create mode 100644 src/WixToolset.Extensibility/IDecompilerCore.cs create mode 100644 src/WixToolset.Extensibility/IDecompilerExtension.cs create mode 100644 src/WixToolset.Extensibility/IExtensionCommandLine.cs create mode 100644 src/WixToolset.Extensibility/IExtensionData.cs create mode 100644 src/WixToolset.Extensibility/IInspectorCore.cs create mode 100644 src/WixToolset.Extensibility/IInspectorExtension.cs create mode 100644 src/WixToolset.Extensibility/IPreprocessorCore.cs create mode 100644 src/WixToolset.Extensibility/IPreprocessorExtension.cs create mode 100644 src/WixToolset.Extensibility/IUnbinderExtension.cs create mode 100644 src/WixToolset.Extensibility/Identifier.cs create mode 100644 src/WixToolset.Extensibility/InspectorExtension.cs create mode 100644 src/WixToolset.Extensibility/PreprocessorExtension.cs create mode 100644 src/WixToolset.Extensibility/ResolvedCabinet.cs create mode 100644 src/WixToolset.Extensibility/WixToolset.Extensibility.csproj diff --git a/WixToolset.Extensibility.sln b/WixToolset.Extensibility.sln new file mode 100644 index 00000000..94ce905c --- /dev/null +++ b/WixToolset.Extensibility.sln @@ -0,0 +1,36 @@ +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +VisualStudioVersion = 15.0.26730.8 +MinimumVisualStudioVersion = 15.0.26124.0 +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WixToolset.Extensibility", "src\WixToolset.Extensibility\WixToolset.Extensibility.csproj", "{AA049009-D7D9-4C63-8E0D-83206ADCFBD1}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 + Release|Any CPU = Release|Any CPU + Release|x64 = Release|x64 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {AA049009-D7D9-4C63-8E0D-83206ADCFBD1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {AA049009-D7D9-4C63-8E0D-83206ADCFBD1}.Debug|Any CPU.Build.0 = Debug|Any CPU + {AA049009-D7D9-4C63-8E0D-83206ADCFBD1}.Debug|x64.ActiveCfg = Debug|Any CPU + {AA049009-D7D9-4C63-8E0D-83206ADCFBD1}.Debug|x64.Build.0 = Debug|Any CPU + {AA049009-D7D9-4C63-8E0D-83206ADCFBD1}.Debug|x86.ActiveCfg = Debug|Any CPU + {AA049009-D7D9-4C63-8E0D-83206ADCFBD1}.Debug|x86.Build.0 = Debug|Any CPU + {AA049009-D7D9-4C63-8E0D-83206ADCFBD1}.Release|Any CPU.ActiveCfg = Release|Any CPU + {AA049009-D7D9-4C63-8E0D-83206ADCFBD1}.Release|Any CPU.Build.0 = Release|Any CPU + {AA049009-D7D9-4C63-8E0D-83206ADCFBD1}.Release|x64.ActiveCfg = Release|Any CPU + {AA049009-D7D9-4C63-8E0D-83206ADCFBD1}.Release|x64.Build.0 = Release|Any CPU + {AA049009-D7D9-4C63-8E0D-83206ADCFBD1}.Release|x86.ActiveCfg = Release|Any CPU + {AA049009-D7D9-4C63-8E0D-83206ADCFBD1}.Release|x86.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {BB8820D5-723D-426D-B4A0-4D221603C5FA} + EndGlobalSection +EndGlobal diff --git a/src/Directory.Build.props b/src/Directory.Build.props new file mode 100644 index 00000000..0ea54cfe --- /dev/null +++ b/src/Directory.Build.props @@ -0,0 +1,18 @@ + + + + + + Debug + $(MSBuildThisFileDirectory)..\build\obj\$(MSBuildProjectName)\ + $(MSBuildThisFileDirectory)..\build\$(Configuration)\ + + Rob Mensching, Bob Arnson + WiX Toolset + Copyright (c) .NET Foundation and contributors. All rights reserved. + + + + $(MSBuildThisFileDirectory)..\..\ + + diff --git a/src/WixToolset.Extensibility/AssemblyInfo.cs b/src/WixToolset.Extensibility/AssemblyInfo.cs new file mode 100644 index 00000000..6512230a --- /dev/null +++ b/src/WixToolset.Extensibility/AssemblyInfo.cs @@ -0,0 +1,9 @@ +// 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. + +using System; +using System.Reflection; +using System.Runtime.InteropServices; + +[assembly: AssemblyCulture("")] +[assembly:CLSCompliant(true)] +[assembly: ComVisible(false)] diff --git a/src/WixToolset.Extensibility/BindFileWithPath.cs b/src/WixToolset.Extensibility/BindFileWithPath.cs new file mode 100644 index 00000000..f07873fc --- /dev/null +++ b/src/WixToolset.Extensibility/BindFileWithPath.cs @@ -0,0 +1,20 @@ +// 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. + +namespace WixToolset.Extensibility +{ + /// + /// Bind file with its path. + /// + public class BindFileWithPath + { + /// + /// Gets or sets the identifier of the file with this path. + /// + public string Id { get; set; } + + /// + /// Gets or sets the file path. + /// + public string Path { get; set; } + } +} diff --git a/src/WixToolset.Extensibility/BindPath.cs b/src/WixToolset.Extensibility/BindPath.cs new file mode 100644 index 00000000..236ee4ec --- /dev/null +++ b/src/WixToolset.Extensibility/BindPath.cs @@ -0,0 +1,52 @@ +// 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. + +namespace WixToolset.Extensibility +{ + using System; + + /// + /// Bind path representation. + /// + public class BindPath + { + /// + /// Creates an unnamed bind path. + /// + /// Path for the bind path. + public BindPath(string path) : this(String.Empty, path) + { + } + + /// + /// Creates a named bind path. + /// + /// Name of the bind path. + /// Path for the bind path. + public BindPath(string name, string path) + { + this.Name = name; + this.Path = path; + } + + /// + /// Parses a bind path from its string representation + /// + /// String representation of bind path that looks like: [name=]path + /// Parsed bind path. + public static BindPath Parse(string bindPath) + { + string[] namedPath = bindPath.Split(new char[] { '=' }, 2); + return (1 == namedPath.Length) ? new BindPath(namedPath[0]) : new BindPath(namedPath[0], namedPath[1]); + } + + /// + /// Name of the bind path or String.Empty if the path is unnamed. + /// + public string Name { get; set; } + + /// + /// Path for the bind path. + /// + public string Path { get; set; } + } +} diff --git a/src/WixToolset.Extensibility/BindStage.cs b/src/WixToolset.Extensibility/BindStage.cs new file mode 100644 index 00000000..71ac5616 --- /dev/null +++ b/src/WixToolset.Extensibility/BindStage.cs @@ -0,0 +1,27 @@ +// 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. + +namespace WixToolset.Extensibility +{ + /// + /// Bind stage of a file.. The reason we need this is to change the ResolveFile behavior based on if + /// dynamic bindpath plugin is desirable. We cannot change the signature of ResolveFile since it might + /// break existing implementers which derived from BinderFileManager + /// + public enum BindStage + { + /// + /// Normal binding + /// + Normal, + + /// + /// Bind the file path of the target build file + /// + Target, + + /// + /// Bind the file path of the updated build file + /// + Updated, + } +} diff --git a/src/WixToolset.Extensibility/BinderExtension.cs b/src/WixToolset.Extensibility/BinderExtension.cs new file mode 100644 index 00000000..c6ccb3c2 --- /dev/null +++ b/src/WixToolset.Extensibility/BinderExtension.cs @@ -0,0 +1,40 @@ +// 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. + +namespace WixToolset.Extensibility +{ + using WixToolset.Data; + + /// + /// Base class for creating an binder extension. + /// + public abstract class BinderExtension : IBinderExtension + { + /// + /// Gets or sets the binder core for the extension. + /// + /// Binder core for the extension. + public IBinderCore Core { get; set; } + + + /// + /// Called before binding occurs. + /// + public virtual void Initialize(Output output) + { + } + + /// + /// Called after variable resolution occurs. + /// + public virtual void AfterResolvedFields(Output output) + { + } + + /// + /// Called after all output changes occur and right before the output is bound into its final format. + /// + public virtual void Finish(Output output) + { + } + } +} diff --git a/src/WixToolset.Extensibility/CabinetBuildOption.cs b/src/WixToolset.Extensibility/CabinetBuildOption.cs new file mode 100644 index 00000000..6f63131c --- /dev/null +++ b/src/WixToolset.Extensibility/CabinetBuildOption.cs @@ -0,0 +1,25 @@ +// 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. + +namespace WixToolset.Extensibility +{ + /// + /// Options for building the cabinet. + /// + public enum CabinetBuildOption + { + /// + /// Build the cabinet and move it to the target location. + /// + BuildAndMove, + + /// + /// Build the cabinet and copy it to the target location. + /// + BuildAndCopy, + + /// + /// Just copy the cabinet to the target location. + /// + Copy + } +} diff --git a/src/WixToolset.Extensibility/CompilerConstants.cs b/src/WixToolset.Extensibility/CompilerConstants.cs new file mode 100644 index 00000000..6d4ca742 --- /dev/null +++ b/src/WixToolset.Extensibility/CompilerConstants.cs @@ -0,0 +1,19 @@ +// 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. + +namespace WixToolset +{ + using System; + + /// + /// Constants used by compiler. + /// + public class CompilerConstants + { + public const int IntegerNotSet = int.MinValue; + public const int IllegalInteger = int.MinValue + 1; + public const long LongNotSet = long.MinValue; + public const long IllegalLong = long.MinValue + 1; + public const string IllegalGuid = "IllegalGuid"; + public static readonly Version IllegalVersion = new Version(Int32.MaxValue, Int32.MaxValue, Int32.MaxValue, Int32.MaxValue); + } +} diff --git a/src/WixToolset.Extensibility/CompilerExtension.cs b/src/WixToolset.Extensibility/CompilerExtension.cs new file mode 100644 index 00000000..522ffcf8 --- /dev/null +++ b/src/WixToolset.Extensibility/CompilerExtension.cs @@ -0,0 +1,74 @@ +// 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. + +namespace WixToolset.Extensibility +{ + using System.Collections.Generic; + using System.Xml.Linq; + + /// + /// Base class for creating a compiler extension. + /// + public abstract class CompilerExtension : ICompilerExtension + { + /// + /// Gets or sets the compiler core for the extension. + /// + /// Compiler core for the extension. + public ICompilerCore Core { get; set; } + + /// + /// Gets the schema namespace for this extension. + /// + /// Schema namespace supported by this extension. + public XNamespace Namespace { get; protected set; } + + /// + /// Called at the beginning of the compilation of a source file. + /// + public virtual void Initialize() + { + } + + /// + /// Processes an attribute for the Compiler. + /// + /// Parent element of attribute. + /// Attribute to process. + /// Extra information about the context in which this element is being parsed. + public virtual void ParseAttribute(XElement parentElement, XAttribute attribute, IDictionary context) + { + this.Core.UnexpectedAttribute(parentElement, attribute); + } + + /// + /// Processes an element for the Compiler. + /// + /// Parent element of element to process. + /// Element to process. + /// Extra information about the context in which this element is being parsed. + public virtual void ParseElement(XElement parentElement, XElement element, IDictionary context) + { + this.Core.UnexpectedElement(parentElement, element); + } + + /// + /// Processes an element for the Compiler, with the ability to supply a component keypath. + /// + /// Parent element of element to process. + /// Element to process. + /// Explicit key path. + /// Extra information about the context in which this element is being parsed. + public virtual ComponentKeyPath ParsePossibleKeyPathElement(XElement parentElement, XElement element, IDictionary context) + { + this.ParseElement(parentElement, element, context); + return null; + } + + /// + /// Called at the end of the compilation of a source file. + /// + public virtual void Finish() + { + } + } +} diff --git a/src/WixToolset.Extensibility/ComponentKeyPath.cs b/src/WixToolset.Extensibility/ComponentKeyPath.cs new file mode 100644 index 00000000..f00e8f74 --- /dev/null +++ b/src/WixToolset.Extensibility/ComponentKeyPath.cs @@ -0,0 +1,57 @@ +// 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. + +namespace WixToolset.Extensibility +{ + using System; + + public enum ComponentKeyPathType + { + /// + /// Not a key path. + /// + None, + + /// + /// File resource as a key path. + /// + File, + + /// + /// Folder as a key path. + /// + Directory, + + /// + /// ODBC data source as a key path. + /// + OdbcDataSource, + + /// + /// A simple registry key acting as a key path. + /// + Registry, + + /// + /// A registry key that contains a formatted property acting as a key path. + /// + RegistryFormatted + } + + public class ComponentKeyPath + { + /// + /// Identifier of the resource to be a key path. + /// + public string Id { get; set; } + + /// + /// Indicates whether the key path was explicitly set for this resource. + /// + public bool Explicit { get; set; } + + /// + /// Type of resource to be the key path. + /// + public ComponentKeyPathType Type { get; set; } + } +} diff --git a/src/WixToolset.Extensibility/DecompilerConstants.cs b/src/WixToolset.Extensibility/DecompilerConstants.cs new file mode 100644 index 00000000..58742182 --- /dev/null +++ b/src/WixToolset.Extensibility/DecompilerConstants.cs @@ -0,0 +1,15 @@ +// 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. + +namespace WixToolset +{ + using System; + + /// + /// Constants used by decompiler. + /// + public class DecompilerConstants + { + public const char PrimaryKeyDelimiter = '/'; + public const string PrimaryKeyDelimiterString = "/"; + } +} diff --git a/src/WixToolset.Extensibility/DecompilerExtension.cs b/src/WixToolset.Extensibility/DecompilerExtension.cs new file mode 100644 index 00000000..00277639 --- /dev/null +++ b/src/WixToolset.Extensibility/DecompilerExtension.cs @@ -0,0 +1,59 @@ +// 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. + +namespace WixToolset.Extensibility +{ + using WixToolset.Data; + + /// + /// Base class for creating a decompiler extension. + /// + public abstract class DecompilerExtension : IDecompilerExtension + { + /// + /// Gets or sets the decompiler core for the extension. + /// + /// The decompiler core for the extension. + public IDecompilerCore Core { get; set; } + + /// + /// Gets the table definitions this extension decompiles. + /// + /// Table definitions this extension decompiles. + public virtual TableDefinitionCollection TableDefinitions { get; protected set; } + + /// + /// Gets the library that this decompiler wants removed from the decomipiled output. + /// + /// The table definitions to use while loading the library. + /// The library for this extension or null if there is no library to be removed. + public virtual Library GetLibraryToRemove(TableDefinitionCollection tableDefinitions) + { + return null; + } + + /// + /// Called at the beginning of the decompilation of a database. + /// + /// The collection of all tables. + public virtual void Initialize(TableIndexedCollection tables) + { + } + + /// + /// Decompiles an extension table. + /// + /// The table to decompile. + public virtual void DecompileTable(Table table) + { + this.Core.UnexpectedTable(table); + } + + /// + /// Finalize decompilation. + /// + /// The collection of all tables. + public virtual void Finish(TableIndexedCollection tables) + { + } + } +} diff --git a/src/WixToolset.Extensibility/ExtensionData.cs b/src/WixToolset.Extensibility/ExtensionData.cs new file mode 100644 index 00000000..4cf262b9 --- /dev/null +++ b/src/WixToolset.Extensibility/ExtensionData.cs @@ -0,0 +1,75 @@ +// 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. + +namespace WixToolset.Extensibility +{ + using System; + using System.IO; + using System.Reflection; + using System.Xml; + using WixToolset.Data; + + public abstract class ExtensionData : IExtensionData + { + /// + /// Gets the optional table definitions for this extension. + /// + /// Table definisions for this extension or null if there are no table definitions. + public virtual TableDefinitionCollection TableDefinitions + { + get { return null; } + } + + /// + /// Gets the optional default culture. + /// + /// The optional default culture. + public virtual string DefaultCulture + { + get { return null; } + } + + /// + /// Gets the optional library associated with this extension. + /// + /// The table definitions to use while loading the library. + /// The library for this extension or null if there is no library. + public virtual Library GetLibrary(TableDefinitionCollection tableDefinitions) + { + return null; + } + + /// + /// Help for loading a library from an embedded resource. + /// + /// The assembly containing the embedded resource. + /// The name of the embedded resource being requested. + /// The table definitions to use while loading the library. + /// The loaded library. + protected static Library LoadLibraryHelper(Assembly assembly, string resourceName, TableDefinitionCollection tableDefinitions) + { + using (Stream resourceStream = assembly.GetManifestResourceStream(resourceName)) + { + UriBuilder uriBuilder = new UriBuilder(assembly.CodeBase); + uriBuilder.Scheme = "embeddedresource"; + uriBuilder.Fragment = resourceName; + + return Library.Load(resourceStream, uriBuilder.Uri, tableDefinitions, false); + } + } + + /// + /// Helper for loading table definitions from an embedded resource. + /// + /// The assembly containing the embedded resource. + /// The name of the embedded resource being requested. + /// The loaded table definitions. + protected static TableDefinitionCollection LoadTableDefinitionHelper(Assembly assembly, string resourceName) + { + using (Stream resourceStream = assembly.GetManifestResourceStream(resourceName)) + using (XmlReader reader = XmlReader.Create(resourceStream)) + { + return TableDefinitionCollection.Load(reader); + } + } + } +} diff --git a/src/WixToolset.Extensibility/ExtensionHelper.cs b/src/WixToolset.Extensibility/ExtensionHelper.cs new file mode 100644 index 00000000..9c1ca950 --- /dev/null +++ b/src/WixToolset.Extensibility/ExtensionHelper.cs @@ -0,0 +1,53 @@ +// 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. + +namespace WixToolset.Extensibility +{ + using System; + using System.Collections.Specialized; + using System.IO; + using System.Reflection; + using System.Xml; + using WixToolset.Data; + using WixToolset.Extensibility; + + /// + /// The main class for a WiX extension. + /// + public static class ExtensionHelper + { + /// + /// Help for loading a library from an embedded resource. + /// + /// The assembly containing the embedded resource. + /// The name of the embedded resource being requested. + /// The table definitions to use while loading the library. + /// The loaded library. + public static Library LoadLibraryHelper(Assembly assembly, string resourceName, TableDefinitionCollection tableDefinitions) + { + using (Stream resourceStream = assembly.GetManifestResourceStream(resourceName)) + { + UriBuilder uriBuilder = new UriBuilder(); + uriBuilder.Scheme = "embeddedresource"; + uriBuilder.Path = assembly.Location; + uriBuilder.Fragment = resourceName; + + return Library.Load(resourceStream, uriBuilder.Uri, tableDefinitions, false); + } + } + + /// + /// Helper for loading table definitions from an embedded resource. + /// + /// The assembly containing the embedded resource. + /// The name of the embedded resource being requested. + /// The loaded table definitions. + public static TableDefinitionCollection LoadTableDefinitionHelper(Assembly assembly, string resourceName) + { + using (Stream resourceStream = assembly.GetManifestResourceStream(resourceName)) + using (XmlReader reader = XmlReader.Create(resourceStream)) + { + return TableDefinitionCollection.Load(reader); + } + } + } +} diff --git a/src/WixToolset.Extensibility/IBinderCore.cs b/src/WixToolset.Extensibility/IBinderCore.cs new file mode 100644 index 00000000..a4044c11 --- /dev/null +++ b/src/WixToolset.Extensibility/IBinderCore.cs @@ -0,0 +1,35 @@ +// 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. + +namespace WixToolset.Extensibility +{ + using WixToolset.Data; + + public interface IBinderCore : IMessageHandler + { + /// + /// Gets or sets the file manager core for the extension. + /// + /// File manager core for the extension. + IBinderFileManagerCore FileManagerCore { get; set; } + + /// + /// Gets whether the binder core encountered an error while processing. + /// + /// Flag if core encountered an error during processing. + bool EncounteredError { get; } + + /// + /// Gets the table definitions used by the Binder. + /// + /// Table definitions used by the binder. + TableDefinitionCollection TableDefinitions { get; } + + /// + /// Generate an identifier by hashing data from the row. + /// + /// Three letter or less prefix for generated row identifier. + /// Information to hash. + /// The generated identifier. + string CreateIdentifier(string prefix, params string[] args); + } +} diff --git a/src/WixToolset.Extensibility/IBinderExtension.cs b/src/WixToolset.Extensibility/IBinderExtension.cs new file mode 100644 index 00000000..19790b14 --- /dev/null +++ b/src/WixToolset.Extensibility/IBinderExtension.cs @@ -0,0 +1,33 @@ +// 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. + +namespace WixToolset.Extensibility +{ + using WixToolset.Data; + + /// + /// Interface all binder extensions implement. + /// + public interface IBinderExtension + { + /// + /// Gets or sets the binder core for the extension. + /// + /// Binder core for the extension. + IBinderCore Core { get; set; } + + /// + /// Called before binding occurs. + /// + void Initialize(Output output); + + /// + /// Called after variable resolution occurs. + /// + void AfterResolvedFields(Output output); + + /// + /// Called after all output changes occur and right before the output is bound into its final format. + /// + void Finish(Output output); + } +} diff --git a/src/WixToolset.Extensibility/IBinderFileManager.cs b/src/WixToolset.Extensibility/IBinderFileManager.cs new file mode 100644 index 00000000..3a2b1d40 --- /dev/null +++ b/src/WixToolset.Extensibility/IBinderFileManager.cs @@ -0,0 +1,29 @@ +// 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. + +namespace WixToolset.Extensibility +{ + using System.Collections.Generic; + using WixToolset.Data; + using WixToolset.Data.Rows; + + public interface IBinderFileManager + { + IBinderFileManagerCore Core { set; } + + ResolvedCabinet ResolveCabinet(string cabinetPath, IEnumerable files); + + string ResolveFile(string source, string type, SourceLineNumber sourceLineNumbers, BindStage bindStage); + + string ResolveRelatedFile(string source, string relatedSource, string type, SourceLineNumber sourceLineNumbers, BindStage bindStage); + + string ResolveMedia(MediaRow mediaRow, string mediaLayoutDirectory, string layoutDirectory); + + string ResolveUrl(string url, string fallbackUrl, string packageId, string payloadId, string fileName); + + bool? CompareFiles(string targetFile, string updatedFile); + + bool CopyFile(string source, string destination, bool overwrite); + + bool MoveFile(string source, string destination, bool overwrite); + } +} diff --git a/src/WixToolset.Extensibility/IBinderFileManagerCore.cs b/src/WixToolset.Extensibility/IBinderFileManagerCore.cs new file mode 100644 index 00000000..f5adf4e1 --- /dev/null +++ b/src/WixToolset.Extensibility/IBinderFileManagerCore.cs @@ -0,0 +1,54 @@ +// 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. + +namespace WixToolset.Extensibility +{ + using System.Collections.Generic; + using WixToolset.Data; + + public interface IBinderFileManagerCore : IMessageHandler + { + /// + /// Gets or sets the path to cabinet cache. + /// + /// The path to cabinet cache. + string CabCachePath { get; } + + /// + /// Gets or sets the active subStorage used for binding. + /// + /// The subStorage object. + SubStorage ActiveSubStorage { get; } + + /// + /// Gets or sets the output object used for binding. + /// + /// The output object. + Output Output { get; } + + /// + /// Gets or sets the path to the temp files location. + /// + /// The path to the temp files location. + string TempFilesLocation { get; } + + /// + /// Gets the property if re-basing target is true or false + /// + /// It returns true if target bind path is to be replaced, otherwise false. + bool RebaseTarget { get; } + + /// + /// Gets the property if re-basing updated build is true or false + /// + /// It returns true if updated bind path is to be replaced, otherwise false. + bool RebaseUpdated { get; } + + /// + /// Gets the collection of paths to locate files during ResolveFile for the provided BindStage and name. + /// + /// Optional stage to get bind paths for. Default is normal. + /// Optional name of the bind paths to get. Default is the unnamed paths. + /// The bind paths to locate files. + IEnumerable GetBindPaths(BindStage stage = BindStage.Normal, string name = null); + } +} diff --git a/src/WixToolset.Extensibility/ICompilerCore.cs b/src/WixToolset.Extensibility/ICompilerCore.cs new file mode 100644 index 00000000..b2ad6abd --- /dev/null +++ b/src/WixToolset.Extensibility/ICompilerCore.cs @@ -0,0 +1,339 @@ +// 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. + +namespace WixToolset.Extensibility +{ + using System; + using System.Collections; + using System.Collections.Generic; + using System.Xml.Linq; + using WixToolset.Data; + + /// + /// Core interface provided by the compiler. + /// + public interface ICompilerCore : IMessageHandler + { + /// + /// Gets whether the compiler core encountered an error while processing. + /// + /// Flag if core encountered an error during processing. + bool EncounteredError { get; } + + /// + /// Gets the platform which the compiler will use when defaulting 64-bit attributes and elements. + /// + /// The platform which the compiler will use when defaulting 64-bit attributes and elements. + Platform CurrentPlatform { get; } + + /// + /// Creates a version 3 name-based UUID. + /// + /// The namespace UUID. + /// The value. + /// The generated GUID for the given namespace and value. + string CreateGuid(Guid namespaceGuid, string value); + + /// + /// Create an identifier by hashing data from the row. + /// + /// Three letter or less prefix for generated row identifier. + /// Information to hash. + /// The new identifier. + Identifier CreateIdentifier(string prefix, params string[] args); + + /// + /// Create an identifier based on passed file name + /// + /// File name to generate identifer from + /// + Identifier CreateIdentifierFromFilename(string filename); + + /// + /// Convert a bit array into an int value. + /// + /// The bit array to convert. + /// The converted int value. + int CreateIntegerFromBitArray(BitArray bits); + + /// + /// Creates a row in the active section. + /// + /// Source and line number of current row. + /// Name of table to create row in. + /// Optional identifier for the row. + /// New row. + Row CreateRow(SourceLineNumber sourceLineNumbers, string tableName, Identifier identifier = null); + + /// + /// Creates directories using the inline directory syntax. + /// + /// Source line information. + /// The attribute to parse. + /// Optional identifier of parent directory. + /// Identifier of the leaf directory created. + string CreateDirectoryReferenceFromInlineSyntax(SourceLineNumber sourceLineNumbers, XAttribute attribute, string parentId); + + /// + /// Creates a Registry row in the active section. + /// + /// Source and line number of the current row. + /// The registry entry root. + /// The registry entry key. + /// The registry entry name. + /// The registry entry value. + /// The component which will control installation/uninstallation of the registry entry. + /// If true, "escape" leading '#' characters so the value is written as a REG_SZ. + Identifier CreateRegistryRow(SourceLineNumber sourceLineNumbers, int root, string key, string name, string value, string componentId, bool escapeLeadingHash = false); + + /// + /// Creates a short file/directory name using an identifier and long file/directory name as input. + /// + /// The long file/directory name. + /// The option to keep the extension on generated short names. + /// true if wildcards are allowed in the filename. + /// Any additional information to include in the hash for the generated short name. + /// The generated 8.3-compliant short file/directory name. + string CreateShortName(string longName, bool keepExtension, bool allowWildcards, params string[] args); + + /// + /// Create a WixSimpleReference row in the active section. + /// + /// Source line information for the row. + /// The table name of the simple reference. + /// The primary keys of the simple reference. + void CreateSimpleReference(SourceLineNumber sourceLineNumbers, string tableName, params string[] primaryKeys); + + /// + /// Creates WixComplexReference and WixGroup rows in the active section. + /// + /// Source line information. + /// The parent type. + /// The parent id. + /// The parent language. + /// The child type. + /// The child id. + /// Whether the child is primary. + void CreateComplexReference(SourceLineNumber sourceLineNumbers, ComplexReferenceParentType parentType, string parentId, string parentLanguage, ComplexReferenceChildType childType, string childId, bool isPrimary); + + /// + /// Creates a patch resource reference to the list of resoures to be filtered when producing a patch. This method should only be used when processing children of a patch family. + /// + /// Source and line number of current row. + /// Name of table to create row in. + /// Array of keys that make up the primary key of the table. + /// New row. + void CreatePatchFamilyChildReference(SourceLineNumber sourceLineNumbers, string tableName, params string[] primaryKeys); + + /// + /// Checks if the string contains a property (i.e. "foo[Property]bar") + /// + /// String to evaluate for properties. + /// True if a property is found in the string. + bool ContainsProperty(string possibleProperty); + + /// + /// Add the appropriate rows to make sure that the given table shows up in the resulting output. + /// + /// Source line numbers. + /// Name of the table to ensure existance of. + void EnsureTable(SourceLineNumber sourceLineNumbers, string tableName); + + /// + /// Get an attribute value and displays an error if the value is empty by default. + /// + /// Source line information about the owner element. + /// The attribute containing the value to get. + /// A rule for the contents of the value. If the contents do not follow the rule, an error is thrown. + /// The attribute's value. + string GetAttributeValue(SourceLineNumber sourceLineNumbers, XAttribute attribute, EmptyRule emptyRule = EmptyRule.CanBeWhitespaceOnly); + + /// + /// Gets a Bundle variable value and displays an error for an illegal value. + /// + /// Source line information about the owner element. + /// The attribute containing the value to get. + /// The attribute's value. + string GetAttributeBundleVariableValue(SourceLineNumber sourceLineNumbers, XAttribute attribute); + + /// + /// Get a guid attribute value and displays an error for an illegal guid value. + /// + /// Source line information about the owner element. + /// The attribute containing the value to get. + /// Determines whether the guid can be automatically generated. + /// If true, no error is raised on empty value. If false, an error is raised. + /// The attribute's guid value or a special value if an error occurred. + string GetAttributeGuidValue(SourceLineNumber sourceLineNumbers, XAttribute attribute, bool generatable = false, bool canBeEmpty = false); + + /// + /// Get an identifier attribute value and displays an error for an illegal identifier value. + /// + /// Source line information about the owner element. + /// The attribute containing the value to get. + /// The attribute's identifier value or a special value if an error occurred. + Identifier GetAttributeIdentifier(SourceLineNumber sourceLineNumbers, XAttribute attribute); + + /// + /// Get an identifier attribute value and displays an error for an illegal identifier value. + /// + /// Source line information about the owner element. + /// The attribute containing the value to get. + /// The attribute's identifier value or a special value if an error occurred. + string GetAttributeIdentifierValue(SourceLineNumber sourceLineNumbers, XAttribute attribute); + + /// + /// Get an integer attribute value and displays an error for an illegal integer value. + /// + /// Source line information about the owner element. + /// The attribute containing the value to get. + /// The minimum legal value. + /// The maximum legal value. + /// The attribute's integer value or a special value if an error occurred during conversion. + int GetAttributeIntegerValue(SourceLineNumber sourceLineNumbers, XAttribute attribute, int minimum, int maximum); + + /// + /// Get a long integral attribute value and displays an error for an illegal long value. + /// + /// Source line information about the owner element. + /// The attribute containing the value to get. + /// The minimum legal value. + /// The maximum legal value. + /// The attribute's long value or a special value if an error occurred during conversion. + long GetAttributeLongValue(SourceLineNumber sourceLineNumbers, XAttribute attribute, long minimum, long maximum); + + /// + /// Gets a long filename value and displays an error for an illegal long filename value. + /// + /// Source line information about the owner element. + /// The attribute containing the value to get. + /// true if wildcards are allowed in the filename. + /// true if relative paths are allowed in the filename. + /// The attribute's long filename value. + string GetAttributeLongFilename(SourceLineNumber sourceLineNumbers, XAttribute attribute, bool allowWildcards = false, bool allowRelative = false); + + /// + /// Gets a RegistryRoot as a MsiInterop.MsidbRegistryRoot value and displays an error for an illegal value. + /// + /// Source line information about the owner element. + /// The attribute containing the value to get. + /// Whether HKMU is returned as -1 (true), or treated as an error (false). + /// The attribute's RegisitryRootType value. + int GetAttributeMsidbRegistryRootValue(SourceLineNumber sourceLineNumbers, XAttribute attribute, bool allowHkmu); + + /// + /// Gets a version value or possibly a binder variable and displays an error for an illegal version value. + /// + /// Source line information about the owner element. + /// The attribute containing the value to get. + /// The attribute's version value. + string GetAttributeVersionValue(SourceLineNumber sourceLineNumbers, XAttribute attribute); + + /// + /// Gets a yes/no value and displays an error for an illegal yes/no value. + /// + /// Source line information about the owner element. + /// The attribute containing the value to get. + /// The attribute's YesNoType value. + YesNoType GetAttributeYesNoValue(SourceLineNumber sourceLineNumbers, XAttribute attribute); + + /// + /// Gets a yes/no/default value and displays an error for an illegal yes/no/default value. + /// + /// Source line information about the owner element. + /// The attribute containing the value to get. + /// The attribute's YesNoType value. + YesNoDefaultType GetAttributeYesNoDefaultValue(SourceLineNumber sourceLineNumbers, XAttribute attribute); + + /// + /// Gets node's inner text and ensure's it is safe for use in a condition by trimming any extra whitespace. + /// + /// The node to ensure inner text is a condition. + /// The value converted into a safe condition. + string GetConditionInnerText(XElement node); + + /// + /// Get an element's inner text and trims any extra whitespace. + /// + /// The element with inner text to be trimmed. + /// The node's inner text trimmed. + string GetTrimmedInnerText(XElement element); + + /// + /// Verifies that a value is a legal identifier. + /// + /// The value to verify. + /// true if the value is an identifier; false otherwise. + bool IsValidIdentifier(string value); + + /// + /// Verifies if an identifier is a valid loc identifier. + /// + /// Identifier to verify. + /// True if the identifier is a valid loc identifier. + bool IsValidLocIdentifier(string identifier); + + /// + /// Verifies if a filename is a valid long filename. + /// + /// Filename to verify. + /// true if wildcards are allowed in the filename. + /// true if relative paths are allowed in the filename. + /// True if the filename is a valid long filename + bool IsValidLongFilename(string filename, bool allowWildcards = false, bool allowRelative = false); + + /// + /// Verifies if a filename is a valid short filename. + /// + /// Filename to verify. + /// true if wildcards are allowed in the filename. + /// True if the filename is a valid short filename + bool IsValidShortFilename(string filename, bool allowWildcards = false); + + /// + /// Attempts to use an extension to parse the attribute. + /// + /// Element containing attribute to be parsed. + /// Attribute to be parsed. + /// Extra information about the context in which this element is being parsed. + void ParseExtensionAttribute(XElement element, XAttribute attribute, IDictionary context = null); + + /// + /// Attempts to use an extension to parse the element. + /// + /// Element containing element to be parsed. + /// Element to be parsed. + /// Extra information about the context in which this element is being parsed. + void ParseExtensionElement(XElement parentElement, XElement element, IDictionary context = null); + + /// + /// Process all children of the element looking for extensions and erroring on the unexpected. + /// + /// Element to parse children. + void ParseForExtensionElements(XElement element); + + /// + /// Sets a bit in a bit array based on the index at which an attribute name was found in a string array. + /// + /// Array of attributes that map to bits. + /// Name of attribute to check. + /// Value of attribute to check. + /// The bit array in which the bit will be set if found. + /// The offset into the bit array. + /// true if the bit was set; false otherwise. + bool TrySetBitFromName(string[] attributeNames, string attributeName, YesNoType attributeValue, BitArray bits, int offset); + + /// + /// Called when the compiler encounters an unexpected attribute. + /// + /// Parent element that found unexpected attribute. + /// Unexpected attribute. + void UnexpectedAttribute(XElement element, XAttribute attribute); + + /// + /// Called when the compiler encounters an unexpected child element. + /// + /// Parent element that found unexpected child. + /// Unexpected child element. + void UnexpectedElement(XElement parentElement, XElement childElement); + } +} diff --git a/src/WixToolset.Extensibility/ICompilerExtension.cs b/src/WixToolset.Extensibility/ICompilerExtension.cs new file mode 100644 index 00000000..edd7aa15 --- /dev/null +++ b/src/WixToolset.Extensibility/ICompilerExtension.cs @@ -0,0 +1,59 @@ +// 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. + +namespace WixToolset.Extensibility +{ + using System.Collections.Generic; + using System.Xml.Linq; + + /// + /// Interface all compiler extensions implement. + /// + public interface ICompilerExtension + { + /// + /// Gets or sets the compiler core for the extension. + /// + /// Compiler core for the extension. + ICompilerCore Core { get; set; } + + /// + /// Gets the schema namespace for this extension. + /// + /// Schema namespace supported by this extension. + XNamespace Namespace { get; } + + /// + /// Called at the beginning of the compilation of a source file. + /// + void Initialize(); + + /// + /// Processes an attribute for the Compiler. + /// + /// Parent element of attribute. + /// Attribute to process. + /// Extra information about the context in which this element is being parsed. + void ParseAttribute(XElement parentElement, XAttribute attribute, IDictionary context); + + /// + /// Processes an element for the Compiler. + /// + /// Parent element of element to process. + /// Element to process. + /// Extra information about the context in which this element is being parsed. + void ParseElement(XElement parentElement, XElement element, IDictionary context); + + /// + /// Processes an element for the Compiler, with the ability to supply a component keypath. + /// + /// Parent element of element to process. + /// Element to process. + /// Extra information about the context in which this element is being parsed. + ComponentKeyPath ParsePossibleKeyPathElement(XElement parentElement, XElement element, IDictionary context); + + /// + /// Called at the end of the compilation of a source file. + /// + void Finish(); + } +} diff --git a/src/WixToolset.Extensibility/IDecompilerCore.cs b/src/WixToolset.Extensibility/IDecompilerCore.cs new file mode 100644 index 00000000..d18d5170 --- /dev/null +++ b/src/WixToolset.Extensibility/IDecompilerCore.cs @@ -0,0 +1,73 @@ +// 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. + +namespace WixToolset.Extensibility +{ + using System; + using WixToolset.Data; + using Wix = WixToolset.Data.Serialize; + + public interface IDecompilerCore : IMessageHandler + { + + /// + /// Gets whether the decompiler core encountered an error while processing. + /// + /// Flag if core encountered an error during processing. + bool EncounteredError { get; } + + /// + /// Gets the root element of the decompiled output. + /// + /// The root element of the decompiled output. + Wix.IParentElement RootElement { get; } + + /// + /// Gets the UI element. + /// + /// The UI element. + Wix.UI UIElement { get; } + + /// + /// Verifies if a filename is a valid short filename. + /// + /// Filename to verify. + /// true if wildcards are allowed in the filename. + /// True if the filename is a valid short filename + bool IsValidShortFilename(string filename, bool allowWildcards); + + /// + /// Convert an Int32 into a DateTime. + /// + /// The Int32 value. + /// The DateTime. + DateTime ConvertIntegerToDateTime(int value); + + /// + /// Gets the element corresponding to the row it came from. + /// + /// The row corresponding to the element. + /// The indexed element. + Wix.ISchemaElement GetIndexedElement(Row row); + + /// + /// Gets the element corresponding to the primary key of the given table. + /// + /// The table corresponding to the element. + /// The primary key corresponding to the element. + /// The indexed element. + Wix.ISchemaElement GetIndexedElement(string table, params string[] primaryKey); + + /// + /// Index an element by its corresponding row. + /// + /// The row corresponding to the element. + /// The element to index. + void IndexElement(Row row, Wix.ISchemaElement element); + + /// + /// Indicates the decompiler encountered and unexpected table to decompile. + /// + /// Unknown decompiled table. + void UnexpectedTable(Table table); +} +} diff --git a/src/WixToolset.Extensibility/IDecompilerExtension.cs b/src/WixToolset.Extensibility/IDecompilerExtension.cs new file mode 100644 index 00000000..6124f348 --- /dev/null +++ b/src/WixToolset.Extensibility/IDecompilerExtension.cs @@ -0,0 +1,49 @@ +// 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. + +namespace WixToolset.Extensibility +{ + using WixToolset.Data; + + /// + /// Base class for creating a decompiler extension. + /// + public interface IDecompilerExtension + { + /// + /// Gets or sets the decompiler core for the extension. + /// + /// The decompiler core for the extension. + IDecompilerCore Core { get; set; } + + /// + /// Gets the table definitions this extension decompiles. + /// + /// Table definitions this extension decompiles. + TableDefinitionCollection TableDefinitions { get; } + + /// + /// Gets the library that this decompiler wants removed from the decomipiled output. + /// + /// The table definitions to use while loading the library. + /// The library for this extension or null if there is no library to be removed. + Library GetLibraryToRemove(TableDefinitionCollection tableDefinitions); + + /// + /// Called at the beginning of the decompilation of a database. + /// + /// The collection of all tables. + void Initialize(TableIndexedCollection tables); + + /// + /// Decompiles an extension table. + /// + /// The table to decompile. + void DecompileTable(Table table); + + /// + /// Finalize decompilation. + /// + /// The collection of all tables. + void Finish(TableIndexedCollection tables); + } +} diff --git a/src/WixToolset.Extensibility/IExtensionCommandLine.cs b/src/WixToolset.Extensibility/IExtensionCommandLine.cs new file mode 100644 index 00000000..b6cff5d0 --- /dev/null +++ b/src/WixToolset.Extensibility/IExtensionCommandLine.cs @@ -0,0 +1,42 @@ +// 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. + +namespace WixToolset.Extensibility +{ + using System.Collections.Generic; + using WixToolset.Data; + + /// + /// A command line option. + /// + public struct ExtensionCommandLineSwitch + { + public string Switch { get; set; } + + public string Description { get; set; } + } + + /// + /// Interface extensions implement to be able to parse command-line options. + /// + public interface IExtensionCommandLine + { + /// + /// Sets the message handler for the extension. + /// + /// Message handler for the extension. + IMessageHandler MessageHandler { set; } + + /// + /// Gets the supported command line types for this extension. + /// + /// The supported command line types for this extension. + IEnumerable CommandLineSwitches { get; } + + /// + /// Parse the commandline arguments. + /// + /// Commandline arguments. + /// Unparsed commandline arguments. + string[] ParseCommandLine(string[] args); + } +} diff --git a/src/WixToolset.Extensibility/IExtensionData.cs b/src/WixToolset.Extensibility/IExtensionData.cs new file mode 100644 index 00000000..19e23590 --- /dev/null +++ b/src/WixToolset.Extensibility/IExtensionData.cs @@ -0,0 +1,31 @@ +// 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. + +namespace WixToolset.Extensibility +{ + using WixToolset.Data; + + /// + /// Interface extensions implement to provide data. + /// + public interface IExtensionData + { + /// + /// Gets the table definitions for this extension. + /// + /// Table definisions for this extension or null if there are no table definitions. + TableDefinitionCollection TableDefinitions { get; } + + /// + /// Gets the optional default culture. + /// + /// The optional default culture. + string DefaultCulture { get; } + + /// + /// Gets the library associated with this extension. + /// + /// The table definitions to use while loading the library. + /// The library for this extension or null if there is no library. + Library GetLibrary(TableDefinitionCollection tableDefinitions); + } +} diff --git a/src/WixToolset.Extensibility/IInspectorCore.cs b/src/WixToolset.Extensibility/IInspectorCore.cs new file mode 100644 index 00000000..06239ce5 --- /dev/null +++ b/src/WixToolset.Extensibility/IInspectorCore.cs @@ -0,0 +1,17 @@ +// 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. + +namespace WixToolset.Extensibility +{ + using WixToolset.Data; + + /// + /// Core facilities for inspector extensions. + /// + public interface IInspectorCore : IMessageHandler + { + /// + /// Gets whether an error occured. + /// + bool EncounteredError { get; } + } +} diff --git a/src/WixToolset.Extensibility/IInspectorExtension.cs b/src/WixToolset.Extensibility/IInspectorExtension.cs new file mode 100644 index 00000000..b2a098b7 --- /dev/null +++ b/src/WixToolset.Extensibility/IInspectorExtension.cs @@ -0,0 +1,59 @@ +// 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. + +namespace WixToolset.Extensibility +{ + using System; + using System.IO; + using WixToolset.Data; + + /// + /// Interface for inspector extensions. + /// + /// + /// The inspector methods are stateless, but extensions are loaded and last for the lifetime of the + /// containing classes like , , , + /// , and . If you want to maintain state, you should check + /// if your data is loaded for each method and, if not, load it. + /// + public interface IInspectorExtension + { + /// + /// Gets or sets the for inspector extensions to use. + /// + IInspectorCore Core { get; set; } + + /// + /// Inspect the source before preprocessing. + /// + /// The source to preprocess. + void InspectSource(Stream source); + + /// + /// Inspect the compiled output. + /// + /// The compiled output. + void InspectIntermediate(Intermediate intermediate); + + /// + /// Inspect the output. + /// + /// The output. May be called after linking or binding. + /// + /// To inspect a patch's filtered transforms, enumerate . + /// Transforms where the begins with "#" are + /// called patch transforms and instruct Windows Installer how to apply the + /// authored transforms - those that do not begin with "#". The authored + /// transforms are the primary transforms you'll typically want to inspect + /// and contain your changes to target products. + /// + void InspectOutput(Output output); + + /// + /// Inspect the final output after binding. + /// + /// The file path to the final bound output. + /// The that contains source line numbers + /// for the database and all rows. + void InspectDatabase(string filePath, Pdb pdb); + } +} diff --git a/src/WixToolset.Extensibility/IPreprocessorCore.cs b/src/WixToolset.Extensibility/IPreprocessorCore.cs new file mode 100644 index 00000000..a0449139 --- /dev/null +++ b/src/WixToolset.Extensibility/IPreprocessorCore.cs @@ -0,0 +1,21 @@ +// 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. + +namespace WixToolset.Extensibility +{ + using WixToolset.Data; + + public interface IPreprocessorCore : IMessageHandler + { + /// + /// Gets or sets the platform which the compiler will use when defaulting 64-bit attributes and elements. + /// + /// The platform which the compiler will use when defaulting 64-bit attributes and elements. + Platform CurrentPlatform { get; } + + /// + /// Gets whether the core encountered an error while processing. + /// + /// Flag if core encountered an error during processing. + bool EncounteredError { get; } + } +} diff --git a/src/WixToolset.Extensibility/IPreprocessorExtension.cs b/src/WixToolset.Extensibility/IPreprocessorExtension.cs new file mode 100644 index 00000000..de415526 --- /dev/null +++ b/src/WixToolset.Extensibility/IPreprocessorExtension.cs @@ -0,0 +1,79 @@ +// 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. + +namespace WixToolset.Extensibility +{ + using System; + using System.Xml.Linq; + using WixToolset.Data; + + /// + /// Interface for extending the WiX toolset preprocessor. + /// + public interface IPreprocessorExtension + { + /// + /// Gets or sets the preprocessor core for the extension. + /// + /// Preprocessor core for the extension. + IPreprocessorCore Core { get; set; } + + /// + /// Gets the variable prefixes for the extension. + /// + /// The variable prefixes for the extension. + string[] Prefixes { get; } + + /// + /// Called at the beginning of the preprocessing of a source file. + /// + void Initialize(); + + /// + /// Gets the value of a variable whose prefix matches the extension. + /// + /// The prefix of the variable to be processed by the extension. + /// The name of the variable. + /// The value of the variable or null if the variable is undefined. + string GetVariableValue(string prefix, string name); + + /// + /// Evaluates a function defined in the extension. + /// + /// The prefix of the function to be processed by the extension. + /// The name of the function. + /// The list of arguments. + /// The value of the function or null if the function is not defined. + string EvaluateFunction(string prefix, string function, string[] args); + + /// + /// Processes a pragma defined in the extension. + /// + /// The location of this pragma's PI. + /// The prefix of the pragma to be processed by the extension. + /// The name of the pragma. + /// The pragma's arguments. + /// The parent node of the pragma. + /// false if the pragma is not defined. + /// Don't return false for any condition except for unrecognized pragmas. Use Core.OnMessage for errors, warnings and messages. + bool ProcessPragma(SourceLineNumber sourceLineNumbers, string prefix, string pragma, string args, XContainer parent); + + /// + /// Preprocess a document after normal preprocessing has completed. + /// + /// The document to preprocess. + void PreprocessDocument(XDocument document); + + /// + /// Preprocesses a parameter. + /// + /// Name of parameter that matches extension. + /// The value of the parameter after processing. + /// By default this method will cause an error if its called. + string PreprocessParameter(string name); + + /// + /// Called at the end of the preprocessing of a source file. + /// + void Finish(); + } +} diff --git a/src/WixToolset.Extensibility/IUnbinderExtension.cs b/src/WixToolset.Extensibility/IUnbinderExtension.cs new file mode 100644 index 00000000..88bf20d9 --- /dev/null +++ b/src/WixToolset.Extensibility/IUnbinderExtension.cs @@ -0,0 +1,18 @@ +// 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. + +namespace WixToolset.Extensibility +{ + using System; + using WixToolset.Data; + + /// + /// Base class for creating an unbinder extension. + /// + public interface IUnbinderExtension + { + /// + /// Called during the generation of sectionIds for an admin image. + /// + void GenerateSectionIds(Output output); + } +} diff --git a/src/WixToolset.Extensibility/Identifier.cs b/src/WixToolset.Extensibility/Identifier.cs new file mode 100644 index 00000000..628cd335 --- /dev/null +++ b/src/WixToolset.Extensibility/Identifier.cs @@ -0,0 +1,31 @@ +// 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. + +namespace WixToolset.Extensibility +{ + using System; + using WixToolset.Data; + + /// + /// Class to define the identifier and access for a row. + /// + public class Identifier + { + public static Identifier Invalid = new Identifier(null, AccessModifier.Private); + + public Identifier(string id, AccessModifier access) + { + this.Id = id; + this.Access = access; + } + + /// + /// Access modifier for a row. + /// + public AccessModifier Access { get; private set; } + + /// + /// Identifier for the row. + /// + public string Id { get; private set; } + } +} diff --git a/src/WixToolset.Extensibility/InspectorExtension.cs b/src/WixToolset.Extensibility/InspectorExtension.cs new file mode 100644 index 00000000..82b1ef02 --- /dev/null +++ b/src/WixToolset.Extensibility/InspectorExtension.cs @@ -0,0 +1,61 @@ +// 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. + +namespace WixToolset.Extensibility +{ + using System; + using System.IO; + using WixToolset.Data; + + /// + /// Opitonal base class for inspector extensions. + /// + public class InspectorExtension : IInspectorExtension + { + /// + /// Gets the for inspector extensions to use. + /// + public IInspectorCore Core { get; set; } + + /// + /// Inspect the source before preprocessing. + /// + /// The source to preprocess. + public virtual void InspectSource(Stream source) + { + } + + /// + /// Inspect the compiled output. + /// + /// The compiled output. + public virtual void InspectIntermediate(Intermediate intermediate) + { + } + + /// + /// Inspect the output. + /// + /// The output. May be called after linking or binding. + /// + /// To inspect a patch's filtered transforms, enumerate . + /// Transforms where the begins with "#" are + /// called patch transforms and instruct Windows Installer how to apply the + /// authored transforms - those that do not begin with "#". The authored + /// transforms are the primary transforms you'll typically want to inspect + /// and contain your changes to target products. + /// + public virtual void InspectOutput(Output output) + { + } + + /// + /// Inspect the final output after binding. + /// + /// The file path to the final bound output. + /// The that contains source line numbers + /// for the database and all rows. + public virtual void InspectDatabase(string filePath, Pdb pdb) + { + } + } +} diff --git a/src/WixToolset.Extensibility/PreprocessorExtension.cs b/src/WixToolset.Extensibility/PreprocessorExtension.cs new file mode 100644 index 00000000..2af30a95 --- /dev/null +++ b/src/WixToolset.Extensibility/PreprocessorExtension.cs @@ -0,0 +1,99 @@ +// 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. + +namespace WixToolset.Extensibility +{ + using System.Xml.Linq; + using WixToolset.Data; + + /// + /// Base class for creating a preprocessor extension. + /// + public abstract class PreprocessorExtension : IPreprocessorExtension + { + /// + /// Gets or sets the preprocessor core for the extension. + /// + /// Preprocessor core for the extension. + public IPreprocessorCore Core { get; set; } + + /// + /// Gets or sets the variable prefixes for the extension. + /// + /// The variable prefixes for the extension. + public virtual string[] Prefixes + { + get { return null; } + } + + /// + /// Called at the beginning of the preprocessing of a source file. + /// + public virtual void Initialize() + { + } + + /// + /// Gets the value of a variable whose prefix matches the extension. + /// + /// The prefix of the variable to be processed by the extension. + /// The name of the variable. + /// The value of the variable or null if the variable is undefined. + public virtual string GetVariableValue(string prefix, string name) + { + return null; + } + + /// + /// Evaluates a function defined in the extension. + /// + /// The prefix of the function to be processed by the extension. + /// The name of the function. + /// The list of arguments. + /// The value of the function or null if the function is not defined. + public virtual string EvaluateFunction(string prefix, string function, string[] args) + { + return null; + } + + /// + /// Processes a pragma defined in the extension. + /// + /// The location of this pragma's PI. + /// The prefix of the pragma to be processed by the extension. + /// The name of the pragma. + /// The pragma's arguments. + /// The parent node of the pragma. + /// false if the pragma is not defined. + /// 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. + public virtual bool ProcessPragma(SourceLineNumber sourceLineNumbers, string prefix, string pragma, string args, XContainer parent) + { + return false; + } + + /// + /// Preprocess a document after normal preprocessing has completed. + /// + /// The document to preprocess. + public virtual void PreprocessDocument(XDocument document) + { + } + + /// + /// Preprocesses a parameter. + /// + /// Name of parameter that matches extension. + /// The value of the parameter after processing. + /// By default this method will cause an error if its called. + public virtual string PreprocessParameter(string name) + { + return null; + } + + /// + /// Called at the end of the preprocessing of a source file. + /// + public virtual void Finish() + { + } + } +} diff --git a/src/WixToolset.Extensibility/ResolvedCabinet.cs b/src/WixToolset.Extensibility/ResolvedCabinet.cs new file mode 100644 index 00000000..e98d6d96 --- /dev/null +++ b/src/WixToolset.Extensibility/ResolvedCabinet.cs @@ -0,0 +1,20 @@ +// 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. + +namespace WixToolset.Extensibility +{ + /// + /// Data returned from build file manager ResolveCabinet callback. + /// + public class ResolvedCabinet + { + /// + /// Gets or sets the build option for the resolved cabinet. + /// + public CabinetBuildOption BuildOption { get; set; } + + /// + /// Gets or sets the path for the resolved cabinet. + /// + public string Path { get; set; } + } +} diff --git a/src/WixToolset.Extensibility/WixToolset.Extensibility.csproj b/src/WixToolset.Extensibility/WixToolset.Extensibility.csproj new file mode 100644 index 00000000..8efae769 --- /dev/null +++ b/src/WixToolset.Extensibility/WixToolset.Extensibility.csproj @@ -0,0 +1,17 @@ + + + + + + netstandard2.0 + + WiX Toolset Extensibility + + + + + + + + + -- cgit v1.2.3-55-g6feb From c83079486f01c3b1511108e202ab7f2d65ddf434 Mon Sep 17 00:00:00 2001 From: Rob Mensching Date: Sun, 17 Sep 2017 15:19:33 -0700 Subject: Update to latest GitVersioning and Directory.Build.props standards --- src/Directory.Build.props | 4 +++- src/WixToolset.Extensibility/WixToolset.Extensibility.csproj | 6 ++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/Directory.Build.props b/src/Directory.Build.props index 0ea54cfe..25cb6d36 100644 --- a/src/Directory.Build.props +++ b/src/Directory.Build.props @@ -7,7 +7,7 @@ $(MSBuildThisFileDirectory)..\build\obj\$(MSBuildProjectName)\ $(MSBuildThisFileDirectory)..\build\$(Configuration)\ - Rob Mensching, Bob Arnson + WiX Toolset Team WiX Toolset Copyright (c) .NET Foundation and contributors. All rights reserved. @@ -15,4 +15,6 @@ $(MSBuildThisFileDirectory)..\..\ + + diff --git a/src/WixToolset.Extensibility/WixToolset.Extensibility.csproj b/src/WixToolset.Extensibility/WixToolset.Extensibility.csproj index 8efae769..a2cb5e26 100644 --- a/src/WixToolset.Extensibility/WixToolset.Extensibility.csproj +++ b/src/WixToolset.Extensibility/WixToolset.Extensibility.csproj @@ -9,9 +9,11 @@ - - + + + + -- cgit v1.2.3-55-g6feb From 475dd063933b8a23d8e47021e9b105a20699bbac Mon Sep 17 00:00:00 2001 From: Rob Mensching Date: Sun, 17 Sep 2017 15:19:50 -0700 Subject: Standardize on appveyor.cmd for builds --- appveyor.cmd | 7 +++++++ appveyor.yml | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) create mode 100644 appveyor.cmd diff --git a/appveyor.cmd b/appveyor.cmd new file mode 100644 index 00000000..e0dfe33f --- /dev/null +++ b/appveyor.cmd @@ -0,0 +1,7 @@ +@setlocal +@pushd %~dp0 + +dotnet pack -c Release + +@popd +@endlocal \ No newline at end of file diff --git a/appveyor.yml b/appveyor.yml index aa6bcaae..d9da1df5 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -9,7 +9,7 @@ environment: NUGET_XMLDOC_MODE: skip build_script: -- dotnet pack + - appveyor.cmd pull_requests: do_not_increment_build_number: true -- cgit v1.2.3-55-g6feb From 7efd412cda00b369bc331c9bedd8db971d98fee7 Mon Sep 17 00:00:00 2001 From: Rob Mensching Date: Wed, 18 Oct 2017 15:21:45 -0700 Subject: Incorporate refactoring of WixToolset.Core assemblies --- src/WixToolset.Extensibility/AssemblyInfo.cs | 2 +- src/WixToolset.Extensibility/BindPath.cs | 52 ------------------- src/WixToolset.Extensibility/BindStage.cs | 27 ---------- src/WixToolset.Extensibility/BinderExtension.cs | 40 --------------- .../BinderExtensionBase.cs | 55 ++++++++++++++++++++ src/WixToolset.Extensibility/IBackend.cs | 17 +++++++ src/WixToolset.Extensibility/IBackendFactory.cs | 11 ++++ .../IBindVariableResolver.cs | 26 ++++++++++ src/WixToolset.Extensibility/IBinderExtension.cs | 20 +++++--- src/WixToolset.Extensibility/IBinderFileManager.cs | 29 ----------- .../IBinderFileManagerCore.cs | 1 + .../IBurnBackendExtension.cs | 25 +++++++++ src/WixToolset.Extensibility/IDelayedField.cs | 13 +++++ .../IExpectedExtractFile.cs | 15 ++++++ src/WixToolset.Extensibility/IInscribeContext.cs | 22 ++++++++ .../ILibrarianExtension.cs | 15 ++++++ src/WixToolset.Extensibility/ILibraryContext.cs | 20 ++++++++ src/WixToolset.Extensibility/ILocalizer.cs | 15 ++++++ src/WixToolset.Extensibility/IUnbindContext.cs | 23 +++++++++ .../IWindowsInstallerBackendExtension.cs | 29 +++++++++++ src/WixToolset.Extensibility/Identifier.cs | 31 ------------ .../Services/IBindContext.cs | 59 ++++++++++++++++++++++ .../Services/ICommandLine.cs | 9 ++++ .../Services/ICommandLineCommand.cs | 9 ++++ .../Services/ICommandLineContext.cs | 20 ++++++++ .../Services/IExtensionManager.cs | 16 ++++++ .../Services/ServiceProviderExtensions.cs | 14 +++++ 27 files changed, 427 insertions(+), 188 deletions(-) delete mode 100644 src/WixToolset.Extensibility/BindPath.cs delete mode 100644 src/WixToolset.Extensibility/BindStage.cs delete mode 100644 src/WixToolset.Extensibility/BinderExtension.cs create mode 100644 src/WixToolset.Extensibility/BinderExtensionBase.cs create mode 100644 src/WixToolset.Extensibility/IBackend.cs create mode 100644 src/WixToolset.Extensibility/IBackendFactory.cs create mode 100644 src/WixToolset.Extensibility/IBindVariableResolver.cs delete mode 100644 src/WixToolset.Extensibility/IBinderFileManager.cs create mode 100644 src/WixToolset.Extensibility/IBurnBackendExtension.cs create mode 100644 src/WixToolset.Extensibility/IDelayedField.cs create mode 100644 src/WixToolset.Extensibility/IExpectedExtractFile.cs create mode 100644 src/WixToolset.Extensibility/IInscribeContext.cs create mode 100644 src/WixToolset.Extensibility/ILibrarianExtension.cs create mode 100644 src/WixToolset.Extensibility/ILibraryContext.cs create mode 100644 src/WixToolset.Extensibility/ILocalizer.cs create mode 100644 src/WixToolset.Extensibility/IUnbindContext.cs create mode 100644 src/WixToolset.Extensibility/IWindowsInstallerBackendExtension.cs delete mode 100644 src/WixToolset.Extensibility/Identifier.cs create mode 100644 src/WixToolset.Extensibility/Services/IBindContext.cs create mode 100644 src/WixToolset.Extensibility/Services/ICommandLine.cs create mode 100644 src/WixToolset.Extensibility/Services/ICommandLineCommand.cs create mode 100644 src/WixToolset.Extensibility/Services/ICommandLineContext.cs create mode 100644 src/WixToolset.Extensibility/Services/IExtensionManager.cs create mode 100644 src/WixToolset.Extensibility/Services/ServiceProviderExtensions.cs diff --git a/src/WixToolset.Extensibility/AssemblyInfo.cs b/src/WixToolset.Extensibility/AssemblyInfo.cs index 6512230a..b3740b2a 100644 --- a/src/WixToolset.Extensibility/AssemblyInfo.cs +++ b/src/WixToolset.Extensibility/AssemblyInfo.cs @@ -5,5 +5,5 @@ using System.Reflection; using System.Runtime.InteropServices; [assembly: AssemblyCulture("")] -[assembly:CLSCompliant(true)] +[assembly: CLSCompliant(true)] [assembly: ComVisible(false)] diff --git a/src/WixToolset.Extensibility/BindPath.cs b/src/WixToolset.Extensibility/BindPath.cs deleted file mode 100644 index 236ee4ec..00000000 --- a/src/WixToolset.Extensibility/BindPath.cs +++ /dev/null @@ -1,52 +0,0 @@ -// 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. - -namespace WixToolset.Extensibility -{ - using System; - - /// - /// Bind path representation. - /// - public class BindPath - { - /// - /// Creates an unnamed bind path. - /// - /// Path for the bind path. - public BindPath(string path) : this(String.Empty, path) - { - } - - /// - /// Creates a named bind path. - /// - /// Name of the bind path. - /// Path for the bind path. - public BindPath(string name, string path) - { - this.Name = name; - this.Path = path; - } - - /// - /// Parses a bind path from its string representation - /// - /// String representation of bind path that looks like: [name=]path - /// Parsed bind path. - public static BindPath Parse(string bindPath) - { - string[] namedPath = bindPath.Split(new char[] { '=' }, 2); - return (1 == namedPath.Length) ? new BindPath(namedPath[0]) : new BindPath(namedPath[0], namedPath[1]); - } - - /// - /// Name of the bind path or String.Empty if the path is unnamed. - /// - public string Name { get; set; } - - /// - /// Path for the bind path. - /// - public string Path { get; set; } - } -} diff --git a/src/WixToolset.Extensibility/BindStage.cs b/src/WixToolset.Extensibility/BindStage.cs deleted file mode 100644 index 71ac5616..00000000 --- a/src/WixToolset.Extensibility/BindStage.cs +++ /dev/null @@ -1,27 +0,0 @@ -// 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. - -namespace WixToolset.Extensibility -{ - /// - /// Bind stage of a file.. The reason we need this is to change the ResolveFile behavior based on if - /// dynamic bindpath plugin is desirable. We cannot change the signature of ResolveFile since it might - /// break existing implementers which derived from BinderFileManager - /// - public enum BindStage - { - /// - /// Normal binding - /// - Normal, - - /// - /// Bind the file path of the target build file - /// - Target, - - /// - /// Bind the file path of the updated build file - /// - Updated, - } -} diff --git a/src/WixToolset.Extensibility/BinderExtension.cs b/src/WixToolset.Extensibility/BinderExtension.cs deleted file mode 100644 index c6ccb3c2..00000000 --- a/src/WixToolset.Extensibility/BinderExtension.cs +++ /dev/null @@ -1,40 +0,0 @@ -// 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. - -namespace WixToolset.Extensibility -{ - using WixToolset.Data; - - /// - /// Base class for creating an binder extension. - /// - public abstract class BinderExtension : IBinderExtension - { - /// - /// Gets or sets the binder core for the extension. - /// - /// Binder core for the extension. - public IBinderCore Core { get; set; } - - - /// - /// Called before binding occurs. - /// - public virtual void Initialize(Output output) - { - } - - /// - /// Called after variable resolution occurs. - /// - public virtual void AfterResolvedFields(Output output) - { - } - - /// - /// Called after all output changes occur and right before the output is bound into its final format. - /// - public virtual void Finish(Output output) - { - } - } -} diff --git a/src/WixToolset.Extensibility/BinderExtensionBase.cs b/src/WixToolset.Extensibility/BinderExtensionBase.cs new file mode 100644 index 00000000..a0b34a31 --- /dev/null +++ b/src/WixToolset.Extensibility/BinderExtensionBase.cs @@ -0,0 +1,55 @@ +// 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. + +namespace WixToolset.Extensibility +{ + using WixToolset.Data; + using WixToolset.Data.Bind; + using WixToolset.Extensibility.Services; + + public abstract class BinderExtensionBase : IBinderExtension + { + protected IBindContext Context { get; private set; } + + /// + /// Called before binding occurs. + /// + public virtual void PreBind(IBindContext context) + { + this.Context = context; + } + + /// + /// Called after variable resolution occurs. + /// + public virtual void AfterResolvedFields(Output output) + { + } + + public virtual string ResolveFile(string source, string type, SourceLineNumber sourceLineNumbers, BindStage bindStage) + { + return null; + } + + public virtual bool? CompareFiles(string targetFile, string updatedFile) + { + return null; + } + + public virtual bool CopyFile(string source, string destination, bool overwrite) + { + return false; + } + + public virtual bool MoveFile(string source, string destination, bool overwrite) + { + return false; + } + + /// + /// Called after binding is complete before the files are moved to their final locations. + /// + public virtual void PostBind(BindResult result) + { + } + } +} diff --git a/src/WixToolset.Extensibility/IBackend.cs b/src/WixToolset.Extensibility/IBackend.cs new file mode 100644 index 00000000..e38de544 --- /dev/null +++ b/src/WixToolset.Extensibility/IBackend.cs @@ -0,0 +1,17 @@ +// 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. + +namespace WixToolset.Extensibility +{ + using WixToolset.Data; + using WixToolset.Data.Bind; + using WixToolset.Extensibility.Services; + + public interface IBackend + { + BindResult Bind(IBindContext context); + + Output Unbind(IUnbindContext context); + + bool Inscribe(IInscribeContext context); + } +} diff --git a/src/WixToolset.Extensibility/IBackendFactory.cs b/src/WixToolset.Extensibility/IBackendFactory.cs new file mode 100644 index 00000000..12704c0f --- /dev/null +++ b/src/WixToolset.Extensibility/IBackendFactory.cs @@ -0,0 +1,11 @@ +// 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. + +namespace WixToolset.Extensibility +{ + using WixToolset.Extensibility.Services; + + public interface IBackendFactory + { + bool TryCreateBackend(string outputType, string outputPath, IBindContext context, out IBackend backend); + } +} diff --git a/src/WixToolset.Extensibility/IBindVariableResolver.cs b/src/WixToolset.Extensibility/IBindVariableResolver.cs new file mode 100644 index 00000000..4c2c3003 --- /dev/null +++ b/src/WixToolset.Extensibility/IBindVariableResolver.cs @@ -0,0 +1,26 @@ +// 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. + +namespace WixToolset.Extensibility +{ + using WixToolset.Data; + using WixToolset.Data.Rows; + + public interface IBindVariableResolver + { + int VariableCount { get; } + + void AddVariable(string name, string value); + + void AddVariable(WixVariableRow wixVariableRow); + + string ResolveVariables(SourceLineNumber sourceLineNumbers, string value, bool localizationOnly); + + string ResolveVariables(SourceLineNumber sourceLineNumbers, string value, bool localizationOnly, bool errorOnUnknown, out bool isDefault, out bool delayedResolve); + + string ResolveVariables(SourceLineNumber sourceLineNumbers, string value, bool localizationOnly, out bool isDefault); + + string ResolveVariables(SourceLineNumber sourceLineNumbers, string value, bool localizationOnly, out bool isDefault, out bool delayedResolve); + + bool TryGetLocalizedControl(string dialog, string control, out LocalizedControl localizedControl); + } +} diff --git a/src/WixToolset.Extensibility/IBinderExtension.cs b/src/WixToolset.Extensibility/IBinderExtension.cs index 19790b14..9673d60e 100644 --- a/src/WixToolset.Extensibility/IBinderExtension.cs +++ b/src/WixToolset.Extensibility/IBinderExtension.cs @@ -3,31 +3,35 @@ namespace WixToolset.Extensibility { using WixToolset.Data; + using WixToolset.Data.Bind; + using WixToolset.Extensibility.Services; /// /// Interface all binder extensions implement. /// public interface IBinderExtension { - /// - /// Gets or sets the binder core for the extension. - /// - /// Binder core for the extension. - IBinderCore Core { get; set; } - /// /// Called before binding occurs. /// - void Initialize(Output output); + void PreBind(IBindContext context); /// /// Called after variable resolution occurs. /// void AfterResolvedFields(Output output); + string ResolveFile(string source, string type, SourceLineNumber sourceLineNumbers, BindStage bindStage); + + bool? CompareFiles(string targetFile, string updatedFile); + + bool CopyFile(string source, string destination, bool overwrite); + + bool MoveFile(string source, string destination, bool overwrite); + /// /// Called after all output changes occur and right before the output is bound into its final format. /// - void Finish(Output output); + void PostBind(BindResult result); } } diff --git a/src/WixToolset.Extensibility/IBinderFileManager.cs b/src/WixToolset.Extensibility/IBinderFileManager.cs deleted file mode 100644 index 3a2b1d40..00000000 --- a/src/WixToolset.Extensibility/IBinderFileManager.cs +++ /dev/null @@ -1,29 +0,0 @@ -// 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. - -namespace WixToolset.Extensibility -{ - using System.Collections.Generic; - using WixToolset.Data; - using WixToolset.Data.Rows; - - public interface IBinderFileManager - { - IBinderFileManagerCore Core { set; } - - ResolvedCabinet ResolveCabinet(string cabinetPath, IEnumerable files); - - string ResolveFile(string source, string type, SourceLineNumber sourceLineNumbers, BindStage bindStage); - - string ResolveRelatedFile(string source, string relatedSource, string type, SourceLineNumber sourceLineNumbers, BindStage bindStage); - - string ResolveMedia(MediaRow mediaRow, string mediaLayoutDirectory, string layoutDirectory); - - string ResolveUrl(string url, string fallbackUrl, string packageId, string payloadId, string fileName); - - bool? CompareFiles(string targetFile, string updatedFile); - - bool CopyFile(string source, string destination, bool overwrite); - - bool MoveFile(string source, string destination, bool overwrite); - } -} diff --git a/src/WixToolset.Extensibility/IBinderFileManagerCore.cs b/src/WixToolset.Extensibility/IBinderFileManagerCore.cs index f5adf4e1..c6d46e11 100644 --- a/src/WixToolset.Extensibility/IBinderFileManagerCore.cs +++ b/src/WixToolset.Extensibility/IBinderFileManagerCore.cs @@ -4,6 +4,7 @@ namespace WixToolset.Extensibility { using System.Collections.Generic; using WixToolset.Data; + using WixToolset.Data.Bind; public interface IBinderFileManagerCore : IMessageHandler { diff --git a/src/WixToolset.Extensibility/IBurnBackendExtension.cs b/src/WixToolset.Extensibility/IBurnBackendExtension.cs new file mode 100644 index 00000000..c8b8e407 --- /dev/null +++ b/src/WixToolset.Extensibility/IBurnBackendExtension.cs @@ -0,0 +1,25 @@ +// 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. + +namespace WixToolset.Extensibility +{ + using WixToolset.Data; + using WixToolset.Data.Bind; + using WixToolset.Extensibility.Services; + + public interface IBurnBackendExtension + { + /// + /// Called before binding occurs. + /// + void PreBackendBind(IBindContext context); + + string ResolveRelatedFile(string source, string relatedSource, string type, SourceLineNumber sourceLineNumbers, BindStage bindStage); + + string ResolveUrl(string url, string fallbackUrl, string packageId, string payloadId, string fileName); + + /// + /// Called after all output changes occur and right before the output is bound into its final format. + /// + void PostBackendBind(BindResult result); + } +} diff --git a/src/WixToolset.Extensibility/IDelayedField.cs b/src/WixToolset.Extensibility/IDelayedField.cs new file mode 100644 index 00000000..a6cc7a2e --- /dev/null +++ b/src/WixToolset.Extensibility/IDelayedField.cs @@ -0,0 +1,13 @@ +// 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. + +namespace WixToolset.Extensibility +{ + using WixToolset.Data; + + public interface IDelayedField + { + Field Field { get; } + + Row Row { get; } + } +} \ No newline at end of file diff --git a/src/WixToolset.Extensibility/IExpectedExtractFile.cs b/src/WixToolset.Extensibility/IExpectedExtractFile.cs new file mode 100644 index 00000000..06e4f77f --- /dev/null +++ b/src/WixToolset.Extensibility/IExpectedExtractFile.cs @@ -0,0 +1,15 @@ +// 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. + +namespace WixToolset.Extensibility +{ + using System; + + public interface IExpectedExtractFile + { + Uri Uri { get; set; } + + int EmbeddedFileIndex { get; set; } + + string OutputPath { get; set; } + } +} \ No newline at end of file diff --git a/src/WixToolset.Extensibility/IInscribeContext.cs b/src/WixToolset.Extensibility/IInscribeContext.cs new file mode 100644 index 00000000..6294271e --- /dev/null +++ b/src/WixToolset.Extensibility/IInscribeContext.cs @@ -0,0 +1,22 @@ +// 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. + +namespace WixToolset.Extensibility +{ + using System; + using WixToolset.Data; + + public interface IInscribeContext + { + IServiceProvider ServiceProvider { get; } + + string InputFilePath { get; set; } + + string IntermediateFolder { get; set; } + + Messaging Messaging { get; } + + string OutputFile { get; set; } + + string SignedEngineFile { get; set; } + } +} diff --git a/src/WixToolset.Extensibility/ILibrarianExtension.cs b/src/WixToolset.Extensibility/ILibrarianExtension.cs new file mode 100644 index 00000000..08d37607 --- /dev/null +++ b/src/WixToolset.Extensibility/ILibrarianExtension.cs @@ -0,0 +1,15 @@ +// 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. + +namespace WixToolset.Extensibility +{ + using WixToolset.Data; + + public interface ILibrarianExtension + { + void PreCombine(ILibraryContext context); + + string Resolve(SourceLineNumber sourceLineNumber, string table, string path); + + void PostCombine(Library library); + } +} diff --git a/src/WixToolset.Extensibility/ILibraryContext.cs b/src/WixToolset.Extensibility/ILibraryContext.cs new file mode 100644 index 00000000..4e13696b --- /dev/null +++ b/src/WixToolset.Extensibility/ILibraryContext.cs @@ -0,0 +1,20 @@ +// 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. + +namespace WixToolset.Extensibility +{ + using System.Collections.Generic; + using WixToolset.Data; + + public interface ILibraryContext + { + bool BindFiles { get; set; } + + IEnumerable Extensions { get; set; } + + IEnumerable Localizations { get; set; } + + IEnumerable
Sections { get; set; } + + IBindVariableResolver WixVariableResolver { get; set; } + } +} diff --git a/src/WixToolset.Extensibility/ILocalizer.cs b/src/WixToolset.Extensibility/ILocalizer.cs new file mode 100644 index 00000000..3ce29aab --- /dev/null +++ b/src/WixToolset.Extensibility/ILocalizer.cs @@ -0,0 +1,15 @@ +// 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. + +namespace WixToolset.Extensibility +{ + using WixToolset.Data; + + public interface ILocalizer + { + int Codepage { get; } + + string GetLocalizedValue(string id); + + LocalizedControl GetLocalizedControl(string dialog, string control); + } +} diff --git a/src/WixToolset.Extensibility/IUnbindContext.cs b/src/WixToolset.Extensibility/IUnbindContext.cs new file mode 100644 index 00000000..82364652 --- /dev/null +++ b/src/WixToolset.Extensibility/IUnbindContext.cs @@ -0,0 +1,23 @@ +// 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. + +namespace WixToolset.Extensibility +{ + using WixToolset.Data; + + public interface IUnbindContext + { + string ExportBasePath { get; set; } + + string InputFilePath { get; set; } + + string IntermediateFolder { get; set; } + + bool IsAdminImage { get; set; } + + Messaging Messaging { get; } + + bool SuppressDemodularization { get; set; } + + bool SuppressExtractCabinets { get; set; } + } +} \ No newline at end of file diff --git a/src/WixToolset.Extensibility/IWindowsInstallerBackendExtension.cs b/src/WixToolset.Extensibility/IWindowsInstallerBackendExtension.cs new file mode 100644 index 00000000..3b01cc0d --- /dev/null +++ b/src/WixToolset.Extensibility/IWindowsInstallerBackendExtension.cs @@ -0,0 +1,29 @@ +// 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. + +namespace WixToolset.Extensibility +{ + using System.Collections.Generic; + using WixToolset.Data.Rows; + using WixToolset.Data.Bind; + using WixToolset.Extensibility.Services; + + /// + /// Interface all binder extensions implement. + /// + public interface IWindowsInstallerBackendExtension + { + /// + /// Called before binding occurs. + /// + void PreBackendBind(IBindContext context); + + ResolvedCabinet ResolveCabinet(string cabinetPath, IEnumerable files); + + string ResolveMedia(MediaRow mediaRow, string mediaLayoutDirectory, string layoutDirectory); + + /// + /// Called after all output changes occur and right before the output is bound into its final format. + /// + void PostBackendBind(BindResult result); + } +} diff --git a/src/WixToolset.Extensibility/Identifier.cs b/src/WixToolset.Extensibility/Identifier.cs deleted file mode 100644 index 628cd335..00000000 --- a/src/WixToolset.Extensibility/Identifier.cs +++ /dev/null @@ -1,31 +0,0 @@ -// 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. - -namespace WixToolset.Extensibility -{ - using System; - using WixToolset.Data; - - /// - /// Class to define the identifier and access for a row. - /// - public class Identifier - { - public static Identifier Invalid = new Identifier(null, AccessModifier.Private); - - public Identifier(string id, AccessModifier access) - { - this.Id = id; - this.Access = access; - } - - /// - /// Access modifier for a row. - /// - public AccessModifier Access { get; private set; } - - /// - /// Identifier for the row. - /// - public string Id { get; private set; } - } -} diff --git a/src/WixToolset.Extensibility/Services/IBindContext.cs b/src/WixToolset.Extensibility/Services/IBindContext.cs new file mode 100644 index 00000000..ce78709b --- /dev/null +++ b/src/WixToolset.Extensibility/Services/IBindContext.cs @@ -0,0 +1,59 @@ +// 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. + +namespace WixToolset.Extensibility.Services +{ + using System; + using System.Collections.Generic; + using WixToolset.Data; + + public interface IBindContext + { + IServiceProvider ServiceProvider { get; } + + Messaging Messaging { get; set; } + + IEnumerable BindPaths { get; set; } + + int CabbingThreadCount { get; set; } + + string CabCachePath { get; set; } + + int Codepage { get; set; } + + CompressionLevel DefaultCompressionLevel { get; set; } + + IEnumerable DelayedFields { get; set; } + + IEnumerable ExpectedEmbeddedFiles { get; set; } + + IExtensionManager ExtensionManager { get; set; } + + IEnumerable Extensions { get; set; } + + IEnumerable Ices { get; set; } + + string IntermediateFolder { get; set; } + + Output IntermediateRepresentation { get; set; } + + string OutputPath { get; set; } + + string OutputPdbPath { get; set; } + + bool SuppressAclReset { get; set; } + + IEnumerable SuppressIces { get; set; } + + bool SuppressValidation { get; set; } + + IBindVariableResolver WixVariableResolver { get; set; } + + string ContentsFile { get; set; } + + string OutputsFile { get; set; } + + string BuiltOutputsFile { get; set; } + + string WixprojectFile { get; set; } + } +} diff --git a/src/WixToolset.Extensibility/Services/ICommandLine.cs b/src/WixToolset.Extensibility/Services/ICommandLine.cs new file mode 100644 index 00000000..9dd247ff --- /dev/null +++ b/src/WixToolset.Extensibility/Services/ICommandLine.cs @@ -0,0 +1,9 @@ +// 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. + +namespace WixToolset.Extensibility.Services +{ + public interface ICommandLine + { + ICommandLineCommand ParseStandardCommandLine(ICommandLineContext commandLineContext); + } +} diff --git a/src/WixToolset.Extensibility/Services/ICommandLineCommand.cs b/src/WixToolset.Extensibility/Services/ICommandLineCommand.cs new file mode 100644 index 00000000..f2333c55 --- /dev/null +++ b/src/WixToolset.Extensibility/Services/ICommandLineCommand.cs @@ -0,0 +1,9 @@ +// 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. + +namespace WixToolset.Extensibility.Services +{ + public interface ICommandLineCommand + { + int Execute(); + } +} diff --git a/src/WixToolset.Extensibility/Services/ICommandLineContext.cs b/src/WixToolset.Extensibility/Services/ICommandLineContext.cs new file mode 100644 index 00000000..0e040d7f --- /dev/null +++ b/src/WixToolset.Extensibility/Services/ICommandLineContext.cs @@ -0,0 +1,20 @@ +// 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. + +namespace WixToolset.Extensibility.Services +{ + using System; + using WixToolset.Data; + + public interface ICommandLineContext + { + IServiceProvider ServiceProvider { get; } + + Messaging Messaging { get; set; } + + IExtensionManager ExtensionManager { get; set; } + + string Arguments { get; set; } + + string[] ParsedArguments { get; set; } + } +} diff --git a/src/WixToolset.Extensibility/Services/IExtensionManager.cs b/src/WixToolset.Extensibility/Services/IExtensionManager.cs new file mode 100644 index 00000000..1d693ee4 --- /dev/null +++ b/src/WixToolset.Extensibility/Services/IExtensionManager.cs @@ -0,0 +1,16 @@ +// 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. + +namespace WixToolset.Extensibility.Services +{ + using System.Collections.Generic; + using System.Reflection; + + public interface IExtensionManager + { + Assembly Add(Assembly assembly); + + Assembly Load(string extension); + + IEnumerable Create() where T : class; + } +} diff --git a/src/WixToolset.Extensibility/Services/ServiceProviderExtensions.cs b/src/WixToolset.Extensibility/Services/ServiceProviderExtensions.cs new file mode 100644 index 00000000..f4a5e8c3 --- /dev/null +++ b/src/WixToolset.Extensibility/Services/ServiceProviderExtensions.cs @@ -0,0 +1,14 @@ +// 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. + +namespace WixToolset.Extensibility.Services +{ + using System; + + public static class ServiceProviderExtensions + { + public static T GetService(this IServiceProvider serviceProvider) where T : class + { + return (T)serviceProvider.GetService(typeof(T)); + } + } +} -- cgit v1.2.3-55-g6feb From f87ec715a88a78a6d7788503da2ebec786544e75 Mon Sep 17 00:00:00 2001 From: Rob Mensching Date: Wed, 1 Nov 2017 10:59:13 -0700 Subject: Update to WiX Intermediate Representation --- .../BinderExtensionBase.cs | 2 +- src/WixToolset.Extensibility/CompilerExtension.cs | 5 +++-- .../DecompilerExtension.cs | 2 ++ src/WixToolset.Extensibility/ExtensionData.cs | 2 ++ src/WixToolset.Extensibility/ExtensionHelper.cs | 2 ++ src/WixToolset.Extensibility/IBackend.cs | 2 +- .../IBindVariableResolver.cs | 4 ++-- src/WixToolset.Extensibility/IBinderCore.cs | 2 +- src/WixToolset.Extensibility/IBinderExtension.cs | 2 +- .../IBinderFileManagerCore.cs | 4 ++-- src/WixToolset.Extensibility/ICompileContext.cs | 26 ++++++++++++++++++++++ src/WixToolset.Extensibility/ICompilerCore.cs | 2 +- src/WixToolset.Extensibility/ICompilerExtension.cs | 9 +++++--- src/WixToolset.Extensibility/IDecompilerCore.cs | 8 +++---- .../IDecompilerExtension.cs | 10 ++++----- src/WixToolset.Extensibility/IDelayedField.cs | 4 ++-- src/WixToolset.Extensibility/IExtensionData.cs | 16 +++++++------ .../IInspectorExtension.cs | 4 ++-- .../ILibrarianExtension.cs | 2 +- src/WixToolset.Extensibility/ILibraryContext.cs | 11 ++++++++- src/WixToolset.Extensibility/ILinkerExtension.cs | 23 +++++++++++++++++++ src/WixToolset.Extensibility/IUnbinderExtension.cs | 2 +- .../IWindowsInstallerBackendExtension.cs | 4 ++-- src/WixToolset.Extensibility/InspectorExtension.cs | 2 ++ .../Services/IBindContext.cs | 2 +- .../Services/ILinkContext.cs | 21 +++++++++++++++++ 26 files changed, 133 insertions(+), 40 deletions(-) create mode 100644 src/WixToolset.Extensibility/ICompileContext.cs create mode 100644 src/WixToolset.Extensibility/ILinkerExtension.cs create mode 100644 src/WixToolset.Extensibility/Services/ILinkContext.cs diff --git a/src/WixToolset.Extensibility/BinderExtensionBase.cs b/src/WixToolset.Extensibility/BinderExtensionBase.cs index a0b34a31..f3f3d63b 100644 --- a/src/WixToolset.Extensibility/BinderExtensionBase.cs +++ b/src/WixToolset.Extensibility/BinderExtensionBase.cs @@ -21,7 +21,7 @@ namespace WixToolset.Extensibility /// /// Called after variable resolution occurs. /// - public virtual void AfterResolvedFields(Output output) + public virtual void AfterResolvedFields(Intermediate intermediate) { } diff --git a/src/WixToolset.Extensibility/CompilerExtension.cs b/src/WixToolset.Extensibility/CompilerExtension.cs index 522ffcf8..d0bb4a10 100644 --- a/src/WixToolset.Extensibility/CompilerExtension.cs +++ b/src/WixToolset.Extensibility/CompilerExtension.cs @@ -4,6 +4,7 @@ namespace WixToolset.Extensibility { using System.Collections.Generic; using System.Xml.Linq; + using WixToolset.Data; /// /// Base class for creating a compiler extension. @@ -25,7 +26,7 @@ namespace WixToolset.Extensibility /// /// Called at the beginning of the compilation of a source file. /// - public virtual void Initialize() + public virtual void PreCompile(ICompileContext context) { } @@ -67,7 +68,7 @@ namespace WixToolset.Extensibility /// /// Called at the end of the compilation of a source file. /// - public virtual void Finish() + public virtual void PostCompile(Intermediate intermediate) { } } diff --git a/src/WixToolset.Extensibility/DecompilerExtension.cs b/src/WixToolset.Extensibility/DecompilerExtension.cs index 00277639..b492cf3a 100644 --- a/src/WixToolset.Extensibility/DecompilerExtension.cs +++ b/src/WixToolset.Extensibility/DecompilerExtension.cs @@ -4,6 +4,7 @@ namespace WixToolset.Extensibility { using WixToolset.Data; +#if BRING_BACK_LATER /// /// Base class for creating a decompiler extension. /// @@ -56,4 +57,5 @@ namespace WixToolset.Extensibility { } } +#endif } diff --git a/src/WixToolset.Extensibility/ExtensionData.cs b/src/WixToolset.Extensibility/ExtensionData.cs index 4cf262b9..0cd0c420 100644 --- a/src/WixToolset.Extensibility/ExtensionData.cs +++ b/src/WixToolset.Extensibility/ExtensionData.cs @@ -8,6 +8,7 @@ namespace WixToolset.Extensibility using System.Xml; using WixToolset.Data; +#if BRING_BACK_LATER public abstract class ExtensionData : IExtensionData { /// @@ -72,4 +73,5 @@ namespace WixToolset.Extensibility } } } +#endif } diff --git a/src/WixToolset.Extensibility/ExtensionHelper.cs b/src/WixToolset.Extensibility/ExtensionHelper.cs index 9c1ca950..6b938a65 100644 --- a/src/WixToolset.Extensibility/ExtensionHelper.cs +++ b/src/WixToolset.Extensibility/ExtensionHelper.cs @@ -10,6 +10,7 @@ namespace WixToolset.Extensibility using WixToolset.Data; using WixToolset.Extensibility; +#if BRING_BACK_LATER /// /// The main class for a WiX extension. /// @@ -50,4 +51,5 @@ namespace WixToolset.Extensibility } } } +#endif } diff --git a/src/WixToolset.Extensibility/IBackend.cs b/src/WixToolset.Extensibility/IBackend.cs index e38de544..9b950364 100644 --- a/src/WixToolset.Extensibility/IBackend.cs +++ b/src/WixToolset.Extensibility/IBackend.cs @@ -10,7 +10,7 @@ namespace WixToolset.Extensibility { BindResult Bind(IBindContext context); - Output Unbind(IUnbindContext context); + Intermediate Unbind(IUnbindContext context); bool Inscribe(IInscribeContext context); } diff --git a/src/WixToolset.Extensibility/IBindVariableResolver.cs b/src/WixToolset.Extensibility/IBindVariableResolver.cs index 4c2c3003..f584f327 100644 --- a/src/WixToolset.Extensibility/IBindVariableResolver.cs +++ b/src/WixToolset.Extensibility/IBindVariableResolver.cs @@ -3,7 +3,7 @@ namespace WixToolset.Extensibility { using WixToolset.Data; - using WixToolset.Data.Rows; + using WixToolset.Data.Tuples; public interface IBindVariableResolver { @@ -11,7 +11,7 @@ namespace WixToolset.Extensibility void AddVariable(string name, string value); - void AddVariable(WixVariableRow wixVariableRow); + void AddVariable(WixVariableTuple wixVariableRow); string ResolveVariables(SourceLineNumber sourceLineNumbers, string value, bool localizationOnly); diff --git a/src/WixToolset.Extensibility/IBinderCore.cs b/src/WixToolset.Extensibility/IBinderCore.cs index a4044c11..dd3fa3fe 100644 --- a/src/WixToolset.Extensibility/IBinderCore.cs +++ b/src/WixToolset.Extensibility/IBinderCore.cs @@ -22,7 +22,7 @@ namespace WixToolset.Extensibility /// Gets the table definitions used by the Binder. /// /// Table definitions used by the binder. - TableDefinitionCollection TableDefinitions { get; } + //TableDefinitionCollection TableDefinitions { get; } /// /// Generate an identifier by hashing data from the row. diff --git a/src/WixToolset.Extensibility/IBinderExtension.cs b/src/WixToolset.Extensibility/IBinderExtension.cs index 9673d60e..0e9df10b 100644 --- a/src/WixToolset.Extensibility/IBinderExtension.cs +++ b/src/WixToolset.Extensibility/IBinderExtension.cs @@ -19,7 +19,7 @@ namespace WixToolset.Extensibility /// /// Called after variable resolution occurs. /// - void AfterResolvedFields(Output output); + void AfterResolvedFields(Intermediate intermediate); string ResolveFile(string source, string type, SourceLineNumber sourceLineNumbers, BindStage bindStage); diff --git a/src/WixToolset.Extensibility/IBinderFileManagerCore.cs b/src/WixToolset.Extensibility/IBinderFileManagerCore.cs index c6d46e11..b73acb6b 100644 --- a/src/WixToolset.Extensibility/IBinderFileManagerCore.cs +++ b/src/WixToolset.Extensibility/IBinderFileManagerCore.cs @@ -18,13 +18,13 @@ namespace WixToolset.Extensibility /// Gets or sets the active subStorage used for binding. /// /// The subStorage object. - SubStorage ActiveSubStorage { get; } + //SubStorage ActiveSubStorage { get; } /// /// Gets or sets the output object used for binding. /// /// The output object. - Output Output { get; } + Intermediate Intermediate { get; } /// /// Gets or sets the path to the temp files location. diff --git a/src/WixToolset.Extensibility/ICompileContext.cs b/src/WixToolset.Extensibility/ICompileContext.cs new file mode 100644 index 00000000..d48e9539 --- /dev/null +++ b/src/WixToolset.Extensibility/ICompileContext.cs @@ -0,0 +1,26 @@ +// 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. + +namespace WixToolset.Extensibility +{ + using System; + using System.Collections.Generic; + using System.Xml.Linq; + using WixToolset.Data; + + public interface ICompileContext + { + IServiceProvider ServiceProvider { get; } + + Messaging Messaging { get; set; } + + string CompilationId { get; set; } + + IEnumerable Extensions { get; set; } + + string OutputPath { get; set; } + + Platform Platform { get; set; } + + XDocument Source { get; set; } + } +} diff --git a/src/WixToolset.Extensibility/ICompilerCore.cs b/src/WixToolset.Extensibility/ICompilerCore.cs index b2ad6abd..d71f9cbe 100644 --- a/src/WixToolset.Extensibility/ICompilerCore.cs +++ b/src/WixToolset.Extensibility/ICompilerCore.cs @@ -62,7 +62,7 @@ namespace WixToolset.Extensibility /// Name of table to create row in. /// Optional identifier for the row. /// New row. - Row CreateRow(SourceLineNumber sourceLineNumbers, string tableName, Identifier identifier = null); + IntermediateTuple CreateRow(SourceLineNumber sourceLineNumbers, string tableName, Identifier identifier = null); /// /// Creates directories using the inline directory syntax. diff --git a/src/WixToolset.Extensibility/ICompilerExtension.cs b/src/WixToolset.Extensibility/ICompilerExtension.cs index edd7aa15..1746a571 100644 --- a/src/WixToolset.Extensibility/ICompilerExtension.cs +++ b/src/WixToolset.Extensibility/ICompilerExtension.cs @@ -4,18 +4,21 @@ namespace WixToolset.Extensibility { using System.Collections.Generic; using System.Xml.Linq; + using WixToolset.Data; + using WixToolset.Extensibility.Services; /// /// Interface all compiler extensions implement. /// public interface ICompilerExtension { +#if false /// /// Gets or sets the compiler core for the extension. /// /// Compiler core for the extension. ICompilerCore Core { get; set; } - +#endif /// /// Gets the schema namespace for this extension. /// @@ -25,7 +28,7 @@ namespace WixToolset.Extensibility /// /// Called at the beginning of the compilation of a source file. /// - void Initialize(); + void PreCompile(ICompileContext context); /// /// Processes an attribute for the Compiler. @@ -54,6 +57,6 @@ namespace WixToolset.Extensibility /// /// Called at the end of the compilation of a source file. /// - void Finish(); + void PostCompile(Intermediate intermediate); } } diff --git a/src/WixToolset.Extensibility/IDecompilerCore.cs b/src/WixToolset.Extensibility/IDecompilerCore.cs index d18d5170..1c367e0c 100644 --- a/src/WixToolset.Extensibility/IDecompilerCore.cs +++ b/src/WixToolset.Extensibility/IDecompilerCore.cs @@ -47,7 +47,7 @@ namespace WixToolset.Extensibility /// /// The row corresponding to the element. /// The indexed element. - Wix.ISchemaElement GetIndexedElement(Row row); + Wix.ISchemaElement GetIndexedElement(IntermediateTuple row); /// /// Gets the element corresponding to the primary key of the given table. @@ -62,12 +62,12 @@ namespace WixToolset.Extensibility /// /// The row corresponding to the element. /// The element to index. - void IndexElement(Row row, Wix.ISchemaElement element); + void IndexElement(IntermediateTuple row, Wix.ISchemaElement element); - /// + /// /// Indicates the decompiler encountered and unexpected table to decompile. /// /// Unknown decompiled table. - void UnexpectedTable(Table table); + void UnexpectedTable(string table); } } diff --git a/src/WixToolset.Extensibility/IDecompilerExtension.cs b/src/WixToolset.Extensibility/IDecompilerExtension.cs index 6124f348..1574f964 100644 --- a/src/WixToolset.Extensibility/IDecompilerExtension.cs +++ b/src/WixToolset.Extensibility/IDecompilerExtension.cs @@ -19,31 +19,31 @@ namespace WixToolset.Extensibility /// Gets the table definitions this extension decompiles. /// /// Table definitions this extension decompiles. - TableDefinitionCollection TableDefinitions { get; } + //TableDefinitionCollection TableDefinitions { get; } /// /// Gets the library that this decompiler wants removed from the decomipiled output. /// /// The table definitions to use while loading the library. /// The library for this extension or null if there is no library to be removed. - Library GetLibraryToRemove(TableDefinitionCollection tableDefinitions); + //Library GetLibraryToRemove(TableDefinitionCollection tableDefinitions); /// /// Called at the beginning of the decompilation of a database. /// /// The collection of all tables. - void Initialize(TableIndexedCollection tables); + //void Initialize(TableIndexedCollection tables); /// /// Decompiles an extension table. /// /// The table to decompile. - void DecompileTable(Table table); + //void DecompileTable(Table table); /// /// Finalize decompilation. /// /// The collection of all tables. - void Finish(TableIndexedCollection tables); + //void Finish(TableIndexedCollection tables); } } diff --git a/src/WixToolset.Extensibility/IDelayedField.cs b/src/WixToolset.Extensibility/IDelayedField.cs index a6cc7a2e..e06dbe59 100644 --- a/src/WixToolset.Extensibility/IDelayedField.cs +++ b/src/WixToolset.Extensibility/IDelayedField.cs @@ -6,8 +6,8 @@ namespace WixToolset.Extensibility public interface IDelayedField { - Field Field { get; } + IntermediateField Field { get; } - Row Row { get; } + IntermediateTuple Row { get; } } } \ No newline at end of file diff --git a/src/WixToolset.Extensibility/IExtensionData.cs b/src/WixToolset.Extensibility/IExtensionData.cs index 19e23590..f0e339d4 100644 --- a/src/WixToolset.Extensibility/IExtensionData.cs +++ b/src/WixToolset.Extensibility/IExtensionData.cs @@ -9,23 +9,25 @@ namespace WixToolset.Extensibility /// public interface IExtensionData { - /// - /// Gets the table definitions for this extension. - /// - /// Table definisions for this extension or null if there are no table definitions. - TableDefinitionCollection TableDefinitions { get; } - /// /// Gets the optional default culture. /// /// The optional default culture. string DefaultCulture { get; } + /// + /// + /// + /// + /// + /// True + bool TryGetTupleDefinitionByName(string name, out IntermediateTupleDefinition tupleDefinition); + /// /// Gets the library associated with this extension. /// /// The table definitions to use while loading the library. /// The library for this extension or null if there is no library. - Library GetLibrary(TableDefinitionCollection tableDefinitions); + Library GetLibrary(ITupleDefinitionCreator tupleDefinitions); } } diff --git a/src/WixToolset.Extensibility/IInspectorExtension.cs b/src/WixToolset.Extensibility/IInspectorExtension.cs index b2a098b7..6c4be1e5 100644 --- a/src/WixToolset.Extensibility/IInspectorExtension.cs +++ b/src/WixToolset.Extensibility/IInspectorExtension.cs @@ -46,7 +46,7 @@ namespace WixToolset.Extensibility /// transforms are the primary transforms you'll typically want to inspect /// and contain your changes to target products. /// - void InspectOutput(Output output); + void InspectOutput(Intermediate output); /// /// Inspect the final output after binding. @@ -54,6 +54,6 @@ namespace WixToolset.Extensibility /// The file path to the final bound output. /// The that contains source line numbers /// for the database and all rows. - void InspectDatabase(string filePath, Pdb pdb); + void InspectDatabase(string filePath, Intermediate pdb); } } diff --git a/src/WixToolset.Extensibility/ILibrarianExtension.cs b/src/WixToolset.Extensibility/ILibrarianExtension.cs index 08d37607..ae4529d8 100644 --- a/src/WixToolset.Extensibility/ILibrarianExtension.cs +++ b/src/WixToolset.Extensibility/ILibrarianExtension.cs @@ -10,6 +10,6 @@ namespace WixToolset.Extensibility string Resolve(SourceLineNumber sourceLineNumber, string table, string path); - void PostCombine(Library library); + void PostCombine(Intermediate library); } } diff --git a/src/WixToolset.Extensibility/ILibraryContext.cs b/src/WixToolset.Extensibility/ILibraryContext.cs index 4e13696b..b8c1887a 100644 --- a/src/WixToolset.Extensibility/ILibraryContext.cs +++ b/src/WixToolset.Extensibility/ILibraryContext.cs @@ -2,18 +2,27 @@ namespace WixToolset.Extensibility { + using System; using System.Collections.Generic; using WixToolset.Data; public interface ILibraryContext { + IServiceProvider ServiceProvider { get; } + + Messaging Messaging { get; set; } + bool BindFiles { get; set; } + IEnumerable BindPaths { get; set; } + IEnumerable Extensions { get; set; } + string LibraryId { get; set; } + IEnumerable Localizations { get; set; } - IEnumerable
Sections { get; set; } + IEnumerable Intermediates { get; set; } IBindVariableResolver WixVariableResolver { get; set; } } diff --git a/src/WixToolset.Extensibility/ILinkerExtension.cs b/src/WixToolset.Extensibility/ILinkerExtension.cs new file mode 100644 index 00000000..cb82720a --- /dev/null +++ b/src/WixToolset.Extensibility/ILinkerExtension.cs @@ -0,0 +1,23 @@ +// 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. + +namespace WixToolset.Extensibility +{ + using WixToolset.Data; + using WixToolset.Extensibility.Services; + + /// + /// Interface all binder extensions implement. + /// + public interface ILinkerExtension + { + /// + /// Called before linking occurs. + /// + void PreLink(ILinkContext context); + + /// + /// Called after all linking occurs. + /// + void PostLink(Intermediate intermediate); + } +} diff --git a/src/WixToolset.Extensibility/IUnbinderExtension.cs b/src/WixToolset.Extensibility/IUnbinderExtension.cs index 88bf20d9..0e9a2504 100644 --- a/src/WixToolset.Extensibility/IUnbinderExtension.cs +++ b/src/WixToolset.Extensibility/IUnbinderExtension.cs @@ -13,6 +13,6 @@ namespace WixToolset.Extensibility /// /// Called during the generation of sectionIds for an admin image. /// - void GenerateSectionIds(Output output); + void GenerateSectionIds(Intermediate output); } } diff --git a/src/WixToolset.Extensibility/IWindowsInstallerBackendExtension.cs b/src/WixToolset.Extensibility/IWindowsInstallerBackendExtension.cs index 3b01cc0d..f6ffc69c 100644 --- a/src/WixToolset.Extensibility/IWindowsInstallerBackendExtension.cs +++ b/src/WixToolset.Extensibility/IWindowsInstallerBackendExtension.cs @@ -3,8 +3,8 @@ namespace WixToolset.Extensibility { using System.Collections.Generic; - using WixToolset.Data.Rows; using WixToolset.Data.Bind; + using WixToolset.Data.Tuples; using WixToolset.Extensibility.Services; /// @@ -19,7 +19,7 @@ namespace WixToolset.Extensibility ResolvedCabinet ResolveCabinet(string cabinetPath, IEnumerable files); - string ResolveMedia(MediaRow mediaRow, string mediaLayoutDirectory, string layoutDirectory); + string ResolveMedia(MediaTuple mediaRow, string mediaLayoutDirectory, string layoutDirectory); /// /// Called after all output changes occur and right before the output is bound into its final format. diff --git a/src/WixToolset.Extensibility/InspectorExtension.cs b/src/WixToolset.Extensibility/InspectorExtension.cs index 82b1ef02..49c3f9de 100644 --- a/src/WixToolset.Extensibility/InspectorExtension.cs +++ b/src/WixToolset.Extensibility/InspectorExtension.cs @@ -6,6 +6,7 @@ namespace WixToolset.Extensibility using System.IO; using WixToolset.Data; +#if BRING_THIS_BACK /// /// Opitonal base class for inspector extensions. /// @@ -58,4 +59,5 @@ namespace WixToolset.Extensibility { } } +#endif } diff --git a/src/WixToolset.Extensibility/Services/IBindContext.cs b/src/WixToolset.Extensibility/Services/IBindContext.cs index ce78709b..6bed0ef6 100644 --- a/src/WixToolset.Extensibility/Services/IBindContext.cs +++ b/src/WixToolset.Extensibility/Services/IBindContext.cs @@ -34,7 +34,7 @@ namespace WixToolset.Extensibility.Services string IntermediateFolder { get; set; } - Output IntermediateRepresentation { get; set; } + Intermediate IntermediateRepresentation { get; set; } string OutputPath { get; set; } diff --git a/src/WixToolset.Extensibility/Services/ILinkContext.cs b/src/WixToolset.Extensibility/Services/ILinkContext.cs new file mode 100644 index 00000000..8c5b3c65 --- /dev/null +++ b/src/WixToolset.Extensibility/Services/ILinkContext.cs @@ -0,0 +1,21 @@ +// 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. + +namespace WixToolset.Extensibility.Services +{ + using System; + using System.Collections.Generic; + using WixToolset.Data; + + public interface ILinkContext + { + IServiceProvider ServiceProvider { get; } + + Messaging Messaging { get; set; } + + IEnumerable Extensions { get; set; } + + OutputType ExpectedOutputType { get; set; } + + IEnumerable Intermediates { get; set; } + } +} -- cgit v1.2.3-55-g6feb From 3f6e936c5e9d7a9df7e3e0ed1bc17001c53db5b3 Mon Sep 17 00:00:00 2001 From: Rob Mensching Date: Sat, 11 Nov 2017 12:40:51 -0800 Subject: Introduce IExtensionFactory as mechanism to create extensions --- src/WixToolset.Extensibility/IExtensionFactory.cs | 17 +++++++++++++ .../Services/IExtensionManager.cs | 28 ++++++++++++++++++++-- 2 files changed, 43 insertions(+), 2 deletions(-) create mode 100644 src/WixToolset.Extensibility/IExtensionFactory.cs diff --git a/src/WixToolset.Extensibility/IExtensionFactory.cs b/src/WixToolset.Extensibility/IExtensionFactory.cs new file mode 100644 index 00000000..234f64fa --- /dev/null +++ b/src/WixToolset.Extensibility/IExtensionFactory.cs @@ -0,0 +1,17 @@ +// 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. + +namespace WixToolset.Extensibility +{ + using System; + + public interface IExtensionFactory + { + /// + /// Request to create an extension of the specified type. + /// + /// Extension type to create. + /// Extension created. + /// True if extension was created; otherwise false. + bool TryCreateExtension(Type extensionType, out object extension); + } +} diff --git a/src/WixToolset.Extensibility/Services/IExtensionManager.cs b/src/WixToolset.Extensibility/Services/IExtensionManager.cs index 1d693ee4..32ee85a5 100644 --- a/src/WixToolset.Extensibility/Services/IExtensionManager.cs +++ b/src/WixToolset.Extensibility/Services/IExtensionManager.cs @@ -7,10 +7,34 @@ namespace WixToolset.Extensibility.Services public interface IExtensionManager { - Assembly Add(Assembly assembly); + /// + /// Adds an extension assembly directly to the manager. + /// + /// Extension assembly. + void Add(Assembly extensionAssembly); - Assembly Load(string extension); + /// + /// Loads an extension assembly from a type description string. + /// + /// The assembly type description string. + /// The loaded assembly. This assembly can be ignored since the extension manager maintains the list of loaded assemblies internally. + /// + /// can be in several different forms: + /// + /// AssemblyName (MyAssembly, Version=1.3.0.0, Culture=neutral, PublicKeyToken=b17a5c561934e089) + /// Absolute path to an assembly (C:\MyExtensions\ExtensionAssembly.dll) + /// Filename of an assembly in the application directory (ExtensionAssembly.dll) + /// Relative path to an assembly (..\..\MyExtensions\ExtensionAssembly.dll) + /// + /// + void Load(string extensionPath); + + /// + /// Creates extension of specified type from factories loaded into the extension manager. + /// + /// Type of extension to create. + /// Extensions created of the specified type. IEnumerable Create() where T : class; } } -- cgit v1.2.3-55-g6feb From 404f34f00ecce034a8a06fe4757789c6ce62f3f6 Mon Sep 17 00:00:00 2001 From: Rob Mensching Date: Tue, 14 Nov 2017 23:08:24 -0800 Subject: Remove ICompilerCore, introduce IParseHelper and other small fixes --- .../BaseCompilerExtension.cs | 76 +++++ src/WixToolset.Extensibility/CompilerConstants.cs | 2 +- src/WixToolset.Extensibility/CompilerExtension.cs | 75 ----- src/WixToolset.Extensibility/ComponentKeyPath.cs | 2 - src/WixToolset.Extensibility/IBinderCore.cs | 35 --- src/WixToolset.Extensibility/ICompileContext.cs | 4 + src/WixToolset.Extensibility/ICompilerCore.cs | 339 --------------------- src/WixToolset.Extensibility/ICompilerExtension.cs | 14 +- .../Services/IParseHelper.cs | 334 ++++++++++++++++++++ 9 files changed, 418 insertions(+), 463 deletions(-) create mode 100644 src/WixToolset.Extensibility/BaseCompilerExtension.cs delete mode 100644 src/WixToolset.Extensibility/CompilerExtension.cs delete mode 100644 src/WixToolset.Extensibility/IBinderCore.cs delete mode 100644 src/WixToolset.Extensibility/ICompilerCore.cs create mode 100644 src/WixToolset.Extensibility/Services/IParseHelper.cs diff --git a/src/WixToolset.Extensibility/BaseCompilerExtension.cs b/src/WixToolset.Extensibility/BaseCompilerExtension.cs new file mode 100644 index 00000000..508886d3 --- /dev/null +++ b/src/WixToolset.Extensibility/BaseCompilerExtension.cs @@ -0,0 +1,76 @@ +// 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. + +namespace WixToolset.Extensibility +{ + using System.Collections.Generic; + using System.Xml.Linq; + using WixToolset.Data; + using WixToolset.Extensibility.Services; + + /// + /// Base class for creating a compiler extension. + /// + public abstract class BaseCompilerExtension : ICompilerExtension + { + /// + /// ParserHelper for use by the extension. + /// + protected IParseHelper ParseHelper { get; private set; } + + /// + /// Gets the schema namespace for this extension. + /// + /// Schema namespace supported by this extension. + public XNamespace Namespace { get; protected set; } + + /// + /// Called at the beginning of the compilation of a source file. + /// + public virtual void PreCompile(ICompileContext context) + { + this.ParseHelper = context.ServiceProvider.GetService(); + } + + /// + /// Processes an attribute for the Compiler. + /// + /// Parent element of attribute. + /// Attribute to process. + /// Extra information about the context in which this element is being parsed. + public virtual void ParseAttribute(Intermediate intermediate, IntermediateSection section, XElement parentElement, XAttribute attribute, IDictionary context) + { + this.ParseHelper.UnexpectedAttribute(parentElement, attribute); + } + + /// + /// Processes an element for the Compiler. + /// + /// Parent element of element to process. + /// Element to process. + /// Extra information about the context in which this element is being parsed. + public virtual void ParseElement(Intermediate intermediate, IntermediateSection section, XElement parentElement, XElement element, IDictionary context) + { + this.ParseHelper.UnexpectedElement(parentElement, element); + } + + /// + /// Processes an element for the Compiler, with the ability to supply a component keypath. + /// + /// Parent element of element to process. + /// Element to process. + /// Explicit key path. + /// Extra information about the context in which this element is being parsed. + public virtual ComponentKeyPath ParsePossibleKeyPathElement(Intermediate intermediate, IntermediateSection section, XElement parentElement, XElement element, IDictionary context) + { + this.ParseElement(intermediate, section, parentElement, element, context); + return null; + } + + /// + /// Called at the end of the compilation of a source file. + /// + public virtual void PostCompile(Intermediate intermediate) + { + } + } +} diff --git a/src/WixToolset.Extensibility/CompilerConstants.cs b/src/WixToolset.Extensibility/CompilerConstants.cs index 6d4ca742..9f666b43 100644 --- a/src/WixToolset.Extensibility/CompilerConstants.cs +++ b/src/WixToolset.Extensibility/CompilerConstants.cs @@ -1,6 +1,6 @@ // 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. -namespace WixToolset +namespace WixToolset.Extensibility { using System; diff --git a/src/WixToolset.Extensibility/CompilerExtension.cs b/src/WixToolset.Extensibility/CompilerExtension.cs deleted file mode 100644 index d0bb4a10..00000000 --- a/src/WixToolset.Extensibility/CompilerExtension.cs +++ /dev/null @@ -1,75 +0,0 @@ -// 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. - -namespace WixToolset.Extensibility -{ - using System.Collections.Generic; - using System.Xml.Linq; - using WixToolset.Data; - - /// - /// Base class for creating a compiler extension. - /// - public abstract class CompilerExtension : ICompilerExtension - { - /// - /// Gets or sets the compiler core for the extension. - /// - /// Compiler core for the extension. - public ICompilerCore Core { get; set; } - - /// - /// Gets the schema namespace for this extension. - /// - /// Schema namespace supported by this extension. - public XNamespace Namespace { get; protected set; } - - /// - /// Called at the beginning of the compilation of a source file. - /// - public virtual void PreCompile(ICompileContext context) - { - } - - /// - /// Processes an attribute for the Compiler. - /// - /// Parent element of attribute. - /// Attribute to process. - /// Extra information about the context in which this element is being parsed. - public virtual void ParseAttribute(XElement parentElement, XAttribute attribute, IDictionary context) - { - this.Core.UnexpectedAttribute(parentElement, attribute); - } - - /// - /// Processes an element for the Compiler. - /// - /// Parent element of element to process. - /// Element to process. - /// Extra information about the context in which this element is being parsed. - public virtual void ParseElement(XElement parentElement, XElement element, IDictionary context) - { - this.Core.UnexpectedElement(parentElement, element); - } - - /// - /// Processes an element for the Compiler, with the ability to supply a component keypath. - /// - /// Parent element of element to process. - /// Element to process. - /// Explicit key path. - /// Extra information about the context in which this element is being parsed. - public virtual ComponentKeyPath ParsePossibleKeyPathElement(XElement parentElement, XElement element, IDictionary context) - { - this.ParseElement(parentElement, element, context); - return null; - } - - /// - /// Called at the end of the compilation of a source file. - /// - public virtual void PostCompile(Intermediate intermediate) - { - } - } -} diff --git a/src/WixToolset.Extensibility/ComponentKeyPath.cs b/src/WixToolset.Extensibility/ComponentKeyPath.cs index f00e8f74..15cbb02f 100644 --- a/src/WixToolset.Extensibility/ComponentKeyPath.cs +++ b/src/WixToolset.Extensibility/ComponentKeyPath.cs @@ -2,8 +2,6 @@ namespace WixToolset.Extensibility { - using System; - public enum ComponentKeyPathType { /// diff --git a/src/WixToolset.Extensibility/IBinderCore.cs b/src/WixToolset.Extensibility/IBinderCore.cs deleted file mode 100644 index dd3fa3fe..00000000 --- a/src/WixToolset.Extensibility/IBinderCore.cs +++ /dev/null @@ -1,35 +0,0 @@ -// 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. - -namespace WixToolset.Extensibility -{ - using WixToolset.Data; - - public interface IBinderCore : IMessageHandler - { - /// - /// Gets or sets the file manager core for the extension. - /// - /// File manager core for the extension. - IBinderFileManagerCore FileManagerCore { get; set; } - - /// - /// Gets whether the binder core encountered an error while processing. - /// - /// Flag if core encountered an error during processing. - bool EncounteredError { get; } - - /// - /// Gets the table definitions used by the Binder. - /// - /// Table definitions used by the binder. - //TableDefinitionCollection TableDefinitions { get; } - - /// - /// Generate an identifier by hashing data from the row. - /// - /// Three letter or less prefix for generated row identifier. - /// Information to hash. - /// The generated identifier. - string CreateIdentifier(string prefix, params string[] args); - } -} diff --git a/src/WixToolset.Extensibility/ICompileContext.cs b/src/WixToolset.Extensibility/ICompileContext.cs index d48e9539..bd0d0a4b 100644 --- a/src/WixToolset.Extensibility/ICompileContext.cs +++ b/src/WixToolset.Extensibility/ICompileContext.cs @@ -19,6 +19,10 @@ namespace WixToolset.Extensibility string OutputPath { get; set; } + /// + /// Gets or sets the platform which the compiler will use when defaulting 64-bit attributes and elements. + /// + /// The platform which the compiler will use when defaulting 64-bit attributes and elements. Platform Platform { get; set; } XDocument Source { get; set; } diff --git a/src/WixToolset.Extensibility/ICompilerCore.cs b/src/WixToolset.Extensibility/ICompilerCore.cs deleted file mode 100644 index d71f9cbe..00000000 --- a/src/WixToolset.Extensibility/ICompilerCore.cs +++ /dev/null @@ -1,339 +0,0 @@ -// 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. - -namespace WixToolset.Extensibility -{ - using System; - using System.Collections; - using System.Collections.Generic; - using System.Xml.Linq; - using WixToolset.Data; - - /// - /// Core interface provided by the compiler. - /// - public interface ICompilerCore : IMessageHandler - { - /// - /// Gets whether the compiler core encountered an error while processing. - /// - /// Flag if core encountered an error during processing. - bool EncounteredError { get; } - - /// - /// Gets the platform which the compiler will use when defaulting 64-bit attributes and elements. - /// - /// The platform which the compiler will use when defaulting 64-bit attributes and elements. - Platform CurrentPlatform { get; } - - /// - /// Creates a version 3 name-based UUID. - /// - /// The namespace UUID. - /// The value. - /// The generated GUID for the given namespace and value. - string CreateGuid(Guid namespaceGuid, string value); - - /// - /// Create an identifier by hashing data from the row. - /// - /// Three letter or less prefix for generated row identifier. - /// Information to hash. - /// The new identifier. - Identifier CreateIdentifier(string prefix, params string[] args); - - /// - /// Create an identifier based on passed file name - /// - /// File name to generate identifer from - /// - Identifier CreateIdentifierFromFilename(string filename); - - /// - /// Convert a bit array into an int value. - /// - /// The bit array to convert. - /// The converted int value. - int CreateIntegerFromBitArray(BitArray bits); - - /// - /// Creates a row in the active section. - /// - /// Source and line number of current row. - /// Name of table to create row in. - /// Optional identifier for the row. - /// New row. - IntermediateTuple CreateRow(SourceLineNumber sourceLineNumbers, string tableName, Identifier identifier = null); - - /// - /// Creates directories using the inline directory syntax. - /// - /// Source line information. - /// The attribute to parse. - /// Optional identifier of parent directory. - /// Identifier of the leaf directory created. - string CreateDirectoryReferenceFromInlineSyntax(SourceLineNumber sourceLineNumbers, XAttribute attribute, string parentId); - - /// - /// Creates a Registry row in the active section. - /// - /// Source and line number of the current row. - /// The registry entry root. - /// The registry entry key. - /// The registry entry name. - /// The registry entry value. - /// The component which will control installation/uninstallation of the registry entry. - /// If true, "escape" leading '#' characters so the value is written as a REG_SZ. - Identifier CreateRegistryRow(SourceLineNumber sourceLineNumbers, int root, string key, string name, string value, string componentId, bool escapeLeadingHash = false); - - /// - /// Creates a short file/directory name using an identifier and long file/directory name as input. - /// - /// The long file/directory name. - /// The option to keep the extension on generated short names. - /// true if wildcards are allowed in the filename. - /// Any additional information to include in the hash for the generated short name. - /// The generated 8.3-compliant short file/directory name. - string CreateShortName(string longName, bool keepExtension, bool allowWildcards, params string[] args); - - /// - /// Create a WixSimpleReference row in the active section. - /// - /// Source line information for the row. - /// The table name of the simple reference. - /// The primary keys of the simple reference. - void CreateSimpleReference(SourceLineNumber sourceLineNumbers, string tableName, params string[] primaryKeys); - - /// - /// Creates WixComplexReference and WixGroup rows in the active section. - /// - /// Source line information. - /// The parent type. - /// The parent id. - /// The parent language. - /// The child type. - /// The child id. - /// Whether the child is primary. - void CreateComplexReference(SourceLineNumber sourceLineNumbers, ComplexReferenceParentType parentType, string parentId, string parentLanguage, ComplexReferenceChildType childType, string childId, bool isPrimary); - - /// - /// Creates a patch resource reference to the list of resoures to be filtered when producing a patch. This method should only be used when processing children of a patch family. - /// - /// Source and line number of current row. - /// Name of table to create row in. - /// Array of keys that make up the primary key of the table. - /// New row. - void CreatePatchFamilyChildReference(SourceLineNumber sourceLineNumbers, string tableName, params string[] primaryKeys); - - /// - /// Checks if the string contains a property (i.e. "foo[Property]bar") - /// - /// String to evaluate for properties. - /// True if a property is found in the string. - bool ContainsProperty(string possibleProperty); - - /// - /// Add the appropriate rows to make sure that the given table shows up in the resulting output. - /// - /// Source line numbers. - /// Name of the table to ensure existance of. - void EnsureTable(SourceLineNumber sourceLineNumbers, string tableName); - - /// - /// Get an attribute value and displays an error if the value is empty by default. - /// - /// Source line information about the owner element. - /// The attribute containing the value to get. - /// A rule for the contents of the value. If the contents do not follow the rule, an error is thrown. - /// The attribute's value. - string GetAttributeValue(SourceLineNumber sourceLineNumbers, XAttribute attribute, EmptyRule emptyRule = EmptyRule.CanBeWhitespaceOnly); - - /// - /// Gets a Bundle variable value and displays an error for an illegal value. - /// - /// Source line information about the owner element. - /// The attribute containing the value to get. - /// The attribute's value. - string GetAttributeBundleVariableValue(SourceLineNumber sourceLineNumbers, XAttribute attribute); - - /// - /// Get a guid attribute value and displays an error for an illegal guid value. - /// - /// Source line information about the owner element. - /// The attribute containing the value to get. - /// Determines whether the guid can be automatically generated. - /// If true, no error is raised on empty value. If false, an error is raised. - /// The attribute's guid value or a special value if an error occurred. - string GetAttributeGuidValue(SourceLineNumber sourceLineNumbers, XAttribute attribute, bool generatable = false, bool canBeEmpty = false); - - /// - /// Get an identifier attribute value and displays an error for an illegal identifier value. - /// - /// Source line information about the owner element. - /// The attribute containing the value to get. - /// The attribute's identifier value or a special value if an error occurred. - Identifier GetAttributeIdentifier(SourceLineNumber sourceLineNumbers, XAttribute attribute); - - /// - /// Get an identifier attribute value and displays an error for an illegal identifier value. - /// - /// Source line information about the owner element. - /// The attribute containing the value to get. - /// The attribute's identifier value or a special value if an error occurred. - string GetAttributeIdentifierValue(SourceLineNumber sourceLineNumbers, XAttribute attribute); - - /// - /// Get an integer attribute value and displays an error for an illegal integer value. - /// - /// Source line information about the owner element. - /// The attribute containing the value to get. - /// The minimum legal value. - /// The maximum legal value. - /// The attribute's integer value or a special value if an error occurred during conversion. - int GetAttributeIntegerValue(SourceLineNumber sourceLineNumbers, XAttribute attribute, int minimum, int maximum); - - /// - /// Get a long integral attribute value and displays an error for an illegal long value. - /// - /// Source line information about the owner element. - /// The attribute containing the value to get. - /// The minimum legal value. - /// The maximum legal value. - /// The attribute's long value or a special value if an error occurred during conversion. - long GetAttributeLongValue(SourceLineNumber sourceLineNumbers, XAttribute attribute, long minimum, long maximum); - - /// - /// Gets a long filename value and displays an error for an illegal long filename value. - /// - /// Source line information about the owner element. - /// The attribute containing the value to get. - /// true if wildcards are allowed in the filename. - /// true if relative paths are allowed in the filename. - /// The attribute's long filename value. - string GetAttributeLongFilename(SourceLineNumber sourceLineNumbers, XAttribute attribute, bool allowWildcards = false, bool allowRelative = false); - - /// - /// Gets a RegistryRoot as a MsiInterop.MsidbRegistryRoot value and displays an error for an illegal value. - /// - /// Source line information about the owner element. - /// The attribute containing the value to get. - /// Whether HKMU is returned as -1 (true), or treated as an error (false). - /// The attribute's RegisitryRootType value. - int GetAttributeMsidbRegistryRootValue(SourceLineNumber sourceLineNumbers, XAttribute attribute, bool allowHkmu); - - /// - /// Gets a version value or possibly a binder variable and displays an error for an illegal version value. - /// - /// Source line information about the owner element. - /// The attribute containing the value to get. - /// The attribute's version value. - string GetAttributeVersionValue(SourceLineNumber sourceLineNumbers, XAttribute attribute); - - /// - /// Gets a yes/no value and displays an error for an illegal yes/no value. - /// - /// Source line information about the owner element. - /// The attribute containing the value to get. - /// The attribute's YesNoType value. - YesNoType GetAttributeYesNoValue(SourceLineNumber sourceLineNumbers, XAttribute attribute); - - /// - /// Gets a yes/no/default value and displays an error for an illegal yes/no/default value. - /// - /// Source line information about the owner element. - /// The attribute containing the value to get. - /// The attribute's YesNoType value. - YesNoDefaultType GetAttributeYesNoDefaultValue(SourceLineNumber sourceLineNumbers, XAttribute attribute); - - /// - /// Gets node's inner text and ensure's it is safe for use in a condition by trimming any extra whitespace. - /// - /// The node to ensure inner text is a condition. - /// The value converted into a safe condition. - string GetConditionInnerText(XElement node); - - /// - /// Get an element's inner text and trims any extra whitespace. - /// - /// The element with inner text to be trimmed. - /// The node's inner text trimmed. - string GetTrimmedInnerText(XElement element); - - /// - /// Verifies that a value is a legal identifier. - /// - /// The value to verify. - /// true if the value is an identifier; false otherwise. - bool IsValidIdentifier(string value); - - /// - /// Verifies if an identifier is a valid loc identifier. - /// - /// Identifier to verify. - /// True if the identifier is a valid loc identifier. - bool IsValidLocIdentifier(string identifier); - - /// - /// Verifies if a filename is a valid long filename. - /// - /// Filename to verify. - /// true if wildcards are allowed in the filename. - /// true if relative paths are allowed in the filename. - /// True if the filename is a valid long filename - bool IsValidLongFilename(string filename, bool allowWildcards = false, bool allowRelative = false); - - /// - /// Verifies if a filename is a valid short filename. - /// - /// Filename to verify. - /// true if wildcards are allowed in the filename. - /// True if the filename is a valid short filename - bool IsValidShortFilename(string filename, bool allowWildcards = false); - - /// - /// Attempts to use an extension to parse the attribute. - /// - /// Element containing attribute to be parsed. - /// Attribute to be parsed. - /// Extra information about the context in which this element is being parsed. - void ParseExtensionAttribute(XElement element, XAttribute attribute, IDictionary context = null); - - /// - /// Attempts to use an extension to parse the element. - /// - /// Element containing element to be parsed. - /// Element to be parsed. - /// Extra information about the context in which this element is being parsed. - void ParseExtensionElement(XElement parentElement, XElement element, IDictionary context = null); - - /// - /// Process all children of the element looking for extensions and erroring on the unexpected. - /// - /// Element to parse children. - void ParseForExtensionElements(XElement element); - - /// - /// Sets a bit in a bit array based on the index at which an attribute name was found in a string array. - /// - /// Array of attributes that map to bits. - /// Name of attribute to check. - /// Value of attribute to check. - /// The bit array in which the bit will be set if found. - /// The offset into the bit array. - /// true if the bit was set; false otherwise. - bool TrySetBitFromName(string[] attributeNames, string attributeName, YesNoType attributeValue, BitArray bits, int offset); - - /// - /// Called when the compiler encounters an unexpected attribute. - /// - /// Parent element that found unexpected attribute. - /// Unexpected attribute. - void UnexpectedAttribute(XElement element, XAttribute attribute); - - /// - /// Called when the compiler encounters an unexpected child element. - /// - /// Parent element that found unexpected child. - /// Unexpected child element. - void UnexpectedElement(XElement parentElement, XElement childElement); - } -} diff --git a/src/WixToolset.Extensibility/ICompilerExtension.cs b/src/WixToolset.Extensibility/ICompilerExtension.cs index 1746a571..0aa5c9e2 100644 --- a/src/WixToolset.Extensibility/ICompilerExtension.cs +++ b/src/WixToolset.Extensibility/ICompilerExtension.cs @@ -5,20 +5,12 @@ namespace WixToolset.Extensibility using System.Collections.Generic; using System.Xml.Linq; using WixToolset.Data; - using WixToolset.Extensibility.Services; /// /// Interface all compiler extensions implement. /// public interface ICompilerExtension { -#if false - /// - /// Gets or sets the compiler core for the extension. - /// - /// Compiler core for the extension. - ICompilerCore Core { get; set; } -#endif /// /// Gets the schema namespace for this extension. /// @@ -36,7 +28,7 @@ namespace WixToolset.Extensibility /// Parent element of attribute. /// Attribute to process. /// Extra information about the context in which this element is being parsed. - void ParseAttribute(XElement parentElement, XAttribute attribute, IDictionary context); + void ParseAttribute(Intermediate intermediate, IntermediateSection section, XElement parentElement, XAttribute attribute, IDictionary context); /// /// Processes an element for the Compiler. @@ -44,7 +36,7 @@ namespace WixToolset.Extensibility /// Parent element of element to process. /// Element to process. /// Extra information about the context in which this element is being parsed. - void ParseElement(XElement parentElement, XElement element, IDictionary context); + void ParseElement(Intermediate intermediate, IntermediateSection section, XElement parentElement, XElement element, IDictionary context); /// /// Processes an element for the Compiler, with the ability to supply a component keypath. @@ -52,7 +44,7 @@ namespace WixToolset.Extensibility /// Parent element of element to process. /// Element to process. /// Extra information about the context in which this element is being parsed. - ComponentKeyPath ParsePossibleKeyPathElement(XElement parentElement, XElement element, IDictionary context); + ComponentKeyPath ParsePossibleKeyPathElement(Intermediate intermediate, IntermediateSection section, XElement parentElement, XElement element, IDictionary context); /// /// Called at the end of the compilation of a source file. diff --git a/src/WixToolset.Extensibility/Services/IParseHelper.cs b/src/WixToolset.Extensibility/Services/IParseHelper.cs new file mode 100644 index 00000000..46ade2e1 --- /dev/null +++ b/src/WixToolset.Extensibility/Services/IParseHelper.cs @@ -0,0 +1,334 @@ +// 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. + +namespace WixToolset.Extensibility.Services +{ + using System; + using System.Collections.Generic; + using System.Xml.Linq; + using WixToolset.Data; + + /// + /// Core interface provided by the compiler. + /// + public interface IParseHelper + { + /// + /// Creates a version 3 name-based UUID. + /// + /// The namespace UUID. + /// The value. + /// The generated GUID for the given namespace and value. + string CreateGuid(Guid namespaceGuid, string value); + + /// + /// Create an identifier by hashing data from the row. + /// + /// Three letter or less prefix for generated row identifier. + /// Information to hash. + /// The new identifier. + Identifier CreateIdentifier(string prefix, params string[] args); + + /// + /// Create an identifier based on passed file name + /// + /// File name to generate identifer from + /// + Identifier CreateIdentifierFromFilename(string filename); + + /// + /// Creates a row in the section. + /// + /// Section to add the new tuple to. + /// Source and line number of current row. + /// Name of table to create row in. + /// Optional identifier for the row. + /// New row. + IntermediateTuple CreateRow(IntermediateSection section, SourceLineNumber sourceLineNumbers, string tableName, Identifier identifier = null); + + /// + /// Creates a row in the section. + /// + /// Section to add the new tuple to. + /// Source and line number of current row. + /// Type of tuple to create. + /// Optional identifier for the row. + /// New row. + IntermediateTuple CreateRow(IntermediateSection section, SourceLineNumber sourceLineNumbers, TupleDefinitionType tupleType, Identifier identifier = null); + + /// + /// Creates a directory row from a name. + /// + /// Section to add the new tuple to. + /// Source line information. + /// Optional identifier for the new row. + /// Optional identifier for the parent row. + /// Long name of the directory. + /// Optional short name of the directory. + /// Optional source name for the directory. + /// Optional short source name for the directory. + /// Identifier for the newly created row. + Identifier CreateDirectoryRow(IntermediateSection section, SourceLineNumber sourceLineNumbers, Identifier id, string parentId, string name, string shortName = null, string sourceName = null, string shortSourceName = null, ISet sectionInlinedDirectoryIds = null); + + /// + /// Creates directories using the inline directory syntax. + /// + /// Source line information. + /// The attribute to parse. + /// Optional identifier of parent directory. + /// Identifier of the leaf directory created. + string CreateDirectoryReferenceFromInlineSyntax(IntermediateSection section, SourceLineNumber sourceLineNumbers, XAttribute attribute, string parentId); + + /// + /// Creates a Registry row in the active section. + /// + /// Source and line number of the current row. + /// The registry entry root. + /// The registry entry key. + /// The registry entry name. + /// The registry entry value. + /// The component which will control installation/uninstallation of the registry entry. + /// If true, "escape" leading '#' characters so the value is written as a REG_SZ. + Identifier CreateRegistryRow(IntermediateSection section, SourceLineNumber sourceLineNumbers, int root, string key, string name, string value, string componentId, bool escapeLeadingHash); + + /// + /// Creates a short file/directory name using an identifier and long file/directory name as input. + /// + /// The long file/directory name. + /// The option to keep the extension on generated short names. + /// true if wildcards are allowed in the filename. + /// Any additional information to include in the hash for the generated short name. + /// The generated 8.3-compliant short file/directory name. + string CreateShortName(string longName, bool keepExtension, bool allowWildcards, params string[] args); + + /// + /// Create a WixSimpleReference row in the active section. + /// + /// Source line information for the row. + /// The table name of the simple reference. + /// The primary keys of the simple reference. + void CreateSimpleReference(IntermediateSection section, SourceLineNumber sourceLineNumbers, string tableName, params string[] primaryKeys); + + /// + /// Creates WixComplexReference and WixGroup rows in the active section. + /// + /// Source line information. + /// The parent type. + /// The parent id. + /// The parent language. + /// The child type. + /// The child id. + /// Whether the child is primary. + void CreateComplexReference(IntermediateSection section, SourceLineNumber sourceLineNumbers, ComplexReferenceParentType parentType, string parentId, string parentLanguage, ComplexReferenceChildType childType, string childId, bool isPrimary); + + /// + /// A row in the WixGroup table is added for this child node and its parent node. + /// + /// Source line information for the row. + /// Type of child's complex reference parent. + /// Id of the parenet node. + /// Complex reference type of child + /// Id of the Child Node. + void CreateWixGroupRow(IntermediateSection section, SourceLineNumber sourceLineNumbers, ComplexReferenceParentType parentType, string parentId, ComplexReferenceChildType childType, string childId); + + /// + /// Checks if the string contains a property (i.e. "foo[Property]bar") + /// + /// String to evaluate for properties. + /// True if a property is found in the string. + bool ContainsProperty(string possibleProperty); + + /// + /// Add the appropriate rows to make sure that the given table shows up in the resulting output. + /// + /// Source line numbers. + /// Name of the table to ensure existance of. + void EnsureTable(IntermediateSection section, SourceLineNumber sourceLineNumbers, string tableName); + + /// + /// Get an attribute value and displays an error if the value is empty by default. + /// + /// Source line information about the owner element. + /// The attribute containing the value to get. + /// A rule for the contents of the value. If the contents do not follow the rule, an error is thrown. + /// The attribute's value. + string GetAttributeValue(SourceLineNumber sourceLineNumbers, XAttribute attribute, EmptyRule emptyRule = EmptyRule.CanBeWhitespaceOnly); + + /// + /// Get a guid attribute value and displays an error for an illegal guid value. + /// + /// Source line information about the owner element. + /// The attribute containing the value to get. + /// Determines whether the guid can be automatically generated. + /// If true, no error is raised on empty value. If false, an error is raised. + /// The attribute's guid value or a special value if an error occurred. + string GetAttributeGuidValue(SourceLineNumber sourceLineNumbers, XAttribute attribute, bool generatable = false, bool canBeEmpty = false); + + /// + /// Get an identifier attribute value and displays an error for an illegal identifier value. + /// + /// Source line information about the owner element. + /// The attribute containing the value to get. + /// The attribute's identifier value or a special value if an error occurred. + Identifier GetAttributeIdentifier(SourceLineNumber sourceLineNumbers, XAttribute attribute); + + /// + /// Get an identifier attribute value and displays an error for an illegal identifier value. + /// + /// Source line information about the owner element. + /// The attribute containing the value to get. + /// The attribute's identifier value or a special value if an error occurred. + string GetAttributeIdentifierValue(SourceLineNumber sourceLineNumbers, XAttribute attribute); + + /// + /// Gets the attribute value as inline directory syntax. + /// + /// Source line information. + /// Attribute containing the value to get. + /// Flag indicates whether the inline directory syntax should be processed to create a directory row or to create a directory reference. + /// Inline directory syntax split into array of strings or null if the syntax did not parse. + string[] GetAttributeInlineDirectorySyntax(SourceLineNumber sourceLineNumbers, XAttribute attribute, bool resultUsedToCreateReference); + + /// + /// Get an integer attribute value and displays an error for an illegal integer value. + /// + /// Source line information about the owner element. + /// The attribute containing the value to get. + /// The minimum legal value. + /// The maximum legal value. + /// The attribute's integer value or a special value if an error occurred during conversion. + int GetAttributeIntegerValue(SourceLineNumber sourceLineNumbers, XAttribute attribute, int minimum, int maximum); + + /// + /// Get a long integral attribute value and displays an error for an illegal long value. + /// + /// Source line information about the owner element. + /// The attribute containing the value to get. + /// The minimum legal value. + /// The maximum legal value. + /// The attribute's long value or a special value if an error occurred during conversion. + long GetAttributeLongValue(SourceLineNumber sourceLineNumbers, XAttribute attribute, long minimum, long maximum); + + /// + /// Gets a long filename value and displays an error for an illegal long filename value. + /// + /// Source line information about the owner element. + /// The attribute containing the value to get. + /// true if wildcards are allowed in the filename. + /// true if relative paths are allowed in the filename. + /// The attribute's long filename value. + string GetAttributeLongFilename(SourceLineNumber sourceLineNumbers, XAttribute attribute, bool allowWildcards = false, bool allowRelative = false); + + /// + /// Gets a version value or possibly a binder variable and displays an error for an illegal version value. + /// + /// Source line information about the owner element. + /// The attribute containing the value to get. + /// The attribute's version value. + string GetAttributeVersionValue(SourceLineNumber sourceLineNumbers, XAttribute attribute); + + /// + /// Gets a yes/no value and displays an error for an illegal yes/no value. + /// + /// Source line information about the owner element. + /// The attribute containing the value to get. + /// The attribute's YesNoType value. + YesNoType GetAttributeYesNoValue(SourceLineNumber sourceLineNumbers, XAttribute attribute); + + /// + /// Gets a yes/no/default value and displays an error for an illegal yes/no/default value. + /// + /// Source line information about the owner element. + /// The attribute containing the value to get. + /// The attribute's YesNoType value. + YesNoDefaultType GetAttributeYesNoDefaultValue(SourceLineNumber sourceLineNumbers, XAttribute attribute); + + /// + /// Gets node's inner text and ensure's it is safe for use in a condition by trimming any extra whitespace. + /// + /// The node to ensure inner text is a condition. + /// The value converted into a safe condition. + string GetConditionInnerText(XElement node); + + /// + /// Get an element's inner text and trims any extra whitespace. + /// + /// The element with inner text to be trimmed. + /// The node's inner text trimmed. + string GetTrimmedInnerText(XElement element); + + /// + /// Verifies that a value is a legal identifier. + /// + /// The value to verify. + /// true if the value is an identifier; false otherwise. + bool IsValidIdentifier(string value); + + /// + /// Verifies if an identifier is a valid loc identifier. + /// + /// Identifier to verify. + /// True if the identifier is a valid loc identifier. + bool IsValidLocIdentifier(string identifier); + + /// + /// Verifies if a filename is a valid long filename. + /// + /// Filename to verify. + /// true if wildcards are allowed in the filename. + /// true if relative paths are allowed in the filename. + /// True if the filename is a valid long filename + bool IsValidLongFilename(string filename, bool allowWildcards = false, bool allowRelative = false); + + /// + /// Verifies if a filename is a valid short filename. + /// + /// Filename to verify. + /// true if wildcards are allowed in the filename. + /// True if the filename is a valid short filename + bool IsValidShortFilename(string filename, bool allowWildcards = false); + + /// + /// Attempts to use an extension to parse the attribute. + /// + /// Element containing attribute to be parsed. + /// Attribute to be parsed. + /// Extra information about the context in which this element is being parsed. + void ParseExtensionAttribute(IEnumerable extensions, Intermediate intermediate, IntermediateSection section, XElement element, XAttribute attribute, IDictionary context = null); + + /// + /// Attempts to use an extension to parse the element. + /// + /// Element containing element to be parsed. + /// Element to be parsed. + /// Extra information about the context in which this element is being parsed. + void ParseExtensionElement(IEnumerable extensions, Intermediate intermediate, IntermediateSection section, XElement parentElement, XElement element, IDictionary context = null); + + /// + /// Attempts to use an extension to parse the element, with support for setting component keypath. + /// + /// Element containing element to be parsed. + /// Element to be parsed. + /// Extra information about the context in which this element is being parsed. + ComponentKeyPath ParsePossibleKeyPathExtensionElement(IEnumerable extensions, Intermediate intermediate, IntermediateSection section, XElement parentElement, XElement element, IDictionary context); + + /// + /// Process all children of the element looking for extensions and erroring on the unexpected. + /// + /// Element to parse children. + void ParseForExtensionElements(IEnumerable extensions, Intermediate intermediate, IntermediateSection section, XElement element); + + /// + /// Called when the compiler encounters an unexpected attribute. + /// + /// Parent element that found unexpected attribute. + /// Unexpected attribute. + void UnexpectedAttribute(XElement element, XAttribute attribute); + + /// + /// Called when the compiler encounters an unexpected child element. + /// + /// Parent element that found unexpected child. + /// Unexpected child element. + void UnexpectedElement(XElement parentElement, XElement childElement); + } +} -- cgit v1.2.3-55-g6feb From fb2df0e24c0709ce94c396624cf86c70e02da01f Mon Sep 17 00:00:00 2001 From: Rob Mensching Date: Sat, 2 Dec 2017 00:45:33 -0800 Subject: Fix IExtensionCommandLine and IPreprocessorExtension --- src/Directory.Build.props | 4 +- .../BaseCompilerExtension.cs | 7 ++ .../BasePreprocessorExtension.cs | 84 ++++++++++++++++++ .../IExtensionCommandLine.cs | 17 +--- src/WixToolset.Extensibility/IExtensionData.cs | 4 +- src/WixToolset.Extensibility/IPreprocessContext.cs | 31 +++++++ src/WixToolset.Extensibility/IPreprocessorCore.cs | 21 ----- .../IPreprocessorExtension.cs | 26 +----- .../PreprocessorExtension.cs | 99 ---------------------- .../Services/IParseCommandLine.cs | 21 +++++ .../Services/IParseHelper.cs | 9 +- .../Services/IPreprocessHelper.cs | 89 +++++++++++++++++++ 12 files changed, 252 insertions(+), 160 deletions(-) create mode 100644 src/WixToolset.Extensibility/BasePreprocessorExtension.cs create mode 100644 src/WixToolset.Extensibility/IPreprocessContext.cs delete mode 100644 src/WixToolset.Extensibility/IPreprocessorCore.cs delete mode 100644 src/WixToolset.Extensibility/PreprocessorExtension.cs create mode 100644 src/WixToolset.Extensibility/Services/IParseCommandLine.cs create mode 100644 src/WixToolset.Extensibility/Services/IPreprocessHelper.cs diff --git a/src/Directory.Build.props b/src/Directory.Build.props index 25cb6d36..7cd6767f 100644 --- a/src/Directory.Build.props +++ b/src/Directory.Build.props @@ -5,11 +5,13 @@ Debug $(MSBuildThisFileDirectory)..\build\obj\$(MSBuildProjectName)\ - $(MSBuildThisFileDirectory)..\build\$(Configuration)\ + $(MSBuildThisFileDirectory)..\build\$(Configuration)\ + $(BaseOutputPath) WiX Toolset Team WiX Toolset Copyright (c) .NET Foundation and contributors. All rights reserved. + WiX Toolset diff --git a/src/WixToolset.Extensibility/BaseCompilerExtension.cs b/src/WixToolset.Extensibility/BaseCompilerExtension.cs index 508886d3..5dfe5dcf 100644 --- a/src/WixToolset.Extensibility/BaseCompilerExtension.cs +++ b/src/WixToolset.Extensibility/BaseCompilerExtension.cs @@ -12,6 +12,11 @@ namespace WixToolset.Extensibility /// public abstract class BaseCompilerExtension : ICompilerExtension { + /// + /// Messaging for use by the extension. + /// + protected Messaging Messaging { get; private set; } + /// /// ParserHelper for use by the extension. /// @@ -28,6 +33,8 @@ namespace WixToolset.Extensibility /// public virtual void PreCompile(ICompileContext context) { + this.Messaging = context.Messaging; + this.ParseHelper = context.ServiceProvider.GetService(); } diff --git a/src/WixToolset.Extensibility/BasePreprocessorExtension.cs b/src/WixToolset.Extensibility/BasePreprocessorExtension.cs new file mode 100644 index 00000000..acfcd5b9 --- /dev/null +++ b/src/WixToolset.Extensibility/BasePreprocessorExtension.cs @@ -0,0 +1,84 @@ +// 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. + +namespace WixToolset.Extensibility +{ + using System.Xml.Linq; + using WixToolset.Extensibility.Services; + + /// + /// Base class for creating a preprocessor extension. + /// + public abstract class BasePreprocessorExtension : IPreprocessorExtension + { + /// + /// Context for use by the extension. + /// + protected IPreprocessContext Context { get; private set; } + + /// + /// ParserHelper for use by the extension. + /// + protected IPreprocessHelper PreprocessHelper { get; private set; } + + /// + /// Gets or sets the variable prefixes for the extension. + /// + /// The variable prefixes for the extension. + public string[] Prefixes { get; protected set; } + + /// + /// Called at the beginning of the preprocessing of a source file. + /// + public virtual void PrePreprocess(IPreprocessContext context) + { + this.Context = context; + + this.PreprocessHelper = context.ServiceProvider.GetService(); + } + + /// + /// Gets the value of a variable whose prefix matches the extension. + /// + /// The prefix of the variable to be processed by the extension. + /// The name of the variable. + /// The value of the variable or null if the variable is undefined. + public virtual string GetVariableValue(string prefix, string name) + { + return null; + } + + /// + /// Evaluates a function defined in the extension. + /// + /// The prefix of the function to be processed by the extension. + /// The name of the function. + /// The list of arguments. + /// The value of the function or null if the function is not defined. + public virtual string EvaluateFunction(string prefix, string function, string[] args) + { + return null; + } + + /// + /// Processes a pragma defined in the extension. + /// + /// The location of this pragma's PI. + /// The prefix of the pragma to be processed by the extension. + /// The name of the pragma. + /// The pragma's arguments. + /// The parent node of the pragma. + /// false if the pragma is not defined. + /// 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. + public virtual bool ProcessPragma(string prefix, string pragma, string args, XContainer parent) + { + return false; + } + + /// + /// Called at the end of the preprocessing of a source file. + /// + public virtual void PostPreprocess(XDocument document) + { + } + } +} diff --git a/src/WixToolset.Extensibility/IExtensionCommandLine.cs b/src/WixToolset.Extensibility/IExtensionCommandLine.cs index b6cff5d0..1f8e6ed8 100644 --- a/src/WixToolset.Extensibility/IExtensionCommandLine.cs +++ b/src/WixToolset.Extensibility/IExtensionCommandLine.cs @@ -3,7 +3,7 @@ namespace WixToolset.Extensibility { using System.Collections.Generic; - using WixToolset.Data; + using WixToolset.Extensibility.Services; /// /// A command line option. @@ -20,23 +20,14 @@ namespace WixToolset.Extensibility /// public interface IExtensionCommandLine { - /// - /// Sets the message handler for the extension. - /// - /// Message handler for the extension. - IMessageHandler MessageHandler { set; } - /// /// Gets the supported command line types for this extension. /// /// The supported command line types for this extension. IEnumerable CommandLineSwitches { get; } - /// - /// Parse the commandline arguments. - /// - /// Commandline arguments. - /// Unparsed commandline arguments. - string[] ParseCommandLine(string[] args); + void PreParse(ICommandLineContext context); + + bool TryParseArgument(IParseCommandLine parseCommandLine, string arg); } } diff --git a/src/WixToolset.Extensibility/IExtensionData.cs b/src/WixToolset.Extensibility/IExtensionData.cs index f0e339d4..1721a76c 100644 --- a/src/WixToolset.Extensibility/IExtensionData.cs +++ b/src/WixToolset.Extensibility/IExtensionData.cs @@ -26,8 +26,8 @@ namespace WixToolset.Extensibility /// /// Gets the library associated with this extension. /// - /// The table definitions to use while loading the library. + /// The tuple definitions to use while loading the library. /// The library for this extension or null if there is no library. - Library GetLibrary(ITupleDefinitionCreator tupleDefinitions); + Intermediate GetLibrary(ITupleDefinitionCreator tupleDefinitions); } } diff --git a/src/WixToolset.Extensibility/IPreprocessContext.cs b/src/WixToolset.Extensibility/IPreprocessContext.cs new file mode 100644 index 00000000..0f9c90bf --- /dev/null +++ b/src/WixToolset.Extensibility/IPreprocessContext.cs @@ -0,0 +1,31 @@ +// 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. + +namespace WixToolset.Extensibility +{ + using System; + using System.Collections.Generic; + using WixToolset.Data; + + public interface IPreprocessContext + { + IServiceProvider ServiceProvider { get; } + + Messaging Messaging { get; set; } + + IEnumerable Extensions { get; set; } + + /// + /// Gets the platform which the compiler will use when defaulting 64-bit attributes and elements. + /// + /// The platform which the compiler will use when defaulting 64-bit attributes and elements. + Platform Platform { get; set; } + + IList IncludeSearchPaths { get; set; } + + string SourceFile { get; set; } + + IDictionary Variables { get; set; } + + SourceLineNumber CurrentSourceLineNumber { get; set; } + } +} diff --git a/src/WixToolset.Extensibility/IPreprocessorCore.cs b/src/WixToolset.Extensibility/IPreprocessorCore.cs deleted file mode 100644 index a0449139..00000000 --- a/src/WixToolset.Extensibility/IPreprocessorCore.cs +++ /dev/null @@ -1,21 +0,0 @@ -// 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. - -namespace WixToolset.Extensibility -{ - using WixToolset.Data; - - public interface IPreprocessorCore : IMessageHandler - { - /// - /// Gets or sets the platform which the compiler will use when defaulting 64-bit attributes and elements. - /// - /// The platform which the compiler will use when defaulting 64-bit attributes and elements. - Platform CurrentPlatform { get; } - - /// - /// Gets whether the core encountered an error while processing. - /// - /// Flag if core encountered an error during processing. - bool EncounteredError { get; } - } -} diff --git a/src/WixToolset.Extensibility/IPreprocessorExtension.cs b/src/WixToolset.Extensibility/IPreprocessorExtension.cs index de415526..8511abbc 100644 --- a/src/WixToolset.Extensibility/IPreprocessorExtension.cs +++ b/src/WixToolset.Extensibility/IPreprocessorExtension.cs @@ -11,12 +11,6 @@ namespace WixToolset.Extensibility /// public interface IPreprocessorExtension { - /// - /// Gets or sets the preprocessor core for the extension. - /// - /// Preprocessor core for the extension. - IPreprocessorCore Core { get; set; } - /// /// Gets the variable prefixes for the extension. /// @@ -26,7 +20,7 @@ namespace WixToolset.Extensibility /// /// Called at the beginning of the preprocessing of a source file. /// - void Initialize(); + void PrePreprocess(IPreprocessContext context); /// /// Gets the value of a variable whose prefix matches the extension. @@ -55,25 +49,11 @@ namespace WixToolset.Extensibility /// The parent node of the pragma. /// false if the pragma is not defined. /// Don't return false for any condition except for unrecognized pragmas. Use Core.OnMessage for errors, warnings and messages. - bool ProcessPragma(SourceLineNumber sourceLineNumbers, string prefix, string pragma, string args, XContainer parent); - - /// - /// Preprocess a document after normal preprocessing has completed. - /// - /// The document to preprocess. - void PreprocessDocument(XDocument document); - - /// - /// Preprocesses a parameter. - /// - /// Name of parameter that matches extension. - /// The value of the parameter after processing. - /// By default this method will cause an error if its called. - string PreprocessParameter(string name); + bool ProcessPragma(string prefix, string pragma, string args, XContainer parent); /// /// Called at the end of the preprocessing of a source file. /// - void Finish(); + void PostPreprocess(XDocument document); } } diff --git a/src/WixToolset.Extensibility/PreprocessorExtension.cs b/src/WixToolset.Extensibility/PreprocessorExtension.cs deleted file mode 100644 index 2af30a95..00000000 --- a/src/WixToolset.Extensibility/PreprocessorExtension.cs +++ /dev/null @@ -1,99 +0,0 @@ -// 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. - -namespace WixToolset.Extensibility -{ - using System.Xml.Linq; - using WixToolset.Data; - - /// - /// Base class for creating a preprocessor extension. - /// - public abstract class PreprocessorExtension : IPreprocessorExtension - { - /// - /// Gets or sets the preprocessor core for the extension. - /// - /// Preprocessor core for the extension. - public IPreprocessorCore Core { get; set; } - - /// - /// Gets or sets the variable prefixes for the extension. - /// - /// The variable prefixes for the extension. - public virtual string[] Prefixes - { - get { return null; } - } - - /// - /// Called at the beginning of the preprocessing of a source file. - /// - public virtual void Initialize() - { - } - - /// - /// Gets the value of a variable whose prefix matches the extension. - /// - /// The prefix of the variable to be processed by the extension. - /// The name of the variable. - /// The value of the variable or null if the variable is undefined. - public virtual string GetVariableValue(string prefix, string name) - { - return null; - } - - /// - /// Evaluates a function defined in the extension. - /// - /// The prefix of the function to be processed by the extension. - /// The name of the function. - /// The list of arguments. - /// The value of the function or null if the function is not defined. - public virtual string EvaluateFunction(string prefix, string function, string[] args) - { - return null; - } - - /// - /// Processes a pragma defined in the extension. - /// - /// The location of this pragma's PI. - /// The prefix of the pragma to be processed by the extension. - /// The name of the pragma. - /// The pragma's arguments. - /// The parent node of the pragma. - /// false if the pragma is not defined. - /// 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. - public virtual bool ProcessPragma(SourceLineNumber sourceLineNumbers, string prefix, string pragma, string args, XContainer parent) - { - return false; - } - - /// - /// Preprocess a document after normal preprocessing has completed. - /// - /// The document to preprocess. - public virtual void PreprocessDocument(XDocument document) - { - } - - /// - /// Preprocesses a parameter. - /// - /// Name of parameter that matches extension. - /// The value of the parameter after processing. - /// By default this method will cause an error if its called. - public virtual string PreprocessParameter(string name) - { - return null; - } - - /// - /// Called at the end of the preprocessing of a source file. - /// - public virtual void Finish() - { - } - } -} diff --git a/src/WixToolset.Extensibility/Services/IParseCommandLine.cs b/src/WixToolset.Extensibility/Services/IParseCommandLine.cs new file mode 100644 index 00000000..1b23be14 --- /dev/null +++ b/src/WixToolset.Extensibility/Services/IParseCommandLine.cs @@ -0,0 +1,21 @@ +// 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. + +namespace WixToolset.Extensibility.Services +{ + using System.Collections.Generic; + + public interface IParseCommandLine + { + bool IsSwitch(string arg); + + bool IsSwitchAt(IEnumerable args, int index); + + void GetNextArgumentOrError(ref string arg); + + void GetNextArgumentOrError(IList args); + + void GetNextArgumentAsFilePathOrError(IList args, string fileType); + + bool TryGetNextArgumentOrError(out string arg); + } +} diff --git a/src/WixToolset.Extensibility/Services/IParseHelper.cs b/src/WixToolset.Extensibility/Services/IParseHelper.cs index 46ade2e1..ad15c063 100644 --- a/src/WixToolset.Extensibility/Services/IParseHelper.cs +++ b/src/WixToolset.Extensibility/Services/IParseHelper.cs @@ -8,7 +8,7 @@ namespace WixToolset.Extensibility.Services using WixToolset.Data; /// - /// Core interface provided by the compiler. + /// Interface provided to help compiler extensions parse. /// public interface IParseHelper { @@ -242,6 +242,13 @@ namespace WixToolset.Extensibility.Services /// The attribute's YesNoType value. YesNoDefaultType GetAttributeYesNoDefaultValue(SourceLineNumber sourceLineNumbers, XAttribute attribute); + /// + /// Gets a source line number for an element. + /// + /// Element to get source line number. + /// Source line number. + SourceLineNumber GetSourceLineNumbers(XElement element); + /// /// Gets node's inner text and ensure's it is safe for use in a condition by trimming any extra whitespace. /// diff --git a/src/WixToolset.Extensibility/Services/IPreprocessHelper.cs b/src/WixToolset.Extensibility/Services/IPreprocessHelper.cs new file mode 100644 index 00000000..01c55009 --- /dev/null +++ b/src/WixToolset.Extensibility/Services/IPreprocessHelper.cs @@ -0,0 +1,89 @@ +// 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. + +namespace WixToolset.Extensibility.Services +{ + using System.Xml.Linq; + + /// + /// Interface provided to help preprocessor extensions. + /// + public interface IPreprocessHelper + { + /// + /// Add a variable. + /// + /// The preprocess context. + /// The variable name. + /// The variable value. + void AddVariable(IPreprocessContext context, string name, string value); + + /// + /// Add a variable. + /// + /// The preprocess context. + /// The variable name. + /// The variable value. + /// Set to true to show variable overwrite warning. + void AddVariable(IPreprocessContext context, string name, string value, bool showWarning); + + /// + /// Evaluate a function. + /// + /// The preprocess context. + /// The function expression including the prefix and name. + /// The function value. + string EvaluateFunction(IPreprocessContext context, string function); + + /// + /// Evaluate a function. + /// + /// The preprocess context. + /// The function prefix. + /// The function name. + /// The arguments for the function. + /// The function value or null if the function is not defined. + string EvaluateFunction(IPreprocessContext context, string prefix, string function, string[] args); + + /// + /// Get the value of a variable expression like var.name. + /// + /// The preprocess context. + /// The variable expression including the optional prefix and name. + /// true to allow the variable prefix to be missing. + /// The variable value. + string GetVariableValue(IPreprocessContext context, string variable, bool allowMissingPrefix); + + /// + /// Get the value of a variable. + /// + /// The preprocess context. + /// The variable prefix. + /// The variable name. + /// The variable value or null if the variable is not set. + string GetVariableValue(IPreprocessContext context, string prefix, string name); + + /// + /// Evaluate a Pragma. + /// + /// The preprocess context. + /// The pragma's full name (.). + /// The arguments to the pragma. + /// The parent element of the pragma. + void PreprocessPragma(IPreprocessContext context, string pragmaName, string args, XContainer parent); + + /// + /// Replaces parameters in the source text. + /// + /// The preprocess context. + /// Text that may contain parameters to replace. + /// Text after parameters have been replaced. + string PreprocessString(IPreprocessContext context, string value); + + /// + /// Remove a variable. + /// + /// The preprocess context. + /// The variable name. + void RemoveVariable(IPreprocessContext context, string name); + } +} -- cgit v1.2.3-55-g6feb From b6e9ba894bafe216348292b7c46212c974d02c39 Mon Sep 17 00:00:00 2001 From: Rob Mensching Date: Wed, 6 Dec 2017 11:37:13 -0800 Subject: Enhance link context to support loading intermediates from extensions --- src/WixToolset.Extensibility/Services/ILinkContext.cs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/WixToolset.Extensibility/Services/ILinkContext.cs b/src/WixToolset.Extensibility/Services/ILinkContext.cs index 8c5b3c65..25c7962f 100644 --- a/src/WixToolset.Extensibility/Services/ILinkContext.cs +++ b/src/WixToolset.Extensibility/Services/ILinkContext.cs @@ -14,8 +14,12 @@ namespace WixToolset.Extensibility.Services IEnumerable Extensions { get; set; } + IEnumerable ExtensionData { get; set; } + OutputType ExpectedOutputType { get; set; } IEnumerable Intermediates { get; set; } + + ITupleDefinitionCreator TupleDefinitionCreator { get; set; } } } -- cgit v1.2.3-55-g6feb From 54cacc5653a0c8a053d6641badf4470d1b54e865 Mon Sep 17 00:00:00 2001 From: Rob Mensching Date: Thu, 7 Dec 2017 14:17:45 -0800 Subject: Enable MSI backends to add custom tables from tuples --- .../BasePreprocessorExtension.cs | 2 +- .../BaseWindowsInstallerBackendExtension.cs | 53 +++++++++++++++ src/WixToolset.Extensibility/ExtensionData.cs | 77 ---------------------- .../IPreprocessorExtension.cs | 2 - .../IWindowsInstallerBackendExtension.cs | 4 ++ .../Services/IWindowsInstallerBackendHelper.cs | 15 +++++ 6 files changed, 73 insertions(+), 80 deletions(-) create mode 100644 src/WixToolset.Extensibility/BaseWindowsInstallerBackendExtension.cs delete mode 100644 src/WixToolset.Extensibility/ExtensionData.cs create mode 100644 src/WixToolset.Extensibility/Services/IWindowsInstallerBackendHelper.cs diff --git a/src/WixToolset.Extensibility/BasePreprocessorExtension.cs b/src/WixToolset.Extensibility/BasePreprocessorExtension.cs index acfcd5b9..f5d89103 100644 --- a/src/WixToolset.Extensibility/BasePreprocessorExtension.cs +++ b/src/WixToolset.Extensibility/BasePreprocessorExtension.cs @@ -16,7 +16,7 @@ namespace WixToolset.Extensibility protected IPreprocessContext Context { get; private set; } /// - /// ParserHelper for use by the extension. + /// PreprocessHelper for use by the extension. /// protected IPreprocessHelper PreprocessHelper { get; private set; } diff --git a/src/WixToolset.Extensibility/BaseWindowsInstallerBackendExtension.cs b/src/WixToolset.Extensibility/BaseWindowsInstallerBackendExtension.cs new file mode 100644 index 00000000..0bcfce01 --- /dev/null +++ b/src/WixToolset.Extensibility/BaseWindowsInstallerBackendExtension.cs @@ -0,0 +1,53 @@ +// 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. + +namespace WixToolset.Extensibility +{ + using System.Collections.Generic; + using WixToolset.Data; + using WixToolset.Data.Bind; + using WixToolset.Data.Tuples; + using WixToolset.Data.WindowsInstaller; + using WixToolset.Extensibility.Services; + + /// + /// Base class for creating a preprocessor extension. + /// + public abstract class BaseWindowsInstallerBackendExtension : IWindowsInstallerBackendExtension + { + /// + /// Context for use by the extension. + /// + protected IBindContext Context { get; private set; } + + /// + /// Backend helper for use by the extension. + /// + protected IWindowsInstallerBackendHelper BackendHelper { get; private set; } + + public virtual void PreBackendBind(IBindContext context) + { + this.Context = context; + + this.BackendHelper = context.ServiceProvider.GetService(); + } + + public virtual ResolvedCabinet ResolveCabinet(string cabinetPath, IEnumerable files) + { + return null; + } + + public virtual string ResolveMedia(MediaTuple mediaRow, string mediaLayoutDirectory, string layoutDirectory) + { + return null; + } + + public virtual bool TryAddTupleToOutput(IntermediateTuple tuple, Output output) + { + return false; + } + + public virtual void PostBackendBind(BindResult result) + { + } + } +} diff --git a/src/WixToolset.Extensibility/ExtensionData.cs b/src/WixToolset.Extensibility/ExtensionData.cs deleted file mode 100644 index 0cd0c420..00000000 --- a/src/WixToolset.Extensibility/ExtensionData.cs +++ /dev/null @@ -1,77 +0,0 @@ -// 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. - -namespace WixToolset.Extensibility -{ - using System; - using System.IO; - using System.Reflection; - using System.Xml; - using WixToolset.Data; - -#if BRING_BACK_LATER - public abstract class ExtensionData : IExtensionData - { - /// - /// Gets the optional table definitions for this extension. - /// - /// Table definisions for this extension or null if there are no table definitions. - public virtual TableDefinitionCollection TableDefinitions - { - get { return null; } - } - - /// - /// Gets the optional default culture. - /// - /// The optional default culture. - public virtual string DefaultCulture - { - get { return null; } - } - - /// - /// Gets the optional library associated with this extension. - /// - /// The table definitions to use while loading the library. - /// The library for this extension or null if there is no library. - public virtual Library GetLibrary(TableDefinitionCollection tableDefinitions) - { - return null; - } - - /// - /// Help for loading a library from an embedded resource. - /// - /// The assembly containing the embedded resource. - /// The name of the embedded resource being requested. - /// The table definitions to use while loading the library. - /// The loaded library. - protected static Library LoadLibraryHelper(Assembly assembly, string resourceName, TableDefinitionCollection tableDefinitions) - { - using (Stream resourceStream = assembly.GetManifestResourceStream(resourceName)) - { - UriBuilder uriBuilder = new UriBuilder(assembly.CodeBase); - uriBuilder.Scheme = "embeddedresource"; - uriBuilder.Fragment = resourceName; - - return Library.Load(resourceStream, uriBuilder.Uri, tableDefinitions, false); - } - } - - /// - /// Helper for loading table definitions from an embedded resource. - /// - /// The assembly containing the embedded resource. - /// The name of the embedded resource being requested. - /// The loaded table definitions. - protected static TableDefinitionCollection LoadTableDefinitionHelper(Assembly assembly, string resourceName) - { - using (Stream resourceStream = assembly.GetManifestResourceStream(resourceName)) - using (XmlReader reader = XmlReader.Create(resourceStream)) - { - return TableDefinitionCollection.Load(reader); - } - } - } -#endif -} diff --git a/src/WixToolset.Extensibility/IPreprocessorExtension.cs b/src/WixToolset.Extensibility/IPreprocessorExtension.cs index 8511abbc..68f82693 100644 --- a/src/WixToolset.Extensibility/IPreprocessorExtension.cs +++ b/src/WixToolset.Extensibility/IPreprocessorExtension.cs @@ -2,9 +2,7 @@ namespace WixToolset.Extensibility { - using System; using System.Xml.Linq; - using WixToolset.Data; /// /// Interface for extending the WiX toolset preprocessor. diff --git a/src/WixToolset.Extensibility/IWindowsInstallerBackendExtension.cs b/src/WixToolset.Extensibility/IWindowsInstallerBackendExtension.cs index f6ffc69c..ed10a077 100644 --- a/src/WixToolset.Extensibility/IWindowsInstallerBackendExtension.cs +++ b/src/WixToolset.Extensibility/IWindowsInstallerBackendExtension.cs @@ -3,8 +3,10 @@ namespace WixToolset.Extensibility { using System.Collections.Generic; + using WixToolset.Data; using WixToolset.Data.Bind; using WixToolset.Data.Tuples; + using WixToolset.Data.WindowsInstaller; using WixToolset.Extensibility.Services; /// @@ -21,6 +23,8 @@ namespace WixToolset.Extensibility string ResolveMedia(MediaTuple mediaRow, string mediaLayoutDirectory, string layoutDirectory); + bool TryAddTupleToOutput(IntermediateTuple tuple, Output output); + /// /// Called after all output changes occur and right before the output is bound into its final format. /// diff --git a/src/WixToolset.Extensibility/Services/IWindowsInstallerBackendHelper.cs b/src/WixToolset.Extensibility/Services/IWindowsInstallerBackendHelper.cs new file mode 100644 index 00000000..2de455fd --- /dev/null +++ b/src/WixToolset.Extensibility/Services/IWindowsInstallerBackendHelper.cs @@ -0,0 +1,15 @@ +// 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. + +namespace WixToolset.Extensibility.Services +{ + using WixToolset.Data; + using WixToolset.Data.WindowsInstaller; + + /// + /// Interface provided to help Windows Installer backend extensions. + /// + public interface IWindowsInstallerBackendHelper + { + bool TryAddTupleToOutputMatchingTableDefinitions(IntermediateTuple tuple, Output output, TableDefinition[] tableDefinitions); + } +} -- cgit v1.2.3-55-g6feb From 46a4f1d98fdedc82c701ada198252dfd6099959f Mon Sep 17 00:00:00 2001 From: Rob Mensching Date: Tue, 19 Dec 2017 12:24:49 -0800 Subject: Integrate simplified message handling --- .../BaseCompilerExtension.cs | 2 +- .../IBinderFileManagerCore.cs | 2 +- src/WixToolset.Extensibility/ICompileContext.cs | 3 +- src/WixToolset.Extensibility/IDecompilerCore.cs | 2 +- src/WixToolset.Extensibility/IInscribeContext.cs | 6 +- src/WixToolset.Extensibility/IInspectorCore.cs | 4 +- src/WixToolset.Extensibility/ILibraryContext.cs | 3 +- src/WixToolset.Extensibility/IMessageListener.cs | 17 +++++ src/WixToolset.Extensibility/IPreprocessContext.cs | 3 +- src/WixToolset.Extensibility/IUnbindContext.cs | 9 ++- .../Services/IBindContext.cs | 2 +- .../Services/ICommandLineContext.cs | 3 +- .../Services/ILinkContext.cs | 2 +- .../Services/IMessaging.cs | 80 ++++++++++++++++++++++ 14 files changed, 119 insertions(+), 19 deletions(-) create mode 100644 src/WixToolset.Extensibility/IMessageListener.cs create mode 100644 src/WixToolset.Extensibility/Services/IMessaging.cs diff --git a/src/WixToolset.Extensibility/BaseCompilerExtension.cs b/src/WixToolset.Extensibility/BaseCompilerExtension.cs index 5dfe5dcf..0f386e28 100644 --- a/src/WixToolset.Extensibility/BaseCompilerExtension.cs +++ b/src/WixToolset.Extensibility/BaseCompilerExtension.cs @@ -15,7 +15,7 @@ namespace WixToolset.Extensibility /// /// Messaging for use by the extension. /// - protected Messaging Messaging { get; private set; } + protected IMessaging Messaging { get; private set; } /// /// ParserHelper for use by the extension. diff --git a/src/WixToolset.Extensibility/IBinderFileManagerCore.cs b/src/WixToolset.Extensibility/IBinderFileManagerCore.cs index b73acb6b..27644413 100644 --- a/src/WixToolset.Extensibility/IBinderFileManagerCore.cs +++ b/src/WixToolset.Extensibility/IBinderFileManagerCore.cs @@ -6,7 +6,7 @@ namespace WixToolset.Extensibility using WixToolset.Data; using WixToolset.Data.Bind; - public interface IBinderFileManagerCore : IMessageHandler + public interface IBinderFileManagerCore { /// /// Gets or sets the path to cabinet cache. diff --git a/src/WixToolset.Extensibility/ICompileContext.cs b/src/WixToolset.Extensibility/ICompileContext.cs index bd0d0a4b..fbe38d63 100644 --- a/src/WixToolset.Extensibility/ICompileContext.cs +++ b/src/WixToolset.Extensibility/ICompileContext.cs @@ -6,12 +6,13 @@ namespace WixToolset.Extensibility using System.Collections.Generic; using System.Xml.Linq; using WixToolset.Data; + using WixToolset.Extensibility.Services; public interface ICompileContext { IServiceProvider ServiceProvider { get; } - Messaging Messaging { get; set; } + IMessaging Messaging { get; set; } string CompilationId { get; set; } diff --git a/src/WixToolset.Extensibility/IDecompilerCore.cs b/src/WixToolset.Extensibility/IDecompilerCore.cs index 1c367e0c..2133829a 100644 --- a/src/WixToolset.Extensibility/IDecompilerCore.cs +++ b/src/WixToolset.Extensibility/IDecompilerCore.cs @@ -6,7 +6,7 @@ namespace WixToolset.Extensibility using WixToolset.Data; using Wix = WixToolset.Data.Serialize; - public interface IDecompilerCore : IMessageHandler + public interface IDecompilerCore { /// diff --git a/src/WixToolset.Extensibility/IInscribeContext.cs b/src/WixToolset.Extensibility/IInscribeContext.cs index 6294271e..7f741024 100644 --- a/src/WixToolset.Extensibility/IInscribeContext.cs +++ b/src/WixToolset.Extensibility/IInscribeContext.cs @@ -3,18 +3,18 @@ namespace WixToolset.Extensibility { using System; - using WixToolset.Data; + using WixToolset.Extensibility.Services; public interface IInscribeContext { IServiceProvider ServiceProvider { get; } + IMessaging Messaging { get; set; } + string InputFilePath { get; set; } string IntermediateFolder { get; set; } - Messaging Messaging { get; } - string OutputFile { get; set; } string SignedEngineFile { get; set; } diff --git a/src/WixToolset.Extensibility/IInspectorCore.cs b/src/WixToolset.Extensibility/IInspectorCore.cs index 06239ce5..9420ea05 100644 --- a/src/WixToolset.Extensibility/IInspectorCore.cs +++ b/src/WixToolset.Extensibility/IInspectorCore.cs @@ -2,12 +2,10 @@ namespace WixToolset.Extensibility { - using WixToolset.Data; - /// /// Core facilities for inspector extensions. /// - public interface IInspectorCore : IMessageHandler + public interface IInspectorCore { /// /// Gets whether an error occured. diff --git a/src/WixToolset.Extensibility/ILibraryContext.cs b/src/WixToolset.Extensibility/ILibraryContext.cs index b8c1887a..e715080f 100644 --- a/src/WixToolset.Extensibility/ILibraryContext.cs +++ b/src/WixToolset.Extensibility/ILibraryContext.cs @@ -5,12 +5,13 @@ namespace WixToolset.Extensibility using System; using System.Collections.Generic; using WixToolset.Data; + using WixToolset.Extensibility.Services; public interface ILibraryContext { IServiceProvider ServiceProvider { get; } - Messaging Messaging { get; set; } + IMessaging Messaging { get; set; } bool BindFiles { get; set; } diff --git a/src/WixToolset.Extensibility/IMessageListener.cs b/src/WixToolset.Extensibility/IMessageListener.cs new file mode 100644 index 00000000..91e3da31 --- /dev/null +++ b/src/WixToolset.Extensibility/IMessageListener.cs @@ -0,0 +1,17 @@ +// 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. + +namespace WixToolset.Extensibility +{ + using WixToolset.Data; + + public interface IMessageListener + { + string ShortAppName { get; } + + string LongAppName { get; } + + void Write(Message message); + + void Write(string message); + } +} diff --git a/src/WixToolset.Extensibility/IPreprocessContext.cs b/src/WixToolset.Extensibility/IPreprocessContext.cs index 0f9c90bf..2e288d59 100644 --- a/src/WixToolset.Extensibility/IPreprocessContext.cs +++ b/src/WixToolset.Extensibility/IPreprocessContext.cs @@ -5,12 +5,13 @@ namespace WixToolset.Extensibility using System; using System.Collections.Generic; using WixToolset.Data; + using WixToolset.Extensibility.Services; public interface IPreprocessContext { IServiceProvider ServiceProvider { get; } - Messaging Messaging { get; set; } + IMessaging Messaging { get; set; } IEnumerable Extensions { get; set; } diff --git a/src/WixToolset.Extensibility/IUnbindContext.cs b/src/WixToolset.Extensibility/IUnbindContext.cs index 82364652..beaa5491 100644 --- a/src/WixToolset.Extensibility/IUnbindContext.cs +++ b/src/WixToolset.Extensibility/IUnbindContext.cs @@ -2,10 +2,15 @@ namespace WixToolset.Extensibility { - using WixToolset.Data; + using System; + using WixToolset.Extensibility.Services; public interface IUnbindContext { + IServiceProvider ServiceProvider { get; } + + IMessaging Messaging { get; set; } + string ExportBasePath { get; set; } string InputFilePath { get; set; } @@ -14,8 +19,6 @@ namespace WixToolset.Extensibility bool IsAdminImage { get; set; } - Messaging Messaging { get; } - bool SuppressDemodularization { get; set; } bool SuppressExtractCabinets { get; set; } diff --git a/src/WixToolset.Extensibility/Services/IBindContext.cs b/src/WixToolset.Extensibility/Services/IBindContext.cs index 6bed0ef6..ad1aa818 100644 --- a/src/WixToolset.Extensibility/Services/IBindContext.cs +++ b/src/WixToolset.Extensibility/Services/IBindContext.cs @@ -10,7 +10,7 @@ namespace WixToolset.Extensibility.Services { IServiceProvider ServiceProvider { get; } - Messaging Messaging { get; set; } + IMessaging Messaging { get; set; } IEnumerable BindPaths { get; set; } diff --git a/src/WixToolset.Extensibility/Services/ICommandLineContext.cs b/src/WixToolset.Extensibility/Services/ICommandLineContext.cs index 0e040d7f..27d4e6dd 100644 --- a/src/WixToolset.Extensibility/Services/ICommandLineContext.cs +++ b/src/WixToolset.Extensibility/Services/ICommandLineContext.cs @@ -3,13 +3,12 @@ namespace WixToolset.Extensibility.Services { using System; - using WixToolset.Data; public interface ICommandLineContext { IServiceProvider ServiceProvider { get; } - Messaging Messaging { get; set; } + IMessaging Messaging { get; set; } IExtensionManager ExtensionManager { get; set; } diff --git a/src/WixToolset.Extensibility/Services/ILinkContext.cs b/src/WixToolset.Extensibility/Services/ILinkContext.cs index 25c7962f..e098a900 100644 --- a/src/WixToolset.Extensibility/Services/ILinkContext.cs +++ b/src/WixToolset.Extensibility/Services/ILinkContext.cs @@ -10,7 +10,7 @@ namespace WixToolset.Extensibility.Services { IServiceProvider ServiceProvider { get; } - Messaging Messaging { get; set; } + IMessaging Messaging { get; set; } IEnumerable Extensions { get; set; } diff --git a/src/WixToolset.Extensibility/Services/IMessaging.cs b/src/WixToolset.Extensibility/Services/IMessaging.cs new file mode 100644 index 00000000..901c7af4 --- /dev/null +++ b/src/WixToolset.Extensibility/Services/IMessaging.cs @@ -0,0 +1,80 @@ +// 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. + +namespace WixToolset.Extensibility.Services +{ + using WixToolset.Data; + + /// + /// Interface for handling messages (error/warning/verbose). + /// + public interface IMessaging + { + /// + /// Indicates whether an error has been found. + /// + /// A bool indicating whether an error has been found. + bool EncounteredError { get; } + + /// + /// Gets the last error code encountered during messaging. + /// + /// The exit code for the process. + int LastErrorNumber { get; } + + /// + /// Gets or sets the option to show verbose messages. + /// + /// The option to show verbose messages. + bool ShowVerboseMessages { get; set; } + + /// + /// Gets or sets the option to suppress all warning messages. + /// + /// The option to suppress all warning messages. + bool SuppressAllWarnings { get; set; } + + /// + /// Gets and sets the option to treat warnings as errors. + /// + /// The option to treat warnings as errors. + bool WarningsAsError { get; set; } + + /// + /// Sets the listener for messaging. + /// + /// + void SetListener(IMessageListener listener); + + /// + /// Adds a warning message id to be elevated to an error message. + /// + /// Id of the message to elevate. + void ElevateWarningMessage(int warningNumber); + + /// + /// Adds a warning message id to be suppressed in message output. + /// + /// Id of the message to suppress. + void SuppressWarningMessage(int warningNumber); + + /// + /// Formats a message to standard message. + /// + /// Message to format. + /// Formatted message + string FormatMessage(Message message); + + /// + /// Sends a message with the given arguments. + /// + /// Message to write. + void Write(Message message); + + /// + /// Sends a message with the given arguments. + /// + /// Message to write. + /// Indicates where to write a verbose message. + void Write(string message, bool verbose = false); + } +} -- cgit v1.2.3-55-g6feb From 21be85310baadfb1a479ca5b8c4d8f27018ff8f8 Mon Sep 17 00:00:00 2001 From: Bob Arnson Date: Wed, 20 Dec 2017 21:42:24 -0500 Subject: Add ICompileContext to BaseCompilerExtension --- src/WixToolset.Extensibility/BaseCompilerExtension.cs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/WixToolset.Extensibility/BaseCompilerExtension.cs b/src/WixToolset.Extensibility/BaseCompilerExtension.cs index 0f386e28..58efa37f 100644 --- a/src/WixToolset.Extensibility/BaseCompilerExtension.cs +++ b/src/WixToolset.Extensibility/BaseCompilerExtension.cs @@ -12,6 +12,11 @@ namespace WixToolset.Extensibility /// public abstract class BaseCompilerExtension : ICompilerExtension { + /// + /// Context for use by the extension. + /// + protected ICompileContext Context { get; private set; } + /// /// Messaging for use by the extension. /// @@ -33,6 +38,8 @@ namespace WixToolset.Extensibility /// public virtual void PreCompile(ICompileContext context) { + this.Context = context; + this.Messaging = context.Messaging; this.ParseHelper = context.ServiceProvider.GetService(); -- cgit v1.2.3-55-g6feb From 5287c9ce70877b6b1e96d3253a395101fe30de8f Mon Sep 17 00:00:00 2001 From: Rob Mensching Date: Thu, 21 Dec 2017 13:37:19 -0800 Subject: Introduce IResolveExtension and IFileSystemExtension with cleanup --- .../BaseResolverExtension.cs | 38 ++++++++++++++ .../BinderExtensionBase.cs | 55 -------------------- src/WixToolset.Extensibility/IBackend.cs | 1 - src/WixToolset.Extensibility/IBindContext.cs | 52 +++++++++++++++++++ .../IBindVariableResolver.cs | 26 ---------- src/WixToolset.Extensibility/IBinderExtension.cs | 37 -------------- .../IBinderFileManagerCore.cs | 55 -------------------- src/WixToolset.Extensibility/IFileSystemContext.cs | 25 +++++++++ .../IFileSystemExtension.cs | 18 +++++++ src/WixToolset.Extensibility/ILayoutContext.cs | 34 +++++++++++++ src/WixToolset.Extensibility/ILayoutExtension.cs | 20 ++++++++ .../ILibrarianExtension.cs | 2 +- src/WixToolset.Extensibility/ILibraryContext.cs | 2 - src/WixToolset.Extensibility/ILinkContext.cs | 26 ++++++++++ src/WixToolset.Extensibility/IResolveContext.cs | 26 ++++++++++ src/WixToolset.Extensibility/IResolverExtension.cs | 25 +++++++++ src/WixToolset.Extensibility/ResolveResult.cs | 18 +++++++ .../Services/BindVariableResolution.cs | 27 ++++++++++ .../Services/IBindContext.cs | 59 ---------------------- .../Services/IBindVariableResolver.cs | 17 +++++++ .../Services/ILinkContext.cs | 25 --------- 21 files changed, 327 insertions(+), 261 deletions(-) create mode 100644 src/WixToolset.Extensibility/BaseResolverExtension.cs delete mode 100644 src/WixToolset.Extensibility/BinderExtensionBase.cs create mode 100644 src/WixToolset.Extensibility/IBindContext.cs delete mode 100644 src/WixToolset.Extensibility/IBindVariableResolver.cs delete mode 100644 src/WixToolset.Extensibility/IBinderExtension.cs delete mode 100644 src/WixToolset.Extensibility/IBinderFileManagerCore.cs create mode 100644 src/WixToolset.Extensibility/IFileSystemContext.cs create mode 100644 src/WixToolset.Extensibility/IFileSystemExtension.cs create mode 100644 src/WixToolset.Extensibility/ILayoutContext.cs create mode 100644 src/WixToolset.Extensibility/ILayoutExtension.cs create mode 100644 src/WixToolset.Extensibility/ILinkContext.cs create mode 100644 src/WixToolset.Extensibility/IResolveContext.cs create mode 100644 src/WixToolset.Extensibility/IResolverExtension.cs create mode 100644 src/WixToolset.Extensibility/ResolveResult.cs create mode 100644 src/WixToolset.Extensibility/Services/BindVariableResolution.cs delete mode 100644 src/WixToolset.Extensibility/Services/IBindContext.cs create mode 100644 src/WixToolset.Extensibility/Services/IBindVariableResolver.cs delete mode 100644 src/WixToolset.Extensibility/Services/ILinkContext.cs diff --git a/src/WixToolset.Extensibility/BaseResolverExtension.cs b/src/WixToolset.Extensibility/BaseResolverExtension.cs new file mode 100644 index 00000000..9498d126 --- /dev/null +++ b/src/WixToolset.Extensibility/BaseResolverExtension.cs @@ -0,0 +1,38 @@ +// 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. + +namespace WixToolset.Extensibility +{ + using WixToolset.Data; + using WixToolset.Data.Bind; + + /// + /// Base class for creating a resolver extension. + /// + public abstract class BaseResolverExtension : IResolverExtension + { + /// + /// Context for use by the extension. + /// + protected IResolveContext Context { get; private set; } + + /// + /// Called at the beginning of the resolving variables and files. + /// + public virtual void PreResolve(IResolveContext context) + { + this.Context = context; + } + + public virtual string ResolveFile(string source, IntermediateTupleDefinition tupleDefinition, SourceLineNumber sourceLineNumbers, BindStage bindStage) + { + return null; + } + + /// + /// Called at the end of resolve. + /// + public virtual void PostResolve(ResolveResult result) + { + } + } +} diff --git a/src/WixToolset.Extensibility/BinderExtensionBase.cs b/src/WixToolset.Extensibility/BinderExtensionBase.cs deleted file mode 100644 index f3f3d63b..00000000 --- a/src/WixToolset.Extensibility/BinderExtensionBase.cs +++ /dev/null @@ -1,55 +0,0 @@ -// 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. - -namespace WixToolset.Extensibility -{ - using WixToolset.Data; - using WixToolset.Data.Bind; - using WixToolset.Extensibility.Services; - - public abstract class BinderExtensionBase : IBinderExtension - { - protected IBindContext Context { get; private set; } - - /// - /// Called before binding occurs. - /// - public virtual void PreBind(IBindContext context) - { - this.Context = context; - } - - /// - /// Called after variable resolution occurs. - /// - public virtual void AfterResolvedFields(Intermediate intermediate) - { - } - - public virtual string ResolveFile(string source, string type, SourceLineNumber sourceLineNumbers, BindStage bindStage) - { - return null; - } - - public virtual bool? CompareFiles(string targetFile, string updatedFile) - { - return null; - } - - public virtual bool CopyFile(string source, string destination, bool overwrite) - { - return false; - } - - public virtual bool MoveFile(string source, string destination, bool overwrite) - { - return false; - } - - /// - /// Called after binding is complete before the files are moved to their final locations. - /// - public virtual void PostBind(BindResult result) - { - } - } -} diff --git a/src/WixToolset.Extensibility/IBackend.cs b/src/WixToolset.Extensibility/IBackend.cs index 9b950364..385fd086 100644 --- a/src/WixToolset.Extensibility/IBackend.cs +++ b/src/WixToolset.Extensibility/IBackend.cs @@ -4,7 +4,6 @@ namespace WixToolset.Extensibility { using WixToolset.Data; using WixToolset.Data.Bind; - using WixToolset.Extensibility.Services; public interface IBackend { diff --git a/src/WixToolset.Extensibility/IBindContext.cs b/src/WixToolset.Extensibility/IBindContext.cs new file mode 100644 index 00000000..1cb1c558 --- /dev/null +++ b/src/WixToolset.Extensibility/IBindContext.cs @@ -0,0 +1,52 @@ +// 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. + +namespace WixToolset.Extensibility +{ + using System; + using System.Collections.Generic; + using WixToolset.Data; + using WixToolset.Extensibility.Services; + + public interface IBindContext + { + IServiceProvider ServiceProvider { get; } + + IMessaging Messaging { get; set; } + + int CabbingThreadCount { get; set; } + + string CabCachePath { get; set; } + + int Codepage { get; set; } + + CompressionLevel DefaultCompressionLevel { get; set; } + + IEnumerable DelayedFields { get; set; } + + IEnumerable ExpectedEmbeddedFiles { get; set; } + + IEnumerable FileSystemExtensions { get; set; } + + IEnumerable Ices { get; set; } + + string IntermediateFolder { get; set; } + + Intermediate IntermediateRepresentation { get; set; } + + string OutputPath { get; set; } + + string OutputPdbPath { get; set; } + + IEnumerable SuppressIces { get; set; } + + bool SuppressValidation { get; set; } + + string ContentsFile { get; set; } + + string OutputsFile { get; set; } + + string BuiltOutputsFile { get; set; } + + string WixprojectFile { get; set; } + } +} diff --git a/src/WixToolset.Extensibility/IBindVariableResolver.cs b/src/WixToolset.Extensibility/IBindVariableResolver.cs deleted file mode 100644 index f584f327..00000000 --- a/src/WixToolset.Extensibility/IBindVariableResolver.cs +++ /dev/null @@ -1,26 +0,0 @@ -// 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. - -namespace WixToolset.Extensibility -{ - using WixToolset.Data; - using WixToolset.Data.Tuples; - - public interface IBindVariableResolver - { - int VariableCount { get; } - - void AddVariable(string name, string value); - - void AddVariable(WixVariableTuple wixVariableRow); - - string ResolveVariables(SourceLineNumber sourceLineNumbers, string value, bool localizationOnly); - - string ResolveVariables(SourceLineNumber sourceLineNumbers, string value, bool localizationOnly, bool errorOnUnknown, out bool isDefault, out bool delayedResolve); - - string ResolveVariables(SourceLineNumber sourceLineNumbers, string value, bool localizationOnly, out bool isDefault); - - string ResolveVariables(SourceLineNumber sourceLineNumbers, string value, bool localizationOnly, out bool isDefault, out bool delayedResolve); - - bool TryGetLocalizedControl(string dialog, string control, out LocalizedControl localizedControl); - } -} diff --git a/src/WixToolset.Extensibility/IBinderExtension.cs b/src/WixToolset.Extensibility/IBinderExtension.cs deleted file mode 100644 index 0e9df10b..00000000 --- a/src/WixToolset.Extensibility/IBinderExtension.cs +++ /dev/null @@ -1,37 +0,0 @@ -// 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. - -namespace WixToolset.Extensibility -{ - using WixToolset.Data; - using WixToolset.Data.Bind; - using WixToolset.Extensibility.Services; - - /// - /// Interface all binder extensions implement. - /// - public interface IBinderExtension - { - /// - /// Called before binding occurs. - /// - void PreBind(IBindContext context); - - /// - /// Called after variable resolution occurs. - /// - void AfterResolvedFields(Intermediate intermediate); - - string ResolveFile(string source, string type, SourceLineNumber sourceLineNumbers, BindStage bindStage); - - bool? CompareFiles(string targetFile, string updatedFile); - - bool CopyFile(string source, string destination, bool overwrite); - - bool MoveFile(string source, string destination, bool overwrite); - - /// - /// Called after all output changes occur and right before the output is bound into its final format. - /// - void PostBind(BindResult result); - } -} diff --git a/src/WixToolset.Extensibility/IBinderFileManagerCore.cs b/src/WixToolset.Extensibility/IBinderFileManagerCore.cs deleted file mode 100644 index 27644413..00000000 --- a/src/WixToolset.Extensibility/IBinderFileManagerCore.cs +++ /dev/null @@ -1,55 +0,0 @@ -// 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. - -namespace WixToolset.Extensibility -{ - using System.Collections.Generic; - using WixToolset.Data; - using WixToolset.Data.Bind; - - public interface IBinderFileManagerCore - { - /// - /// Gets or sets the path to cabinet cache. - /// - /// The path to cabinet cache. - string CabCachePath { get; } - - /// - /// Gets or sets the active subStorage used for binding. - /// - /// The subStorage object. - //SubStorage ActiveSubStorage { get; } - - /// - /// Gets or sets the output object used for binding. - /// - /// The output object. - Intermediate Intermediate { get; } - - /// - /// Gets or sets the path to the temp files location. - /// - /// The path to the temp files location. - string TempFilesLocation { get; } - - /// - /// Gets the property if re-basing target is true or false - /// - /// It returns true if target bind path is to be replaced, otherwise false. - bool RebaseTarget { get; } - - /// - /// Gets the property if re-basing updated build is true or false - /// - /// It returns true if updated bind path is to be replaced, otherwise false. - bool RebaseUpdated { get; } - - /// - /// Gets the collection of paths to locate files during ResolveFile for the provided BindStage and name. - /// - /// Optional stage to get bind paths for. Default is normal. - /// Optional name of the bind paths to get. Default is the unnamed paths. - /// The bind paths to locate files. - IEnumerable GetBindPaths(BindStage stage = BindStage.Normal, string name = null); - } -} diff --git a/src/WixToolset.Extensibility/IFileSystemContext.cs b/src/WixToolset.Extensibility/IFileSystemContext.cs new file mode 100644 index 00000000..32783957 --- /dev/null +++ b/src/WixToolset.Extensibility/IFileSystemContext.cs @@ -0,0 +1,25 @@ +// 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. + +namespace WixToolset.Extensibility +{ + using System; + using WixToolset.Data; + using WixToolset.Extensibility.Services; + + public interface IFileSystemContext + { + IServiceProvider ServiceProvider { get; } + + IMessaging Messaging { get; set; } + + string CabCachePath { get; set; } + + string IntermediateFolder { get; set; } + + Intermediate IntermediateRepresentation { get; set; } + + string OutputPath { get; set; } + + string OutputPdbPath { get; set; } + } +} diff --git a/src/WixToolset.Extensibility/IFileSystemExtension.cs b/src/WixToolset.Extensibility/IFileSystemExtension.cs new file mode 100644 index 00000000..37b8e24a --- /dev/null +++ b/src/WixToolset.Extensibility/IFileSystemExtension.cs @@ -0,0 +1,18 @@ +// 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. + +namespace WixToolset.Extensibility +{ + /// + /// Interface all file system extensions implement. + /// + public interface IFileSystemExtension + { + void Initialize(IFileSystemContext context); + + bool? CompareFiles(string targetFile, string updatedFile); + + bool CopyFile(string source, string destination, bool overwrite); + + bool MoveFile(string source, string destination, bool overwrite); + } +} diff --git a/src/WixToolset.Extensibility/ILayoutContext.cs b/src/WixToolset.Extensibility/ILayoutContext.cs new file mode 100644 index 00000000..5b4f014d --- /dev/null +++ b/src/WixToolset.Extensibility/ILayoutContext.cs @@ -0,0 +1,34 @@ +// 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. + +namespace WixToolset.Extensibility +{ + using System; + using System.Collections.Generic; + using WixToolset.Data.Bind; + using WixToolset.Extensibility.Services; + + public interface ILayoutContext + { + IServiceProvider ServiceProvider { get; } + + IMessaging Messaging { get; set; } + + IEnumerable Extensions { get; set; } + + IEnumerable FileSystemExtensions { get; set; } + + IEnumerable ContentFilePaths { get; set; } + + IEnumerable FileTransfers { get; set; } + + string OutputPdbPath { get; set; } + + string ContentsFile { get; set; } + + string OutputsFile { get; set; } + + string BuiltOutputsFile { get; set; } + + bool SuppressAclReset { get; set; } + } +} diff --git a/src/WixToolset.Extensibility/ILayoutExtension.cs b/src/WixToolset.Extensibility/ILayoutExtension.cs new file mode 100644 index 00000000..b1de5bd2 --- /dev/null +++ b/src/WixToolset.Extensibility/ILayoutExtension.cs @@ -0,0 +1,20 @@ +// 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. + +namespace WixToolset.Extensibility +{ + /// + /// Interface all resolver extensions implement. + /// + public interface ILayoutExtension + { + /// + /// Called before resolving occurs. + /// + void PreLayout(ILayoutContext context); + + /// + /// Called after all resolving occurs. + /// + void PostLayout(); + } +} diff --git a/src/WixToolset.Extensibility/ILibrarianExtension.cs b/src/WixToolset.Extensibility/ILibrarianExtension.cs index ae4529d8..381abf01 100644 --- a/src/WixToolset.Extensibility/ILibrarianExtension.cs +++ b/src/WixToolset.Extensibility/ILibrarianExtension.cs @@ -8,7 +8,7 @@ namespace WixToolset.Extensibility { void PreCombine(ILibraryContext context); - string Resolve(SourceLineNumber sourceLineNumber, string table, string path); + string Resolve(SourceLineNumber sourceLineNumber, IntermediateTupleDefinition tupleDefinition, string path); void PostCombine(Intermediate library); } diff --git a/src/WixToolset.Extensibility/ILibraryContext.cs b/src/WixToolset.Extensibility/ILibraryContext.cs index e715080f..0c29a3dd 100644 --- a/src/WixToolset.Extensibility/ILibraryContext.cs +++ b/src/WixToolset.Extensibility/ILibraryContext.cs @@ -24,7 +24,5 @@ namespace WixToolset.Extensibility IEnumerable Localizations { get; set; } IEnumerable Intermediates { get; set; } - - IBindVariableResolver WixVariableResolver { get; set; } } } diff --git a/src/WixToolset.Extensibility/ILinkContext.cs b/src/WixToolset.Extensibility/ILinkContext.cs new file mode 100644 index 00000000..65eeb6f1 --- /dev/null +++ b/src/WixToolset.Extensibility/ILinkContext.cs @@ -0,0 +1,26 @@ +// 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. + +namespace WixToolset.Extensibility +{ + using System; + using System.Collections.Generic; + using WixToolset.Data; + using WixToolset.Extensibility.Services; + + public interface ILinkContext + { + IServiceProvider ServiceProvider { get; } + + IMessaging Messaging { get; set; } + + IEnumerable Extensions { get; set; } + + IEnumerable ExtensionData { get; set; } + + OutputType ExpectedOutputType { get; set; } + + IEnumerable Intermediates { get; set; } + + ITupleDefinitionCreator TupleDefinitionCreator { get; set; } + } +} diff --git a/src/WixToolset.Extensibility/IResolveContext.cs b/src/WixToolset.Extensibility/IResolveContext.cs new file mode 100644 index 00000000..026e5a35 --- /dev/null +++ b/src/WixToolset.Extensibility/IResolveContext.cs @@ -0,0 +1,26 @@ +// 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. + +namespace WixToolset.Extensibility +{ + using System; + using System.Collections.Generic; + using WixToolset.Data; + using WixToolset.Extensibility.Services; + + public interface IResolveContext + { + IServiceProvider ServiceProvider { get; } + + IMessaging Messaging { get; set; } + + IEnumerable BindPaths { get; set; } + + IEnumerable Extensions { get; set; } + + string IntermediateFolder { get; set; } + + Intermediate IntermediateRepresentation { get; set; } + + IBindVariableResolver WixVariableResolver { get; set; } + } +} diff --git a/src/WixToolset.Extensibility/IResolverExtension.cs b/src/WixToolset.Extensibility/IResolverExtension.cs new file mode 100644 index 00000000..b0478ff0 --- /dev/null +++ b/src/WixToolset.Extensibility/IResolverExtension.cs @@ -0,0 +1,25 @@ +// 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. + +namespace WixToolset.Extensibility +{ + using WixToolset.Data; + using WixToolset.Data.Bind; + + /// + /// Interface all resolver extensions implement. + /// + public interface IResolverExtension + { + /// + /// Called before resolving occurs. + /// + void PreResolve(IResolveContext context); + + string ResolveFile(string source, IntermediateTupleDefinition tupleDefinition, SourceLineNumber sourceLineNumbers, BindStage bindStage); + + /// + /// Called after all resolving occurs. + /// + void PostResolve(ResolveResult result); + } +} diff --git a/src/WixToolset.Extensibility/ResolveResult.cs b/src/WixToolset.Extensibility/ResolveResult.cs new file mode 100644 index 00000000..14073ab0 --- /dev/null +++ b/src/WixToolset.Extensibility/ResolveResult.cs @@ -0,0 +1,18 @@ +// 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. + +namespace WixToolset.Extensibility +{ + using System.Collections.Generic; + using WixToolset.Data; + + public class ResolveResult + { + public int Codepage { get; set; } + + public IEnumerable ExpectedEmbeddedFiles { get; set; } + + public IEnumerable DelayedFields { get; set; } + + public Intermediate IntermediateRepresentation { get; set; } + } +} \ No newline at end of file diff --git a/src/WixToolset.Extensibility/Services/BindVariableResolution.cs b/src/WixToolset.Extensibility/Services/BindVariableResolution.cs new file mode 100644 index 00000000..cdd1fa19 --- /dev/null +++ b/src/WixToolset.Extensibility/Services/BindVariableResolution.cs @@ -0,0 +1,27 @@ +// 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. + +namespace WixToolset.Extensibility.Services +{ + public class BindVariableResolution + { + /// + /// Indicates whether the variable should be delay resolved. + /// + public bool DelayedResolve { get; set; } + + /// + /// Indicates whether the value is the default value of the variable. + /// + public bool IsDefault { get; set; } + + /// + /// Indicates whether the value changed. + /// + public bool UpdatedValue { get; set; } + + /// + /// Resolved value. + /// + public string Value { get; set; } + } +} \ No newline at end of file diff --git a/src/WixToolset.Extensibility/Services/IBindContext.cs b/src/WixToolset.Extensibility/Services/IBindContext.cs deleted file mode 100644 index ad1aa818..00000000 --- a/src/WixToolset.Extensibility/Services/IBindContext.cs +++ /dev/null @@ -1,59 +0,0 @@ -// 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. - -namespace WixToolset.Extensibility.Services -{ - using System; - using System.Collections.Generic; - using WixToolset.Data; - - public interface IBindContext - { - IServiceProvider ServiceProvider { get; } - - IMessaging Messaging { get; set; } - - IEnumerable BindPaths { get; set; } - - int CabbingThreadCount { get; set; } - - string CabCachePath { get; set; } - - int Codepage { get; set; } - - CompressionLevel DefaultCompressionLevel { get; set; } - - IEnumerable DelayedFields { get; set; } - - IEnumerable ExpectedEmbeddedFiles { get; set; } - - IExtensionManager ExtensionManager { get; set; } - - IEnumerable Extensions { get; set; } - - IEnumerable Ices { get; set; } - - string IntermediateFolder { get; set; } - - Intermediate IntermediateRepresentation { get; set; } - - string OutputPath { get; set; } - - string OutputPdbPath { get; set; } - - bool SuppressAclReset { get; set; } - - IEnumerable SuppressIces { get; set; } - - bool SuppressValidation { get; set; } - - IBindVariableResolver WixVariableResolver { get; set; } - - string ContentsFile { get; set; } - - string OutputsFile { get; set; } - - string BuiltOutputsFile { get; set; } - - string WixprojectFile { get; set; } - } -} diff --git a/src/WixToolset.Extensibility/Services/IBindVariableResolver.cs b/src/WixToolset.Extensibility/Services/IBindVariableResolver.cs new file mode 100644 index 00000000..50071658 --- /dev/null +++ b/src/WixToolset.Extensibility/Services/IBindVariableResolver.cs @@ -0,0 +1,17 @@ +// 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. + +namespace WixToolset.Extensibility.Services +{ + using WixToolset.Data; + + public interface IBindVariableResolver + { + int VariableCount { get; } + + void AddVariable(string name, string value, bool overridable); + + BindVariableResolution ResolveVariables(SourceLineNumber sourceLineNumbers, string value, bool localizationOnly); + + bool TryGetLocalizedControl(string dialog, string control, out LocalizedControl localizedControl); + } +} diff --git a/src/WixToolset.Extensibility/Services/ILinkContext.cs b/src/WixToolset.Extensibility/Services/ILinkContext.cs deleted file mode 100644 index e098a900..00000000 --- a/src/WixToolset.Extensibility/Services/ILinkContext.cs +++ /dev/null @@ -1,25 +0,0 @@ -// 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. - -namespace WixToolset.Extensibility.Services -{ - using System; - using System.Collections.Generic; - using WixToolset.Data; - - public interface ILinkContext - { - IServiceProvider ServiceProvider { get; } - - IMessaging Messaging { get; set; } - - IEnumerable Extensions { get; set; } - - IEnumerable ExtensionData { get; set; } - - OutputType ExpectedOutputType { get; set; } - - IEnumerable Intermediates { get; set; } - - ITupleDefinitionCreator TupleDefinitionCreator { get; set; } - } -} -- cgit v1.2.3-55-g6feb From 027d1ac927aa6b0ee0c934b1f6b540d2a1667df2 Mon Sep 17 00:00:00 2001 From: Rob Mensching Date: Fri, 22 Dec 2017 15:47:26 -0800 Subject: Bring back binder extensions and missing layout base extension --- .../BaseBinderExtension.cs | 32 ++++++++++++++++++++++ .../BaseLayoutExtension.cs | 30 ++++++++++++++++++++ src/WixToolset.Extensibility/IBindContext.cs | 12 ++------ src/WixToolset.Extensibility/IBindExtension.cs | 22 +++++++++++++++ src/WixToolset.Extensibility/ILayoutExtension.cs | 6 ++-- src/WixToolset.Extensibility/ResolveResult.cs | 4 +-- 6 files changed, 92 insertions(+), 14 deletions(-) create mode 100644 src/WixToolset.Extensibility/BaseBinderExtension.cs create mode 100644 src/WixToolset.Extensibility/BaseLayoutExtension.cs create mode 100644 src/WixToolset.Extensibility/IBindExtension.cs diff --git a/src/WixToolset.Extensibility/BaseBinderExtension.cs b/src/WixToolset.Extensibility/BaseBinderExtension.cs new file mode 100644 index 00000000..e5e38793 --- /dev/null +++ b/src/WixToolset.Extensibility/BaseBinderExtension.cs @@ -0,0 +1,32 @@ +// 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. + +namespace WixToolset.Extensibility +{ + using WixToolset.Data.Bind; + + /// + /// Base class for creating a resolver extension. + /// + public abstract class BaseBinderExtension : IBinderExtension + { + /// + /// Context for use by the extension. + /// + protected IBindContext Context { get; private set; } + + /// + /// Called at the beginning of bind. + /// + public virtual void PreBind(IBindContext context) + { + this.Context = context; + } + + /// + /// Called at the end of bind. + /// + public virtual void PostBind(BindResult result) + { + } + } +} diff --git a/src/WixToolset.Extensibility/BaseLayoutExtension.cs b/src/WixToolset.Extensibility/BaseLayoutExtension.cs new file mode 100644 index 00000000..6dfe7f2c --- /dev/null +++ b/src/WixToolset.Extensibility/BaseLayoutExtension.cs @@ -0,0 +1,30 @@ +// 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. + +namespace WixToolset.Extensibility +{ + /// + /// Base class for creating a resolver extension. + /// + public abstract class BaseLayoutExtension : ILayoutExtension + { + /// + /// Context for use by the extension. + /// + protected ILayoutContext Context { get; private set; } + + /// + /// Called at the beginning of layout. + /// + public virtual void PreLayout(ILayoutContext context) + { + this.Context = context; + } + + /// + /// Called at the end of ayout. + /// + public virtual void PostLayout() + { + } + } +} diff --git a/src/WixToolset.Extensibility/IBindContext.cs b/src/WixToolset.Extensibility/IBindContext.cs index 1cb1c558..59509ecf 100644 --- a/src/WixToolset.Extensibility/IBindContext.cs +++ b/src/WixToolset.Extensibility/IBindContext.cs @@ -19,12 +19,14 @@ namespace WixToolset.Extensibility int Codepage { get; set; } - CompressionLevel DefaultCompressionLevel { get; set; } + CompressionLevel? DefaultCompressionLevel { get; set; } IEnumerable DelayedFields { get; set; } IEnumerable ExpectedEmbeddedFiles { get; set; } + IEnumerable Extensions { get; set; } + IEnumerable FileSystemExtensions { get; set; } IEnumerable Ices { get; set; } @@ -40,13 +42,5 @@ namespace WixToolset.Extensibility IEnumerable SuppressIces { get; set; } bool SuppressValidation { get; set; } - - string ContentsFile { get; set; } - - string OutputsFile { get; set; } - - string BuiltOutputsFile { get; set; } - - string WixprojectFile { get; set; } } } diff --git a/src/WixToolset.Extensibility/IBindExtension.cs b/src/WixToolset.Extensibility/IBindExtension.cs new file mode 100644 index 00000000..c9830a35 --- /dev/null +++ b/src/WixToolset.Extensibility/IBindExtension.cs @@ -0,0 +1,22 @@ +// 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. + +namespace WixToolset.Extensibility +{ + using WixToolset.Data.Bind; + + /// + /// Interface all binder extensions implement. + /// + public interface IBinderExtension + { + /// + /// Called before binding occurs. + /// + void PreBind(IBindContext context); + + /// + /// Called after all binding occurs. + /// + void PostBind(BindResult result); + } +} diff --git a/src/WixToolset.Extensibility/ILayoutExtension.cs b/src/WixToolset.Extensibility/ILayoutExtension.cs index b1de5bd2..525c5053 100644 --- a/src/WixToolset.Extensibility/ILayoutExtension.cs +++ b/src/WixToolset.Extensibility/ILayoutExtension.cs @@ -3,17 +3,17 @@ namespace WixToolset.Extensibility { /// - /// Interface all resolver extensions implement. + /// Interface all layout extensions implement. /// public interface ILayoutExtension { /// - /// Called before resolving occurs. + /// Called before layout occurs. /// void PreLayout(ILayoutContext context); /// - /// Called after all resolving occurs. + /// Called after all layout occurs. /// void PostLayout(); } diff --git a/src/WixToolset.Extensibility/ResolveResult.cs b/src/WixToolset.Extensibility/ResolveResult.cs index 14073ab0..53f12fe9 100644 --- a/src/WixToolset.Extensibility/ResolveResult.cs +++ b/src/WixToolset.Extensibility/ResolveResult.cs @@ -9,10 +9,10 @@ namespace WixToolset.Extensibility { public int Codepage { get; set; } - public IEnumerable ExpectedEmbeddedFiles { get; set; } - public IEnumerable DelayedFields { get; set; } + public IEnumerable ExpectedEmbeddedFiles { get; set; } + public Intermediate IntermediateRepresentation { get; set; } } } \ No newline at end of file -- cgit v1.2.3-55-g6feb From ed5fd9d8258a5c752cd37fe7702f3a0dc37052f7 Mon Sep 17 00:00:00 2001 From: Rob Mensching Date: Tue, 26 Dec 2017 15:12:34 -0800 Subject: Move copy/move file operations to ILayoutExtension plus other cleanup --- src/WixToolset.Extensibility/BaseLayoutExtension.cs | 10 ++++++++++ src/WixToolset.Extensibility/IFileSystemExtension.cs | 4 ---- src/WixToolset.Extensibility/ILayoutContext.cs | 2 -- src/WixToolset.Extensibility/ILayoutExtension.cs | 4 ++++ src/WixToolset.Extensibility/IPreprocessContext.cs | 4 ++-- src/WixToolset.Extensibility/ServiceProviderExtensions.cs | 14 ++++++++++++++ .../Services/ServiceProviderExtensions.cs | 14 -------------- 7 files changed, 30 insertions(+), 22 deletions(-) create mode 100644 src/WixToolset.Extensibility/ServiceProviderExtensions.cs delete mode 100644 src/WixToolset.Extensibility/Services/ServiceProviderExtensions.cs diff --git a/src/WixToolset.Extensibility/BaseLayoutExtension.cs b/src/WixToolset.Extensibility/BaseLayoutExtension.cs index 6dfe7f2c..624d01fc 100644 --- a/src/WixToolset.Extensibility/BaseLayoutExtension.cs +++ b/src/WixToolset.Extensibility/BaseLayoutExtension.cs @@ -20,6 +20,16 @@ namespace WixToolset.Extensibility this.Context = context; } + public bool CopyFile(string source, string destination) + { + return false; + } + + public bool MoveFile(string source, string destination) + { + return false; + } + /// /// Called at the end of ayout. /// diff --git a/src/WixToolset.Extensibility/IFileSystemExtension.cs b/src/WixToolset.Extensibility/IFileSystemExtension.cs index 37b8e24a..96c8a748 100644 --- a/src/WixToolset.Extensibility/IFileSystemExtension.cs +++ b/src/WixToolset.Extensibility/IFileSystemExtension.cs @@ -10,9 +10,5 @@ namespace WixToolset.Extensibility void Initialize(IFileSystemContext context); bool? CompareFiles(string targetFile, string updatedFile); - - bool CopyFile(string source, string destination, bool overwrite); - - bool MoveFile(string source, string destination, bool overwrite); } } diff --git a/src/WixToolset.Extensibility/ILayoutContext.cs b/src/WixToolset.Extensibility/ILayoutContext.cs index 5b4f014d..9ec559f9 100644 --- a/src/WixToolset.Extensibility/ILayoutContext.cs +++ b/src/WixToolset.Extensibility/ILayoutContext.cs @@ -15,8 +15,6 @@ namespace WixToolset.Extensibility IEnumerable Extensions { get; set; } - IEnumerable FileSystemExtensions { get; set; } - IEnumerable ContentFilePaths { get; set; } IEnumerable FileTransfers { get; set; } diff --git a/src/WixToolset.Extensibility/ILayoutExtension.cs b/src/WixToolset.Extensibility/ILayoutExtension.cs index 525c5053..1cf4871f 100644 --- a/src/WixToolset.Extensibility/ILayoutExtension.cs +++ b/src/WixToolset.Extensibility/ILayoutExtension.cs @@ -12,6 +12,10 @@ namespace WixToolset.Extensibility /// void PreLayout(ILayoutContext context); + bool CopyFile(string source, string destination); + + bool MoveFile(string source, string destination); + /// /// Called after all layout occurs. /// diff --git a/src/WixToolset.Extensibility/IPreprocessContext.cs b/src/WixToolset.Extensibility/IPreprocessContext.cs index 2e288d59..fcf698c1 100644 --- a/src/WixToolset.Extensibility/IPreprocessContext.cs +++ b/src/WixToolset.Extensibility/IPreprocessContext.cs @@ -15,14 +15,14 @@ namespace WixToolset.Extensibility IEnumerable Extensions { get; set; } + IList IncludeSearchPaths { get; set; } + /// /// Gets the platform which the compiler will use when defaulting 64-bit attributes and elements. /// /// The platform which the compiler will use when defaulting 64-bit attributes and elements. Platform Platform { get; set; } - IList IncludeSearchPaths { get; set; } - string SourceFile { get; set; } IDictionary Variables { get; set; } diff --git a/src/WixToolset.Extensibility/ServiceProviderExtensions.cs b/src/WixToolset.Extensibility/ServiceProviderExtensions.cs new file mode 100644 index 00000000..408d1523 --- /dev/null +++ b/src/WixToolset.Extensibility/ServiceProviderExtensions.cs @@ -0,0 +1,14 @@ +// 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. + +namespace WixToolset.Extensibility +{ + using System; + + public static class ServiceProviderExtensions + { + public static T GetService(this IServiceProvider serviceProvider) where T : class + { + return (T)serviceProvider.GetService(typeof(T)); + } + } +} diff --git a/src/WixToolset.Extensibility/Services/ServiceProviderExtensions.cs b/src/WixToolset.Extensibility/Services/ServiceProviderExtensions.cs deleted file mode 100644 index f4a5e8c3..00000000 --- a/src/WixToolset.Extensibility/Services/ServiceProviderExtensions.cs +++ /dev/null @@ -1,14 +0,0 @@ -// 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. - -namespace WixToolset.Extensibility.Services -{ - using System; - - public static class ServiceProviderExtensions - { - public static T GetService(this IServiceProvider serviceProvider) where T : class - { - return (T)serviceProvider.GetService(typeof(T)); - } - } -} -- cgit v1.2.3-55-g6feb From 888a51c27d6bcc9c394603d1a3be60aa660ef062 Mon Sep 17 00:00:00 2001 From: Rob Mensching Date: Wed, 27 Dec 2017 13:24:08 -0800 Subject: Better abstract extension factory, tuple to table creation and others --- .../BaseCompilerExtension.cs | 2 +- src/WixToolset.Extensibility/BaseExtensionData.cs | 25 +++++++++++++++++ .../BaseExtensionFactory.cs | 31 ++++++++++++++++++++++ .../BaseWindowsInstallerBackendExtension.cs | 10 +++++++ 4 files changed, 67 insertions(+), 1 deletion(-) create mode 100644 src/WixToolset.Extensibility/BaseExtensionData.cs create mode 100644 src/WixToolset.Extensibility/BaseExtensionFactory.cs diff --git a/src/WixToolset.Extensibility/BaseCompilerExtension.cs b/src/WixToolset.Extensibility/BaseCompilerExtension.cs index 58efa37f..abe2f4a9 100644 --- a/src/WixToolset.Extensibility/BaseCompilerExtension.cs +++ b/src/WixToolset.Extensibility/BaseCompilerExtension.cs @@ -31,7 +31,7 @@ namespace WixToolset.Extensibility /// Gets the schema namespace for this extension. /// /// Schema namespace supported by this extension. - public XNamespace Namespace { get; protected set; } + public abstract XNamespace Namespace { get; } /// /// Called at the beginning of the compilation of a source file. diff --git a/src/WixToolset.Extensibility/BaseExtensionData.cs b/src/WixToolset.Extensibility/BaseExtensionData.cs new file mode 100644 index 00000000..ddcec873 --- /dev/null +++ b/src/WixToolset.Extensibility/BaseExtensionData.cs @@ -0,0 +1,25 @@ +// 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. + +namespace WixToolset.Extensibility +{ + using WixToolset.Data; + + /// + /// Base class for creating a resolver extension. + /// + public abstract class BaseExtensionData : IExtensionData + { + public virtual string DefaultCulture => null; + + public virtual Intermediate GetLibrary(ITupleDefinitionCreator tupleDefinitions) + { + return null; + } + + public virtual bool TryGetTupleDefinitionByName(string name, out IntermediateTupleDefinition tupleDefinition) + { + tupleDefinition = null; + return false; + } + } +} diff --git a/src/WixToolset.Extensibility/BaseExtensionFactory.cs b/src/WixToolset.Extensibility/BaseExtensionFactory.cs new file mode 100644 index 00000000..2e7fdbb8 --- /dev/null +++ b/src/WixToolset.Extensibility/BaseExtensionFactory.cs @@ -0,0 +1,31 @@ +// 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. + +namespace WixToolset.Extensibility +{ + using System; + using System.Collections.Generic; + + /// + /// Base class for extension factories. + /// + public abstract class BaseExtensionFactory : IExtensionFactory + { + protected abstract IEnumerable ExtensionTypes { get; } + + public virtual bool TryCreateExtension(Type extensionType, out object extension) + { + extension = null; + + foreach (var type in this.ExtensionTypes) + { + if (extensionType.IsAssignableFrom(type)) + { + extension = Activator.CreateInstance(type); + break; + } + } + + return extension != null; + } + } +} diff --git a/src/WixToolset.Extensibility/BaseWindowsInstallerBackendExtension.cs b/src/WixToolset.Extensibility/BaseWindowsInstallerBackendExtension.cs index 0bcfce01..50e34288 100644 --- a/src/WixToolset.Extensibility/BaseWindowsInstallerBackendExtension.cs +++ b/src/WixToolset.Extensibility/BaseWindowsInstallerBackendExtension.cs @@ -24,6 +24,11 @@ namespace WixToolset.Extensibility /// protected IWindowsInstallerBackendHelper BackendHelper { get; private set; } + /// + /// Optional table definitions to automatically map to tuples. + /// + protected virtual TableDefinition[] TableDefinitionsForTuples { get; } + public virtual void PreBackendBind(IBindContext context) { this.Context = context; @@ -43,6 +48,11 @@ namespace WixToolset.Extensibility public virtual bool TryAddTupleToOutput(IntermediateTuple tuple, Output output) { + if (this.TableDefinitionsForTuples != null) + { + return this.BackendHelper.TryAddTupleToOutputMatchingTableDefinitions(tuple, output, this.TableDefinitionsForTuples); + } + return false; } -- cgit v1.2.3-55-g6feb From 7b251f34d266cff551c42f4ee8ebd9d5d1e96591 Mon Sep 17 00:00:00 2001 From: Rob Mensching Date: Wed, 27 Dec 2017 13:54:56 -0800 Subject: Send build notifications to Slack --- appveyor.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/appveyor.yml b/appveyor.yml index d9da1df5..0c74d54b 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -22,3 +22,8 @@ skip_tags: true artifacts: - path: build\Release\**\*.nupkg name: nuget + +notifications: +- provider: Slack + incoming_webhook: + secure: p5xuu+4x2JHfwGDMDe5KcG1k7gZxqYc4jWVwvyNZv5cvkubPD2waJs5yXMAXZNN7Z63/3PWHb7q4KoY/99AjauYa1nZ4c5qYqRPFRBKTHfA= -- cgit v1.2.3-55-g6feb From 83fe823da7ca2b27bd6de67e70df28b92307762a Mon Sep 17 00:00:00 2001 From: Rob Mensching Date: Wed, 27 Dec 2017 14:07:34 -0800 Subject: Build before packing to ensure tests are created --- appveyor.cmd | 1 + 1 file changed, 1 insertion(+) diff --git a/appveyor.cmd b/appveyor.cmd index e0dfe33f..3adf473e 100644 --- a/appveyor.cmd +++ b/appveyor.cmd @@ -1,6 +1,7 @@ @setlocal @pushd %~dp0 +dotnet build -c Release dotnet pack -c Release @popd -- cgit v1.2.3-55-g6feb From 885cba75c6d890e8d893396ec16301b6c03623c0 Mon Sep 17 00:00:00 2001 From: Rob Mensching Date: Wed, 27 Dec 2017 21:53:40 -0800 Subject: Correctly set BaseLayoutExtension abstract class methods virtual --- src/WixToolset.Extensibility/BaseLayoutExtension.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/WixToolset.Extensibility/BaseLayoutExtension.cs b/src/WixToolset.Extensibility/BaseLayoutExtension.cs index 624d01fc..bc80d432 100644 --- a/src/WixToolset.Extensibility/BaseLayoutExtension.cs +++ b/src/WixToolset.Extensibility/BaseLayoutExtension.cs @@ -20,12 +20,12 @@ namespace WixToolset.Extensibility this.Context = context; } - public bool CopyFile(string source, string destination) + public virtual bool CopyFile(string source, string destination) { return false; } - public bool MoveFile(string source, string destination) + public virtual bool MoveFile(string source, string destination) { return false; } -- cgit v1.2.3-55-g6feb From e127932777ab17592100188919cbfd663cf51a98 Mon Sep 17 00:00:00 2001 From: Rob Mensching Date: Fri, 29 Dec 2017 04:29:58 -0800 Subject: Update to latest GitVersioning --- src/WixToolset.Extensibility/WixToolset.Extensibility.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/WixToolset.Extensibility/WixToolset.Extensibility.csproj b/src/WixToolset.Extensibility/WixToolset.Extensibility.csproj index a2cb5e26..b35170d4 100644 --- a/src/WixToolset.Extensibility/WixToolset.Extensibility.csproj +++ b/src/WixToolset.Extensibility/WixToolset.Extensibility.csproj @@ -14,6 +14,6 @@ - + -- cgit v1.2.3-55-g6feb From 5e0736223c10b443c9b4ca9a70148ff1efb8032f Mon Sep 17 00:00:00 2001 From: Rob Mensching Date: Fri, 29 Dec 2017 21:47:36 -0800 Subject: Re-add IParseHelper.GetAttributeMsidbRegistryRootValue() --- src/WixToolset.Extensibility/Services/IParseHelper.cs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/WixToolset.Extensibility/Services/IParseHelper.cs b/src/WixToolset.Extensibility/Services/IParseHelper.cs index ad15c063..96e2c83c 100644 --- a/src/WixToolset.Extensibility/Services/IParseHelper.cs +++ b/src/WixToolset.Extensibility/Services/IParseHelper.cs @@ -218,6 +218,15 @@ namespace WixToolset.Extensibility.Services /// The attribute's long filename value. string GetAttributeLongFilename(SourceLineNumber sourceLineNumbers, XAttribute attribute, bool allowWildcards = false, bool allowRelative = false); + /// + /// Gets a RegistryRoot as a MsiInterop.MsidbRegistryRoot value and displays an error for an illegal value. + /// + /// Source line information about the owner element. + /// The attribute containing the value to get. + /// Whether HKMU is returned as -1 (true), or treated as an error (false). + /// The attribute's RegisitryRootType value. + int GetAttributeMsidbRegistryRootValue(SourceLineNumber sourceLineNumbers, XAttribute attribute, bool allowHkmu); + /// /// Gets a version value or possibly a binder variable and displays an error for an illegal version value. /// -- cgit v1.2.3-55-g6feb From 528b13ce4ccd3a585c6f4caea0ce6ff0962b7310 Mon Sep 17 00:00:00 2001 From: Rob Mensching Date: Sat, 30 Dec 2017 17:05:37 -0800 Subject: Rename IBindVariableResolver to IVariableResolve and merge ILocalizer plus improve IResolveContext --- src/WixToolset.Extensibility/ILocalizer.cs | 15 ------- src/WixToolset.Extensibility/IResolveContext.cs | 6 ++- .../Services/BindVariableResolution.cs | 27 ------------- .../Services/IBindVariableResolver.cs | 17 -------- .../Services/IVariableResolver.cs | 47 ++++++++++++++++++++++ .../Services/VariableResolution.cs | 27 +++++++++++++ 6 files changed, 79 insertions(+), 60 deletions(-) delete mode 100644 src/WixToolset.Extensibility/ILocalizer.cs delete mode 100644 src/WixToolset.Extensibility/Services/BindVariableResolution.cs delete mode 100644 src/WixToolset.Extensibility/Services/IBindVariableResolver.cs create mode 100644 src/WixToolset.Extensibility/Services/IVariableResolver.cs create mode 100644 src/WixToolset.Extensibility/Services/VariableResolution.cs diff --git a/src/WixToolset.Extensibility/ILocalizer.cs b/src/WixToolset.Extensibility/ILocalizer.cs deleted file mode 100644 index 3ce29aab..00000000 --- a/src/WixToolset.Extensibility/ILocalizer.cs +++ /dev/null @@ -1,15 +0,0 @@ -// 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. - -namespace WixToolset.Extensibility -{ - using WixToolset.Data; - - public interface ILocalizer - { - int Codepage { get; } - - string GetLocalizedValue(string id); - - LocalizedControl GetLocalizedControl(string dialog, string control); - } -} diff --git a/src/WixToolset.Extensibility/IResolveContext.cs b/src/WixToolset.Extensibility/IResolveContext.cs index 026e5a35..e03e6689 100644 --- a/src/WixToolset.Extensibility/IResolveContext.cs +++ b/src/WixToolset.Extensibility/IResolveContext.cs @@ -17,10 +17,14 @@ namespace WixToolset.Extensibility IEnumerable Extensions { get; set; } + IEnumerable ExtensionData { get; set; } + string IntermediateFolder { get; set; } Intermediate IntermediateRepresentation { get; set; } - IBindVariableResolver WixVariableResolver { get; set; } + IEnumerable Localizations { get; set; } + + IVariableResolver VariableResolver { get; set; } } } diff --git a/src/WixToolset.Extensibility/Services/BindVariableResolution.cs b/src/WixToolset.Extensibility/Services/BindVariableResolution.cs deleted file mode 100644 index cdd1fa19..00000000 --- a/src/WixToolset.Extensibility/Services/BindVariableResolution.cs +++ /dev/null @@ -1,27 +0,0 @@ -// 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. - -namespace WixToolset.Extensibility.Services -{ - public class BindVariableResolution - { - /// - /// Indicates whether the variable should be delay resolved. - /// - public bool DelayedResolve { get; set; } - - /// - /// Indicates whether the value is the default value of the variable. - /// - public bool IsDefault { get; set; } - - /// - /// Indicates whether the value changed. - /// - public bool UpdatedValue { get; set; } - - /// - /// Resolved value. - /// - public string Value { get; set; } - } -} \ No newline at end of file diff --git a/src/WixToolset.Extensibility/Services/IBindVariableResolver.cs b/src/WixToolset.Extensibility/Services/IBindVariableResolver.cs deleted file mode 100644 index 50071658..00000000 --- a/src/WixToolset.Extensibility/Services/IBindVariableResolver.cs +++ /dev/null @@ -1,17 +0,0 @@ -// 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. - -namespace WixToolset.Extensibility.Services -{ - using WixToolset.Data; - - public interface IBindVariableResolver - { - int VariableCount { get; } - - void AddVariable(string name, string value, bool overridable); - - BindVariableResolution ResolveVariables(SourceLineNumber sourceLineNumbers, string value, bool localizationOnly); - - bool TryGetLocalizedControl(string dialog, string control, out LocalizedControl localizedControl); - } -} diff --git a/src/WixToolset.Extensibility/Services/IVariableResolver.cs b/src/WixToolset.Extensibility/Services/IVariableResolver.cs new file mode 100644 index 00000000..ce11aa81 --- /dev/null +++ b/src/WixToolset.Extensibility/Services/IVariableResolver.cs @@ -0,0 +1,47 @@ +// 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. + +namespace WixToolset.Extensibility.Services +{ + using WixToolset.Data; + + public interface IVariableResolver + { + /// + /// Gets the codepage. + /// + int Codepage { get; } + + /// + /// Gets the count of variables added to the resolver. + /// + int VariableCount { get; } + + void AddLocalization(Localization localization); + + /// + /// Add a variable. + /// + /// The name of the variable. + /// The value of the variable. + /// Indicates whether the variable can be overridden by an existing variable. + void AddVariable(SourceLineNumber sourceLineNumber, string name, string value, bool overridable); + + /// + /// Resolve the wix variables in a value. + /// + /// The source line information for the value. + /// The value to resolve. + /// true to only resolve localization variables; false otherwise. + /// The resolved result. + VariableResolution ResolveVariables(SourceLineNumber sourceLineNumbers, string value, bool localizationOnly); + + /// + /// Try to find localization information for dialog and (optional) control. + /// + /// Dialog identifier. + /// Optional control identifier. + /// Found localization information. + /// True if localized control was found, otherwise false. + bool TryGetLocalizedControl(string dialog, string control, out LocalizedControl localizedControl); + } +} diff --git a/src/WixToolset.Extensibility/Services/VariableResolution.cs b/src/WixToolset.Extensibility/Services/VariableResolution.cs new file mode 100644 index 00000000..2974e84f --- /dev/null +++ b/src/WixToolset.Extensibility/Services/VariableResolution.cs @@ -0,0 +1,27 @@ +// 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. + +namespace WixToolset.Extensibility.Services +{ + public class VariableResolution + { + /// + /// Indicates whether the variable should be delay resolved. + /// + public bool DelayedResolve { get; set; } + + /// + /// Indicates whether the value is the default value of the variable. + /// + public bool IsDefault { get; set; } + + /// + /// Indicates whether the value changed. + /// + public bool UpdatedValue { get; set; } + + /// + /// Resolved value. + /// + public string Value { get; set; } + } +} \ No newline at end of file -- cgit v1.2.3-55-g6feb From 5cec434079fae57eaf0e0e6c9f20bead057f2b1d Mon Sep 17 00:00:00 2001 From: Rob Mensching Date: Sun, 31 Dec 2017 02:13:56 -0800 Subject: Support filtering localizations by culture --- src/WixToolset.Extensibility/IResolveContext.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/WixToolset.Extensibility/IResolveContext.cs b/src/WixToolset.Extensibility/IResolveContext.cs index e03e6689..26891d6b 100644 --- a/src/WixToolset.Extensibility/IResolveContext.cs +++ b/src/WixToolset.Extensibility/IResolveContext.cs @@ -19,6 +19,8 @@ namespace WixToolset.Extensibility IEnumerable ExtensionData { get; set; } + IEnumerable FilterCultures { get; set; } + string IntermediateFolder { get; set; } Intermediate IntermediateRepresentation { get; set; } -- cgit v1.2.3-55-g6feb From 2cd75e35ba43afcb41e96f2c6aa8df44f15aa29c Mon Sep 17 00:00:00 2001 From: Rob Mensching Date: Wed, 3 Jan 2018 15:04:21 -0800 Subject: Include Pdb in IWindowsInstallerBackendExtension.PostBackendBind() --- src/WixToolset.Extensibility/BaseWindowsInstallerBackendExtension.cs | 2 +- src/WixToolset.Extensibility/IWindowsInstallerBackendExtension.cs | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/WixToolset.Extensibility/BaseWindowsInstallerBackendExtension.cs b/src/WixToolset.Extensibility/BaseWindowsInstallerBackendExtension.cs index 50e34288..28f3f927 100644 --- a/src/WixToolset.Extensibility/BaseWindowsInstallerBackendExtension.cs +++ b/src/WixToolset.Extensibility/BaseWindowsInstallerBackendExtension.cs @@ -56,7 +56,7 @@ namespace WixToolset.Extensibility return false; } - public virtual void PostBackendBind(BindResult result) + public virtual void PostBackendBind(BindResult result, Pdb pdb) { } } diff --git a/src/WixToolset.Extensibility/IWindowsInstallerBackendExtension.cs b/src/WixToolset.Extensibility/IWindowsInstallerBackendExtension.cs index ed10a077..5ea73995 100644 --- a/src/WixToolset.Extensibility/IWindowsInstallerBackendExtension.cs +++ b/src/WixToolset.Extensibility/IWindowsInstallerBackendExtension.cs @@ -7,7 +7,6 @@ namespace WixToolset.Extensibility using WixToolset.Data.Bind; using WixToolset.Data.Tuples; using WixToolset.Data.WindowsInstaller; - using WixToolset.Extensibility.Services; /// /// Interface all binder extensions implement. @@ -28,6 +27,6 @@ namespace WixToolset.Extensibility /// /// Called after all output changes occur and right before the output is bound into its final format. /// - void PostBackendBind(BindResult result); + void PostBackendBind(BindResult result, Pdb wixpdb); } } -- cgit v1.2.3-55-g6feb From ce026a4a61336aec750510f501e943027e033934 Mon Sep 17 00:00:00 2001 From: Rob Mensching Date: Thu, 12 Jul 2018 21:15:17 -0700 Subject: Improve command line processing interfaces for extensions Partial fix for wixtoolset/issues#5845 --- .../Services/ICommandLineArguments.cs | 23 ++++++++++++++++++++++ .../Services/ICommandLineContext.cs | 4 +--- .../Services/IParseCommandLine.cs | 23 +++++++++++++++++----- 3 files changed, 42 insertions(+), 8 deletions(-) create mode 100644 src/WixToolset.Extensibility/Services/ICommandLineArguments.cs diff --git a/src/WixToolset.Extensibility/Services/ICommandLineArguments.cs b/src/WixToolset.Extensibility/Services/ICommandLineArguments.cs new file mode 100644 index 00000000..eb1f8765 --- /dev/null +++ b/src/WixToolset.Extensibility/Services/ICommandLineArguments.cs @@ -0,0 +1,23 @@ +// 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. + +namespace WixToolset.Extensibility.Services +{ + using System.Collections.Generic; + + public interface ICommandLineArguments + { + string[] OriginalArguments { get; set; } + + string[] Arguments { get; set; } + + string[] Extensions { get; set; } + + string ErrorArgument { get; set; } + + void Populate(string commandLine); + + void Populate(string[] args); + + IParseCommandLine Parse(); + } +} diff --git a/src/WixToolset.Extensibility/Services/ICommandLineContext.cs b/src/WixToolset.Extensibility/Services/ICommandLineContext.cs index 27d4e6dd..84b9654f 100644 --- a/src/WixToolset.Extensibility/Services/ICommandLineContext.cs +++ b/src/WixToolset.Extensibility/Services/ICommandLineContext.cs @@ -12,8 +12,6 @@ namespace WixToolset.Extensibility.Services IExtensionManager ExtensionManager { get; set; } - string Arguments { get; set; } - - string[] ParsedArguments { get; set; } + ICommandLineArguments Arguments { get; set; } } } diff --git a/src/WixToolset.Extensibility/Services/IParseCommandLine.cs b/src/WixToolset.Extensibility/Services/IParseCommandLine.cs index 1b23be14..3753b4f2 100644 --- a/src/WixToolset.Extensibility/Services/IParseCommandLine.cs +++ b/src/WixToolset.Extensibility/Services/IParseCommandLine.cs @@ -6,16 +6,29 @@ namespace WixToolset.Extensibility.Services public interface IParseCommandLine { + string ErrorArgument { get; set; } + + /// + /// Validates that a valid switch (starts with "/" or "-"), and returns a bool indicating its validity + /// + /// The string check. + /// True if a valid switch, otherwise false. bool IsSwitch(string arg); - bool IsSwitchAt(IEnumerable args, int index); + void GetArgumentAsFilePathOrError(string argument, string fileType, IList paths); + + string GetNextArgumentOrError(string commandLineSwitch); + + bool GetNextArgumentOrError(string commandLineSwitch, IList argument); + + string GetNextArgumentAsDirectoryOrError(string commandLineSwitch); - void GetNextArgumentOrError(ref string arg); + bool GetNextArgumentAsDirectoryOrError(string commandLineSwitch, IList directories); - void GetNextArgumentOrError(IList args); + string GetNextArgumentAsFilePathOrError(string commandLineSwitch); - void GetNextArgumentAsFilePathOrError(IList args, string fileType); + bool GetNextArgumentAsFilePathOrError(string commandLineSwitch, string fileType, IList paths); - bool TryGetNextArgumentOrError(out string arg); + bool TryGetNextSwitchOrArgument(out string arg); } } -- cgit v1.2.3-55-g6feb From 9e83b3914156b0568712b4d21b5daf067a451573 Mon Sep 17 00:00:00 2001 From: Rob Mensching Date: Thu, 12 Jul 2018 21:51:05 -0700 Subject: Improve debuggability --- src/WixToolset.Extensibility/WixToolset.Extensibility.csproj | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/WixToolset.Extensibility/WixToolset.Extensibility.csproj b/src/WixToolset.Extensibility/WixToolset.Extensibility.csproj index b35170d4..d8b2d4bc 100644 --- a/src/WixToolset.Extensibility/WixToolset.Extensibility.csproj +++ b/src/WixToolset.Extensibility/WixToolset.Extensibility.csproj @@ -6,6 +6,8 @@ netstandard2.0 WiX Toolset Extensibility + embedded + true @@ -14,6 +16,7 @@ + -- cgit v1.2.3-55-g6feb From 26a3049eaae48da5d17800405c323e298402b633 Mon Sep 17 00:00:00 2001 From: Rob Mensching Date: Thu, 12 Jul 2018 22:06:10 -0700 Subject: Update development dependencies --- src/WixToolset.Extensibility/WixToolset.Extensibility.csproj | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/WixToolset.Extensibility/WixToolset.Extensibility.csproj b/src/WixToolset.Extensibility/WixToolset.Extensibility.csproj index d8b2d4bc..b1f758e5 100644 --- a/src/WixToolset.Extensibility/WixToolset.Extensibility.csproj +++ b/src/WixToolset.Extensibility/WixToolset.Extensibility.csproj @@ -4,8 +4,8 @@ netstandard2.0 - WiX Toolset Extensibility + embedded true @@ -17,6 +17,6 @@ - + -- cgit v1.2.3-55-g6feb From d3da4f5cc6f07376a783ba4bdd03c3bb8dc5e480 Mon Sep 17 00:00:00 2001 From: Rob Mensching Date: Fri, 13 Jul 2018 15:39:16 -0700 Subject: Add PostParse() method to IExtensionCommandLine Fixes wixtoolset/issues#5850 --- src/WixToolset.Extensibility/IExtensionCommandLine.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/WixToolset.Extensibility/IExtensionCommandLine.cs b/src/WixToolset.Extensibility/IExtensionCommandLine.cs index 1f8e6ed8..831a1bc2 100644 --- a/src/WixToolset.Extensibility/IExtensionCommandLine.cs +++ b/src/WixToolset.Extensibility/IExtensionCommandLine.cs @@ -29,5 +29,7 @@ namespace WixToolset.Extensibility void PreParse(ICommandLineContext context); bool TryParseArgument(IParseCommandLine parseCommandLine, string arg); + + void PostParse(); } } -- cgit v1.2.3-55-g6feb From e130a7a296696e3a7b1229cf580de393b3f20cbd Mon Sep 17 00:00:00 2001 From: Rob Mensching Date: Mon, 23 Jul 2018 13:46:09 -0700 Subject: Reorganize data into Extensibility.Data namespace --- .../BaseBinderExtension.cs | 2 +- .../BaseCompilerExtension.cs | 3 +- .../BaseLayoutExtension.cs | 10 ++ .../BasePreprocessorExtension.cs | 8 ++ .../BaseResolverExtension.cs | 10 +- .../BaseWindowsInstallerBackendExtension.cs | 9 +- src/WixToolset.Extensibility/BindFileWithPath.cs | 20 ---- src/WixToolset.Extensibility/CabinetBuildOption.cs | 25 ----- src/WixToolset.Extensibility/ComponentKeyPath.cs | 55 ---------- .../Data/BindFileWithPath.cs | 20 ++++ src/WixToolset.Extensibility/Data/BindPath.cs | 59 +++++++++++ src/WixToolset.Extensibility/Data/BindResult.cs | 13 +++ src/WixToolset.Extensibility/Data/BindStage.cs | 22 ++++ .../Data/CabinetBuildOption.cs | 25 +++++ .../Data/ComponentKeyPath.cs | 55 ++++++++++ .../Data/ExtensionCommandLineSwitch.cs | 14 +++ src/WixToolset.Extensibility/Data/FileTransfer.cs | 114 +++++++++++++++++++++ src/WixToolset.Extensibility/Data/IBindContext.cs | 43 ++++++++ .../Data/ICommandLineArguments.cs | 23 +++++ .../Data/ICommandLineCommand.cs | 9 ++ .../Data/ICommandLineContext.cs | 16 +++ .../Data/ICompileContext.cs | 28 +++++ src/WixToolset.Extensibility/Data/IDelayedField.cs | 13 +++ .../Data/IExpectedExtractFile.cs | 15 +++ .../Data/IFileSystemContext.cs | 22 ++++ .../Data/IInscribeContext.cs | 19 ++++ .../Data/ILayoutContext.cs | 26 +++++ .../Data/ILibraryContext.cs | 25 +++++ src/WixToolset.Extensibility/Data/ILinkContext.cs | 23 +++++ .../Data/IPreprocessContext.cs | 29 ++++++ .../Data/IResolveContext.cs | 30 ++++++ .../Data/IUnbindContext.cs | 23 +++++ src/WixToolset.Extensibility/Data/ResolveResult.cs | 18 ++++ .../Data/ResolvedCabinet.cs | 20 ++++ src/WixToolset.Extensibility/IBackend.cs | 2 +- src/WixToolset.Extensibility/IBackendFactory.cs | 2 +- src/WixToolset.Extensibility/IBindContext.cs | 46 --------- src/WixToolset.Extensibility/IBindExtension.cs | 1 + .../IBurnBackendExtension.cs | 2 +- src/WixToolset.Extensibility/ICompileContext.cs | 31 ------ src/WixToolset.Extensibility/ICompilerExtension.cs | 1 + .../IDecompilerExtension.cs | 2 - src/WixToolset.Extensibility/IDelayedField.cs | 13 --- .../IExpectedExtractFile.cs | 15 --- .../IExtensionCommandLine.cs | 11 +- src/WixToolset.Extensibility/IFileSystemContext.cs | 25 ----- .../IFileSystemExtension.cs | 2 + src/WixToolset.Extensibility/IInscribeContext.cs | 22 ---- src/WixToolset.Extensibility/ILayoutContext.cs | 32 ------ src/WixToolset.Extensibility/ILayoutExtension.cs | 2 + .../ILibrarianExtension.cs | 1 + src/WixToolset.Extensibility/ILibraryContext.cs | 28 ----- src/WixToolset.Extensibility/ILinkContext.cs | 26 ----- src/WixToolset.Extensibility/ILinkerExtension.cs | 2 +- src/WixToolset.Extensibility/IPreprocessContext.cs | 32 ------ .../IPreprocessorExtension.cs | 1 + src/WixToolset.Extensibility/IResolveContext.cs | 32 ------ src/WixToolset.Extensibility/IResolverExtension.cs | 2 +- src/WixToolset.Extensibility/IUnbindContext.cs | 26 ----- .../IWindowsInstallerBackendExtension.cs | 1 + src/WixToolset.Extensibility/ResolveResult.cs | 18 ---- src/WixToolset.Extensibility/ResolvedCabinet.cs | 20 ---- .../ServiceProviderExtensions.cs | 14 --- .../Services/ICommandLine.cs | 8 +- .../Services/ICommandLineArguments.cs | 23 ----- .../Services/ICommandLineCommand.cs | 9 -- .../Services/ICommandLineContext.cs | 17 --- .../Services/IParseHelper.cs | 1 + .../Services/IPreprocessHelper.cs | 1 + .../Services/ServiceProviderExtensions.cs | 14 +++ .../WixToolset.Extensibility.csproj | 2 +- 71 files changed, 781 insertions(+), 552 deletions(-) delete mode 100644 src/WixToolset.Extensibility/BindFileWithPath.cs delete mode 100644 src/WixToolset.Extensibility/CabinetBuildOption.cs delete mode 100644 src/WixToolset.Extensibility/ComponentKeyPath.cs create mode 100644 src/WixToolset.Extensibility/Data/BindFileWithPath.cs create mode 100644 src/WixToolset.Extensibility/Data/BindPath.cs create mode 100644 src/WixToolset.Extensibility/Data/BindResult.cs create mode 100644 src/WixToolset.Extensibility/Data/BindStage.cs create mode 100644 src/WixToolset.Extensibility/Data/CabinetBuildOption.cs create mode 100644 src/WixToolset.Extensibility/Data/ComponentKeyPath.cs create mode 100644 src/WixToolset.Extensibility/Data/ExtensionCommandLineSwitch.cs create mode 100644 src/WixToolset.Extensibility/Data/FileTransfer.cs create mode 100644 src/WixToolset.Extensibility/Data/IBindContext.cs create mode 100644 src/WixToolset.Extensibility/Data/ICommandLineArguments.cs create mode 100644 src/WixToolset.Extensibility/Data/ICommandLineCommand.cs create mode 100644 src/WixToolset.Extensibility/Data/ICommandLineContext.cs create mode 100644 src/WixToolset.Extensibility/Data/ICompileContext.cs create mode 100644 src/WixToolset.Extensibility/Data/IDelayedField.cs create mode 100644 src/WixToolset.Extensibility/Data/IExpectedExtractFile.cs create mode 100644 src/WixToolset.Extensibility/Data/IFileSystemContext.cs create mode 100644 src/WixToolset.Extensibility/Data/IInscribeContext.cs create mode 100644 src/WixToolset.Extensibility/Data/ILayoutContext.cs create mode 100644 src/WixToolset.Extensibility/Data/ILibraryContext.cs create mode 100644 src/WixToolset.Extensibility/Data/ILinkContext.cs create mode 100644 src/WixToolset.Extensibility/Data/IPreprocessContext.cs create mode 100644 src/WixToolset.Extensibility/Data/IResolveContext.cs create mode 100644 src/WixToolset.Extensibility/Data/IUnbindContext.cs create mode 100644 src/WixToolset.Extensibility/Data/ResolveResult.cs create mode 100644 src/WixToolset.Extensibility/Data/ResolvedCabinet.cs delete mode 100644 src/WixToolset.Extensibility/IBindContext.cs delete mode 100644 src/WixToolset.Extensibility/ICompileContext.cs delete mode 100644 src/WixToolset.Extensibility/IDelayedField.cs delete mode 100644 src/WixToolset.Extensibility/IExpectedExtractFile.cs delete mode 100644 src/WixToolset.Extensibility/IFileSystemContext.cs delete mode 100644 src/WixToolset.Extensibility/IInscribeContext.cs delete mode 100644 src/WixToolset.Extensibility/ILayoutContext.cs delete mode 100644 src/WixToolset.Extensibility/ILibraryContext.cs delete mode 100644 src/WixToolset.Extensibility/ILinkContext.cs delete mode 100644 src/WixToolset.Extensibility/IPreprocessContext.cs delete mode 100644 src/WixToolset.Extensibility/IResolveContext.cs delete mode 100644 src/WixToolset.Extensibility/IUnbindContext.cs delete mode 100644 src/WixToolset.Extensibility/ResolveResult.cs delete mode 100644 src/WixToolset.Extensibility/ResolvedCabinet.cs delete mode 100644 src/WixToolset.Extensibility/ServiceProviderExtensions.cs delete mode 100644 src/WixToolset.Extensibility/Services/ICommandLineArguments.cs delete mode 100644 src/WixToolset.Extensibility/Services/ICommandLineCommand.cs delete mode 100644 src/WixToolset.Extensibility/Services/ICommandLineContext.cs create mode 100644 src/WixToolset.Extensibility/Services/ServiceProviderExtensions.cs diff --git a/src/WixToolset.Extensibility/BaseBinderExtension.cs b/src/WixToolset.Extensibility/BaseBinderExtension.cs index e5e38793..51d63694 100644 --- a/src/WixToolset.Extensibility/BaseBinderExtension.cs +++ b/src/WixToolset.Extensibility/BaseBinderExtension.cs @@ -2,7 +2,7 @@ namespace WixToolset.Extensibility { - using WixToolset.Data.Bind; + using WixToolset.Extensibility.Data; /// /// Base class for creating a resolver extension. diff --git a/src/WixToolset.Extensibility/BaseCompilerExtension.cs b/src/WixToolset.Extensibility/BaseCompilerExtension.cs index abe2f4a9..e1584bc3 100644 --- a/src/WixToolset.Extensibility/BaseCompilerExtension.cs +++ b/src/WixToolset.Extensibility/BaseCompilerExtension.cs @@ -5,6 +5,7 @@ namespace WixToolset.Extensibility using System.Collections.Generic; using System.Xml.Linq; using WixToolset.Data; + using WixToolset.Extensibility.Data; using WixToolset.Extensibility.Services; /// @@ -40,7 +41,7 @@ namespace WixToolset.Extensibility { this.Context = context; - this.Messaging = context.Messaging; + this.Messaging = context.ServiceProvider.GetService(); this.ParseHelper = context.ServiceProvider.GetService(); } diff --git a/src/WixToolset.Extensibility/BaseLayoutExtension.cs b/src/WixToolset.Extensibility/BaseLayoutExtension.cs index bc80d432..78ec8d0a 100644 --- a/src/WixToolset.Extensibility/BaseLayoutExtension.cs +++ b/src/WixToolset.Extensibility/BaseLayoutExtension.cs @@ -2,6 +2,9 @@ namespace WixToolset.Extensibility { + using WixToolset.Extensibility.Data; + using WixToolset.Extensibility.Services; + /// /// Base class for creating a resolver extension. /// @@ -12,12 +15,19 @@ namespace WixToolset.Extensibility /// protected ILayoutContext Context { get; private set; } + /// + /// Messaging for use by the extension. + /// + protected IMessaging Messaging { get; private set; } + /// /// Called at the beginning of layout. /// public virtual void PreLayout(ILayoutContext context) { this.Context = context; + + this.Messaging = context.ServiceProvider.GetService(); } public virtual bool CopyFile(string source, string destination) diff --git a/src/WixToolset.Extensibility/BasePreprocessorExtension.cs b/src/WixToolset.Extensibility/BasePreprocessorExtension.cs index f5d89103..b7d29095 100644 --- a/src/WixToolset.Extensibility/BasePreprocessorExtension.cs +++ b/src/WixToolset.Extensibility/BasePreprocessorExtension.cs @@ -3,6 +3,7 @@ namespace WixToolset.Extensibility { using System.Xml.Linq; + using WixToolset.Extensibility.Data; using WixToolset.Extensibility.Services; /// @@ -15,6 +16,11 @@ namespace WixToolset.Extensibility /// protected IPreprocessContext Context { get; private set; } + /// + /// Messaging for use by the extension. + /// + protected IMessaging Messaging { get; private set; } + /// /// PreprocessHelper for use by the extension. /// @@ -33,6 +39,8 @@ namespace WixToolset.Extensibility { this.Context = context; + this.Messaging = context.ServiceProvider.GetService(); + this.PreprocessHelper = context.ServiceProvider.GetService(); } diff --git a/src/WixToolset.Extensibility/BaseResolverExtension.cs b/src/WixToolset.Extensibility/BaseResolverExtension.cs index 9498d126..16219e93 100644 --- a/src/WixToolset.Extensibility/BaseResolverExtension.cs +++ b/src/WixToolset.Extensibility/BaseResolverExtension.cs @@ -3,7 +3,8 @@ namespace WixToolset.Extensibility { using WixToolset.Data; - using WixToolset.Data.Bind; + using WixToolset.Extensibility.Data; + using WixToolset.Extensibility.Services; /// /// Base class for creating a resolver extension. @@ -15,12 +16,19 @@ namespace WixToolset.Extensibility /// protected IResolveContext Context { get; private set; } + /// + /// Messaging for use by the extension. + /// + protected IMessaging Messaging { get; private set; } + /// /// Called at the beginning of the resolving variables and files. /// public virtual void PreResolve(IResolveContext context) { this.Context = context; + + this.Messaging = context.ServiceProvider.GetService(); } public virtual string ResolveFile(string source, IntermediateTupleDefinition tupleDefinition, SourceLineNumber sourceLineNumbers, BindStage bindStage) diff --git a/src/WixToolset.Extensibility/BaseWindowsInstallerBackendExtension.cs b/src/WixToolset.Extensibility/BaseWindowsInstallerBackendExtension.cs index 28f3f927..4393dfda 100644 --- a/src/WixToolset.Extensibility/BaseWindowsInstallerBackendExtension.cs +++ b/src/WixToolset.Extensibility/BaseWindowsInstallerBackendExtension.cs @@ -4,9 +4,9 @@ namespace WixToolset.Extensibility { using System.Collections.Generic; using WixToolset.Data; - using WixToolset.Data.Bind; using WixToolset.Data.Tuples; using WixToolset.Data.WindowsInstaller; + using WixToolset.Extensibility.Data; using WixToolset.Extensibility.Services; /// @@ -19,6 +19,11 @@ namespace WixToolset.Extensibility /// protected IBindContext Context { get; private set; } + /// + /// Messaging for use by the extension. + /// + protected IMessaging Messaging { get; private set; } + /// /// Backend helper for use by the extension. /// @@ -33,6 +38,8 @@ namespace WixToolset.Extensibility { this.Context = context; + this.Messaging = context.ServiceProvider.GetService(); + this.BackendHelper = context.ServiceProvider.GetService(); } diff --git a/src/WixToolset.Extensibility/BindFileWithPath.cs b/src/WixToolset.Extensibility/BindFileWithPath.cs deleted file mode 100644 index f07873fc..00000000 --- a/src/WixToolset.Extensibility/BindFileWithPath.cs +++ /dev/null @@ -1,20 +0,0 @@ -// 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. - -namespace WixToolset.Extensibility -{ - /// - /// Bind file with its path. - /// - public class BindFileWithPath - { - /// - /// Gets or sets the identifier of the file with this path. - /// - public string Id { get; set; } - - /// - /// Gets or sets the file path. - /// - public string Path { get; set; } - } -} diff --git a/src/WixToolset.Extensibility/CabinetBuildOption.cs b/src/WixToolset.Extensibility/CabinetBuildOption.cs deleted file mode 100644 index 6f63131c..00000000 --- a/src/WixToolset.Extensibility/CabinetBuildOption.cs +++ /dev/null @@ -1,25 +0,0 @@ -// 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. - -namespace WixToolset.Extensibility -{ - /// - /// Options for building the cabinet. - /// - public enum CabinetBuildOption - { - /// - /// Build the cabinet and move it to the target location. - /// - BuildAndMove, - - /// - /// Build the cabinet and copy it to the target location. - /// - BuildAndCopy, - - /// - /// Just copy the cabinet to the target location. - /// - Copy - } -} diff --git a/src/WixToolset.Extensibility/ComponentKeyPath.cs b/src/WixToolset.Extensibility/ComponentKeyPath.cs deleted file mode 100644 index 15cbb02f..00000000 --- a/src/WixToolset.Extensibility/ComponentKeyPath.cs +++ /dev/null @@ -1,55 +0,0 @@ -// 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. - -namespace WixToolset.Extensibility -{ - public enum ComponentKeyPathType - { - /// - /// Not a key path. - /// - None, - - /// - /// File resource as a key path. - /// - File, - - /// - /// Folder as a key path. - /// - Directory, - - /// - /// ODBC data source as a key path. - /// - OdbcDataSource, - - /// - /// A simple registry key acting as a key path. - /// - Registry, - - /// - /// A registry key that contains a formatted property acting as a key path. - /// - RegistryFormatted - } - - public class ComponentKeyPath - { - /// - /// Identifier of the resource to be a key path. - /// - public string Id { get; set; } - - /// - /// Indicates whether the key path was explicitly set for this resource. - /// - public bool Explicit { get; set; } - - /// - /// Type of resource to be the key path. - /// - public ComponentKeyPathType Type { get; set; } - } -} diff --git a/src/WixToolset.Extensibility/Data/BindFileWithPath.cs b/src/WixToolset.Extensibility/Data/BindFileWithPath.cs new file mode 100644 index 00000000..d65ae1ba --- /dev/null +++ b/src/WixToolset.Extensibility/Data/BindFileWithPath.cs @@ -0,0 +1,20 @@ +// 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. + +namespace WixToolset.Extensibility.Data +{ + /// + /// Bind file with its path. + /// + public class BindFileWithPath + { + /// + /// Gets or sets the identifier of the file with this path. + /// + public string Id { get; set; } + + /// + /// Gets or sets the file path. + /// + public string Path { get; set; } + } +} diff --git a/src/WixToolset.Extensibility/Data/BindPath.cs b/src/WixToolset.Extensibility/Data/BindPath.cs new file mode 100644 index 00000000..3b0b73bb --- /dev/null +++ b/src/WixToolset.Extensibility/Data/BindPath.cs @@ -0,0 +1,59 @@ +// 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. + +namespace WixToolset.Extensibility.Data +{ + using System; + + /// + /// Bind path representation. + /// + public class BindPath + { + /// + /// Creates an unnamed bind path. + /// + /// Path for the bind path. + public BindPath(string path) : this(String.Empty, path, BindStage.Normal) + { + } + + /// + /// Creates a named bind path. + /// + /// Name of the bind path. + /// Path for the bind path. + /// Stage for the bind path. + public BindPath(string name, string path, BindStage stage = BindStage.Normal) + { + this.Name = name; + this.Path = path; + this.Stage = stage; + } + + /// + /// Name of the bind path or String.Empty if the path is unnamed. + /// + public string Name { get; set; } + + /// + /// Path for the bind path. + /// + public string Path { get; set; } + + /// + /// Stage for the bind path. + /// + public BindStage Stage { get; set; } + + /// + /// Parses a normal bind path from its string representation + /// + /// String representation of bind path that looks like: [name=]path + /// Parsed normal bind path. + public static BindPath Parse(string bindPath) + { + string[] namedPath = bindPath.Split(new char[] { '=' }, 2); + return (1 == namedPath.Length) ? new BindPath(namedPath[0]) : new BindPath(namedPath[0], namedPath[1]); + } + } +} diff --git a/src/WixToolset.Extensibility/Data/BindResult.cs b/src/WixToolset.Extensibility/Data/BindResult.cs new file mode 100644 index 00000000..ec97154f --- /dev/null +++ b/src/WixToolset.Extensibility/Data/BindResult.cs @@ -0,0 +1,13 @@ +// 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. + +namespace WixToolset.Extensibility.Data +{ + using System.Collections.Generic; + + public class BindResult + { + public IEnumerable FileTransfers { get; set; } + + public IEnumerable ContentFilePaths { get; set; } + } +} diff --git a/src/WixToolset.Extensibility/Data/BindStage.cs b/src/WixToolset.Extensibility/Data/BindStage.cs new file mode 100644 index 00000000..559a5a5a --- /dev/null +++ b/src/WixToolset.Extensibility/Data/BindStage.cs @@ -0,0 +1,22 @@ +// 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. + +namespace WixToolset.Extensibility.Data +{ + public enum BindStage + { + /// + /// Normal binding + /// + Normal, + + /// + /// Bind the file path of the target build file + /// + Target, + + /// + /// Bind the file path of the updated build file + /// + Updated, + } +} diff --git a/src/WixToolset.Extensibility/Data/CabinetBuildOption.cs b/src/WixToolset.Extensibility/Data/CabinetBuildOption.cs new file mode 100644 index 00000000..f9938814 --- /dev/null +++ b/src/WixToolset.Extensibility/Data/CabinetBuildOption.cs @@ -0,0 +1,25 @@ +// 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. + +namespace WixToolset.Extensibility.Data +{ + /// + /// Options for building the cabinet. + /// + public enum CabinetBuildOption + { + /// + /// Build the cabinet and move it to the target location. + /// + BuildAndMove, + + /// + /// Build the cabinet and copy it to the target location. + /// + BuildAndCopy, + + /// + /// Just copy the cabinet to the target location. + /// + Copy + } +} diff --git a/src/WixToolset.Extensibility/Data/ComponentKeyPath.cs b/src/WixToolset.Extensibility/Data/ComponentKeyPath.cs new file mode 100644 index 00000000..112f562c --- /dev/null +++ b/src/WixToolset.Extensibility/Data/ComponentKeyPath.cs @@ -0,0 +1,55 @@ +// 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. + +namespace WixToolset.Extensibility.Data +{ + public enum ComponentKeyPathType + { + /// + /// Not a key path. + /// + None, + + /// + /// File resource as a key path. + /// + File, + + /// + /// Folder as a key path. + /// + Directory, + + /// + /// ODBC data source as a key path. + /// + OdbcDataSource, + + /// + /// A simple registry key acting as a key path. + /// + Registry, + + /// + /// A registry key that contains a formatted property acting as a key path. + /// + RegistryFormatted + } + + public class ComponentKeyPath + { + /// + /// Identifier of the resource to be a key path. + /// + public string Id { get; set; } + + /// + /// Indicates whether the key path was explicitly set for this resource. + /// + public bool Explicit { get; set; } + + /// + /// Type of resource to be the key path. + /// + public ComponentKeyPathType Type { get; set; } + } +} diff --git a/src/WixToolset.Extensibility/Data/ExtensionCommandLineSwitch.cs b/src/WixToolset.Extensibility/Data/ExtensionCommandLineSwitch.cs new file mode 100644 index 00000000..d1d8f0c3 --- /dev/null +++ b/src/WixToolset.Extensibility/Data/ExtensionCommandLineSwitch.cs @@ -0,0 +1,14 @@ +// 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. + +namespace WixToolset.Extensibility.Data +{ + /// + /// A command line option. + /// + public struct ExtensionCommandLineSwitch + { + public string Switch { get; set; } + + public string Description { get; set; } + } +} diff --git a/src/WixToolset.Extensibility/Data/FileTransfer.cs b/src/WixToolset.Extensibility/Data/FileTransfer.cs new file mode 100644 index 00000000..0356ac4c --- /dev/null +++ b/src/WixToolset.Extensibility/Data/FileTransfer.cs @@ -0,0 +1,114 @@ +// 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. + +namespace WixToolset.Extensibility.Data +{ + using System; + using System.IO; + using WixToolset.Data; + + /// + /// Structure used for all file transfer information. + /// + public class FileTransfer + { + /// Source path to file. + public string Source { get; set; } + + /// Destination path for file. + public string Destination { get; set; } + + /// Flag if file should be moved (optimal). + public bool Move { get; set; } + + /// Optional source line numbers where this file transfer orginated. + public SourceLineNumber SourceLineNumbers { get; set; } + + /// Optional type of file this transfer is moving or copying. + public string Type { get; set; } + + /// Indicates whether the file transer was a built by this build or copied from other some build. + public bool Built { get; set; } + + /// Set during layout of media when the file transfer when the source and target resolve to the same path. + public bool Redundant { get; set; } + + /// + /// Prefer the TryCreate() method to create FileTransfer objects. + /// + /// Source path to file. + /// Destination path for file. + /// File if file should be moved (optimal). + /// Optional type of file this transfer is transferring. + /// Optional source line numbers wher this transfer originated. + public FileTransfer(string source, string destination, bool move, string type = null, SourceLineNumber sourceLineNumbers = null) + { + this.Source = source; + this.Destination = destination; + this.Move = move; + + this.Type = type; + this.SourceLineNumbers = sourceLineNumbers; + } + + /// + /// Creates a file transfer if the source and destination are different. + /// + /// Source path to file. + /// Destination path for file. + /// File if file should be moved (optimal). + /// Optional type of file this transfer is transferring. + /// Optional source line numbers where this transfer originated. + /// true if the source and destination are the different, false if no file transfer is created. + public static bool TryCreate(string source, string destination, bool move, string type, SourceLineNumber sourceLineNumbers, out FileTransfer transfer) + { + //string sourceFullPath = GetValidatedFullPath(sourceLineNumbers, source); + + //string fileLayoutFullPath = GetValidatedFullPath(sourceLineNumbers, destination); + + ////// if the current source path (where we know that the file already exists) and the resolved + ////// path as dictated by the Directory table are not the same, then propagate the file. The + ////// image that we create may have already been done by some other process other than the linker, so + ////// there is no reason to copy the files to the resolved source if they are already there. + ////if (String.Equals(sourceFullPath, fileLayoutFullPath, StringComparison.OrdinalIgnoreCase)) + ////{ + //// transfer = null; + //// return false; + ////} + + //transfer = new FileTransfer(source, destination, move, type, sourceLineNumbers); + //transfer.Redundant = String.Equals(sourceFullPath, fileLayoutFullPath, StringComparison.OrdinalIgnoreCase); + //return true; + throw new NotImplementedException(); + } + + //private static string GetValidatedFullPath(SourceLineNumber sourceLineNumbers, string path) + //{ + // string result; + + // try + // { + // result = Path.GetFullPath(path); + + // var filename = Path.GetFileName(result); + + // foreach (var reservedName in Common.ReservedFileNames) + // { + // if (reservedName.Equals(filename, StringComparison.OrdinalIgnoreCase)) + // { + // throw new WixException(ErrorMessages.InvalidFileName(sourceLineNumbers, path)); + // } + // } + // } + // catch (ArgumentException) + // { + // throw new WixException(ErrorMessages.InvalidFileName(sourceLineNumbers, path)); + // } + // catch (PathTooLongException) + // { + // throw new WixException(ErrorMessages.PathTooLong(sourceLineNumbers, path)); + // } + + // return result; + //} + } +} diff --git a/src/WixToolset.Extensibility/Data/IBindContext.cs b/src/WixToolset.Extensibility/Data/IBindContext.cs new file mode 100644 index 00000000..355b1a53 --- /dev/null +++ b/src/WixToolset.Extensibility/Data/IBindContext.cs @@ -0,0 +1,43 @@ +// 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. + +namespace WixToolset.Extensibility.Data +{ + using System; + using System.Collections.Generic; + using WixToolset.Data; + + public interface IBindContext + { + IServiceProvider ServiceProvider { get; } + + int CabbingThreadCount { get; set; } + + string CabCachePath { get; set; } + + int Codepage { get; set; } + + CompressionLevel? DefaultCompressionLevel { get; set; } + + IEnumerable DelayedFields { get; set; } + + IEnumerable ExpectedEmbeddedFiles { get; set; } + + IEnumerable Extensions { get; set; } + + IEnumerable FileSystemExtensions { get; set; } + + IEnumerable Ices { get; set; } + + string IntermediateFolder { get; set; } + + Intermediate IntermediateRepresentation { get; set; } + + string OutputPath { get; set; } + + string OutputPdbPath { get; set; } + + IEnumerable SuppressIces { get; set; } + + bool SuppressValidation { get; set; } + } +} diff --git a/src/WixToolset.Extensibility/Data/ICommandLineArguments.cs b/src/WixToolset.Extensibility/Data/ICommandLineArguments.cs new file mode 100644 index 00000000..5729ff36 --- /dev/null +++ b/src/WixToolset.Extensibility/Data/ICommandLineArguments.cs @@ -0,0 +1,23 @@ +// 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. + +namespace WixToolset.Extensibility.Data +{ + using WixToolset.Extensibility.Services; + + public interface ICommandLineArguments + { + string[] OriginalArguments { get; set; } + + string[] Arguments { get; set; } + + string[] Extensions { get; set; } + + string ErrorArgument { get; set; } + + void Populate(string commandLine); + + void Populate(string[] args); + + IParseCommandLine Parse(); + } +} diff --git a/src/WixToolset.Extensibility/Data/ICommandLineCommand.cs b/src/WixToolset.Extensibility/Data/ICommandLineCommand.cs new file mode 100644 index 00000000..1146d40a --- /dev/null +++ b/src/WixToolset.Extensibility/Data/ICommandLineCommand.cs @@ -0,0 +1,9 @@ +// 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. + +namespace WixToolset.Extensibility.Data +{ + public interface ICommandLineCommand + { + int Execute(); + } +} diff --git a/src/WixToolset.Extensibility/Data/ICommandLineContext.cs b/src/WixToolset.Extensibility/Data/ICommandLineContext.cs new file mode 100644 index 00000000..1b2db4a4 --- /dev/null +++ b/src/WixToolset.Extensibility/Data/ICommandLineContext.cs @@ -0,0 +1,16 @@ +// 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. + +namespace WixToolset.Extensibility.Data +{ + using System; + using WixToolset.Extensibility.Services; + + public interface ICommandLineContext + { + IServiceProvider ServiceProvider { get; } + + IExtensionManager ExtensionManager { get; set; } + + ICommandLineArguments Arguments { get; set; } + } +} diff --git a/src/WixToolset.Extensibility/Data/ICompileContext.cs b/src/WixToolset.Extensibility/Data/ICompileContext.cs new file mode 100644 index 00000000..50ad10b9 --- /dev/null +++ b/src/WixToolset.Extensibility/Data/ICompileContext.cs @@ -0,0 +1,28 @@ +// 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. + +namespace WixToolset.Extensibility.Data +{ + using System; + using System.Collections.Generic; + using System.Xml.Linq; + using WixToolset.Data; + + public interface ICompileContext + { + IServiceProvider ServiceProvider { get; } + + string CompilationId { get; set; } + + IEnumerable Extensions { get; set; } + + string OutputPath { get; set; } + + /// + /// Gets or sets the platform which the compiler will use when defaulting 64-bit attributes and elements. + /// + /// The platform which the compiler will use when defaulting 64-bit attributes and elements. + Platform Platform { get; set; } + + XDocument Source { get; set; } + } +} diff --git a/src/WixToolset.Extensibility/Data/IDelayedField.cs b/src/WixToolset.Extensibility/Data/IDelayedField.cs new file mode 100644 index 00000000..5c078762 --- /dev/null +++ b/src/WixToolset.Extensibility/Data/IDelayedField.cs @@ -0,0 +1,13 @@ +// 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. + +namespace WixToolset.Extensibility.Data +{ + using WixToolset.Data; + + public interface IDelayedField + { + IntermediateField Field { get; } + + IntermediateTuple Row { get; } + } +} \ No newline at end of file diff --git a/src/WixToolset.Extensibility/Data/IExpectedExtractFile.cs b/src/WixToolset.Extensibility/Data/IExpectedExtractFile.cs new file mode 100644 index 00000000..edcf82e0 --- /dev/null +++ b/src/WixToolset.Extensibility/Data/IExpectedExtractFile.cs @@ -0,0 +1,15 @@ +// 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. + +namespace WixToolset.Extensibility.Data +{ + using System; + + public interface IExpectedExtractFile + { + Uri Uri { get; set; } + + int EmbeddedFileIndex { get; set; } + + string OutputPath { get; set; } + } +} \ No newline at end of file diff --git a/src/WixToolset.Extensibility/Data/IFileSystemContext.cs b/src/WixToolset.Extensibility/Data/IFileSystemContext.cs new file mode 100644 index 00000000..86fc106c --- /dev/null +++ b/src/WixToolset.Extensibility/Data/IFileSystemContext.cs @@ -0,0 +1,22 @@ +// 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. + +namespace WixToolset.Extensibility.Data +{ + using System; + using WixToolset.Data; + + public interface IFileSystemContext + { + IServiceProvider ServiceProvider { get; } + + string CabCachePath { get; set; } + + string IntermediateFolder { get; set; } + + Intermediate IntermediateRepresentation { get; set; } + + string OutputPath { get; set; } + + string OutputPdbPath { get; set; } + } +} diff --git a/src/WixToolset.Extensibility/Data/IInscribeContext.cs b/src/WixToolset.Extensibility/Data/IInscribeContext.cs new file mode 100644 index 00000000..4f13ba10 --- /dev/null +++ b/src/WixToolset.Extensibility/Data/IInscribeContext.cs @@ -0,0 +1,19 @@ +// 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. + +namespace WixToolset.Extensibility.Data +{ + using System; + + public interface IInscribeContext + { + IServiceProvider ServiceProvider { get; } + + string InputFilePath { get; set; } + + string IntermediateFolder { get; set; } + + string OutputFile { get; set; } + + string SignedEngineFile { get; set; } + } +} diff --git a/src/WixToolset.Extensibility/Data/ILayoutContext.cs b/src/WixToolset.Extensibility/Data/ILayoutContext.cs new file mode 100644 index 00000000..c3555268 --- /dev/null +++ b/src/WixToolset.Extensibility/Data/ILayoutContext.cs @@ -0,0 +1,26 @@ +// 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. + +namespace WixToolset.Extensibility.Data +{ + using System; + using System.Collections.Generic; + + public interface ILayoutContext + { + IServiceProvider ServiceProvider { get; } + + IEnumerable Extensions { get; set; } + + IEnumerable ContentFilePaths { get; set; } + + IEnumerable FileTransfers { get; set; } + + string ContentsFile { get; set; } + + string OutputsFile { get; set; } + + string BuiltOutputsFile { get; set; } + + bool SuppressAclReset { get; set; } + } +} diff --git a/src/WixToolset.Extensibility/Data/ILibraryContext.cs b/src/WixToolset.Extensibility/Data/ILibraryContext.cs new file mode 100644 index 00000000..08b4ed26 --- /dev/null +++ b/src/WixToolset.Extensibility/Data/ILibraryContext.cs @@ -0,0 +1,25 @@ +// 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. + +namespace WixToolset.Extensibility.Data +{ + using System; + using System.Collections.Generic; + using WixToolset.Data; + + public interface ILibraryContext + { + IServiceProvider ServiceProvider { get; } + + bool BindFiles { get; set; } + + IEnumerable BindPaths { get; set; } + + IEnumerable Extensions { get; set; } + + string LibraryId { get; set; } + + IEnumerable Localizations { get; set; } + + IEnumerable Intermediates { get; set; } + } +} diff --git a/src/WixToolset.Extensibility/Data/ILinkContext.cs b/src/WixToolset.Extensibility/Data/ILinkContext.cs new file mode 100644 index 00000000..8c1d6f22 --- /dev/null +++ b/src/WixToolset.Extensibility/Data/ILinkContext.cs @@ -0,0 +1,23 @@ +// 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. + +namespace WixToolset.Extensibility.Data +{ + using System; + using System.Collections.Generic; + using WixToolset.Data; + + public interface ILinkContext + { + IServiceProvider ServiceProvider { get; } + + IEnumerable Extensions { get; set; } + + IEnumerable ExtensionData { get; set; } + + OutputType ExpectedOutputType { get; set; } + + IEnumerable Intermediates { get; set; } + + ITupleDefinitionCreator TupleDefinitionCreator { get; set; } + } +} diff --git a/src/WixToolset.Extensibility/Data/IPreprocessContext.cs b/src/WixToolset.Extensibility/Data/IPreprocessContext.cs new file mode 100644 index 00000000..a923c4db --- /dev/null +++ b/src/WixToolset.Extensibility/Data/IPreprocessContext.cs @@ -0,0 +1,29 @@ +// 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. + +namespace WixToolset.Extensibility.Data +{ + using System; + using System.Collections.Generic; + using WixToolset.Data; + + public interface IPreprocessContext + { + IServiceProvider ServiceProvider { get; } + + IEnumerable Extensions { get; set; } + + IList IncludeSearchPaths { get; set; } + + /// + /// Gets the platform which the compiler will use when defaulting 64-bit attributes and elements. + /// + /// The platform which the compiler will use when defaulting 64-bit attributes and elements. + Platform Platform { get; set; } + + string SourceFile { get; set; } + + IDictionary Variables { get; set; } + + SourceLineNumber CurrentSourceLineNumber { get; set; } + } +} diff --git a/src/WixToolset.Extensibility/Data/IResolveContext.cs b/src/WixToolset.Extensibility/Data/IResolveContext.cs new file mode 100644 index 00000000..0e12a534 --- /dev/null +++ b/src/WixToolset.Extensibility/Data/IResolveContext.cs @@ -0,0 +1,30 @@ +// 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. + +namespace WixToolset.Extensibility.Data +{ + using System; + using System.Collections.Generic; + using WixToolset.Data; + using WixToolset.Extensibility.Services; + + public interface IResolveContext + { + IServiceProvider ServiceProvider { get; } + + IEnumerable BindPaths { get; set; } + + IEnumerable Extensions { get; set; } + + IEnumerable ExtensionData { get; set; } + + IEnumerable FilterCultures { get; set; } + + string IntermediateFolder { get; set; } + + Intermediate IntermediateRepresentation { get; set; } + + IEnumerable Localizations { get; set; } + + IVariableResolver VariableResolver { get; set; } + } +} diff --git a/src/WixToolset.Extensibility/Data/IUnbindContext.cs b/src/WixToolset.Extensibility/Data/IUnbindContext.cs new file mode 100644 index 00000000..84dc5167 --- /dev/null +++ b/src/WixToolset.Extensibility/Data/IUnbindContext.cs @@ -0,0 +1,23 @@ +// 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. + +namespace WixToolset.Extensibility.Data +{ + using System; + + public interface IUnbindContext + { + IServiceProvider ServiceProvider { get; } + + string ExportBasePath { get; set; } + + string InputFilePath { get; set; } + + string IntermediateFolder { get; set; } + + bool IsAdminImage { get; set; } + + bool SuppressDemodularization { get; set; } + + bool SuppressExtractCabinets { get; set; } + } +} \ No newline at end of file diff --git a/src/WixToolset.Extensibility/Data/ResolveResult.cs b/src/WixToolset.Extensibility/Data/ResolveResult.cs new file mode 100644 index 00000000..cdc9cfcc --- /dev/null +++ b/src/WixToolset.Extensibility/Data/ResolveResult.cs @@ -0,0 +1,18 @@ +// 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. + +namespace WixToolset.Extensibility.Data +{ + using System.Collections.Generic; + using WixToolset.Data; + + public class ResolveResult + { + public int Codepage { get; set; } + + public IEnumerable DelayedFields { get; set; } + + public IEnumerable ExpectedEmbeddedFiles { get; set; } + + public Intermediate IntermediateRepresentation { get; set; } + } +} \ No newline at end of file diff --git a/src/WixToolset.Extensibility/Data/ResolvedCabinet.cs b/src/WixToolset.Extensibility/Data/ResolvedCabinet.cs new file mode 100644 index 00000000..047b7448 --- /dev/null +++ b/src/WixToolset.Extensibility/Data/ResolvedCabinet.cs @@ -0,0 +1,20 @@ +// 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. + +namespace WixToolset.Extensibility.Data +{ + /// + /// Data returned from build file manager ResolveCabinet callback. + /// + public class ResolvedCabinet + { + /// + /// Gets or sets the build option for the resolved cabinet. + /// + public CabinetBuildOption BuildOption { get; set; } + + /// + /// Gets or sets the path for the resolved cabinet. + /// + public string Path { get; set; } + } +} diff --git a/src/WixToolset.Extensibility/IBackend.cs b/src/WixToolset.Extensibility/IBackend.cs index 385fd086..80f885c3 100644 --- a/src/WixToolset.Extensibility/IBackend.cs +++ b/src/WixToolset.Extensibility/IBackend.cs @@ -3,7 +3,7 @@ namespace WixToolset.Extensibility { using WixToolset.Data; - using WixToolset.Data.Bind; + using WixToolset.Extensibility.Data; public interface IBackend { diff --git a/src/WixToolset.Extensibility/IBackendFactory.cs b/src/WixToolset.Extensibility/IBackendFactory.cs index 12704c0f..02f0809a 100644 --- a/src/WixToolset.Extensibility/IBackendFactory.cs +++ b/src/WixToolset.Extensibility/IBackendFactory.cs @@ -2,7 +2,7 @@ namespace WixToolset.Extensibility { - using WixToolset.Extensibility.Services; + using WixToolset.Extensibility.Data; public interface IBackendFactory { diff --git a/src/WixToolset.Extensibility/IBindContext.cs b/src/WixToolset.Extensibility/IBindContext.cs deleted file mode 100644 index 59509ecf..00000000 --- a/src/WixToolset.Extensibility/IBindContext.cs +++ /dev/null @@ -1,46 +0,0 @@ -// 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. - -namespace WixToolset.Extensibility -{ - using System; - using System.Collections.Generic; - using WixToolset.Data; - using WixToolset.Extensibility.Services; - - public interface IBindContext - { - IServiceProvider ServiceProvider { get; } - - IMessaging Messaging { get; set; } - - int CabbingThreadCount { get; set; } - - string CabCachePath { get; set; } - - int Codepage { get; set; } - - CompressionLevel? DefaultCompressionLevel { get; set; } - - IEnumerable DelayedFields { get; set; } - - IEnumerable ExpectedEmbeddedFiles { get; set; } - - IEnumerable Extensions { get; set; } - - IEnumerable FileSystemExtensions { get; set; } - - IEnumerable Ices { get; set; } - - string IntermediateFolder { get; set; } - - Intermediate IntermediateRepresentation { get; set; } - - string OutputPath { get; set; } - - string OutputPdbPath { get; set; } - - IEnumerable SuppressIces { get; set; } - - bool SuppressValidation { get; set; } - } -} diff --git a/src/WixToolset.Extensibility/IBindExtension.cs b/src/WixToolset.Extensibility/IBindExtension.cs index c9830a35..2dcf5eff 100644 --- a/src/WixToolset.Extensibility/IBindExtension.cs +++ b/src/WixToolset.Extensibility/IBindExtension.cs @@ -3,6 +3,7 @@ namespace WixToolset.Extensibility { using WixToolset.Data.Bind; + using WixToolset.Extensibility.Data; /// /// Interface all binder extensions implement. diff --git a/src/WixToolset.Extensibility/IBurnBackendExtension.cs b/src/WixToolset.Extensibility/IBurnBackendExtension.cs index c8b8e407..bcd0d5ee 100644 --- a/src/WixToolset.Extensibility/IBurnBackendExtension.cs +++ b/src/WixToolset.Extensibility/IBurnBackendExtension.cs @@ -4,7 +4,7 @@ namespace WixToolset.Extensibility { using WixToolset.Data; using WixToolset.Data.Bind; - using WixToolset.Extensibility.Services; + using WixToolset.Extensibility.Data; public interface IBurnBackendExtension { diff --git a/src/WixToolset.Extensibility/ICompileContext.cs b/src/WixToolset.Extensibility/ICompileContext.cs deleted file mode 100644 index fbe38d63..00000000 --- a/src/WixToolset.Extensibility/ICompileContext.cs +++ /dev/null @@ -1,31 +0,0 @@ -// 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. - -namespace WixToolset.Extensibility -{ - using System; - using System.Collections.Generic; - using System.Xml.Linq; - using WixToolset.Data; - using WixToolset.Extensibility.Services; - - public interface ICompileContext - { - IServiceProvider ServiceProvider { get; } - - IMessaging Messaging { get; set; } - - string CompilationId { get; set; } - - IEnumerable Extensions { get; set; } - - string OutputPath { get; set; } - - /// - /// Gets or sets the platform which the compiler will use when defaulting 64-bit attributes and elements. - /// - /// The platform which the compiler will use when defaulting 64-bit attributes and elements. - Platform Platform { get; set; } - - XDocument Source { get; set; } - } -} diff --git a/src/WixToolset.Extensibility/ICompilerExtension.cs b/src/WixToolset.Extensibility/ICompilerExtension.cs index 0aa5c9e2..b2dd6d04 100644 --- a/src/WixToolset.Extensibility/ICompilerExtension.cs +++ b/src/WixToolset.Extensibility/ICompilerExtension.cs @@ -5,6 +5,7 @@ namespace WixToolset.Extensibility using System.Collections.Generic; using System.Xml.Linq; using WixToolset.Data; + using WixToolset.Extensibility.Data; /// /// Interface all compiler extensions implement. diff --git a/src/WixToolset.Extensibility/IDecompilerExtension.cs b/src/WixToolset.Extensibility/IDecompilerExtension.cs index 1574f964..e2b80089 100644 --- a/src/WixToolset.Extensibility/IDecompilerExtension.cs +++ b/src/WixToolset.Extensibility/IDecompilerExtension.cs @@ -2,8 +2,6 @@ namespace WixToolset.Extensibility { - using WixToolset.Data; - /// /// Base class for creating a decompiler extension. /// diff --git a/src/WixToolset.Extensibility/IDelayedField.cs b/src/WixToolset.Extensibility/IDelayedField.cs deleted file mode 100644 index e06dbe59..00000000 --- a/src/WixToolset.Extensibility/IDelayedField.cs +++ /dev/null @@ -1,13 +0,0 @@ -// 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. - -namespace WixToolset.Extensibility -{ - using WixToolset.Data; - - public interface IDelayedField - { - IntermediateField Field { get; } - - IntermediateTuple Row { get; } - } -} \ No newline at end of file diff --git a/src/WixToolset.Extensibility/IExpectedExtractFile.cs b/src/WixToolset.Extensibility/IExpectedExtractFile.cs deleted file mode 100644 index 06e4f77f..00000000 --- a/src/WixToolset.Extensibility/IExpectedExtractFile.cs +++ /dev/null @@ -1,15 +0,0 @@ -// 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. - -namespace WixToolset.Extensibility -{ - using System; - - public interface IExpectedExtractFile - { - Uri Uri { get; set; } - - int EmbeddedFileIndex { get; set; } - - string OutputPath { get; set; } - } -} \ No newline at end of file diff --git a/src/WixToolset.Extensibility/IExtensionCommandLine.cs b/src/WixToolset.Extensibility/IExtensionCommandLine.cs index 831a1bc2..5c6f578d 100644 --- a/src/WixToolset.Extensibility/IExtensionCommandLine.cs +++ b/src/WixToolset.Extensibility/IExtensionCommandLine.cs @@ -3,18 +3,9 @@ namespace WixToolset.Extensibility { using System.Collections.Generic; + using WixToolset.Extensibility.Data; using WixToolset.Extensibility.Services; - /// - /// A command line option. - /// - public struct ExtensionCommandLineSwitch - { - public string Switch { get; set; } - - public string Description { get; set; } - } - /// /// Interface extensions implement to be able to parse command-line options. /// diff --git a/src/WixToolset.Extensibility/IFileSystemContext.cs b/src/WixToolset.Extensibility/IFileSystemContext.cs deleted file mode 100644 index 32783957..00000000 --- a/src/WixToolset.Extensibility/IFileSystemContext.cs +++ /dev/null @@ -1,25 +0,0 @@ -// 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. - -namespace WixToolset.Extensibility -{ - using System; - using WixToolset.Data; - using WixToolset.Extensibility.Services; - - public interface IFileSystemContext - { - IServiceProvider ServiceProvider { get; } - - IMessaging Messaging { get; set; } - - string CabCachePath { get; set; } - - string IntermediateFolder { get; set; } - - Intermediate IntermediateRepresentation { get; set; } - - string OutputPath { get; set; } - - string OutputPdbPath { get; set; } - } -} diff --git a/src/WixToolset.Extensibility/IFileSystemExtension.cs b/src/WixToolset.Extensibility/IFileSystemExtension.cs index 96c8a748..0a3e84b8 100644 --- a/src/WixToolset.Extensibility/IFileSystemExtension.cs +++ b/src/WixToolset.Extensibility/IFileSystemExtension.cs @@ -2,6 +2,8 @@ namespace WixToolset.Extensibility { + using WixToolset.Extensibility.Data; + /// /// Interface all file system extensions implement. /// diff --git a/src/WixToolset.Extensibility/IInscribeContext.cs b/src/WixToolset.Extensibility/IInscribeContext.cs deleted file mode 100644 index 7f741024..00000000 --- a/src/WixToolset.Extensibility/IInscribeContext.cs +++ /dev/null @@ -1,22 +0,0 @@ -// 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. - -namespace WixToolset.Extensibility -{ - using System; - using WixToolset.Extensibility.Services; - - public interface IInscribeContext - { - IServiceProvider ServiceProvider { get; } - - IMessaging Messaging { get; set; } - - string InputFilePath { get; set; } - - string IntermediateFolder { get; set; } - - string OutputFile { get; set; } - - string SignedEngineFile { get; set; } - } -} diff --git a/src/WixToolset.Extensibility/ILayoutContext.cs b/src/WixToolset.Extensibility/ILayoutContext.cs deleted file mode 100644 index 9ec559f9..00000000 --- a/src/WixToolset.Extensibility/ILayoutContext.cs +++ /dev/null @@ -1,32 +0,0 @@ -// 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. - -namespace WixToolset.Extensibility -{ - using System; - using System.Collections.Generic; - using WixToolset.Data.Bind; - using WixToolset.Extensibility.Services; - - public interface ILayoutContext - { - IServiceProvider ServiceProvider { get; } - - IMessaging Messaging { get; set; } - - IEnumerable Extensions { get; set; } - - IEnumerable ContentFilePaths { get; set; } - - IEnumerable FileTransfers { get; set; } - - string OutputPdbPath { get; set; } - - string ContentsFile { get; set; } - - string OutputsFile { get; set; } - - string BuiltOutputsFile { get; set; } - - bool SuppressAclReset { get; set; } - } -} diff --git a/src/WixToolset.Extensibility/ILayoutExtension.cs b/src/WixToolset.Extensibility/ILayoutExtension.cs index 1cf4871f..7bcee0a8 100644 --- a/src/WixToolset.Extensibility/ILayoutExtension.cs +++ b/src/WixToolset.Extensibility/ILayoutExtension.cs @@ -2,6 +2,8 @@ namespace WixToolset.Extensibility { + using WixToolset.Extensibility.Data; + /// /// Interface all layout extensions implement. /// diff --git a/src/WixToolset.Extensibility/ILibrarianExtension.cs b/src/WixToolset.Extensibility/ILibrarianExtension.cs index 381abf01..7319f8b9 100644 --- a/src/WixToolset.Extensibility/ILibrarianExtension.cs +++ b/src/WixToolset.Extensibility/ILibrarianExtension.cs @@ -3,6 +3,7 @@ namespace WixToolset.Extensibility { using WixToolset.Data; + using WixToolset.Extensibility.Data; public interface ILibrarianExtension { diff --git a/src/WixToolset.Extensibility/ILibraryContext.cs b/src/WixToolset.Extensibility/ILibraryContext.cs deleted file mode 100644 index 0c29a3dd..00000000 --- a/src/WixToolset.Extensibility/ILibraryContext.cs +++ /dev/null @@ -1,28 +0,0 @@ -// 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. - -namespace WixToolset.Extensibility -{ - using System; - using System.Collections.Generic; - using WixToolset.Data; - using WixToolset.Extensibility.Services; - - public interface ILibraryContext - { - IServiceProvider ServiceProvider { get; } - - IMessaging Messaging { get; set; } - - bool BindFiles { get; set; } - - IEnumerable BindPaths { get; set; } - - IEnumerable Extensions { get; set; } - - string LibraryId { get; set; } - - IEnumerable Localizations { get; set; } - - IEnumerable Intermediates { get; set; } - } -} diff --git a/src/WixToolset.Extensibility/ILinkContext.cs b/src/WixToolset.Extensibility/ILinkContext.cs deleted file mode 100644 index 65eeb6f1..00000000 --- a/src/WixToolset.Extensibility/ILinkContext.cs +++ /dev/null @@ -1,26 +0,0 @@ -// 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. - -namespace WixToolset.Extensibility -{ - using System; - using System.Collections.Generic; - using WixToolset.Data; - using WixToolset.Extensibility.Services; - - public interface ILinkContext - { - IServiceProvider ServiceProvider { get; } - - IMessaging Messaging { get; set; } - - IEnumerable Extensions { get; set; } - - IEnumerable ExtensionData { get; set; } - - OutputType ExpectedOutputType { get; set; } - - IEnumerable Intermediates { get; set; } - - ITupleDefinitionCreator TupleDefinitionCreator { get; set; } - } -} diff --git a/src/WixToolset.Extensibility/ILinkerExtension.cs b/src/WixToolset.Extensibility/ILinkerExtension.cs index cb82720a..febca1df 100644 --- a/src/WixToolset.Extensibility/ILinkerExtension.cs +++ b/src/WixToolset.Extensibility/ILinkerExtension.cs @@ -3,7 +3,7 @@ namespace WixToolset.Extensibility { using WixToolset.Data; - using WixToolset.Extensibility.Services; + using WixToolset.Extensibility.Data; /// /// Interface all binder extensions implement. diff --git a/src/WixToolset.Extensibility/IPreprocessContext.cs b/src/WixToolset.Extensibility/IPreprocessContext.cs deleted file mode 100644 index fcf698c1..00000000 --- a/src/WixToolset.Extensibility/IPreprocessContext.cs +++ /dev/null @@ -1,32 +0,0 @@ -// 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. - -namespace WixToolset.Extensibility -{ - using System; - using System.Collections.Generic; - using WixToolset.Data; - using WixToolset.Extensibility.Services; - - public interface IPreprocessContext - { - IServiceProvider ServiceProvider { get; } - - IMessaging Messaging { get; set; } - - IEnumerable Extensions { get; set; } - - IList IncludeSearchPaths { get; set; } - - /// - /// Gets the platform which the compiler will use when defaulting 64-bit attributes and elements. - /// - /// The platform which the compiler will use when defaulting 64-bit attributes and elements. - Platform Platform { get; set; } - - string SourceFile { get; set; } - - IDictionary Variables { get; set; } - - SourceLineNumber CurrentSourceLineNumber { get; set; } - } -} diff --git a/src/WixToolset.Extensibility/IPreprocessorExtension.cs b/src/WixToolset.Extensibility/IPreprocessorExtension.cs index 68f82693..7eb8584f 100644 --- a/src/WixToolset.Extensibility/IPreprocessorExtension.cs +++ b/src/WixToolset.Extensibility/IPreprocessorExtension.cs @@ -3,6 +3,7 @@ namespace WixToolset.Extensibility { using System.Xml.Linq; + using WixToolset.Extensibility.Data; /// /// Interface for extending the WiX toolset preprocessor. diff --git a/src/WixToolset.Extensibility/IResolveContext.cs b/src/WixToolset.Extensibility/IResolveContext.cs deleted file mode 100644 index 26891d6b..00000000 --- a/src/WixToolset.Extensibility/IResolveContext.cs +++ /dev/null @@ -1,32 +0,0 @@ -// 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. - -namespace WixToolset.Extensibility -{ - using System; - using System.Collections.Generic; - using WixToolset.Data; - using WixToolset.Extensibility.Services; - - public interface IResolveContext - { - IServiceProvider ServiceProvider { get; } - - IMessaging Messaging { get; set; } - - IEnumerable BindPaths { get; set; } - - IEnumerable Extensions { get; set; } - - IEnumerable ExtensionData { get; set; } - - IEnumerable FilterCultures { get; set; } - - string IntermediateFolder { get; set; } - - Intermediate IntermediateRepresentation { get; set; } - - IEnumerable Localizations { get; set; } - - IVariableResolver VariableResolver { get; set; } - } -} diff --git a/src/WixToolset.Extensibility/IResolverExtension.cs b/src/WixToolset.Extensibility/IResolverExtension.cs index b0478ff0..152ef64a 100644 --- a/src/WixToolset.Extensibility/IResolverExtension.cs +++ b/src/WixToolset.Extensibility/IResolverExtension.cs @@ -3,7 +3,7 @@ namespace WixToolset.Extensibility { using WixToolset.Data; - using WixToolset.Data.Bind; + using WixToolset.Extensibility.Data; /// /// Interface all resolver extensions implement. diff --git a/src/WixToolset.Extensibility/IUnbindContext.cs b/src/WixToolset.Extensibility/IUnbindContext.cs deleted file mode 100644 index beaa5491..00000000 --- a/src/WixToolset.Extensibility/IUnbindContext.cs +++ /dev/null @@ -1,26 +0,0 @@ -// 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. - -namespace WixToolset.Extensibility -{ - using System; - using WixToolset.Extensibility.Services; - - public interface IUnbindContext - { - IServiceProvider ServiceProvider { get; } - - IMessaging Messaging { get; set; } - - string ExportBasePath { get; set; } - - string InputFilePath { get; set; } - - string IntermediateFolder { get; set; } - - bool IsAdminImage { get; set; } - - bool SuppressDemodularization { get; set; } - - bool SuppressExtractCabinets { get; set; } - } -} \ No newline at end of file diff --git a/src/WixToolset.Extensibility/IWindowsInstallerBackendExtension.cs b/src/WixToolset.Extensibility/IWindowsInstallerBackendExtension.cs index 5ea73995..bc251bb2 100644 --- a/src/WixToolset.Extensibility/IWindowsInstallerBackendExtension.cs +++ b/src/WixToolset.Extensibility/IWindowsInstallerBackendExtension.cs @@ -7,6 +7,7 @@ namespace WixToolset.Extensibility using WixToolset.Data.Bind; using WixToolset.Data.Tuples; using WixToolset.Data.WindowsInstaller; + using WixToolset.Extensibility.Data; /// /// Interface all binder extensions implement. diff --git a/src/WixToolset.Extensibility/ResolveResult.cs b/src/WixToolset.Extensibility/ResolveResult.cs deleted file mode 100644 index 53f12fe9..00000000 --- a/src/WixToolset.Extensibility/ResolveResult.cs +++ /dev/null @@ -1,18 +0,0 @@ -// 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. - -namespace WixToolset.Extensibility -{ - using System.Collections.Generic; - using WixToolset.Data; - - public class ResolveResult - { - public int Codepage { get; set; } - - public IEnumerable DelayedFields { get; set; } - - public IEnumerable ExpectedEmbeddedFiles { get; set; } - - public Intermediate IntermediateRepresentation { get; set; } - } -} \ No newline at end of file diff --git a/src/WixToolset.Extensibility/ResolvedCabinet.cs b/src/WixToolset.Extensibility/ResolvedCabinet.cs deleted file mode 100644 index e98d6d96..00000000 --- a/src/WixToolset.Extensibility/ResolvedCabinet.cs +++ /dev/null @@ -1,20 +0,0 @@ -// 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. - -namespace WixToolset.Extensibility -{ - /// - /// Data returned from build file manager ResolveCabinet callback. - /// - public class ResolvedCabinet - { - /// - /// Gets or sets the build option for the resolved cabinet. - /// - public CabinetBuildOption BuildOption { get; set; } - - /// - /// Gets or sets the path for the resolved cabinet. - /// - public string Path { get; set; } - } -} diff --git a/src/WixToolset.Extensibility/ServiceProviderExtensions.cs b/src/WixToolset.Extensibility/ServiceProviderExtensions.cs deleted file mode 100644 index 408d1523..00000000 --- a/src/WixToolset.Extensibility/ServiceProviderExtensions.cs +++ /dev/null @@ -1,14 +0,0 @@ -// 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. - -namespace WixToolset.Extensibility -{ - using System; - - public static class ServiceProviderExtensions - { - public static T GetService(this IServiceProvider serviceProvider) where T : class - { - return (T)serviceProvider.GetService(typeof(T)); - } - } -} diff --git a/src/WixToolset.Extensibility/Services/ICommandLine.cs b/src/WixToolset.Extensibility/Services/ICommandLine.cs index 9dd247ff..48f3620f 100644 --- a/src/WixToolset.Extensibility/Services/ICommandLine.cs +++ b/src/WixToolset.Extensibility/Services/ICommandLine.cs @@ -2,8 +2,14 @@ namespace WixToolset.Extensibility.Services { + using WixToolset.Extensibility.Data; + public interface ICommandLine { - ICommandLineCommand ParseStandardCommandLine(ICommandLineContext commandLineContext); + IExtensionManager ExtensionManager { get; set; } + + ICommandLineArguments Arguments { get; set; } + + ICommandLineCommand ParseStandardCommandLine(); } } diff --git a/src/WixToolset.Extensibility/Services/ICommandLineArguments.cs b/src/WixToolset.Extensibility/Services/ICommandLineArguments.cs deleted file mode 100644 index eb1f8765..00000000 --- a/src/WixToolset.Extensibility/Services/ICommandLineArguments.cs +++ /dev/null @@ -1,23 +0,0 @@ -// 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. - -namespace WixToolset.Extensibility.Services -{ - using System.Collections.Generic; - - public interface ICommandLineArguments - { - string[] OriginalArguments { get; set; } - - string[] Arguments { get; set; } - - string[] Extensions { get; set; } - - string ErrorArgument { get; set; } - - void Populate(string commandLine); - - void Populate(string[] args); - - IParseCommandLine Parse(); - } -} diff --git a/src/WixToolset.Extensibility/Services/ICommandLineCommand.cs b/src/WixToolset.Extensibility/Services/ICommandLineCommand.cs deleted file mode 100644 index f2333c55..00000000 --- a/src/WixToolset.Extensibility/Services/ICommandLineCommand.cs +++ /dev/null @@ -1,9 +0,0 @@ -// 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. - -namespace WixToolset.Extensibility.Services -{ - public interface ICommandLineCommand - { - int Execute(); - } -} diff --git a/src/WixToolset.Extensibility/Services/ICommandLineContext.cs b/src/WixToolset.Extensibility/Services/ICommandLineContext.cs deleted file mode 100644 index 84b9654f..00000000 --- a/src/WixToolset.Extensibility/Services/ICommandLineContext.cs +++ /dev/null @@ -1,17 +0,0 @@ -// 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. - -namespace WixToolset.Extensibility.Services -{ - using System; - - public interface ICommandLineContext - { - IServiceProvider ServiceProvider { get; } - - IMessaging Messaging { get; set; } - - IExtensionManager ExtensionManager { get; set; } - - ICommandLineArguments Arguments { get; set; } - } -} diff --git a/src/WixToolset.Extensibility/Services/IParseHelper.cs b/src/WixToolset.Extensibility/Services/IParseHelper.cs index 96e2c83c..49218d4f 100644 --- a/src/WixToolset.Extensibility/Services/IParseHelper.cs +++ b/src/WixToolset.Extensibility/Services/IParseHelper.cs @@ -6,6 +6,7 @@ namespace WixToolset.Extensibility.Services using System.Collections.Generic; using System.Xml.Linq; using WixToolset.Data; + using WixToolset.Extensibility.Data; /// /// Interface provided to help compiler extensions parse. diff --git a/src/WixToolset.Extensibility/Services/IPreprocessHelper.cs b/src/WixToolset.Extensibility/Services/IPreprocessHelper.cs index 01c55009..d55383db 100644 --- a/src/WixToolset.Extensibility/Services/IPreprocessHelper.cs +++ b/src/WixToolset.Extensibility/Services/IPreprocessHelper.cs @@ -3,6 +3,7 @@ namespace WixToolset.Extensibility.Services { using System.Xml.Linq; + using WixToolset.Extensibility.Data; /// /// Interface provided to help preprocessor extensions. diff --git a/src/WixToolset.Extensibility/Services/ServiceProviderExtensions.cs b/src/WixToolset.Extensibility/Services/ServiceProviderExtensions.cs new file mode 100644 index 00000000..f4a5e8c3 --- /dev/null +++ b/src/WixToolset.Extensibility/Services/ServiceProviderExtensions.cs @@ -0,0 +1,14 @@ +// 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. + +namespace WixToolset.Extensibility.Services +{ + using System; + + public static class ServiceProviderExtensions + { + public static T GetService(this IServiceProvider serviceProvider) where T : class + { + return (T)serviceProvider.GetService(typeof(T)); + } + } +} diff --git a/src/WixToolset.Extensibility/WixToolset.Extensibility.csproj b/src/WixToolset.Extensibility/WixToolset.Extensibility.csproj index b1f758e5..31de1095 100644 --- a/src/WixToolset.Extensibility/WixToolset.Extensibility.csproj +++ b/src/WixToolset.Extensibility/WixToolset.Extensibility.csproj @@ -16,7 +16,7 @@ - + -- cgit v1.2.3-55-g6feb From 59e0fda78f52bc34250a84be59c24d2588a8ea45 Mon Sep 17 00:00:00 2001 From: Rob Mensching Date: Mon, 23 Jul 2018 14:19:59 -0700 Subject: Rename ICommandLine to ICommandLineParser --- src/WixToolset.Extensibility/Services/ICommandLine.cs | 15 --------------- .../Services/ICommandLineParser.cs | 15 +++++++++++++++ 2 files changed, 15 insertions(+), 15 deletions(-) delete mode 100644 src/WixToolset.Extensibility/Services/ICommandLine.cs create mode 100644 src/WixToolset.Extensibility/Services/ICommandLineParser.cs diff --git a/src/WixToolset.Extensibility/Services/ICommandLine.cs b/src/WixToolset.Extensibility/Services/ICommandLine.cs deleted file mode 100644 index 48f3620f..00000000 --- a/src/WixToolset.Extensibility/Services/ICommandLine.cs +++ /dev/null @@ -1,15 +0,0 @@ -// 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. - -namespace WixToolset.Extensibility.Services -{ - using WixToolset.Extensibility.Data; - - public interface ICommandLine - { - IExtensionManager ExtensionManager { get; set; } - - ICommandLineArguments Arguments { get; set; } - - ICommandLineCommand ParseStandardCommandLine(); - } -} diff --git a/src/WixToolset.Extensibility/Services/ICommandLineParser.cs b/src/WixToolset.Extensibility/Services/ICommandLineParser.cs new file mode 100644 index 00000000..60507c6c --- /dev/null +++ b/src/WixToolset.Extensibility/Services/ICommandLineParser.cs @@ -0,0 +1,15 @@ +// 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. + +namespace WixToolset.Extensibility.Services +{ + using WixToolset.Extensibility.Data; + + public interface ICommandLineParser + { + IExtensionManager ExtensionManager { get; set; } + + ICommandLineArguments Arguments { get; set; } + + ICommandLineCommand ParseStandardCommandLine(); + } +} -- cgit v1.2.3-55-g6feb From a39985db85c67a8f5229767bb9ba34aaa26edd65 Mon Sep 17 00:00:00 2001 From: Rob Mensching Date: Thu, 26 Jul 2018 23:49:18 -0700 Subject: Expose FileTransfer as interface This reduces the code in Extensiblity which is always a good thing. --- .../BaseBinderExtension.cs | 15 +++ src/WixToolset.Extensibility/Data/BindResult.cs | 2 +- src/WixToolset.Extensibility/Data/FileTransfer.cs | 114 --------------------- .../Data/FileTransferType.cs | 17 +++ src/WixToolset.Extensibility/Data/IFileTransfer.cs | 30 ++++++ .../Data/ILayoutContext.cs | 2 +- .../Services/IBackendHelper.cs | 23 +++++ 7 files changed, 87 insertions(+), 116 deletions(-) delete mode 100644 src/WixToolset.Extensibility/Data/FileTransfer.cs create mode 100644 src/WixToolset.Extensibility/Data/FileTransferType.cs create mode 100644 src/WixToolset.Extensibility/Data/IFileTransfer.cs create mode 100644 src/WixToolset.Extensibility/Services/IBackendHelper.cs diff --git a/src/WixToolset.Extensibility/BaseBinderExtension.cs b/src/WixToolset.Extensibility/BaseBinderExtension.cs index 51d63694..d533b0cb 100644 --- a/src/WixToolset.Extensibility/BaseBinderExtension.cs +++ b/src/WixToolset.Extensibility/BaseBinderExtension.cs @@ -3,6 +3,7 @@ namespace WixToolset.Extensibility { using WixToolset.Extensibility.Data; + using WixToolset.Extensibility.Services; /// /// Base class for creating a resolver extension. @@ -14,12 +15,26 @@ namespace WixToolset.Extensibility /// protected IBindContext Context { get; private set; } + /// + /// Messaging for use by the extension. + /// + protected IMessaging Messaging { get; private set; } + + /// + /// BackendHelper for use by the extension. + /// + protected IBackendHelper BackendHelper { get; private set; } + /// /// Called at the beginning of bind. /// public virtual void PreBind(IBindContext context) { this.Context = context; + + this.Messaging = context.ServiceProvider.GetService(); + + this.BackendHelper = context.ServiceProvider.GetService(); } /// diff --git a/src/WixToolset.Extensibility/Data/BindResult.cs b/src/WixToolset.Extensibility/Data/BindResult.cs index ec97154f..0ccaa08b 100644 --- a/src/WixToolset.Extensibility/Data/BindResult.cs +++ b/src/WixToolset.Extensibility/Data/BindResult.cs @@ -6,7 +6,7 @@ namespace WixToolset.Extensibility.Data public class BindResult { - public IEnumerable FileTransfers { get; set; } + public IEnumerable FileTransfers { get; set; } public IEnumerable ContentFilePaths { get; set; } } diff --git a/src/WixToolset.Extensibility/Data/FileTransfer.cs b/src/WixToolset.Extensibility/Data/FileTransfer.cs deleted file mode 100644 index 0356ac4c..00000000 --- a/src/WixToolset.Extensibility/Data/FileTransfer.cs +++ /dev/null @@ -1,114 +0,0 @@ -// 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. - -namespace WixToolset.Extensibility.Data -{ - using System; - using System.IO; - using WixToolset.Data; - - /// - /// Structure used for all file transfer information. - /// - public class FileTransfer - { - /// Source path to file. - public string Source { get; set; } - - /// Destination path for file. - public string Destination { get; set; } - - /// Flag if file should be moved (optimal). - public bool Move { get; set; } - - /// Optional source line numbers where this file transfer orginated. - public SourceLineNumber SourceLineNumbers { get; set; } - - /// Optional type of file this transfer is moving or copying. - public string Type { get; set; } - - /// Indicates whether the file transer was a built by this build or copied from other some build. - public bool Built { get; set; } - - /// Set during layout of media when the file transfer when the source and target resolve to the same path. - public bool Redundant { get; set; } - - /// - /// Prefer the TryCreate() method to create FileTransfer objects. - /// - /// Source path to file. - /// Destination path for file. - /// File if file should be moved (optimal). - /// Optional type of file this transfer is transferring. - /// Optional source line numbers wher this transfer originated. - public FileTransfer(string source, string destination, bool move, string type = null, SourceLineNumber sourceLineNumbers = null) - { - this.Source = source; - this.Destination = destination; - this.Move = move; - - this.Type = type; - this.SourceLineNumbers = sourceLineNumbers; - } - - /// - /// Creates a file transfer if the source and destination are different. - /// - /// Source path to file. - /// Destination path for file. - /// File if file should be moved (optimal). - /// Optional type of file this transfer is transferring. - /// Optional source line numbers where this transfer originated. - /// true if the source and destination are the different, false if no file transfer is created. - public static bool TryCreate(string source, string destination, bool move, string type, SourceLineNumber sourceLineNumbers, out FileTransfer transfer) - { - //string sourceFullPath = GetValidatedFullPath(sourceLineNumbers, source); - - //string fileLayoutFullPath = GetValidatedFullPath(sourceLineNumbers, destination); - - ////// if the current source path (where we know that the file already exists) and the resolved - ////// path as dictated by the Directory table are not the same, then propagate the file. The - ////// image that we create may have already been done by some other process other than the linker, so - ////// there is no reason to copy the files to the resolved source if they are already there. - ////if (String.Equals(sourceFullPath, fileLayoutFullPath, StringComparison.OrdinalIgnoreCase)) - ////{ - //// transfer = null; - //// return false; - ////} - - //transfer = new FileTransfer(source, destination, move, type, sourceLineNumbers); - //transfer.Redundant = String.Equals(sourceFullPath, fileLayoutFullPath, StringComparison.OrdinalIgnoreCase); - //return true; - throw new NotImplementedException(); - } - - //private static string GetValidatedFullPath(SourceLineNumber sourceLineNumbers, string path) - //{ - // string result; - - // try - // { - // result = Path.GetFullPath(path); - - // var filename = Path.GetFileName(result); - - // foreach (var reservedName in Common.ReservedFileNames) - // { - // if (reservedName.Equals(filename, StringComparison.OrdinalIgnoreCase)) - // { - // throw new WixException(ErrorMessages.InvalidFileName(sourceLineNumbers, path)); - // } - // } - // } - // catch (ArgumentException) - // { - // throw new WixException(ErrorMessages.InvalidFileName(sourceLineNumbers, path)); - // } - // catch (PathTooLongException) - // { - // throw new WixException(ErrorMessages.PathTooLong(sourceLineNumbers, path)); - // } - - // return result; - //} - } -} diff --git a/src/WixToolset.Extensibility/Data/FileTransferType.cs b/src/WixToolset.Extensibility/Data/FileTransferType.cs new file mode 100644 index 00000000..b00a00c4 --- /dev/null +++ b/src/WixToolset.Extensibility/Data/FileTransferType.cs @@ -0,0 +1,17 @@ +// 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. + +namespace WixToolset.Extensibility.Data +{ + public enum FileTransferType + { + /// + /// Transfer of a file built during this build. + /// + Built, + + /// + /// Transfer of a file contained in the output. + /// + Content, + } +} diff --git a/src/WixToolset.Extensibility/Data/IFileTransfer.cs b/src/WixToolset.Extensibility/Data/IFileTransfer.cs new file mode 100644 index 00000000..ca936219 --- /dev/null +++ b/src/WixToolset.Extensibility/Data/IFileTransfer.cs @@ -0,0 +1,30 @@ +// 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. + +namespace WixToolset.Extensibility.Data +{ + using WixToolset.Data; + + /// + /// Structure used for all file transfer information. + /// + public interface IFileTransfer + { + /// Destination path for file. + string Destination { get; set; } + + /// Flag if file should be moved (optimal). + bool Move { get; set; } + + /// Set during layout of media when the file transfer when the source and target resolve to the same path. + bool Redundant { get; set; } + + /// Source path to file. + string Source { get; set; } + + /// Optional source line numbers where this file transfer orginated. + SourceLineNumber SourceLineNumbers { get; set; } + + /// Type of file this transfer is moving or copying. + FileTransferType Type { get; set; } + } +} diff --git a/src/WixToolset.Extensibility/Data/ILayoutContext.cs b/src/WixToolset.Extensibility/Data/ILayoutContext.cs index c3555268..7011fcf6 100644 --- a/src/WixToolset.Extensibility/Data/ILayoutContext.cs +++ b/src/WixToolset.Extensibility/Data/ILayoutContext.cs @@ -13,7 +13,7 @@ namespace WixToolset.Extensibility.Data IEnumerable ContentFilePaths { get; set; } - IEnumerable FileTransfers { get; set; } + IEnumerable FileTransfers { get; set; } string ContentsFile { get; set; } diff --git a/src/WixToolset.Extensibility/Services/IBackendHelper.cs b/src/WixToolset.Extensibility/Services/IBackendHelper.cs new file mode 100644 index 00000000..83f57e35 --- /dev/null +++ b/src/WixToolset.Extensibility/Services/IBackendHelper.cs @@ -0,0 +1,23 @@ +// 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. + +namespace WixToolset.Extensibility.Services +{ + using WixToolset.Data; + using WixToolset.Extensibility.Data; + + /// + /// Interface provided to help backend extensions. + /// + public interface IBackendHelper + { + /// + /// Creates a file transfer and marks it redundant if the source and destination are identical. + /// + /// Source for the file transfer. + /// Destiation for the file transfer. + /// Indicates whether to move or copy the source file. + /// Type of file transfer to create. + /// Optional source line numbers that requested the file transfer. + IFileTransfer CreateFileTransfer(string source, string destination, bool move, FileTransferType type, SourceLineNumber sourceLineNumbers = null); + } +} -- cgit v1.2.3-55-g6feb From d282f53f254d378800c5ee53f8ff6a3586d7abfa Mon Sep 17 00:00:00 2001 From: Rob Mensching Date: Fri, 27 Jul 2018 00:29:27 -0700 Subject: Allow file resolution extensions to send paths checked for file --- src/WixToolset.Extensibility/BaseResolverExtension.cs | 2 +- src/WixToolset.Extensibility/Data/ResolveFileResult.cs | 13 +++++++++++++ src/WixToolset.Extensibility/ILibrarianExtension.cs | 2 +- src/WixToolset.Extensibility/IResolverExtension.cs | 2 +- 4 files changed, 16 insertions(+), 3 deletions(-) create mode 100644 src/WixToolset.Extensibility/Data/ResolveFileResult.cs diff --git a/src/WixToolset.Extensibility/BaseResolverExtension.cs b/src/WixToolset.Extensibility/BaseResolverExtension.cs index 16219e93..fcd2eed9 100644 --- a/src/WixToolset.Extensibility/BaseResolverExtension.cs +++ b/src/WixToolset.Extensibility/BaseResolverExtension.cs @@ -31,7 +31,7 @@ namespace WixToolset.Extensibility this.Messaging = context.ServiceProvider.GetService(); } - public virtual string ResolveFile(string source, IntermediateTupleDefinition tupleDefinition, SourceLineNumber sourceLineNumbers, BindStage bindStage) + public virtual ResolveFileResult ResolveFile(string source, IntermediateTupleDefinition tupleDefinition, SourceLineNumber sourceLineNumbers, BindStage bindStage) { return null; } diff --git a/src/WixToolset.Extensibility/Data/ResolveFileResult.cs b/src/WixToolset.Extensibility/Data/ResolveFileResult.cs new file mode 100644 index 00000000..5ac7c426 --- /dev/null +++ b/src/WixToolset.Extensibility/Data/ResolveFileResult.cs @@ -0,0 +1,13 @@ +// 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. + +namespace WixToolset.Extensibility.Data +{ + using System.Collections.Generic; + + public class ResolveFileResult + { + public string Path { get; set; } + + public IEnumerable CheckedPaths { get; set; } + } +} \ No newline at end of file diff --git a/src/WixToolset.Extensibility/ILibrarianExtension.cs b/src/WixToolset.Extensibility/ILibrarianExtension.cs index 7319f8b9..b9f707e1 100644 --- a/src/WixToolset.Extensibility/ILibrarianExtension.cs +++ b/src/WixToolset.Extensibility/ILibrarianExtension.cs @@ -9,7 +9,7 @@ namespace WixToolset.Extensibility { void PreCombine(ILibraryContext context); - string Resolve(SourceLineNumber sourceLineNumber, IntermediateTupleDefinition tupleDefinition, string path); + ResolveFileResult ResolveFile(SourceLineNumber sourceLineNumber, IntermediateTupleDefinition tupleDefinition, string path); void PostCombine(Intermediate library); } diff --git a/src/WixToolset.Extensibility/IResolverExtension.cs b/src/WixToolset.Extensibility/IResolverExtension.cs index 152ef64a..36ada8f0 100644 --- a/src/WixToolset.Extensibility/IResolverExtension.cs +++ b/src/WixToolset.Extensibility/IResolverExtension.cs @@ -15,7 +15,7 @@ namespace WixToolset.Extensibility /// void PreResolve(IResolveContext context); - string ResolveFile(string source, IntermediateTupleDefinition tupleDefinition, SourceLineNumber sourceLineNumbers, BindStage bindStage); + ResolveFileResult ResolveFile(string source, IntermediateTupleDefinition tupleDefinition, SourceLineNumber sourceLineNumbers, BindStage bindStage); /// /// Called after all resolving occurs. -- cgit v1.2.3-55-g6feb From c60c36800f5e84e1aced6257aeee5f6139ef6af8 Mon Sep 17 00:00:00 2001 From: Rob Mensching Date: Wed, 1 Aug 2018 03:05:58 -0700 Subject: Add CreateGuid() to IBackendHelper --- src/WixToolset.Extensibility/Services/IBackendHelper.cs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/WixToolset.Extensibility/Services/IBackendHelper.cs b/src/WixToolset.Extensibility/Services/IBackendHelper.cs index 83f57e35..813b40ef 100644 --- a/src/WixToolset.Extensibility/Services/IBackendHelper.cs +++ b/src/WixToolset.Extensibility/Services/IBackendHelper.cs @@ -2,6 +2,7 @@ namespace WixToolset.Extensibility.Services { + using System; using WixToolset.Data; using WixToolset.Extensibility.Data; @@ -19,5 +20,13 @@ namespace WixToolset.Extensibility.Services /// Type of file transfer to create. /// Optional source line numbers that requested the file transfer. IFileTransfer CreateFileTransfer(string source, string destination, bool move, FileTransferType type, SourceLineNumber sourceLineNumbers = null); + + /// + /// Creates a version 3 name-based UUID. + /// + /// The namespace UUID. + /// The value. + /// The generated GUID for the given namespace and value. + string CreateGuid(Guid namespaceGuid, string value); } } -- cgit v1.2.3-55-g6feb From 84cb6c26c945fe031bbe36c666d0bbd6275d843b Mon Sep 17 00:00:00 2001 From: Rob Mensching Date: Sat, 11 Aug 2018 01:03:57 -0700 Subject: Add support for tracking files to simplify file transfers --- src/WixToolset.Extensibility/Data/BindResult.cs | 2 +- .../Data/FileTransferType.cs | 17 ------------ src/WixToolset.Extensibility/Data/IFileTransfer.cs | 3 -- .../Data/ILayoutContext.cs | 2 +- src/WixToolset.Extensibility/Data/ITrackedFile.cs | 32 ++++++++++++++++++++++ .../Data/TrackedFileType.cs | 30 ++++++++++++++++++++ .../Services/IBackendHelper.cs | 12 ++++++-- 7 files changed, 73 insertions(+), 25 deletions(-) delete mode 100644 src/WixToolset.Extensibility/Data/FileTransferType.cs create mode 100644 src/WixToolset.Extensibility/Data/ITrackedFile.cs create mode 100644 src/WixToolset.Extensibility/Data/TrackedFileType.cs diff --git a/src/WixToolset.Extensibility/Data/BindResult.cs b/src/WixToolset.Extensibility/Data/BindResult.cs index 0ccaa08b..e467d269 100644 --- a/src/WixToolset.Extensibility/Data/BindResult.cs +++ b/src/WixToolset.Extensibility/Data/BindResult.cs @@ -8,6 +8,6 @@ namespace WixToolset.Extensibility.Data { public IEnumerable FileTransfers { get; set; } - public IEnumerable ContentFilePaths { get; set; } + public IEnumerable TrackedFiles { get; set; } } } diff --git a/src/WixToolset.Extensibility/Data/FileTransferType.cs b/src/WixToolset.Extensibility/Data/FileTransferType.cs deleted file mode 100644 index b00a00c4..00000000 --- a/src/WixToolset.Extensibility/Data/FileTransferType.cs +++ /dev/null @@ -1,17 +0,0 @@ -// 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. - -namespace WixToolset.Extensibility.Data -{ - public enum FileTransferType - { - /// - /// Transfer of a file built during this build. - /// - Built, - - /// - /// Transfer of a file contained in the output. - /// - Content, - } -} diff --git a/src/WixToolset.Extensibility/Data/IFileTransfer.cs b/src/WixToolset.Extensibility/Data/IFileTransfer.cs index ca936219..6f521536 100644 --- a/src/WixToolset.Extensibility/Data/IFileTransfer.cs +++ b/src/WixToolset.Extensibility/Data/IFileTransfer.cs @@ -23,8 +23,5 @@ namespace WixToolset.Extensibility.Data /// Optional source line numbers where this file transfer orginated. SourceLineNumber SourceLineNumbers { get; set; } - - /// Type of file this transfer is moving or copying. - FileTransferType Type { get; set; } } } diff --git a/src/WixToolset.Extensibility/Data/ILayoutContext.cs b/src/WixToolset.Extensibility/Data/ILayoutContext.cs index 7011fcf6..89aadc4d 100644 --- a/src/WixToolset.Extensibility/Data/ILayoutContext.cs +++ b/src/WixToolset.Extensibility/Data/ILayoutContext.cs @@ -11,7 +11,7 @@ namespace WixToolset.Extensibility.Data IEnumerable Extensions { get; set; } - IEnumerable ContentFilePaths { get; set; } + IEnumerable TrackedFiles { get; set; } IEnumerable FileTransfers { get; set; } diff --git a/src/WixToolset.Extensibility/Data/ITrackedFile.cs b/src/WixToolset.Extensibility/Data/ITrackedFile.cs new file mode 100644 index 00000000..df36bd2b --- /dev/null +++ b/src/WixToolset.Extensibility/Data/ITrackedFile.cs @@ -0,0 +1,32 @@ +// 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. + +namespace WixToolset.Extensibility.Data +{ + using WixToolset.Data; + + /// + /// Interface used to track all files processed. + /// + public interface ITrackedFile + { + /// + /// Indicates whether the tracked file should be cleaned by the project. + /// + bool Clean { get; set; } + + /// + /// Path to tracked file. + /// + string Path { get; set; } + + /// + /// Optional source line numbers where the tracked file was created. + /// + SourceLineNumber SourceLineNumbers { get; set; } + + /// + /// Type of tracked file. + /// + TrackedFileType Type { get; set; } + } +} diff --git a/src/WixToolset.Extensibility/Data/TrackedFileType.cs b/src/WixToolset.Extensibility/Data/TrackedFileType.cs new file mode 100644 index 00000000..195d5de9 --- /dev/null +++ b/src/WixToolset.Extensibility/Data/TrackedFileType.cs @@ -0,0 +1,30 @@ +// 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. + +namespace WixToolset.Extensibility.Data +{ + public enum TrackedFileType + { + /// + /// File tracked as input (like content included in an .msi). + /// + Input, + + /// + /// Temporary file (like an .idt or any other temporary file). + /// These are to be deleted before the build completes. + /// + Temporary, + + /// + /// Intermediate file (like a .cab in the cabcache). + /// These are left for subsequent builds. + /// + Intermediate, + + /// + /// Final output (like a .msi, .cab or .wixpdb). + /// These are the whole point of the build process. + /// + Final, + } +} diff --git a/src/WixToolset.Extensibility/Services/IBackendHelper.cs b/src/WixToolset.Extensibility/Services/IBackendHelper.cs index 813b40ef..0622693d 100644 --- a/src/WixToolset.Extensibility/Services/IBackendHelper.cs +++ b/src/WixToolset.Extensibility/Services/IBackendHelper.cs @@ -17,9 +17,7 @@ namespace WixToolset.Extensibility.Services /// Source for the file transfer. /// Destiation for the file transfer. /// Indicates whether to move or copy the source file. - /// Type of file transfer to create. - /// Optional source line numbers that requested the file transfer. - IFileTransfer CreateFileTransfer(string source, string destination, bool move, FileTransferType type, SourceLineNumber sourceLineNumbers = null); + IFileTransfer CreateFileTransfer(string source, string destination, bool move, SourceLineNumber sourceLineNumbers = null); /// /// Creates a version 3 name-based UUID. @@ -28,5 +26,13 @@ namespace WixToolset.Extensibility.Services /// The value. /// The generated GUID for the given namespace and value. string CreateGuid(Guid namespaceGuid, string value); + + /// + /// Creates a tracked file. + /// + /// Destination path for the build output. + /// Type of tracked file to create. + /// Optional source line numbers that requested the tracked file. + ITrackedFile TrackFile(string path, TrackedFileType type, SourceLineNumber sourceLineNumbers = null); } } -- cgit v1.2.3-55-g6feb From ec569071fa5e547c598f30dea9258096663ce5d8 Mon Sep 17 00:00:00 2001 From: Rob Mensching Date: Sat, 11 Aug 2018 01:05:03 -0700 Subject: Enable NCrunch support --- src/Directory.Build.props | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/Directory.Build.props b/src/Directory.Build.props index 7cd6767f..9eacf3f5 100644 --- a/src/Directory.Build.props +++ b/src/Directory.Build.props @@ -1,12 +1,18 @@ - + Debug - $(MSBuildThisFileDirectory)..\build\obj\$(MSBuildProjectName)\ - $(MSBuildThisFileDirectory)..\build\$(Configuration)\ - $(BaseOutputPath) + false + + $(MSBuildProjectName) + $(MSBuildThisFileDirectory)..\build\ + $(BaseOutputPath)obj\$(ProjectName)\ + $(BaseOutputPath)$(Configuration)\ WiX Toolset Team WiX Toolset @@ -18,5 +24,6 @@ $(MSBuildThisFileDirectory)..\..\ + -- cgit v1.2.3-55-g6feb From 780fd42d094e7d9f020bf08b4be55b150b9957e4 Mon Sep 17 00:00:00 2001 From: Rob Mensching Date: Wed, 24 Oct 2018 14:41:40 -0700 Subject: Add .editorconfig --- .editorconfig | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 .editorconfig diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 00000000..2ebba4b3 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,34 @@ +# 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. + +root = true + +[*] +charset = utf-8 +indent_style = space +indent_size = 4 +trim_trailing_whitespace = true + +[*.{cs,vb}] +dotnet_sort_system_directives_first = true + +[*.cs] +csharp_indent_case_contents = true : error +csharp_indent_switch_labels = true : error +csharp_new_line_before_open_brace = all +csharp_prefer_braces = true : error +csharp_style_expression_bodied_methods = when_on_single_line : suggestion +csharp_style_expression_bodied_constructors = when_on_single_line : suggestion +csharp_style_expression_bodied_operators = when_on_single_line : suggestion +csharp_style_expression_bodied_properties = when_on_single_line : suggestion +csharp_style_expression_bodied_indexers = when_on_single_line : suggestion +csharp_style_expression_bodied_accessors = when_on_single_line : suggestion +csharp_style_var_elsewhere = true : suggestion +csharp_style_var_for_built_in_types = true : suggestion +csharp_style_var_when_type_is_apparent = true : suggestion +dotnet_style_qualification_for_event = true : error +dotnet_style_qualification_for_field = true : error +dotnet_style_qualification_for_method = true : error +dotnet_style_qualification_for_property = true : error + +[*.targets] +indent_size = 2 -- cgit v1.2.3-55-g6feb From b86e235ef4f9423624fc93e1c417484e938245df Mon Sep 17 00:00:00 2001 From: Rob Mensching Date: Wed, 24 Oct 2018 15:03:23 -0700 Subject: Re-organize command-line processing and add support for custom commands --- .../BaseExtensionCommandLine.cs | 33 +++++++++++++++++++++ .../Data/ICommandLineArguments.cs | 2 +- .../Data/ICommandLineCommand.cs | 10 ++++++- .../IExtensionCommandLine.cs | 4 ++- .../Services/ICommandLine.cs | 15 ++++++++++ .../Services/ICommandLineParser.cs | 31 ++++++++++++++++---- .../Services/IParseCommandLine.cs | 34 ---------------------- 7 files changed, 87 insertions(+), 42 deletions(-) create mode 100644 src/WixToolset.Extensibility/BaseExtensionCommandLine.cs create mode 100644 src/WixToolset.Extensibility/Services/ICommandLine.cs delete mode 100644 src/WixToolset.Extensibility/Services/IParseCommandLine.cs diff --git a/src/WixToolset.Extensibility/BaseExtensionCommandLine.cs b/src/WixToolset.Extensibility/BaseExtensionCommandLine.cs new file mode 100644 index 00000000..77e8a5bd --- /dev/null +++ b/src/WixToolset.Extensibility/BaseExtensionCommandLine.cs @@ -0,0 +1,33 @@ +// 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. + +namespace WixToolset.Extensibility +{ + using System.Collections.Generic; + using System.Linq; + using WixToolset.Extensibility.Data; + using WixToolset.Extensibility.Services; + + public abstract class BaseExtensionCommandLine : IExtensionCommandLine + { + public IEnumerable CommandLineSwitches => Enumerable.Empty(); + + public virtual void PostParse() + { + } + + public virtual void PreParse(ICommandLineContext context) + { + } + + public virtual bool TryParseArgument(ICommandLineParser parser, string argument) + { + return false; + } + + public virtual bool TryParseCommand(ICommandLineParser parser, out ICommandLineCommand command) + { + command = null; + return false; + } + } +} diff --git a/src/WixToolset.Extensibility/Data/ICommandLineArguments.cs b/src/WixToolset.Extensibility/Data/ICommandLineArguments.cs index 5729ff36..dfa81762 100644 --- a/src/WixToolset.Extensibility/Data/ICommandLineArguments.cs +++ b/src/WixToolset.Extensibility/Data/ICommandLineArguments.cs @@ -18,6 +18,6 @@ namespace WixToolset.Extensibility.Data void Populate(string[] args); - IParseCommandLine Parse(); + ICommandLineParser Parse(); } } diff --git a/src/WixToolset.Extensibility/Data/ICommandLineCommand.cs b/src/WixToolset.Extensibility/Data/ICommandLineCommand.cs index 1146d40a..1c6de205 100644 --- a/src/WixToolset.Extensibility/Data/ICommandLineCommand.cs +++ b/src/WixToolset.Extensibility/Data/ICommandLineCommand.cs @@ -1,9 +1,17 @@ -// 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. +// 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. namespace WixToolset.Extensibility.Data { + using WixToolset.Extensibility.Services; + public interface ICommandLineCommand { + bool ShowLogo { get; } + + bool StopParsing { get; } + int Execute(); + + bool TryParseArgument(ICommandLineParser parser, string argument); } } diff --git a/src/WixToolset.Extensibility/IExtensionCommandLine.cs b/src/WixToolset.Extensibility/IExtensionCommandLine.cs index 5c6f578d..0cbf84d9 100644 --- a/src/WixToolset.Extensibility/IExtensionCommandLine.cs +++ b/src/WixToolset.Extensibility/IExtensionCommandLine.cs @@ -19,7 +19,9 @@ namespace WixToolset.Extensibility void PreParse(ICommandLineContext context); - bool TryParseArgument(IParseCommandLine parseCommandLine, string arg); + bool TryParseArgument(ICommandLineParser parser, string argument); + + bool TryParseCommand(ICommandLineParser parser, out ICommandLineCommand command); void PostParse(); } diff --git a/src/WixToolset.Extensibility/Services/ICommandLine.cs b/src/WixToolset.Extensibility/Services/ICommandLine.cs new file mode 100644 index 00000000..48f3620f --- /dev/null +++ b/src/WixToolset.Extensibility/Services/ICommandLine.cs @@ -0,0 +1,15 @@ +// 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. + +namespace WixToolset.Extensibility.Services +{ + using WixToolset.Extensibility.Data; + + public interface ICommandLine + { + IExtensionManager ExtensionManager { get; set; } + + ICommandLineArguments Arguments { get; set; } + + ICommandLineCommand ParseStandardCommandLine(); + } +} diff --git a/src/WixToolset.Extensibility/Services/ICommandLineParser.cs b/src/WixToolset.Extensibility/Services/ICommandLineParser.cs index 60507c6c..f7e2a28f 100644 --- a/src/WixToolset.Extensibility/Services/ICommandLineParser.cs +++ b/src/WixToolset.Extensibility/Services/ICommandLineParser.cs @@ -1,15 +1,36 @@ -// 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. +// 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. namespace WixToolset.Extensibility.Services { - using WixToolset.Extensibility.Data; + using System.Collections.Generic; public interface ICommandLineParser { - IExtensionManager ExtensionManager { get; set; } + string ErrorArgument { get; set; } - ICommandLineArguments Arguments { get; set; } + /// + /// Validates that a valid switch (starts with "/" or "-"), and returns a bool indicating its validity + /// + /// The string check. + /// True if a valid switch, otherwise false. + bool IsSwitch(string arg); - ICommandLineCommand ParseStandardCommandLine(); + string GetArgumentAsFilePathOrError(string argument, string fileType); + + void GetArgumentAsFilePathOrError(string argument, string fileType, IList paths); + + string GetNextArgumentOrError(string commandLineSwitch); + + bool GetNextArgumentOrError(string commandLineSwitch, IList argument); + + string GetNextArgumentAsDirectoryOrError(string commandLineSwitch); + + bool GetNextArgumentAsDirectoryOrError(string commandLineSwitch, IList directories); + + string GetNextArgumentAsFilePathOrError(string commandLineSwitch); + + bool GetNextArgumentAsFilePathOrError(string commandLineSwitch, string fileType, IList paths); + + bool TryGetNextSwitchOrArgument(out string arg); } } diff --git a/src/WixToolset.Extensibility/Services/IParseCommandLine.cs b/src/WixToolset.Extensibility/Services/IParseCommandLine.cs deleted file mode 100644 index 3753b4f2..00000000 --- a/src/WixToolset.Extensibility/Services/IParseCommandLine.cs +++ /dev/null @@ -1,34 +0,0 @@ -// 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. - -namespace WixToolset.Extensibility.Services -{ - using System.Collections.Generic; - - public interface IParseCommandLine - { - string ErrorArgument { get; set; } - - /// - /// Validates that a valid switch (starts with "/" or "-"), and returns a bool indicating its validity - /// - /// The string check. - /// True if a valid switch, otherwise false. - bool IsSwitch(string arg); - - void GetArgumentAsFilePathOrError(string argument, string fileType, IList paths); - - string GetNextArgumentOrError(string commandLineSwitch); - - bool GetNextArgumentOrError(string commandLineSwitch, IList argument); - - string GetNextArgumentAsDirectoryOrError(string commandLineSwitch); - - bool GetNextArgumentAsDirectoryOrError(string commandLineSwitch, IList directories); - - string GetNextArgumentAsFilePathOrError(string commandLineSwitch); - - bool GetNextArgumentAsFilePathOrError(string commandLineSwitch, string fileType, IList paths); - - bool TryGetNextSwitchOrArgument(out string arg); - } -} -- cgit v1.2.3-55-g6feb From ce51350ca9c020312810447f64a3f40145f749bd Mon Sep 17 00:00:00 2001 From: Rob Mensching Date: Wed, 24 Oct 2018 20:55:33 -0700 Subject: Fix "binder" names in interfaces and file names --- .../BaseWindowsInstallerBackendBinderExtension.cs | 70 ++++++++++++++++++++++ .../BaseWindowsInstallerBackendExtension.cs | 70 ---------------------- src/WixToolset.Extensibility/IBindExtension.cs | 23 ------- src/WixToolset.Extensibility/IBinderExtension.cs | 22 +++++++ .../IWindowsInstallerBackendBinderExtension.cs | 32 ++++++++++ .../IWindowsInstallerBackendExtension.cs | 33 ---------- 6 files changed, 124 insertions(+), 126 deletions(-) create mode 100644 src/WixToolset.Extensibility/BaseWindowsInstallerBackendBinderExtension.cs delete mode 100644 src/WixToolset.Extensibility/BaseWindowsInstallerBackendExtension.cs delete mode 100644 src/WixToolset.Extensibility/IBindExtension.cs create mode 100644 src/WixToolset.Extensibility/IBinderExtension.cs create mode 100644 src/WixToolset.Extensibility/IWindowsInstallerBackendBinderExtension.cs delete mode 100644 src/WixToolset.Extensibility/IWindowsInstallerBackendExtension.cs diff --git a/src/WixToolset.Extensibility/BaseWindowsInstallerBackendBinderExtension.cs b/src/WixToolset.Extensibility/BaseWindowsInstallerBackendBinderExtension.cs new file mode 100644 index 00000000..c5ee9d1b --- /dev/null +++ b/src/WixToolset.Extensibility/BaseWindowsInstallerBackendBinderExtension.cs @@ -0,0 +1,70 @@ +// 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. + +namespace WixToolset.Extensibility +{ + using System.Collections.Generic; + using WixToolset.Data; + using WixToolset.Data.Tuples; + using WixToolset.Data.WindowsInstaller; + using WixToolset.Extensibility.Data; + using WixToolset.Extensibility.Services; + + /// + /// Base class for creating a preprocessor extension. + /// + public abstract class BaseWindowsInstallerBackendBinderExtension : IWindowsInstallerBackendBinderExtension + { + /// + /// Context for use by the extension. + /// + protected IBindContext Context { get; private set; } + + /// + /// Messaging for use by the extension. + /// + protected IMessaging Messaging { get; private set; } + + /// + /// Backend helper for use by the extension. + /// + protected IWindowsInstallerBackendHelper BackendHelper { get; private set; } + + /// + /// Optional table definitions to automatically map to tuples. + /// + protected virtual TableDefinition[] TableDefinitionsForTuples { get; } + + public virtual void PreBackendBind(IBindContext context) + { + this.Context = context; + + this.Messaging = context.ServiceProvider.GetService(); + + this.BackendHelper = context.ServiceProvider.GetService(); + } + + public virtual ResolvedCabinet ResolveCabinet(string cabinetPath, IEnumerable files) + { + return null; + } + + public virtual string ResolveMedia(MediaTuple mediaRow, string mediaLayoutDirectory, string layoutDirectory) + { + return null; + } + + public virtual bool TryAddTupleToOutput(IntermediateTuple tuple, Output output) + { + if (this.TableDefinitionsForTuples != null) + { + return this.BackendHelper.TryAddTupleToOutputMatchingTableDefinitions(tuple, output, this.TableDefinitionsForTuples); + } + + return false; + } + + public virtual void PostBackendBind(BindResult result, Pdb pdb) + { + } + } +} diff --git a/src/WixToolset.Extensibility/BaseWindowsInstallerBackendExtension.cs b/src/WixToolset.Extensibility/BaseWindowsInstallerBackendExtension.cs deleted file mode 100644 index 4393dfda..00000000 --- a/src/WixToolset.Extensibility/BaseWindowsInstallerBackendExtension.cs +++ /dev/null @@ -1,70 +0,0 @@ -// 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. - -namespace WixToolset.Extensibility -{ - using System.Collections.Generic; - using WixToolset.Data; - using WixToolset.Data.Tuples; - using WixToolset.Data.WindowsInstaller; - using WixToolset.Extensibility.Data; - using WixToolset.Extensibility.Services; - - /// - /// Base class for creating a preprocessor extension. - /// - public abstract class BaseWindowsInstallerBackendExtension : IWindowsInstallerBackendExtension - { - /// - /// Context for use by the extension. - /// - protected IBindContext Context { get; private set; } - - /// - /// Messaging for use by the extension. - /// - protected IMessaging Messaging { get; private set; } - - /// - /// Backend helper for use by the extension. - /// - protected IWindowsInstallerBackendHelper BackendHelper { get; private set; } - - /// - /// Optional table definitions to automatically map to tuples. - /// - protected virtual TableDefinition[] TableDefinitionsForTuples { get; } - - public virtual void PreBackendBind(IBindContext context) - { - this.Context = context; - - this.Messaging = context.ServiceProvider.GetService(); - - this.BackendHelper = context.ServiceProvider.GetService(); - } - - public virtual ResolvedCabinet ResolveCabinet(string cabinetPath, IEnumerable files) - { - return null; - } - - public virtual string ResolveMedia(MediaTuple mediaRow, string mediaLayoutDirectory, string layoutDirectory) - { - return null; - } - - public virtual bool TryAddTupleToOutput(IntermediateTuple tuple, Output output) - { - if (this.TableDefinitionsForTuples != null) - { - return this.BackendHelper.TryAddTupleToOutputMatchingTableDefinitions(tuple, output, this.TableDefinitionsForTuples); - } - - return false; - } - - public virtual void PostBackendBind(BindResult result, Pdb pdb) - { - } - } -} diff --git a/src/WixToolset.Extensibility/IBindExtension.cs b/src/WixToolset.Extensibility/IBindExtension.cs deleted file mode 100644 index 2dcf5eff..00000000 --- a/src/WixToolset.Extensibility/IBindExtension.cs +++ /dev/null @@ -1,23 +0,0 @@ -// 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. - -namespace WixToolset.Extensibility -{ - using WixToolset.Data.Bind; - using WixToolset.Extensibility.Data; - - /// - /// Interface all binder extensions implement. - /// - public interface IBinderExtension - { - /// - /// Called before binding occurs. - /// - void PreBind(IBindContext context); - - /// - /// Called after all binding occurs. - /// - void PostBind(BindResult result); - } -} diff --git a/src/WixToolset.Extensibility/IBinderExtension.cs b/src/WixToolset.Extensibility/IBinderExtension.cs new file mode 100644 index 00000000..2656e106 --- /dev/null +++ b/src/WixToolset.Extensibility/IBinderExtension.cs @@ -0,0 +1,22 @@ +// 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. + +namespace WixToolset.Extensibility +{ + using WixToolset.Extensibility.Data; + + /// + /// Interface all binder extensions implement. + /// + public interface IBinderExtension + { + /// + /// Called before binding occurs. + /// + void PreBind(IBindContext context); + + /// + /// Called after all binding occurs. + /// + void PostBind(BindResult result); + } +} diff --git a/src/WixToolset.Extensibility/IWindowsInstallerBackendBinderExtension.cs b/src/WixToolset.Extensibility/IWindowsInstallerBackendBinderExtension.cs new file mode 100644 index 00000000..5f34d3e1 --- /dev/null +++ b/src/WixToolset.Extensibility/IWindowsInstallerBackendBinderExtension.cs @@ -0,0 +1,32 @@ +// 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. + +namespace WixToolset.Extensibility +{ + using System.Collections.Generic; + using WixToolset.Data; + using WixToolset.Data.Tuples; + using WixToolset.Data.WindowsInstaller; + using WixToolset.Extensibility.Data; + + /// + /// Interface all binder extensions implement. + /// + public interface IWindowsInstallerBackendBinderExtension + { + /// + /// Called before binding occurs. + /// + void PreBackendBind(IBindContext context); + + ResolvedCabinet ResolveCabinet(string cabinetPath, IEnumerable files); + + string ResolveMedia(MediaTuple mediaRow, string mediaLayoutDirectory, string layoutDirectory); + + bool TryAddTupleToOutput(IntermediateTuple tuple, Output output); + + /// + /// Called after all output changes occur and right before the output is bound into its final format. + /// + void PostBackendBind(BindResult result, Pdb wixpdb); + } +} diff --git a/src/WixToolset.Extensibility/IWindowsInstallerBackendExtension.cs b/src/WixToolset.Extensibility/IWindowsInstallerBackendExtension.cs deleted file mode 100644 index bc251bb2..00000000 --- a/src/WixToolset.Extensibility/IWindowsInstallerBackendExtension.cs +++ /dev/null @@ -1,33 +0,0 @@ -// 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. - -namespace WixToolset.Extensibility -{ - using System.Collections.Generic; - using WixToolset.Data; - using WixToolset.Data.Bind; - using WixToolset.Data.Tuples; - using WixToolset.Data.WindowsInstaller; - using WixToolset.Extensibility.Data; - - /// - /// Interface all binder extensions implement. - /// - public interface IWindowsInstallerBackendExtension - { - /// - /// Called before binding occurs. - /// - void PreBackendBind(IBindContext context); - - ResolvedCabinet ResolveCabinet(string cabinetPath, IEnumerable files); - - string ResolveMedia(MediaTuple mediaRow, string mediaLayoutDirectory, string layoutDirectory); - - bool TryAddTupleToOutput(IntermediateTuple tuple, Output output); - - /// - /// Called after all output changes occur and right before the output is bound into its final format. - /// - void PostBackendBind(BindResult result, Pdb wixpdb); - } -} -- cgit v1.2.3-55-g6feb From 41e60175f6db63cb988a9340c950c224dc472814 Mon Sep 17 00:00:00 2001 From: Rob Mensching Date: Wed, 24 Oct 2018 20:56:32 -0700 Subject: Re-introduce "decompile" to backend --- .../Data/DecompileResult.cs | 13 +++++ .../Data/IDecompileContext.cs | 55 ++++++++++++++++++++++ .../DecompilerConstants.cs | 4 +- src/WixToolset.Extensibility/IBackend.cs | 4 +- .../IDecompilerExtension.cs | 37 +++------------ .../IWindowsInstallerBackendDecompilerExtension.cs | 43 +++++++++++++++++ 6 files changed, 121 insertions(+), 35 deletions(-) create mode 100644 src/WixToolset.Extensibility/Data/DecompileResult.cs create mode 100644 src/WixToolset.Extensibility/Data/IDecompileContext.cs create mode 100644 src/WixToolset.Extensibility/IWindowsInstallerBackendDecompilerExtension.cs diff --git a/src/WixToolset.Extensibility/Data/DecompileResult.cs b/src/WixToolset.Extensibility/Data/DecompileResult.cs new file mode 100644 index 00000000..29da4887 --- /dev/null +++ b/src/WixToolset.Extensibility/Data/DecompileResult.cs @@ -0,0 +1,13 @@ +// 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. + +namespace WixToolset.Extensibility.Data +{ + using System.Collections.Generic; + + public class DecompileResult + { + public string SourceDocumentPath { get; set; } + + public IEnumerable ExtractedFilePaths { get; set; } + } +} diff --git a/src/WixToolset.Extensibility/Data/IDecompileContext.cs b/src/WixToolset.Extensibility/Data/IDecompileContext.cs new file mode 100644 index 00000000..fb846878 --- /dev/null +++ b/src/WixToolset.Extensibility/Data/IDecompileContext.cs @@ -0,0 +1,55 @@ +// 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. + +namespace WixToolset.Extensibility.Data +{ + using System; + using System.Collections.Generic; + using WixToolset.Data; + + public interface IDecompileContext + { + IServiceProvider ServiceProvider { get; } + + string DecompilePath { get; set; } + + OutputType DecompileType { get; set; } + + IEnumerable Extensions { get; set; } + + string ExtractFolder { get; set; } + + /// + /// Optional gets or sets the base path for the File/@Source. + /// + /// Default value is "SourceDir" to enable use of BindPaths. + string BaseSourcePath { get; set; } + + string IntermediateFolder { get; set; } + + bool IsAdminImage { get; set; } + + string OutputPath { get; set; } + + /// + /// Gets or sets the option to suppress custom tables. + /// + bool SuppressCustomTables { get; set; } + + /// + /// Gets or sets the option to suppress dropping empty tables. + /// + bool SuppressDroppingEmptyTables { get; set; } + + bool SuppressExtractCabinets { get; set; } + + /// + /// Gets or sets the option to suppress decompiling UI-related tables. + /// + bool SuppressUI { get; set; } + + /// + /// Gets or sets whether the decompiler should use module logic on a product output. + /// + bool TreatProductAsModule { get; set; } + } +} diff --git a/src/WixToolset.Extensibility/DecompilerConstants.cs b/src/WixToolset.Extensibility/DecompilerConstants.cs index 58742182..8cd6b19c 100644 --- a/src/WixToolset.Extensibility/DecompilerConstants.cs +++ b/src/WixToolset.Extensibility/DecompilerConstants.cs @@ -1,9 +1,7 @@ // 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. -namespace WixToolset +namespace WixToolset.Extensibility { - using System; - /// /// Constants used by decompiler. /// diff --git a/src/WixToolset.Extensibility/IBackend.cs b/src/WixToolset.Extensibility/IBackend.cs index 80f885c3..df693561 100644 --- a/src/WixToolset.Extensibility/IBackend.cs +++ b/src/WixToolset.Extensibility/IBackend.cs @@ -1,4 +1,4 @@ -// 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. +// 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. namespace WixToolset.Extensibility { @@ -9,6 +9,8 @@ namespace WixToolset.Extensibility { BindResult Bind(IBindContext context); + DecompileResult Decompile(IDecompileContext context); + Intermediate Unbind(IUnbindContext context); bool Inscribe(IInscribeContext context); diff --git a/src/WixToolset.Extensibility/IDecompilerExtension.cs b/src/WixToolset.Extensibility/IDecompilerExtension.cs index e2b80089..9ea4290b 100644 --- a/src/WixToolset.Extensibility/IDecompilerExtension.cs +++ b/src/WixToolset.Extensibility/IDecompilerExtension.cs @@ -2,46 +2,21 @@ namespace WixToolset.Extensibility { + using WixToolset.Extensibility.Data; + /// /// Base class for creating a decompiler extension. /// public interface IDecompilerExtension { /// - /// Gets or sets the decompiler core for the extension. - /// - /// The decompiler core for the extension. - IDecompilerCore Core { get; set; } - - /// - /// Gets the table definitions this extension decompiles. - /// - /// Table definitions this extension decompiles. - //TableDefinitionCollection TableDefinitions { get; } - - /// - /// Gets the library that this decompiler wants removed from the decomipiled output. - /// - /// The table definitions to use while loading the library. - /// The library for this extension or null if there is no library to be removed. - //Library GetLibraryToRemove(TableDefinitionCollection tableDefinitions); - - /// - /// Called at the beginning of the decompilation of a database. - /// - /// The collection of all tables. - //void Initialize(TableIndexedCollection tables); - - /// - /// Decompiles an extension table. + /// Called before decompiling occurs. /// - /// The table to decompile. - //void DecompileTable(Table table); + void PreDecompile(IDecompileContext context); /// - /// Finalize decompilation. + /// Called after all decompiling occurs. /// - /// The collection of all tables. - //void Finish(TableIndexedCollection tables); + void PostDecompile(DecompileResult result); } } diff --git a/src/WixToolset.Extensibility/IWindowsInstallerBackendDecompilerExtension.cs b/src/WixToolset.Extensibility/IWindowsInstallerBackendDecompilerExtension.cs new file mode 100644 index 00000000..05899c1f --- /dev/null +++ b/src/WixToolset.Extensibility/IWindowsInstallerBackendDecompilerExtension.cs @@ -0,0 +1,43 @@ +// 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. + +namespace WixToolset.Extensibility +{ + using WixToolset.Data; + using WixToolset.Data.WindowsInstaller; + using WixToolset.Extensibility.Data; + + /// + /// Interface all binder extensions implement. + /// + public interface IWindowsInstallerBackendDecompilerExtension + { + /// + /// Called before decompiling occurs. + /// + void PreBackendDecompile(IDecompileContext context); + + /// + /// Gets the table definitions this extension decompiles. + /// + /// Table definitions this extension decompiles. + TableDefinitionCollection TableDefinitions { get; } + + /// + /// Gets the library that this decompiler wants removed from the decomipiled output. + /// + /// The table definitions to use while loading the library. + /// The library for this extension or null if there is no library to be removed. + Library GetLibraryToRemove(TableDefinitionCollection tableDefinitions); + + /// + /// Decompiles an extension table. + /// + /// The table to decompile. + void DecompileTable(Table table); + + /// + /// Called after all output changes occur and right before the output is bound into its final format. + /// + void PostBackendDecompile(DecompileResult result); + } +} -- cgit v1.2.3-55-g6feb From e6e1f9293ee1a2f19b84bd61c5a341ee29dca1c1 Mon Sep 17 00:00:00 2001 From: Rob Mensching Date: Wed, 24 Oct 2018 20:57:22 -0700 Subject: Remove unused IBindContext from IBackendFactory and other small fixes --- src/WixToolset.Extensibility/Data/ILayoutContext.cs | 2 ++ src/WixToolset.Extensibility/Data/IPreprocessContext.cs | 4 ++-- src/WixToolset.Extensibility/IBackendFactory.cs | 4 +--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/WixToolset.Extensibility/Data/ILayoutContext.cs b/src/WixToolset.Extensibility/Data/ILayoutContext.cs index 89aadc4d..5c0a46c7 100644 --- a/src/WixToolset.Extensibility/Data/ILayoutContext.cs +++ b/src/WixToolset.Extensibility/Data/ILayoutContext.cs @@ -19,6 +19,8 @@ namespace WixToolset.Extensibility.Data string OutputsFile { get; set; } + string IntermediateFolder { get; set; } + string BuiltOutputsFile { get; set; } bool SuppressAclReset { get; set; } diff --git a/src/WixToolset.Extensibility/Data/IPreprocessContext.cs b/src/WixToolset.Extensibility/Data/IPreprocessContext.cs index a923c4db..42dfbb75 100644 --- a/src/WixToolset.Extensibility/Data/IPreprocessContext.cs +++ b/src/WixToolset.Extensibility/Data/IPreprocessContext.cs @@ -12,7 +12,7 @@ namespace WixToolset.Extensibility.Data IEnumerable Extensions { get; set; } - IList IncludeSearchPaths { get; set; } + IEnumerable IncludeSearchPaths { get; set; } /// /// Gets the platform which the compiler will use when defaulting 64-bit attributes and elements. @@ -20,7 +20,7 @@ namespace WixToolset.Extensibility.Data /// The platform which the compiler will use when defaulting 64-bit attributes and elements. Platform Platform { get; set; } - string SourceFile { get; set; } + string SourcePath { get; set; } IDictionary Variables { get; set; } diff --git a/src/WixToolset.Extensibility/IBackendFactory.cs b/src/WixToolset.Extensibility/IBackendFactory.cs index 02f0809a..1155e9b6 100644 --- a/src/WixToolset.Extensibility/IBackendFactory.cs +++ b/src/WixToolset.Extensibility/IBackendFactory.cs @@ -2,10 +2,8 @@ namespace WixToolset.Extensibility { - using WixToolset.Extensibility.Data; - public interface IBackendFactory { - bool TryCreateBackend(string outputType, string outputPath, IBindContext context, out IBackend backend); + bool TryCreateBackend(string outputType, string outputPath, out IBackend backend); } } -- cgit v1.2.3-55-g6feb From 13ea8f9e17f0bae1158b4a0f3c37e995e9816027 Mon Sep 17 00:00:00 2001 From: Rob Mensching Date: Fri, 2 Nov 2018 23:14:13 -0700 Subject: Add BaseLinkerExtension Fixes wixtoolset/issues#5895 --- .../BaseLinkerExtension.cs | 41 ++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 src/WixToolset.Extensibility/BaseLinkerExtension.cs diff --git a/src/WixToolset.Extensibility/BaseLinkerExtension.cs b/src/WixToolset.Extensibility/BaseLinkerExtension.cs new file mode 100644 index 00000000..91aefc2f --- /dev/null +++ b/src/WixToolset.Extensibility/BaseLinkerExtension.cs @@ -0,0 +1,41 @@ +// 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. + +namespace WixToolset.Extensibility +{ + using WixToolset.Data; + using WixToolset.Extensibility.Data; + using WixToolset.Extensibility.Services; + + /// + /// Base class for creating a linker extension. + /// + public abstract class BaseLinkerExtension : ILinkerExtension + { + /// + /// Context for use by the extension. + /// + protected ILinkContext Context { get; private set; } + + /// + /// Messaging for use by the extension. + /// + protected IMessaging Messaging { get; private set; } + + /// + /// Called at the beginning of the linking. + /// + public virtual void PreLink(ILinkContext context) + { + this.Context = context; + + this.Messaging = context.ServiceProvider.GetService(); + } + + /// + /// Called at the end of the linking. + /// + public virtual void PostLink(Intermediate intermediate) + { + } + } +} -- cgit v1.2.3-55-g6feb From 342fd42e7c6009e5d50a8a0a436d4ee4319ed3be Mon Sep 17 00:00:00 2001 From: Rob Mensching Date: Fri, 2 Nov 2018 23:40:47 -0700 Subject: Change DecompileResult document path to XDocument Fixes wixtoolset/issues#5896 --- .../Data/DecompileResult.cs | 3 +- src/WixToolset.Extensibility/IDecompilerCore.cs | 73 ---------------------- 2 files changed, 2 insertions(+), 74 deletions(-) delete mode 100644 src/WixToolset.Extensibility/IDecompilerCore.cs diff --git a/src/WixToolset.Extensibility/Data/DecompileResult.cs b/src/WixToolset.Extensibility/Data/DecompileResult.cs index 29da4887..27706b2c 100644 --- a/src/WixToolset.Extensibility/Data/DecompileResult.cs +++ b/src/WixToolset.Extensibility/Data/DecompileResult.cs @@ -3,10 +3,11 @@ namespace WixToolset.Extensibility.Data { using System.Collections.Generic; + using System.Xml.Linq; public class DecompileResult { - public string SourceDocumentPath { get; set; } + public XDocument Document { get; set; } public IEnumerable ExtractedFilePaths { get; set; } } diff --git a/src/WixToolset.Extensibility/IDecompilerCore.cs b/src/WixToolset.Extensibility/IDecompilerCore.cs deleted file mode 100644 index 2133829a..00000000 --- a/src/WixToolset.Extensibility/IDecompilerCore.cs +++ /dev/null @@ -1,73 +0,0 @@ -// 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. - -namespace WixToolset.Extensibility -{ - using System; - using WixToolset.Data; - using Wix = WixToolset.Data.Serialize; - - public interface IDecompilerCore - { - - /// - /// Gets whether the decompiler core encountered an error while processing. - /// - /// Flag if core encountered an error during processing. - bool EncounteredError { get; } - - /// - /// Gets the root element of the decompiled output. - /// - /// The root element of the decompiled output. - Wix.IParentElement RootElement { get; } - - /// - /// Gets the UI element. - /// - /// The UI element. - Wix.UI UIElement { get; } - - /// - /// Verifies if a filename is a valid short filename. - /// - /// Filename to verify. - /// true if wildcards are allowed in the filename. - /// True if the filename is a valid short filename - bool IsValidShortFilename(string filename, bool allowWildcards); - - /// - /// Convert an Int32 into a DateTime. - /// - /// The Int32 value. - /// The DateTime. - DateTime ConvertIntegerToDateTime(int value); - - /// - /// Gets the element corresponding to the row it came from. - /// - /// The row corresponding to the element. - /// The indexed element. - Wix.ISchemaElement GetIndexedElement(IntermediateTuple row); - - /// - /// Gets the element corresponding to the primary key of the given table. - /// - /// The table corresponding to the element. - /// The primary key corresponding to the element. - /// The indexed element. - Wix.ISchemaElement GetIndexedElement(string table, params string[] primaryKey); - - /// - /// Index an element by its corresponding row. - /// - /// The row corresponding to the element. - /// The element to index. - void IndexElement(IntermediateTuple row, Wix.ISchemaElement element); - - /// - /// Indicates the decompiler encountered and unexpected table to decompile. - /// - /// Unknown decompiled table. - void UnexpectedTable(string table); -} -} -- cgit v1.2.3-55-g6feb From 25ccd23ebc269a223470f4c12b786271235d5f23 Mon Sep 17 00:00:00 2001 From: Bob Arnson Date: Fri, 7 Dec 2018 20:47:13 -0500 Subject: Let caller specify directory for files extracted by decompiler. --- src/WixToolset.Extensibility/Data/IDecompileContext.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/WixToolset.Extensibility/Data/IDecompileContext.cs b/src/WixToolset.Extensibility/Data/IDecompileContext.cs index fb846878..f61fd84a 100644 --- a/src/WixToolset.Extensibility/Data/IDecompileContext.cs +++ b/src/WixToolset.Extensibility/Data/IDecompileContext.cs @@ -18,6 +18,8 @@ namespace WixToolset.Extensibility.Data string ExtractFolder { get; set; } + string CabinetExtractFolder { get; set; } + /// /// Optional gets or sets the base path for the File/@Source. /// -- cgit v1.2.3-55-g6feb From 7dc73cf5d633e0c817c211022e28d31d25a187d9 Mon Sep 17 00:00:00 2001 From: Rob Mensching Date: Sat, 22 Dec 2018 08:16:06 -0800 Subject: Integrate SmartPackageReference --- src/Directory.Build.props | 6 +-- src/Directory.Build.targets | 43 ++++++++++++++++++++++ .../WixToolset.Extensibility.csproj | 3 +- 3 files changed, 45 insertions(+), 7 deletions(-) create mode 100644 src/Directory.Build.targets diff --git a/src/Directory.Build.props b/src/Directory.Build.props index 9eacf3f5..35ef739b 100644 --- a/src/Directory.Build.props +++ b/src/Directory.Build.props @@ -10,7 +10,7 @@ false $(MSBuildProjectName) - $(MSBuildThisFileDirectory)..\build\ + $([System.IO.Path]::GetFullPath($(MSBuildThisFileDirectory)..\build\)) $(BaseOutputPath)obj\$(ProjectName)\ $(BaseOutputPath)$(Configuration)\ @@ -20,10 +20,6 @@ WiX Toolset - - $(MSBuildThisFileDirectory)..\..\ - - diff --git a/src/Directory.Build.targets b/src/Directory.Build.targets new file mode 100644 index 00000000..48629385 --- /dev/null +++ b/src/Directory.Build.targets @@ -0,0 +1,43 @@ + + + + + true + $(SolutionPath) + $(NCrunchOriginalSolutionPath) + + + + + + + $([System.IO.File]::ReadAllText($(TheSolutionPath))) + $([System.IO.Path]::GetDirectoryName( $(TheSolutionPath) )) + (?<="[PackageName]", ")(.*)(?=", ") + + + + + + %(Identity) + $(SolutionFileContent.Contains('\%(Identity).csproj')) + + + + + $(RegexPattern.Replace('[PackageName]','%(PackageName)') ) + $([System.Text.RegularExpressions.Regex]::Match('$(SolutionFileContent)', '%(Pattern)')) + + + + + + + + + + + diff --git a/src/WixToolset.Extensibility/WixToolset.Extensibility.csproj b/src/WixToolset.Extensibility/WixToolset.Extensibility.csproj index 31de1095..31d5ca87 100644 --- a/src/WixToolset.Extensibility/WixToolset.Extensibility.csproj +++ b/src/WixToolset.Extensibility/WixToolset.Extensibility.csproj @@ -11,8 +11,7 @@ - - + -- cgit v1.2.3-55-g6feb From 3535986732926f81dbf026a02d7099887a285411 Mon Sep 17 00:00:00 2001 From: Rob Mensching Date: Sat, 22 Dec 2018 08:59:00 -0800 Subject: Update to latest Home\repo-template --- .editorconfig | 3 +++ appveyor.yml | 6 ++++++ src/Directory.Build.props | 2 +- src/Directory.Build.targets | 5 +++++ 4 files changed, 15 insertions(+), 1 deletion(-) diff --git a/.editorconfig b/.editorconfig index 2ebba4b3..1d72e683 100644 --- a/.editorconfig +++ b/.editorconfig @@ -1,4 +1,7 @@ # 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. +# +# Do NOT modify this file. Update the canonical version in Home\repo-template\src\.editorconfig +# then update all of the repos. root = true diff --git a/appveyor.yml b/appveyor.yml index 0c74d54b..d55322da 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,3 +1,8 @@ +# 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. +# +# Do NOT modify this file. Update the canonical version in Home\repo-template\src\appveyor.yml +# then update all of the repos. + image: Visual Studio 2017 version: 0.0.0.{build} @@ -17,6 +22,7 @@ pull_requests: nuget: disable_publish_on_pr: true +skip_branch_with_pr: true skip_tags: true artifacts: diff --git a/src/Directory.Build.props b/src/Directory.Build.props index 35ef739b..f09c622b 100644 --- a/src/Directory.Build.props +++ b/src/Directory.Build.props @@ -1,7 +1,7 @@ diff --git a/src/Directory.Build.targets b/src/Directory.Build.targets index 48629385..dac7452a 100644 --- a/src/Directory.Build.targets +++ b/src/Directory.Build.targets @@ -1,4 +1,9 @@ + + + + + + true + $([System.IO.Path]::GetFullPath($(MSBuildThisFileDirectory)wix.snk)) + + diff --git a/src/Directory.Build.props b/src/Directory.Build.props index e853e22d..f83cc154 100644 --- a/src/Directory.Build.props +++ b/src/Directory.Build.props @@ -8,6 +8,7 @@ Debug false + MSB3246 $(MSBuildProjectName) $([System.IO.Path]::GetFullPath($(MSBuildThisFileDirectory)..\build\)) @@ -21,6 +22,8 @@ WiX Toolset - + + + diff --git a/src/wix.snk b/src/wix.snk new file mode 100644 index 00000000..3908a66a Binary files /dev/null and b/src/wix.snk differ -- cgit v1.2.3-55-g6feb From a2190dc48f997093e6b065d9ea9ad69b0b0eb8e7 Mon Sep 17 00:00:00 2001 From: Bob Arnson Date: Thu, 29 Oct 2020 19:18:11 -0400 Subject: One shiny NuGet package, please and thank you. --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 003acd4d..e7464013 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,3 @@ # Extensibility WixToolset.Extensibility - interfaces to extend the WiX Toolset + -- cgit v1.2.3-55-g6feb From 6233eed38f211f883c5cfcacebd6102d436febd4 Mon Sep 17 00:00:00 2001 From: Sean Hall Date: Wed, 2 Dec 2020 12:11:28 -0600 Subject: Update NBGV. --- src/WixToolset.Extensibility/WixToolset.Extensibility.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/WixToolset.Extensibility/WixToolset.Extensibility.csproj b/src/WixToolset.Extensibility/WixToolset.Extensibility.csproj index 44a2243c..9fa4f12e 100644 --- a/src/WixToolset.Extensibility/WixToolset.Extensibility.csproj +++ b/src/WixToolset.Extensibility/WixToolset.Extensibility.csproj @@ -17,6 +17,6 @@ - + -- cgit v1.2.3-55-g6feb From 950ccc8fc44cc67f1b3b37e27a34eb30d1cdfa98 Mon Sep 17 00:00:00 2001 From: Sean Hall Date: Mon, 14 Dec 2020 14:41:41 -0600 Subject: Enable CheckForOverflowUnderflow. --- src/CSharp.Build.props | 1 + 1 file changed, 1 insertion(+) diff --git a/src/CSharp.Build.props b/src/CSharp.Build.props index b12f4c6e..bcd47a0c 100644 --- a/src/CSharp.Build.props +++ b/src/CSharp.Build.props @@ -5,6 +5,7 @@ --> + true true $([System.IO.Path]::GetFullPath($(MSBuildThisFileDirectory)wix.snk)) -- cgit v1.2.3-55-g6feb From 8e08acb229ade411b7418df63b14198220aaaaa7 Mon Sep 17 00:00:00 2001 From: Sean Hall Date: Wed, 16 Dec 2020 18:01:23 -0600 Subject: Add GetCanonicalRelativePath. --- src/WixToolset.Extensibility/Services/IBackendHelper.cs | 11 +++++++++++ src/WixToolset.Extensibility/Services/IParseHelper.cs | 11 +++++++++++ 2 files changed, 22 insertions(+) diff --git a/src/WixToolset.Extensibility/Services/IBackendHelper.cs b/src/WixToolset.Extensibility/Services/IBackendHelper.cs index 26023674..bfec5256 100644 --- a/src/WixToolset.Extensibility/Services/IBackendHelper.cs +++ b/src/WixToolset.Extensibility/Services/IBackendHelper.cs @@ -35,6 +35,17 @@ namespace WixToolset.Extensibility.Services /// Resolved directory. IResolvedDirectory CreateResolvedDirectory(string directoryParent, string name); + /// + /// Validates path is relative and canonicalizes it. + /// For example, "a\..\c\.\d.exe" => "c\d.exe". + /// + /// + /// + /// + /// + /// The original value if not relative, otherwise the canonicalized relative path. + string GetCanonicalRelativePath(SourceLineNumber sourceLineNumbers, string elementName, string attributeName, string relativePath); + /// /// Creates a tracked file. /// diff --git a/src/WixToolset.Extensibility/Services/IParseHelper.cs b/src/WixToolset.Extensibility/Services/IParseHelper.cs index a7c5eb1b..08bcd911 100644 --- a/src/WixToolset.Extensibility/Services/IParseHelper.cs +++ b/src/WixToolset.Extensibility/Services/IParseHelper.cs @@ -340,6 +340,17 @@ namespace WixToolset.Extensibility.Services /// The attribute's YesNoType value. YesNoDefaultType GetAttributeYesNoDefaultValue(SourceLineNumber sourceLineNumbers, XAttribute attribute); + /// + /// Validates path is relative and canonicalizes it. + /// For example, "a\..\c\.\d.exe" => "c\d.exe". + /// + /// + /// + /// + /// + /// The original value if not relative, otherwise the canonicalized relative path. + string GetCanonicalRelativePath(SourceLineNumber sourceLineNumbers, string elementName, string attributeName, string relativePath); + /// /// Gets a source line number for an element. /// -- cgit v1.2.3-55-g6feb From f1b37c3a4d620298f8c646ac0a308a6fae1b662d Mon Sep 17 00:00:00 2001 From: Sean Hall Date: Fri, 18 Dec 2020 20:09:31 -0600 Subject: Enable XML doc and delete obsolete IParseHelper methods. --- src/CSharp.Build.props | 1 + src/Directory.Build.targets | 8 +++++ .../BaseBurnBackendExtension.cs | 42 ++++++++++++++++++++++ .../BaseCompilerExtension.cs | 16 ++------- .../BaseExtensionCommandLine.cs | 18 ++++++++++ src/WixToolset.Extensibility/BaseExtensionData.cs | 9 +++++ .../BaseExtensionFactory.cs | 6 ++++ .../BaseLayoutExtension.cs | 12 +++++++ .../BasePreprocessorExtension.cs | 1 - .../BaseResolverExtension.cs | 8 +++++ .../BaseWindowsInstallerBackendBinderExtension.cs | 15 ++++++++ src/WixToolset.Extensibility/CompilerConstants.cs | 23 ++++++++++++ src/WixToolset.Extensibility/Data/BindStage.cs | 3 ++ .../Data/ExtensionCommandLineSwitch.cs | 8 ++++- src/WixToolset.Extensibility/Data/IBindContext.cs | 1 + .../Data/IBindFileWithPath.cs | 1 + src/WixToolset.Extensibility/Data/IBindPath.cs | 3 ++ src/WixToolset.Extensibility/Data/IBindResult.cs | 1 + .../Data/ICommandLineArguments.cs | 1 + .../Data/ICommandLineContext.cs | 1 + .../Data/ICompileContext.cs | 1 + .../Data/IComponentKeyPath.cs | 1 + .../Data/IDecompileContext.cs | 1 + .../Data/IDecompileResult.cs | 1 + src/WixToolset.Extensibility/Data/IDelayedField.cs | 1 + .../Data/IExpectedExtractFile.cs | 1 + .../Data/IFileSystemContext.cs | 1 + src/WixToolset.Extensibility/Data/IIncludedFile.cs | 3 ++ .../Data/IInscribeContext.cs | 1 + .../Data/ILayoutContext.cs | 1 + .../Data/ILibraryContext.cs | 1 + src/WixToolset.Extensibility/Data/ILinkContext.cs | 1 + .../Data/IPreprocessContext.cs | 1 + .../Data/IPreprocessResult.cs | 1 + .../Data/IResolveContext.cs | 1 + .../Data/IResolveFileResult.cs | 1 + .../Data/IResolveResult.cs | 1 + .../Data/IResolvedCabinet.cs | 1 + .../Data/IUnbindContext.cs | 1 + .../Data/PossibleKeyPathType.cs | 3 ++ .../Data/TrackedFileType.cs | 5 ++- .../DecompilerConstants.cs | 7 ++++ src/WixToolset.Extensibility/IBackend.cs | 1 + src/WixToolset.Extensibility/IBackendFactory.cs | 3 +- .../IBurnBackendExtension.cs | 21 +++++++++++ src/WixToolset.Extensibility/ICompilerExtension.cs | 8 ++++- .../IExtensionCommandLine.cs | 3 +- .../IFileSystemExtension.cs | 1 + .../IInspectorExtension.cs | 11 +++--- src/WixToolset.Extensibility/ILayoutExtension.cs | 2 ++ .../ILibrarianExtension.cs | 1 + src/WixToolset.Extensibility/IMessageListener.cs | 1 + .../IPreprocessorExtension.cs | 1 - .../IWindowsInstallerBackendBinderExtension.cs | 4 +++ .../Services/IBackendHelper.cs | 1 + .../Services/ICommandLineParser.cs | 1 + .../Services/IParseHelper.cs | 42 ++++++++++++---------- .../Services/IPathResolver.cs | 5 ++- .../Services/IPreprocessHelper.cs | 4 +-- .../Services/IVariableResolution.cs | 1 + .../Services/IVariableResolver.cs | 3 ++ .../Services/IWindowsInstallerBackendHelper.cs | 19 ++++++++++ .../Services/IWixtoolsetCoreServiceProvider.cs | 1 - .../WixToolset.Extensibility.csproj | 1 + 64 files changed, 300 insertions(+), 49 deletions(-) diff --git a/src/CSharp.Build.props b/src/CSharp.Build.props index bcd47a0c..81d24ad1 100644 --- a/src/CSharp.Build.props +++ b/src/CSharp.Build.props @@ -8,5 +8,6 @@ true true $([System.IO.Path]::GetFullPath($(MSBuildThisFileDirectory)wix.snk)) + false diff --git a/src/Directory.Build.targets b/src/Directory.Build.targets index dac7452a..cb988931 100644 --- a/src/Directory.Build.targets +++ b/src/Directory.Build.targets @@ -9,6 +9,11 @@ See the original here: https://github.com/dotnet/sdk/issues/1151#issuecomment-385133284 --> + + false + $(OutputPath)\$(AssemblyName).xml + + true $(SolutionPath) @@ -45,4 +50,7 @@ + + + diff --git a/src/WixToolset.Extensibility/BaseBurnBackendExtension.cs b/src/WixToolset.Extensibility/BaseBurnBackendExtension.cs index 99bf5e71..0575d725 100644 --- a/src/WixToolset.Extensibility/BaseBurnBackendExtension.cs +++ b/src/WixToolset.Extensibility/BaseBurnBackendExtension.cs @@ -9,6 +9,9 @@ namespace WixToolset.Extensibility using WixToolset.Extensibility.Data; using WixToolset.Extensibility.Services; + /// + /// Base class for creating a Burn backend extension. + /// public abstract class BaseBurnBackendExtension : IBurnBackendExtension { /// @@ -31,14 +34,25 @@ namespace WixToolset.Extensibility /// protected virtual IEnumerable SymbolDefinitions => Enumerable.Empty(); + /// + /// Called after all output changes occur and right before the output is bound into its final format. + /// public virtual void BundleFinalize() { } + /// + /// Called after output is bound into its final format. + /// + /// public virtual void PostBackendBind(IBindResult result) { } + /// + /// Called before binding occurs. + /// + /// public virtual void PreBackendBind(IBindContext context) { this.Context = context; @@ -46,16 +60,44 @@ namespace WixToolset.Extensibility this.BackendHelper = context.ServiceProvider.GetService(); } + /// + /// + /// + /// + /// + /// + /// + /// + /// public virtual IResolveFileResult ResolveRelatedFile(string source, string relatedSource, string type, SourceLineNumber sourceLineNumbers, BindStage bindStage) { return null; } + /// + /// + /// + /// + /// + /// + /// + /// + /// public virtual string ResolveUrl(string url, string fallbackUrl, string packageId, string payloadId, string fileName) { return null; } + /// + /// Called for each extension symbol that hasn't been handled yet. + /// Use IBurnBackendHelper to add data to the appropriate data manifest. + /// + /// The linked section. + /// The current symbol. + /// + /// True if the extension handled the symbol, false otherwise. + /// The Burn backend will warn on all unhandled symbols. + /// public virtual bool TryAddSymbolToDataManifest(IntermediateSection section, IntermediateSymbol symbol) { if (this.SymbolDefinitions.Any(t => t == symbol.Definition) && diff --git a/src/WixToolset.Extensibility/BaseCompilerExtension.cs b/src/WixToolset.Extensibility/BaseCompilerExtension.cs index 51fbcd0b..2eac3706 100644 --- a/src/WixToolset.Extensibility/BaseCompilerExtension.cs +++ b/src/WixToolset.Extensibility/BaseCompilerExtension.cs @@ -52,34 +52,24 @@ namespace WixToolset.Extensibility } /// - /// Processes an attribute for the Compiler. + /// See /// - /// Parent element of attribute. - /// Attribute to process. - /// Extra information about the context in which this element is being parsed. public virtual void ParseAttribute(Intermediate intermediate, IntermediateSection section, XElement parentElement, XAttribute attribute, IDictionary context) { this.ParseHelper.UnexpectedAttribute(parentElement, attribute); } /// - /// Processes an element for the Compiler. + /// See /// - /// Parent element of element to process. - /// Element to process. - /// Extra information about the context in which this element is being parsed. public virtual void ParseElement(Intermediate intermediate, IntermediateSection section, XElement parentElement, XElement element, IDictionary context) { this.ParseHelper.UnexpectedElement(parentElement, element); } /// - /// Processes an element for the Compiler, with the ability to supply a component keypath. + /// See /// - /// Parent element of element to process. - /// Element to process. - /// Explicit key path. - /// Extra information about the context in which this element is being parsed. public virtual IComponentKeyPath ParsePossibleKeyPathElement(Intermediate intermediate, IntermediateSection section, XElement parentElement, XElement element, IDictionary context) { this.ParseElement(intermediate, section, parentElement, element, context); diff --git a/src/WixToolset.Extensibility/BaseExtensionCommandLine.cs b/src/WixToolset.Extensibility/BaseExtensionCommandLine.cs index 5f2ca109..8a336e1b 100644 --- a/src/WixToolset.Extensibility/BaseExtensionCommandLine.cs +++ b/src/WixToolset.Extensibility/BaseExtensionCommandLine.cs @@ -7,23 +7,41 @@ namespace WixToolset.Extensibility using WixToolset.Extensibility.Data; using WixToolset.Extensibility.Services; + /// + /// Base class for extensions to be able to parse the command-line. + /// public abstract class BaseExtensionCommandLine : IExtensionCommandLine { + /// + /// See + /// public virtual IEnumerable CommandLineSwitches => Enumerable.Empty(); + /// + /// See + /// public virtual void PostParse() { } + /// + /// See + /// public virtual void PreParse(ICommandLineContext context) { } + /// + /// See + /// public virtual bool TryParseArgument(ICommandLineParser parser, string argument) { return false; } + /// + /// See + /// public virtual bool TryParseCommand(ICommandLineParser parser, string argument, out ICommandLineCommand command) { command = null; diff --git a/src/WixToolset.Extensibility/BaseExtensionData.cs b/src/WixToolset.Extensibility/BaseExtensionData.cs index 597a8e4d..e4a10fd9 100644 --- a/src/WixToolset.Extensibility/BaseExtensionData.cs +++ b/src/WixToolset.Extensibility/BaseExtensionData.cs @@ -9,13 +9,22 @@ namespace WixToolset.Extensibility /// public abstract class BaseExtensionData : IExtensionData { + /// + /// See + /// public virtual string DefaultCulture => null; + /// + /// See + /// public virtual Intermediate GetLibrary(ISymbolDefinitionCreator symbolDefinitions) { return null; } + /// + /// See + /// public virtual bool TryGetSymbolDefinitionByName(string name, out IntermediateSymbolDefinition symbolDefinition) { symbolDefinition = null; diff --git a/src/WixToolset.Extensibility/BaseExtensionFactory.cs b/src/WixToolset.Extensibility/BaseExtensionFactory.cs index d0686b46..2e21b51b 100644 --- a/src/WixToolset.Extensibility/BaseExtensionFactory.cs +++ b/src/WixToolset.Extensibility/BaseExtensionFactory.cs @@ -12,8 +12,14 @@ namespace WixToolset.Extensibility /// public abstract class BaseExtensionFactory : IExtensionFactory { + /// + /// The extension types of the WiX extension. + /// protected abstract IEnumerable ExtensionTypes { get; } + /// + /// See + /// public virtual bool TryCreateExtension(Type extensionType, out object extension) { extension = null; diff --git a/src/WixToolset.Extensibility/BaseLayoutExtension.cs b/src/WixToolset.Extensibility/BaseLayoutExtension.cs index 78ec8d0a..21b932ff 100644 --- a/src/WixToolset.Extensibility/BaseLayoutExtension.cs +++ b/src/WixToolset.Extensibility/BaseLayoutExtension.cs @@ -30,11 +30,23 @@ namespace WixToolset.Extensibility this.Messaging = context.ServiceProvider.GetService(); } + /// + /// See + /// + /// + /// + /// public virtual bool CopyFile(string source, string destination) { return false; } + /// + /// See + /// + /// + /// + /// public virtual bool MoveFile(string source, string destination) { return false; diff --git a/src/WixToolset.Extensibility/BasePreprocessorExtension.cs b/src/WixToolset.Extensibility/BasePreprocessorExtension.cs index cfacf97a..b9a856ec 100644 --- a/src/WixToolset.Extensibility/BasePreprocessorExtension.cs +++ b/src/WixToolset.Extensibility/BasePreprocessorExtension.cs @@ -70,7 +70,6 @@ namespace WixToolset.Extensibility /// /// Processes a pragma defined in the extension. /// - /// The location of this pragma's PI. /// The prefix of the pragma to be processed by the extension. /// The name of the pragma. /// The pragma's arguments. diff --git a/src/WixToolset.Extensibility/BaseResolverExtension.cs b/src/WixToolset.Extensibility/BaseResolverExtension.cs index ede903d5..72dc5c41 100644 --- a/src/WixToolset.Extensibility/BaseResolverExtension.cs +++ b/src/WixToolset.Extensibility/BaseResolverExtension.cs @@ -36,6 +36,14 @@ namespace WixToolset.Extensibility this.Messaging = context.ServiceProvider.GetService(); } + /// + /// See + /// + /// + /// + /// + /// + /// public virtual IResolveFileResult ResolveFile(string source, IntermediateSymbolDefinition symbolDefinition, SourceLineNumber sourceLineNumbers, BindStage bindStage) { return null; diff --git a/src/WixToolset.Extensibility/BaseWindowsInstallerBackendBinderExtension.cs b/src/WixToolset.Extensibility/BaseWindowsInstallerBackendBinderExtension.cs index 20e02f2e..e2be63bf 100644 --- a/src/WixToolset.Extensibility/BaseWindowsInstallerBackendBinderExtension.cs +++ b/src/WixToolset.Extensibility/BaseWindowsInstallerBackendBinderExtension.cs @@ -40,6 +40,9 @@ namespace WixToolset.Extensibility /// protected IResolvedCabinet CreateResolvedCabinet() => this.Context.ServiceProvider.GetService(); + /// + /// See + /// public virtual void PreBackendBind(IBindContext context) { this.Context = context; @@ -49,10 +52,19 @@ namespace WixToolset.Extensibility this.BackendHelper = context.ServiceProvider.GetService(); } + /// + /// See + /// public virtual IResolvedCabinet ResolveCabinet(string cabinetPath, IEnumerable files) => null; + /// + /// See + /// public virtual string ResolveMedia(MediaSymbol mediaRow, string mediaLayoutDirectory, string layoutDirectory) => null; + /// + /// See + /// public virtual bool TryAddSymbolToOutput(IntermediateSection section, IntermediateSymbol symbol, WindowsInstallerData output, TableDefinitionCollection tableDefinitions) { if (this.TableDefinitions.Any(t => t.SymbolDefinition == symbol.Definition)) @@ -63,6 +75,9 @@ namespace WixToolset.Extensibility return false; } + /// + /// See + /// public virtual void PostBackendBind(IBindResult result) { } diff --git a/src/WixToolset.Extensibility/CompilerConstants.cs b/src/WixToolset.Extensibility/CompilerConstants.cs index f26456fb..73ff685c 100644 --- a/src/WixToolset.Extensibility/CompilerConstants.cs +++ b/src/WixToolset.Extensibility/CompilerConstants.cs @@ -9,11 +9,34 @@ namespace WixToolset.Extensibility /// public static class CompilerConstants { + /// + /// + /// public const int IntegerNotSet = int.MinValue; + + /// + /// + /// public const int IllegalInteger = int.MinValue + 1; + + /// + /// + /// public const long LongNotSet = long.MinValue; + + /// + /// + /// public const long IllegalLong = long.MinValue + 1; + + /// + /// + /// public const string IllegalGuid = "IllegalGuid"; + + /// + /// + /// public static readonly Version IllegalVersion = new Version(Int32.MaxValue, Int32.MaxValue, Int32.MaxValue, Int32.MaxValue); } } diff --git a/src/WixToolset.Extensibility/Data/BindStage.cs b/src/WixToolset.Extensibility/Data/BindStage.cs index 559a5a5a..a690a896 100644 --- a/src/WixToolset.Extensibility/Data/BindStage.cs +++ b/src/WixToolset.Extensibility/Data/BindStage.cs @@ -2,6 +2,9 @@ namespace WixToolset.Extensibility.Data { + /// + /// + /// public enum BindStage { /// diff --git a/src/WixToolset.Extensibility/Data/ExtensionCommandLineSwitch.cs b/src/WixToolset.Extensibility/Data/ExtensionCommandLineSwitch.cs index d1d8f0c3..14b5dabb 100644 --- a/src/WixToolset.Extensibility/Data/ExtensionCommandLineSwitch.cs +++ b/src/WixToolset.Extensibility/Data/ExtensionCommandLineSwitch.cs @@ -1,4 +1,4 @@ -// 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. +// 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. namespace WixToolset.Extensibility.Data { @@ -7,8 +7,14 @@ namespace WixToolset.Extensibility.Data /// public struct ExtensionCommandLineSwitch { + /// + /// + /// public string Switch { get; set; } + /// + /// + /// public string Description { get; set; } } } diff --git a/src/WixToolset.Extensibility/Data/IBindContext.cs b/src/WixToolset.Extensibility/Data/IBindContext.cs index 650e7fc1..fd5a3ee4 100644 --- a/src/WixToolset.Extensibility/Data/IBindContext.cs +++ b/src/WixToolset.Extensibility/Data/IBindContext.cs @@ -7,6 +7,7 @@ namespace WixToolset.Extensibility.Data using WixToolset.Data; using WixToolset.Extensibility.Services; +#pragma warning disable 1591 // TODO: add documentation public interface IBindContext { IWixToolsetServiceProvider ServiceProvider { get; } diff --git a/src/WixToolset.Extensibility/Data/IBindFileWithPath.cs b/src/WixToolset.Extensibility/Data/IBindFileWithPath.cs index ec78a1a0..69036113 100644 --- a/src/WixToolset.Extensibility/Data/IBindFileWithPath.cs +++ b/src/WixToolset.Extensibility/Data/IBindFileWithPath.cs @@ -2,6 +2,7 @@ namespace WixToolset.Extensibility.Data { +#pragma warning disable 1591 // TODO: add documentation public interface IBindFileWithPath { string Id { get; set; } diff --git a/src/WixToolset.Extensibility/Data/IBindPath.cs b/src/WixToolset.Extensibility/Data/IBindPath.cs index 5784a0e0..46895e89 100644 --- a/src/WixToolset.Extensibility/Data/IBindPath.cs +++ b/src/WixToolset.Extensibility/Data/IBindPath.cs @@ -2,6 +2,9 @@ namespace WixToolset.Extensibility.Data { + /// + /// Interface for a bind path. + /// public interface IBindPath { /// diff --git a/src/WixToolset.Extensibility/Data/IBindResult.cs b/src/WixToolset.Extensibility/Data/IBindResult.cs index 0be93bce..1654f24d 100644 --- a/src/WixToolset.Extensibility/Data/IBindResult.cs +++ b/src/WixToolset.Extensibility/Data/IBindResult.cs @@ -6,6 +6,7 @@ namespace WixToolset.Extensibility.Data using System.Collections.Generic; using WixToolset.Data; +#pragma warning disable 1591 // TODO: add documentation public interface IBindResult : IDisposable { IEnumerable FileTransfers { get; set; } diff --git a/src/WixToolset.Extensibility/Data/ICommandLineArguments.cs b/src/WixToolset.Extensibility/Data/ICommandLineArguments.cs index b732c648..32ee4c09 100644 --- a/src/WixToolset.Extensibility/Data/ICommandLineArguments.cs +++ b/src/WixToolset.Extensibility/Data/ICommandLineArguments.cs @@ -9,6 +9,7 @@ namespace WixToolset.Extensibility.Data /// public interface ICommandLineArguments { +#pragma warning disable 1591 // TODO: add documentation string[] OriginalArguments { get; set; } string[] Arguments { get; set; } diff --git a/src/WixToolset.Extensibility/Data/ICommandLineContext.cs b/src/WixToolset.Extensibility/Data/ICommandLineContext.cs index 41c913fe..fbaa84d1 100644 --- a/src/WixToolset.Extensibility/Data/ICommandLineContext.cs +++ b/src/WixToolset.Extensibility/Data/ICommandLineContext.cs @@ -5,6 +5,7 @@ namespace WixToolset.Extensibility.Data using System; using WixToolset.Extensibility.Services; +#pragma warning disable 1591 // TODO: add documentation public interface ICommandLineContext { IWixToolsetServiceProvider ServiceProvider { get; } diff --git a/src/WixToolset.Extensibility/Data/ICompileContext.cs b/src/WixToolset.Extensibility/Data/ICompileContext.cs index 277b842c..1c3620b6 100644 --- a/src/WixToolset.Extensibility/Data/ICompileContext.cs +++ b/src/WixToolset.Extensibility/Data/ICompileContext.cs @@ -8,6 +8,7 @@ namespace WixToolset.Extensibility.Data using WixToolset.Data; using WixToolset.Extensibility.Services; +#pragma warning disable 1591 // TODO: add documentation public interface ICompileContext { IWixToolsetServiceProvider ServiceProvider { get; } diff --git a/src/WixToolset.Extensibility/Data/IComponentKeyPath.cs b/src/WixToolset.Extensibility/Data/IComponentKeyPath.cs index 9417b836..2de9c028 100644 --- a/src/WixToolset.Extensibility/Data/IComponentKeyPath.cs +++ b/src/WixToolset.Extensibility/Data/IComponentKeyPath.cs @@ -2,6 +2,7 @@ namespace WixToolset.Extensibility.Data { +#pragma warning disable 1591 // TODO: add documentation public interface IComponentKeyPath { bool Explicit { get; set; } diff --git a/src/WixToolset.Extensibility/Data/IDecompileContext.cs b/src/WixToolset.Extensibility/Data/IDecompileContext.cs index 29d6fb3b..f783a31e 100644 --- a/src/WixToolset.Extensibility/Data/IDecompileContext.cs +++ b/src/WixToolset.Extensibility/Data/IDecompileContext.cs @@ -7,6 +7,7 @@ namespace WixToolset.Extensibility.Data using WixToolset.Data; using WixToolset.Extensibility.Services; +#pragma warning disable 1591 // TODO: add documentation public interface IDecompileContext { IWixToolsetServiceProvider ServiceProvider { get; } diff --git a/src/WixToolset.Extensibility/Data/IDecompileResult.cs b/src/WixToolset.Extensibility/Data/IDecompileResult.cs index d15f8847..ad4d0841 100644 --- a/src/WixToolset.Extensibility/Data/IDecompileResult.cs +++ b/src/WixToolset.Extensibility/Data/IDecompileResult.cs @@ -6,6 +6,7 @@ namespace WixToolset.Extensibility.Data using System.Xml.Linq; using WixToolset.Data; +#pragma warning disable 1591 // TODO: add documentation public interface IDecompileResult { XDocument Document { get; set; } diff --git a/src/WixToolset.Extensibility/Data/IDelayedField.cs b/src/WixToolset.Extensibility/Data/IDelayedField.cs index 83139413..59a578a6 100644 --- a/src/WixToolset.Extensibility/Data/IDelayedField.cs +++ b/src/WixToolset.Extensibility/Data/IDelayedField.cs @@ -4,6 +4,7 @@ namespace WixToolset.Extensibility.Data { using WixToolset.Data; +#pragma warning disable 1591 // TODO: add documentation public interface IDelayedField { IntermediateField Field { get; } diff --git a/src/WixToolset.Extensibility/Data/IExpectedExtractFile.cs b/src/WixToolset.Extensibility/Data/IExpectedExtractFile.cs index 50015112..4bc8cd96 100644 --- a/src/WixToolset.Extensibility/Data/IExpectedExtractFile.cs +++ b/src/WixToolset.Extensibility/Data/IExpectedExtractFile.cs @@ -4,6 +4,7 @@ namespace WixToolset.Extensibility.Data { using System; +#pragma warning disable 1591 // TODO: add documentation public interface IExpectedExtractFile { Uri Uri { get; set; } diff --git a/src/WixToolset.Extensibility/Data/IFileSystemContext.cs b/src/WixToolset.Extensibility/Data/IFileSystemContext.cs index f27e16d5..321fa83c 100644 --- a/src/WixToolset.Extensibility/Data/IFileSystemContext.cs +++ b/src/WixToolset.Extensibility/Data/IFileSystemContext.cs @@ -6,6 +6,7 @@ namespace WixToolset.Extensibility.Data using WixToolset.Data; using WixToolset.Extensibility.Services; +#pragma warning disable 1591 // TODO: add documentation public interface IFileSystemContext { IWixToolsetServiceProvider ServiceProvider { get; } diff --git a/src/WixToolset.Extensibility/Data/IIncludedFile.cs b/src/WixToolset.Extensibility/Data/IIncludedFile.cs index ac5e604c..e25c9f7e 100644 --- a/src/WixToolset.Extensibility/Data/IIncludedFile.cs +++ b/src/WixToolset.Extensibility/Data/IIncludedFile.cs @@ -4,6 +4,9 @@ namespace WixToolset.Extensibility.Data { using WixToolset.Data; + /// + /// Interface for an included file. + /// public interface IIncludedFile { /// diff --git a/src/WixToolset.Extensibility/Data/IInscribeContext.cs b/src/WixToolset.Extensibility/Data/IInscribeContext.cs index 816a0c80..79d4d1f5 100644 --- a/src/WixToolset.Extensibility/Data/IInscribeContext.cs +++ b/src/WixToolset.Extensibility/Data/IInscribeContext.cs @@ -5,6 +5,7 @@ namespace WixToolset.Extensibility.Data using System; using WixToolset.Extensibility.Services; +#pragma warning disable 1591 // TODO: add documentation public interface IInscribeContext { IWixToolsetServiceProvider ServiceProvider { get; } diff --git a/src/WixToolset.Extensibility/Data/ILayoutContext.cs b/src/WixToolset.Extensibility/Data/ILayoutContext.cs index 60e5cc8d..89d61d5c 100644 --- a/src/WixToolset.Extensibility/Data/ILayoutContext.cs +++ b/src/WixToolset.Extensibility/Data/ILayoutContext.cs @@ -6,6 +6,7 @@ namespace WixToolset.Extensibility.Data using System.Threading; using WixToolset.Extensibility.Services; +#pragma warning disable 1591 // TODO: add documentation public interface ILayoutContext { IWixToolsetServiceProvider ServiceProvider { get; } diff --git a/src/WixToolset.Extensibility/Data/ILibraryContext.cs b/src/WixToolset.Extensibility/Data/ILibraryContext.cs index 12a400cd..68a9faa9 100644 --- a/src/WixToolset.Extensibility/Data/ILibraryContext.cs +++ b/src/WixToolset.Extensibility/Data/ILibraryContext.cs @@ -7,6 +7,7 @@ namespace WixToolset.Extensibility.Data using WixToolset.Data; using WixToolset.Extensibility.Services; +#pragma warning disable 1591 // TODO: add documentation public interface ILibraryContext { IWixToolsetServiceProvider ServiceProvider { get; } diff --git a/src/WixToolset.Extensibility/Data/ILinkContext.cs b/src/WixToolset.Extensibility/Data/ILinkContext.cs index ab698c1d..c6c9cf7d 100644 --- a/src/WixToolset.Extensibility/Data/ILinkContext.cs +++ b/src/WixToolset.Extensibility/Data/ILinkContext.cs @@ -7,6 +7,7 @@ namespace WixToolset.Extensibility.Data using WixToolset.Data; using WixToolset.Extensibility.Services; +#pragma warning disable 1591 // TODO: add documentation public interface ILinkContext { IWixToolsetServiceProvider ServiceProvider { get; } diff --git a/src/WixToolset.Extensibility/Data/IPreprocessContext.cs b/src/WixToolset.Extensibility/Data/IPreprocessContext.cs index 3418242a..b07fb81f 100644 --- a/src/WixToolset.Extensibility/Data/IPreprocessContext.cs +++ b/src/WixToolset.Extensibility/Data/IPreprocessContext.cs @@ -7,6 +7,7 @@ namespace WixToolset.Extensibility.Data using WixToolset.Data; using WixToolset.Extensibility.Services; +#pragma warning disable 1591 // TODO: add documentation public interface IPreprocessContext { IWixToolsetServiceProvider ServiceProvider { get; } diff --git a/src/WixToolset.Extensibility/Data/IPreprocessResult.cs b/src/WixToolset.Extensibility/Data/IPreprocessResult.cs index 955c0ced..d46c8147 100644 --- a/src/WixToolset.Extensibility/Data/IPreprocessResult.cs +++ b/src/WixToolset.Extensibility/Data/IPreprocessResult.cs @@ -5,6 +5,7 @@ namespace WixToolset.Extensibility.Data using System.Collections.Generic; using System.Xml.Linq; +#pragma warning disable 1591 // TODO: add documentation public interface IPreprocessResult { XDocument Document { get; set; } diff --git a/src/WixToolset.Extensibility/Data/IResolveContext.cs b/src/WixToolset.Extensibility/Data/IResolveContext.cs index e84655b8..2c775932 100644 --- a/src/WixToolset.Extensibility/Data/IResolveContext.cs +++ b/src/WixToolset.Extensibility/Data/IResolveContext.cs @@ -7,6 +7,7 @@ namespace WixToolset.Extensibility.Data using WixToolset.Data; using WixToolset.Extensibility.Services; +#pragma warning disable 1591 // TODO: add documentation public interface IResolveContext { IWixToolsetServiceProvider ServiceProvider { get; } diff --git a/src/WixToolset.Extensibility/Data/IResolveFileResult.cs b/src/WixToolset.Extensibility/Data/IResolveFileResult.cs index bf0af72e..c8dca81a 100644 --- a/src/WixToolset.Extensibility/Data/IResolveFileResult.cs +++ b/src/WixToolset.Extensibility/Data/IResolveFileResult.cs @@ -4,6 +4,7 @@ namespace WixToolset.Extensibility.Data { using System.Collections.Generic; +#pragma warning disable 1591 // TODO: add documentation public interface IResolveFileResult { IEnumerable CheckedPaths { get; set; } diff --git a/src/WixToolset.Extensibility/Data/IResolveResult.cs b/src/WixToolset.Extensibility/Data/IResolveResult.cs index 87b9c573..7c3403d4 100644 --- a/src/WixToolset.Extensibility/Data/IResolveResult.cs +++ b/src/WixToolset.Extensibility/Data/IResolveResult.cs @@ -5,6 +5,7 @@ namespace WixToolset.Extensibility.Data using System.Collections.Generic; using WixToolset.Data; +#pragma warning disable 1591 // TODO: add documentation public interface IResolveResult { int Codepage { get; set; } diff --git a/src/WixToolset.Extensibility/Data/IResolvedCabinet.cs b/src/WixToolset.Extensibility/Data/IResolvedCabinet.cs index c94ff8db..0c07d387 100644 --- a/src/WixToolset.Extensibility/Data/IResolvedCabinet.cs +++ b/src/WixToolset.Extensibility/Data/IResolvedCabinet.cs @@ -2,6 +2,7 @@ namespace WixToolset.Extensibility.Data { +#pragma warning disable 1591 // TODO: add documentation public interface IResolvedCabinet { CabinetBuildOption BuildOption { get; set; } diff --git a/src/WixToolset.Extensibility/Data/IUnbindContext.cs b/src/WixToolset.Extensibility/Data/IUnbindContext.cs index bdc31240..faf77f5d 100644 --- a/src/WixToolset.Extensibility/Data/IUnbindContext.cs +++ b/src/WixToolset.Extensibility/Data/IUnbindContext.cs @@ -5,6 +5,7 @@ namespace WixToolset.Extensibility.Data using System; using WixToolset.Extensibility.Services; +#pragma warning disable 1591 // TODO: add documentation public interface IUnbindContext { IWixToolsetServiceProvider ServiceProvider { get; } diff --git a/src/WixToolset.Extensibility/Data/PossibleKeyPathType.cs b/src/WixToolset.Extensibility/Data/PossibleKeyPathType.cs index 75ccb1d1..08e927e4 100644 --- a/src/WixToolset.Extensibility/Data/PossibleKeyPathType.cs +++ b/src/WixToolset.Extensibility/Data/PossibleKeyPathType.cs @@ -2,6 +2,9 @@ namespace WixToolset.Extensibility.Data { + /// + /// Key path types. + /// public enum PossibleKeyPathType { /// diff --git a/src/WixToolset.Extensibility/Data/TrackedFileType.cs b/src/WixToolset.Extensibility/Data/TrackedFileType.cs index 195d5de9..e7f53842 100644 --- a/src/WixToolset.Extensibility/Data/TrackedFileType.cs +++ b/src/WixToolset.Extensibility/Data/TrackedFileType.cs @@ -1,7 +1,10 @@ -// 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. +// 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. namespace WixToolset.Extensibility.Data { + /// + /// Tracked file types. + /// public enum TrackedFileType { /// diff --git a/src/WixToolset.Extensibility/DecompilerConstants.cs b/src/WixToolset.Extensibility/DecompilerConstants.cs index 83393da9..22e8530d 100644 --- a/src/WixToolset.Extensibility/DecompilerConstants.cs +++ b/src/WixToolset.Extensibility/DecompilerConstants.cs @@ -7,7 +7,14 @@ namespace WixToolset.Extensibility /// public static class DecompilerConstants { + /// + /// + /// public const char PrimaryKeyDelimiter = '/'; + + /// + /// + /// public const string PrimaryKeyDelimiterString = "/"; } } diff --git a/src/WixToolset.Extensibility/IBackend.cs b/src/WixToolset.Extensibility/IBackend.cs index 12a7e834..9579c3ca 100644 --- a/src/WixToolset.Extensibility/IBackend.cs +++ b/src/WixToolset.Extensibility/IBackend.cs @@ -5,6 +5,7 @@ namespace WixToolset.Extensibility using WixToolset.Data; using WixToolset.Extensibility.Data; +#pragma warning disable 1591 // TODO: add documentation public interface IBackend { IBindResult Bind(IBindContext context); diff --git a/src/WixToolset.Extensibility/IBackendFactory.cs b/src/WixToolset.Extensibility/IBackendFactory.cs index 1155e9b6..99a6704f 100644 --- a/src/WixToolset.Extensibility/IBackendFactory.cs +++ b/src/WixToolset.Extensibility/IBackendFactory.cs @@ -1,7 +1,8 @@ -// 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. +// 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. namespace WixToolset.Extensibility { +#pragma warning disable 1591 // TODO: add documentation public interface IBackendFactory { bool TryCreateBackend(string outputType, string outputPath, out IBackend backend); diff --git a/src/WixToolset.Extensibility/IBurnBackendExtension.cs b/src/WixToolset.Extensibility/IBurnBackendExtension.cs index 356d208d..769c2457 100644 --- a/src/WixToolset.Extensibility/IBurnBackendExtension.cs +++ b/src/WixToolset.Extensibility/IBurnBackendExtension.cs @@ -5,6 +5,9 @@ namespace WixToolset.Extensibility using WixToolset.Data; using WixToolset.Extensibility.Data; + /// + /// Interface all Burn backend extensions implement. + /// public interface IBurnBackendExtension { /// @@ -12,8 +15,26 @@ namespace WixToolset.Extensibility /// void PreBackendBind(IBindContext context); + /// + /// + /// + /// + /// + /// + /// + /// + /// IResolveFileResult ResolveRelatedFile(string source, string relatedSource, string type, SourceLineNumber sourceLineNumbers, BindStage bindStage); + /// + /// + /// + /// + /// + /// + /// + /// + /// string ResolveUrl(string url, string fallbackUrl, string packageId, string payloadId, string fileName); /// diff --git a/src/WixToolset.Extensibility/ICompilerExtension.cs b/src/WixToolset.Extensibility/ICompilerExtension.cs index f2fd8193..55ef683a 100644 --- a/src/WixToolset.Extensibility/ICompilerExtension.cs +++ b/src/WixToolset.Extensibility/ICompilerExtension.cs @@ -26,6 +26,8 @@ namespace WixToolset.Extensibility /// /// Processes an attribute for the Compiler. /// + /// Parent intermediate. + /// Parent section. /// Parent element of attribute. /// Attribute to process. /// Extra information about the context in which this element is being parsed. @@ -34,6 +36,8 @@ namespace WixToolset.Extensibility /// /// Processes an element for the Compiler. /// + /// Parent intermediate. + /// Parent section. /// Parent element of element to process. /// Element to process. /// Extra information about the context in which this element is being parsed. @@ -42,9 +46,11 @@ namespace WixToolset.Extensibility /// /// Processes an element for the Compiler, with the ability to supply a component keypath. /// + /// Parent intermediate. + /// Parent section. /// Parent element of element to process. /// Element to process. - /// Extra information about the context in which this element is being parsed. + /// Extra information about the context in which this element is being parsed. IComponentKeyPath ParsePossibleKeyPathElement(Intermediate intermediate, IntermediateSection section, XElement parentElement, XElement element, IDictionary context); /// diff --git a/src/WixToolset.Extensibility/IExtensionCommandLine.cs b/src/WixToolset.Extensibility/IExtensionCommandLine.cs index 45683373..2c7d0a7e 100644 --- a/src/WixToolset.Extensibility/IExtensionCommandLine.cs +++ b/src/WixToolset.Extensibility/IExtensionCommandLine.cs @@ -34,11 +34,10 @@ namespace WixToolset.Extensibility /// /// Gives the extension an opportunity to provide a command. /// - /// /// Parser to help parse the argument and additional arguments. /// Argument to parse. /// - /// True if the argument is recognized as a commond; otherwise false to allow another extension to process it. + /// True if the argument is recognized as a command; otherwise false to allow another extension to process it. bool TryParseCommand(ICommandLineParser parser, string argument, out ICommandLineCommand command); /// diff --git a/src/WixToolset.Extensibility/IFileSystemExtension.cs b/src/WixToolset.Extensibility/IFileSystemExtension.cs index 0a3e84b8..9807e8b9 100644 --- a/src/WixToolset.Extensibility/IFileSystemExtension.cs +++ b/src/WixToolset.Extensibility/IFileSystemExtension.cs @@ -9,6 +9,7 @@ namespace WixToolset.Extensibility /// public interface IFileSystemExtension { +#pragma warning disable 1591 // TODO: add documentation void Initialize(IFileSystemContext context); bool? CompareFiles(string targetFile, string updatedFile); diff --git a/src/WixToolset.Extensibility/IInspectorExtension.cs b/src/WixToolset.Extensibility/IInspectorExtension.cs index 6c4be1e5..7c488a89 100644 --- a/src/WixToolset.Extensibility/IInspectorExtension.cs +++ b/src/WixToolset.Extensibility/IInspectorExtension.cs @@ -10,15 +10,13 @@ namespace WixToolset.Extensibility /// Interface for inspector extensions. /// /// - /// The inspector methods are stateless, but extensions are loaded and last for the lifetime of the - /// containing classes like , , , - /// , and . If you want to maintain state, you should check + /// The inspector methods are stateless, but extensions are loaded once. If you want to maintain state, you should check /// if your data is loaded for each method and, if not, load it. /// public interface IInspectorExtension { /// - /// Gets or sets the for inspector extensions to use. + /// Gets or sets the for inspector extensions to use. /// IInspectorCore Core { get; set; } @@ -34,6 +32,7 @@ namespace WixToolset.Extensibility /// The compiled output. void InspectIntermediate(Intermediate intermediate); +#if REWRITE /// /// Inspect the output. /// @@ -46,13 +45,15 @@ namespace WixToolset.Extensibility /// transforms are the primary transforms you'll typically want to inspect /// and contain your changes to target products. /// +#endif + /// void InspectOutput(Intermediate output); /// /// Inspect the final output after binding. /// /// The file path to the final bound output. - /// The that contains source line numbers + /// The that contains source line numbers /// for the database and all rows. void InspectDatabase(string filePath, Intermediate pdb); } diff --git a/src/WixToolset.Extensibility/ILayoutExtension.cs b/src/WixToolset.Extensibility/ILayoutExtension.cs index 7bcee0a8..ecd7d8f1 100644 --- a/src/WixToolset.Extensibility/ILayoutExtension.cs +++ b/src/WixToolset.Extensibility/ILayoutExtension.cs @@ -14,9 +14,11 @@ namespace WixToolset.Extensibility /// void PreLayout(ILayoutContext context); +#pragma warning disable 1591 // TODO: add documentation bool CopyFile(string source, string destination); bool MoveFile(string source, string destination); +#pragma warning restore 1591 /// /// Called after all layout occurs. diff --git a/src/WixToolset.Extensibility/ILibrarianExtension.cs b/src/WixToolset.Extensibility/ILibrarianExtension.cs index e52c71c9..d9b04cd2 100644 --- a/src/WixToolset.Extensibility/ILibrarianExtension.cs +++ b/src/WixToolset.Extensibility/ILibrarianExtension.cs @@ -5,6 +5,7 @@ namespace WixToolset.Extensibility using WixToolset.Data; using WixToolset.Extensibility.Data; +#pragma warning disable 1591 // TODO: add documentation public interface ILibrarianExtension { void PreCombine(ILibraryContext context); diff --git a/src/WixToolset.Extensibility/IMessageListener.cs b/src/WixToolset.Extensibility/IMessageListener.cs index d5baa24f..ea103538 100644 --- a/src/WixToolset.Extensibility/IMessageListener.cs +++ b/src/WixToolset.Extensibility/IMessageListener.cs @@ -5,6 +5,7 @@ namespace WixToolset.Extensibility using WixToolset.Data; using WixToolset.Extensibility.Services; +#pragma warning disable 1591 // TODO: add documentation public interface IMessageListener { MessageLevel CalculateMessageLevel(IMessaging messaging, Message message, MessageLevel defaultMessageLevel); diff --git a/src/WixToolset.Extensibility/IPreprocessorExtension.cs b/src/WixToolset.Extensibility/IPreprocessorExtension.cs index 94eb7d78..919ff1ae 100644 --- a/src/WixToolset.Extensibility/IPreprocessorExtension.cs +++ b/src/WixToolset.Extensibility/IPreprocessorExtension.cs @@ -41,7 +41,6 @@ namespace WixToolset.Extensibility /// /// Processes a pragma defined in the extension. /// - /// The location of this pragma's PI. /// The prefix of the pragma to be processed by the extension. /// The name of the pragma. /// The pragma's arguments. diff --git a/src/WixToolset.Extensibility/IWindowsInstallerBackendBinderExtension.cs b/src/WixToolset.Extensibility/IWindowsInstallerBackendBinderExtension.cs index fc769da9..f257f1ec 100644 --- a/src/WixToolset.Extensibility/IWindowsInstallerBackendBinderExtension.cs +++ b/src/WixToolset.Extensibility/IWindowsInstallerBackendBinderExtension.cs @@ -13,18 +13,22 @@ namespace WixToolset.Extensibility /// public interface IWindowsInstallerBackendBinderExtension { +#pragma warning disable 1591 // TODO: add documentation IEnumerable TableDefinitions { get; } +#pragma warning restore 1591 /// /// Called before binding occurs. /// void PreBackendBind(IBindContext context); +#pragma warning disable 1591 // TODO: add documentation IResolvedCabinet ResolveCabinet(string cabinetPath, IEnumerable files); string ResolveMedia(MediaSymbol mediaRow, string mediaLayoutDirectory, string layoutDirectory); bool TryAddSymbolToOutput(IntermediateSection section, IntermediateSymbol symbol, WindowsInstallerData output, TableDefinitionCollection tableDefinitions); +#pragma warning restore 1591 /// /// Called after all output changes occur and right before the output is bound into its final format. diff --git a/src/WixToolset.Extensibility/Services/IBackendHelper.cs b/src/WixToolset.Extensibility/Services/IBackendHelper.cs index bfec5256..0c8578b2 100644 --- a/src/WixToolset.Extensibility/Services/IBackendHelper.cs +++ b/src/WixToolset.Extensibility/Services/IBackendHelper.cs @@ -17,6 +17,7 @@ namespace WixToolset.Extensibility.Services /// Source for the file transfer. /// Destination for the file transfer. /// Indicates whether to move or copy the source file. + /// Optional source line numbers that requested the file transfer. IFileTransfer CreateFileTransfer(string source, string destination, bool move, SourceLineNumber sourceLineNumbers = null); /// diff --git a/src/WixToolset.Extensibility/Services/ICommandLineParser.cs b/src/WixToolset.Extensibility/Services/ICommandLineParser.cs index f7e2a28f..f538e0b7 100644 --- a/src/WixToolset.Extensibility/Services/ICommandLineParser.cs +++ b/src/WixToolset.Extensibility/Services/ICommandLineParser.cs @@ -4,6 +4,7 @@ namespace WixToolset.Extensibility.Services { using System.Collections.Generic; +#pragma warning disable 1591 // TODO: add documentation public interface ICommandLineParser { string ErrorArgument { get; set; } diff --git a/src/WixToolset.Extensibility/Services/IParseHelper.cs b/src/WixToolset.Extensibility/Services/IParseHelper.cs index 08bcd911..93144629 100644 --- a/src/WixToolset.Extensibility/Services/IParseHelper.cs +++ b/src/WixToolset.Extensibility/Services/IParseHelper.cs @@ -68,15 +68,6 @@ namespace WixToolset.Extensibility.Services /// New symbol. IntermediateSymbol CreateSymbol(IntermediateSection section, SourceLineNumber sourceLineNumbers, IntermediateSymbolDefinition symbolDefinition, Identifier identifier = null); - [Obsolete] - IntermediateSymbol CreateRow(IntermediateSection section, SourceLineNumber sourceLineNumbers, string tableName, Identifier identifier = null); - - [Obsolete] - IntermediateSymbol CreateSymbol(IntermediateSection section, SourceLineNumber sourceLineNumbers, SymbolDefinitionType symbolType, Identifier identifier = null); - - [Obsolete] - IntermediateSymbol CreateRow(IntermediateSection section, SourceLineNumber sourceLineNumbers, SymbolDefinitionType symbolType, Identifier identifier = null); - /// /// Creates a directory row from a name. /// @@ -106,6 +97,7 @@ namespace WixToolset.Extensibility.Services /// /// Creates a Registry symbol in the active section. /// + /// Active section. /// Source and line number of the current symbol. /// The registry entry root. /// The registry entry key. @@ -115,9 +107,6 @@ namespace WixToolset.Extensibility.Services /// If true, "escape" leading '#' characters so the value is written as a REG_SZ. Identifier CreateRegistrySymbol(IntermediateSection section, SourceLineNumber sourceLineNumbers, RegistryRootType root, string key, string name, string value, string componentId, bool escapeLeadingHash); - [Obsolete] - Identifier CreateRegistryRow(IntermediateSection section, SourceLineNumber sourceLineNumbers, RegistryRootType root, string key, string name, string value, string componentId, bool escapeLeadingHash); - /// /// Creates a short file/directory name using an identifier and long file/directory name as input. /// @@ -131,6 +120,7 @@ namespace WixToolset.Extensibility.Services /// /// Create a WixSimpleReference symbol in the active section. /// + /// Active section. /// Source line information for the row. /// The symbol name of the simple reference. /// The primary key of the simple reference. @@ -139,6 +129,7 @@ namespace WixToolset.Extensibility.Services /// /// Create a WixSimpleReference symbol in the active section. /// + /// Active section. /// Source line information for the row. /// The symbol name of the simple reference. /// The primary keys of the simple reference. @@ -147,6 +138,7 @@ namespace WixToolset.Extensibility.Services /// /// Create a WixSimpleReference symbol in the active section. /// + /// Active section. /// Source line information for the row. /// The symbol definition of the simple reference. /// The primary key of the simple reference. @@ -155,6 +147,7 @@ namespace WixToolset.Extensibility.Services /// /// Create a WixSimpleReference symbol in the active section. /// + /// Active section. /// Source line information for the row. /// The symbol definition of the simple reference. /// The primary keys of the simple reference. @@ -167,7 +160,7 @@ namespace WixToolset.Extensibility.Services /// Source line information. /// Section to create the reference in. /// The custom action base name. - /// The platform being compiled. + /// The platform being compiled. /// The platforms for which there are specialized custom actions. void CreateCustomActionReference(SourceLineNumber sourceLineNumbers, IntermediateSection section, string customAction, Platform platform, CustomActionPlatforms supportedPlatforms); @@ -195,9 +188,6 @@ namespace WixToolset.Extensibility.Services /// Id of the Child Node. void CreateWixGroupSymbol(IntermediateSection section, SourceLineNumber sourceLineNumbers, ComplexReferenceParentType parentType, string parentId, ComplexReferenceChildType childType, string childId); - [Obsolete] - void CreateWixGroupRow(IntermediateSection section, SourceLineNumber sourceLineNumbers, ComplexReferenceParentType parentType, string parentId, ComplexReferenceChildType childType, string childId); - /// /// Creates a symbol in the WixSearch table. /// @@ -231,6 +221,7 @@ namespace WixToolset.Extensibility.Services /// /// Add the appropriate symbols to make sure that the given table shows up in the resulting output. /// + /// Active section. /// Source line numbers. /// Name of the table to ensure existance of. void EnsureTable(IntermediateSection section, SourceLineNumber sourceLineNumbers, string tableName); @@ -238,6 +229,7 @@ namespace WixToolset.Extensibility.Services /// /// Add the appropriate symbols to make sure that the given table shows up in the resulting output. /// + /// Active section. /// Source line numbers. /// Definition of the table to ensure existance of. void EnsureTable(IntermediateSection section, SourceLineNumber sourceLineNumbers, TableDefinition tableDefinition); @@ -408,6 +400,9 @@ namespace WixToolset.Extensibility.Services /// /// Attempts to use an extension to parse the attribute. /// + /// + /// Parent intermediate. + /// Parent section. /// Element containing attribute to be parsed. /// Attribute to be parsed. /// Extra information about the context in which this element is being parsed. @@ -416,22 +411,31 @@ namespace WixToolset.Extensibility.Services /// /// Attempts to use an extension to parse the element. /// + /// + /// Parent intermediate. + /// Parent section. /// Element containing element to be parsed. /// Element to be parsed. - /// Extra information about the context in which this element is being parsed. + /// Extra information about the context in which this element is being parsed. void ParseExtensionElement(IEnumerable extensions, Intermediate intermediate, IntermediateSection section, XElement parentElement, XElement element, IDictionary context = null); /// /// Attempts to use an extension to parse the element, with support for setting component keypath. /// + /// + /// Parent intermediate. + /// Parent section. /// Element containing element to be parsed. /// Element to be parsed. - /// Extra information about the context in which this element is being parsed. + /// Extra information about the context in which this element is being parsed. IComponentKeyPath ParsePossibleKeyPathExtensionElement(IEnumerable extensions, Intermediate intermediate, IntermediateSection section, XElement parentElement, XElement element, IDictionary context); /// /// Process all children of the element looking for extensions and erroring on the unexpected. /// + /// + /// Parent intermediate. + /// Parent section. /// Element to parse children. void ParseForExtensionElements(IEnumerable extensions, Intermediate intermediate, IntermediateSection section, XElement element); @@ -452,7 +456,7 @@ namespace WixToolset.Extensibility.Services /// /// Called when the compiler encounters an unexpected attribute. /// - /// Parent element that found unexpected attribute. + /// Parent element that found unexpected attribute. /// Unexpected attribute. void UnexpectedAttribute(XElement element, XAttribute attribute); diff --git a/src/WixToolset.Extensibility/Services/IPathResolver.cs b/src/WixToolset.Extensibility/Services/IPathResolver.cs index 5713d2d7..5be0c4d3 100644 --- a/src/WixToolset.Extensibility/Services/IPathResolver.cs +++ b/src/WixToolset.Extensibility/Services/IPathResolver.cs @@ -6,7 +6,9 @@ namespace WixToolset.Extensibility.Services using WixToolset.Data; using WixToolset.Extensibility.Data; +#pragma warning disable 1591 // TODO: add documentation public interface IPathResolver +#pragma warning restore 1591 { /// /// Get the canonical source path of a directory. @@ -14,6 +16,7 @@ namespace WixToolset.Extensibility.Services /// All cached directories. /// Hash table of Component GUID generation seeds indexed by directory id. /// Directory identifier. + /// Current platform. /// Source path of a directory. string GetCanonicalDirectoryPath(Dictionary directories, Dictionary componentIdGenSeeds, string directory, Platform platform); @@ -28,7 +31,7 @@ namespace WixToolset.Extensibility.Services /// /// Gets the source path of a file. /// - /// All cached directories in . + /// All cached directories in . /// Parent directory identifier. /// File name (in long|source format). /// Specifies the package is compressed. diff --git a/src/WixToolset.Extensibility/Services/IPreprocessHelper.cs b/src/WixToolset.Extensibility/Services/IPreprocessHelper.cs index d55383db..f7973ac2 100644 --- a/src/WixToolset.Extensibility/Services/IPreprocessHelper.cs +++ b/src/WixToolset.Extensibility/Services/IPreprocessHelper.cs @@ -24,7 +24,7 @@ namespace WixToolset.Extensibility.Services /// The preprocess context. /// The variable name. /// The variable value. - /// Set to true to show variable overwrite warning. + /// Set to true to show variable overwrite warning. void AddVariable(IPreprocessContext context, string name, string value, bool showWarning); /// @@ -67,7 +67,7 @@ namespace WixToolset.Extensibility.Services /// Evaluate a Pragma. /// /// The preprocess context. - /// The pragma's full name (.). + /// The pragma's full name (<prefix>.<pragma>). /// The arguments to the pragma. /// The parent element of the pragma. void PreprocessPragma(IPreprocessContext context, string pragmaName, string args, XContainer parent); diff --git a/src/WixToolset.Extensibility/Services/IVariableResolution.cs b/src/WixToolset.Extensibility/Services/IVariableResolution.cs index efed0b1f..82bacb31 100644 --- a/src/WixToolset.Extensibility/Services/IVariableResolution.cs +++ b/src/WixToolset.Extensibility/Services/IVariableResolution.cs @@ -2,6 +2,7 @@ namespace WixToolset.Extensibility.Services { +#pragma warning disable 1591 // TODO: add documentation public interface IVariableResolution { bool DelayedResolve { get; set; } diff --git a/src/WixToolset.Extensibility/Services/IVariableResolver.cs b/src/WixToolset.Extensibility/Services/IVariableResolver.cs index a108e146..285f1fd1 100644 --- a/src/WixToolset.Extensibility/Services/IVariableResolver.cs +++ b/src/WixToolset.Extensibility/Services/IVariableResolver.cs @@ -4,13 +4,16 @@ namespace WixToolset.Extensibility.Services { using WixToolset.Data; +#pragma warning disable 1591 // TODO: add documentation public interface IVariableResolver { void AddLocalization(Localization localization); +#pragma warning restore 1591 /// /// Add a variable. /// + /// The source line information for the value. /// The name of the variable. /// The value of the variable. /// Indicates whether the variable can be overridden by an existing variable. diff --git a/src/WixToolset.Extensibility/Services/IWindowsInstallerBackendHelper.cs b/src/WixToolset.Extensibility/Services/IWindowsInstallerBackendHelper.cs index 008db83e..ca53ab4a 100644 --- a/src/WixToolset.Extensibility/Services/IWindowsInstallerBackendHelper.cs +++ b/src/WixToolset.Extensibility/Services/IWindowsInstallerBackendHelper.cs @@ -10,7 +10,26 @@ namespace WixToolset.Extensibility.Services /// public interface IWindowsInstallerBackendHelper { + /// + /// Creates a in the specified table. + /// + /// Parent section. + /// Symbol with line information for the row. + /// Current context. + /// Table definition for the row. + /// Row CreateRow(IntermediateSection section, IntermediateSymbol symbol, WindowsInstallerData output, TableDefinition tableDefinition); + + /// + /// Looks up the registered for the given and creates a in that table. + /// Goes sequentially through each field in the symbol and assigns the value to the column with the same index as the field. + /// 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. + /// + /// Parent section. + /// Symbol to create the row from. + /// Current context. + /// Table definitions that have been registered with the binder. + /// True if a row was created. bool TryAddSymbolToOutputMatchingTableDefinitions(IntermediateSection section, IntermediateSymbol symbol, WindowsInstallerData output, TableDefinitionCollection tableDefinitions); } } diff --git a/src/WixToolset.Extensibility/Services/IWixtoolsetCoreServiceProvider.cs b/src/WixToolset.Extensibility/Services/IWixtoolsetCoreServiceProvider.cs index 3c80ddef..2d0450dc 100644 --- a/src/WixToolset.Extensibility/Services/IWixtoolsetCoreServiceProvider.cs +++ b/src/WixToolset.Extensibility/Services/IWixtoolsetCoreServiceProvider.cs @@ -24,7 +24,6 @@ namespace WixToolset.Extensibility.Services /// /// Adds a service to the service locator. /// - /// Type of the service to add. /// /// A function that creates the service. The create function is provided the service provider /// itself to resolve additional services and a type dictionary that stores singleton services diff --git a/src/WixToolset.Extensibility/WixToolset.Extensibility.csproj b/src/WixToolset.Extensibility/WixToolset.Extensibility.csproj index 9fa4f12e..8b18c0ed 100644 --- a/src/WixToolset.Extensibility/WixToolset.Extensibility.csproj +++ b/src/WixToolset.Extensibility/WixToolset.Extensibility.csproj @@ -9,6 +9,7 @@ embedded true + true -- cgit v1.2.3-55-g6feb From 7de0df7fc8582073c54b342713cd75131f0aa64f Mon Sep 17 00:00:00 2001 From: Rob Mensching Date: Thu, 7 Jan 2021 23:05:42 -0800 Subject: Include version info file when building in NCrunch --- .../WixToolset.Extensibility.v3.ncrunchproject | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 src/WixToolset.Extensibility/WixToolset.Extensibility.v3.ncrunchproject diff --git a/src/WixToolset.Extensibility/WixToolset.Extensibility.v3.ncrunchproject b/src/WixToolset.Extensibility/WixToolset.Extensibility.v3.ncrunchproject new file mode 100644 index 00000000..c6001ebe --- /dev/null +++ b/src/WixToolset.Extensibility/WixToolset.Extensibility.v3.ncrunchproject @@ -0,0 +1,7 @@ + + + + ..\..\version.json + + + \ No newline at end of file -- cgit v1.2.3-55-g6feb From a52e79268228a5feb87f5ba763fb4bbac6f96681 Mon Sep 17 00:00:00 2001 From: Rob Mensching Date: Thu, 7 Jan 2021 23:09:28 -0800 Subject: Report invalid command line arguments as errors First part of fix for wixtoolset/issues#6313 --- src/WixToolset.Extensibility/Services/ICommandLineParser.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/WixToolset.Extensibility/Services/ICommandLineParser.cs b/src/WixToolset.Extensibility/Services/ICommandLineParser.cs index f538e0b7..cd17f100 100644 --- a/src/WixToolset.Extensibility/Services/ICommandLineParser.cs +++ b/src/WixToolset.Extensibility/Services/ICommandLineParser.cs @@ -3,11 +3,12 @@ namespace WixToolset.Extensibility.Services { using System.Collections.Generic; + using WixToolset.Data; #pragma warning disable 1591 // TODO: add documentation public interface ICommandLineParser { - string ErrorArgument { get; set; } + string ErrorArgument { get; } /// /// Validates that a valid switch (starts with "/" or "-"), and returns a bool indicating its validity @@ -32,6 +33,8 @@ namespace WixToolset.Extensibility.Services bool GetNextArgumentAsFilePathOrError(string commandLineSwitch, string fileType, IList paths); + void ReportErrorArgument(string argument, Message message = null); + bool TryGetNextSwitchOrArgument(out string arg); } } -- cgit v1.2.3-55-g6feb From 918475619d98474100bbd8736df1a284ac5231aa Mon Sep 17 00:00:00 2001 From: Rob Mensching Date: Thu, 11 Feb 2021 13:30:53 -0800 Subject: Add ICompilerContext.IsCurrentPlatfom64Bit --- .../Data/ICompileContext.cs | 24 +++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/src/WixToolset.Extensibility/Data/ICompileContext.cs b/src/WixToolset.Extensibility/Data/ICompileContext.cs index 1c3620b6..5da5ca84 100644 --- a/src/WixToolset.Extensibility/Data/ICompileContext.cs +++ b/src/WixToolset.Extensibility/Data/ICompileContext.cs @@ -8,13 +8,24 @@ namespace WixToolset.Extensibility.Data using WixToolset.Data; using WixToolset.Extensibility.Services; -#pragma warning disable 1591 // TODO: add documentation + /// + /// Context provided to the compiler. + /// public interface ICompileContext { + /// + /// Service provider made available to the compiler and its extensions. + /// IWixToolsetServiceProvider ServiceProvider { get; } + /// + /// Unique identifier for the compilation. + /// string CompilationId { get; set; } + /// + /// Set of extensions provided to the compiler. + /// IEnumerable Extensions { get; set; } /// @@ -23,8 +34,19 @@ namespace WixToolset.Extensibility.Data /// The platform which the compiler will use when defaulting 64-bit attributes and elements. Platform Platform { get; set; } + /// + /// Calculates whether the target platform for the compilation is 64-bit or not. + /// + bool IsCurrentPlatform64Bit { get; } + + /// + /// Source document being compiled. + /// XDocument Source { get; set; } + /// + /// Cancellation token to abort cancellation. + /// CancellationToken CancellationToken { get; set; } } } -- cgit v1.2.3-55-g6feb From 09007408ffb6c3af9fbb556d0fb34e80aede52ee Mon Sep 17 00:00:00 2001 From: Rob Mensching Date: Sat, 13 Feb 2021 07:19:25 -0800 Subject: Backend specific helpers should passthru implement IBackendHelper --- src/WixToolset.Extensibility/Services/IBurnBackendHelper.cs | 2 +- src/WixToolset.Extensibility/Services/IWindowsInstallerBackendHelper.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/WixToolset.Extensibility/Services/IBurnBackendHelper.cs b/src/WixToolset.Extensibility/Services/IBurnBackendHelper.cs index 7e8d7e3e..ef5fcc65 100644 --- a/src/WixToolset.Extensibility/Services/IBurnBackendHelper.cs +++ b/src/WixToolset.Extensibility/Services/IBurnBackendHelper.cs @@ -7,7 +7,7 @@ namespace WixToolset.Extensibility.Services /// /// Interface provided to help Burn backend extensions. /// - public interface IBurnBackendHelper + public interface IBurnBackendHelper : IBackendHelper { /// /// Adds the given XML to the BootstrapperApplicationData manifest. diff --git a/src/WixToolset.Extensibility/Services/IWindowsInstallerBackendHelper.cs b/src/WixToolset.Extensibility/Services/IWindowsInstallerBackendHelper.cs index ca53ab4a..23e046fa 100644 --- a/src/WixToolset.Extensibility/Services/IWindowsInstallerBackendHelper.cs +++ b/src/WixToolset.Extensibility/Services/IWindowsInstallerBackendHelper.cs @@ -8,7 +8,7 @@ namespace WixToolset.Extensibility.Services /// /// Interface provided to help Windows Installer backend extensions. /// - public interface IWindowsInstallerBackendHelper + public interface IWindowsInstallerBackendHelper : IBackendHelper { /// /// Creates a in the specified table. -- cgit v1.2.3-55-g6feb From 36011e4e6c37139684dcfe982e7d4390c0a1d1d2 Mon Sep 17 00:00:00 2001 From: Rob Mensching Date: Sat, 13 Feb 2021 07:20:13 -0800 Subject: Add IWindowsInstallerBackendBinder.FullyResolved plus documentation --- .../BaseWindowsInstallerBackendBinderExtension.cs | 7 ++++ .../IWindowsInstallerBackendBinderExtension.cs | 37 +++++++++++++++++++--- 2 files changed, 39 insertions(+), 5 deletions(-) diff --git a/src/WixToolset.Extensibility/BaseWindowsInstallerBackendBinderExtension.cs b/src/WixToolset.Extensibility/BaseWindowsInstallerBackendBinderExtension.cs index e2be63bf..c0086aed 100644 --- a/src/WixToolset.Extensibility/BaseWindowsInstallerBackendBinderExtension.cs +++ b/src/WixToolset.Extensibility/BaseWindowsInstallerBackendBinderExtension.cs @@ -52,6 +52,13 @@ namespace WixToolset.Extensibility this.BackendHelper = context.ServiceProvider.GetService(); } + /// + /// See + /// + public virtual void FullyResolved(IntermediateSection section) + { + } + /// /// See /// diff --git a/src/WixToolset.Extensibility/IWindowsInstallerBackendBinderExtension.cs b/src/WixToolset.Extensibility/IWindowsInstallerBackendBinderExtension.cs index f257f1ec..b913dadc 100644 --- a/src/WixToolset.Extensibility/IWindowsInstallerBackendBinderExtension.cs +++ b/src/WixToolset.Extensibility/IWindowsInstallerBackendBinderExtension.cs @@ -13,26 +13,53 @@ namespace WixToolset.Extensibility /// public interface IWindowsInstallerBackendBinderExtension { -#pragma warning disable 1591 // TODO: add documentation + /// + /// Table definitions provided by the extension. + /// IEnumerable TableDefinitions { get; } -#pragma warning restore 1591 /// /// Called before binding occurs. /// void PreBackendBind(IBindContext context); -#pragma warning disable 1591 // TODO: add documentation + /// + /// + /// + /// The resolved intermedate section. + void FullyResolved(IntermediateSection section); + + /// + /// Finds an existing cabinet that contains the provided files. + /// + /// Path to the cabinet. + /// Files contained in the cabinet. + /// Resolved cabinet options or null if the cabinet could not be found. IResolvedCabinet ResolveCabinet(string cabinetPath, IEnumerable files); - string ResolveMedia(MediaSymbol mediaRow, string mediaLayoutDirectory, string layoutDirectory); + /// + /// Override layout location for a media. + /// + /// Media symbol. + /// Default media layout directory. + /// Default layout directory. + /// Layout location or null to use the default processing. + string ResolveMedia(MediaSymbol mediaSymbol, string mediaLayoutDirectory, string layoutDirectory); + /// + /// + /// + /// + /// + /// Windows Installer data + /// Collection of table definitions available for the output. + /// True if the symbol was added to the output, or false if not. bool TryAddSymbolToOutput(IntermediateSection section, IntermediateSymbol symbol, WindowsInstallerData output, TableDefinitionCollection tableDefinitions); -#pragma warning restore 1591 /// /// Called after all output changes occur and right before the output is bound into its final format. /// + /// Bind result to process. void PostBackendBind(IBindResult result); } } -- cgit v1.2.3-55-g6feb From 21c430b0d2a46bae326655209fefde13ae17b051 Mon Sep 17 00:00:00 2001 From: Rob Mensching Date: Tue, 23 Feb 2021 07:45:42 -0800 Subject: Rename FullyResolved to SymbolsFinalized and TryAddSymbolXxx to TryProcessSymbol Plus fix up more documentation --- .../BaseBurnBackendExtension.cs | 63 ++++++++-------------- .../BaseWindowsInstallerBackendBinderExtension.cs | 10 ++-- .../IBurnBackendExtension.cs | 45 ++++++++-------- .../IWindowsInstallerBackendBinderExtension.cs | 22 ++++---- 4 files changed, 61 insertions(+), 79 deletions(-) diff --git a/src/WixToolset.Extensibility/BaseBurnBackendExtension.cs b/src/WixToolset.Extensibility/BaseBurnBackendExtension.cs index 0575d725..488f882a 100644 --- a/src/WixToolset.Extensibility/BaseBurnBackendExtension.cs +++ b/src/WixToolset.Extensibility/BaseBurnBackendExtension.cs @@ -2,6 +2,7 @@ namespace WixToolset.Extensibility { + using System; using System.Collections.Generic; using System.Linq; using WixToolset.Data; @@ -35,24 +36,8 @@ namespace WixToolset.Extensibility protected virtual IEnumerable SymbolDefinitions => Enumerable.Empty(); /// - /// Called after all output changes occur and right before the output is bound into its final format. + /// See /// - public virtual void BundleFinalize() - { - } - - /// - /// Called after output is bound into its final format. - /// - /// - public virtual void PostBackendBind(IBindResult result) - { - } - - /// - /// Called before binding occurs. - /// - /// public virtual void PreBackendBind(IBindContext context) { this.Context = context; @@ -61,44 +46,32 @@ namespace WixToolset.Extensibility } /// - /// + /// See /// - /// - /// - /// - /// - /// - /// - public virtual IResolveFileResult ResolveRelatedFile(string source, string relatedSource, string type, SourceLineNumber sourceLineNumbers, BindStage bindStage) + public virtual IResolveFileResult ResolveRelatedFile(string source, string relatedSource, string type, SourceLineNumber sourceLineNumbers) { return null; } /// - /// + /// See + /// + public virtual void SymbolsFinalized(IntermediateSection section) + { + } + + /// + /// See /// - /// - /// - /// - /// - /// - /// public virtual string ResolveUrl(string url, string fallbackUrl, string packageId, string payloadId, string fileName) { return null; } /// - /// Called for each extension symbol that hasn't been handled yet. - /// Use IBurnBackendHelper to add data to the appropriate data manifest. + /// See /// - /// The linked section. - /// The current symbol. - /// - /// True if the extension handled the symbol, false otherwise. - /// The Burn backend will warn on all unhandled symbols. - /// - public virtual bool TryAddSymbolToDataManifest(IntermediateSection section, IntermediateSymbol symbol) + public virtual bool TryProcessSymbol(IntermediateSection section, IntermediateSymbol symbol) { if (this.SymbolDefinitions.Any(t => t == symbol.Definition) && symbol.Definition.HasTag(BurnConstants.BootstrapperApplicationDataSymbolDefinitionTag)) @@ -109,5 +82,13 @@ namespace WixToolset.Extensibility return false; } + + /// + /// See + /// + /// + public virtual void PostBackendBind(IBindResult result) + { + } } } diff --git a/src/WixToolset.Extensibility/BaseWindowsInstallerBackendBinderExtension.cs b/src/WixToolset.Extensibility/BaseWindowsInstallerBackendBinderExtension.cs index c0086aed..47777fae 100644 --- a/src/WixToolset.Extensibility/BaseWindowsInstallerBackendBinderExtension.cs +++ b/src/WixToolset.Extensibility/BaseWindowsInstallerBackendBinderExtension.cs @@ -53,9 +53,9 @@ namespace WixToolset.Extensibility } /// - /// See + /// See /// - public virtual void FullyResolved(IntermediateSection section) + public virtual void SymbolsFinalized(IntermediateSection section) { } @@ -70,13 +70,13 @@ namespace WixToolset.Extensibility public virtual string ResolveMedia(MediaSymbol mediaRow, string mediaLayoutDirectory, string layoutDirectory) => null; /// - /// See + /// See /// - public virtual bool TryAddSymbolToOutput(IntermediateSection section, IntermediateSymbol symbol, WindowsInstallerData output, TableDefinitionCollection tableDefinitions) + public virtual bool TryProcessSymbol(IntermediateSection section, IntermediateSymbol symbol, WindowsInstallerData data, TableDefinitionCollection tableDefinitions) { if (this.TableDefinitions.Any(t => t.SymbolDefinition == symbol.Definition)) { - return this.BackendHelper.TryAddSymbolToOutputMatchingTableDefinitions(section, symbol, output, tableDefinitions); + return this.BackendHelper.TryAddSymbolToOutputMatchingTableDefinitions(section, symbol, data, tableDefinitions); } return false; diff --git a/src/WixToolset.Extensibility/IBurnBackendExtension.cs b/src/WixToolset.Extensibility/IBurnBackendExtension.cs index 769c2457..07f5cd1b 100644 --- a/src/WixToolset.Extensibility/IBurnBackendExtension.cs +++ b/src/WixToolset.Extensibility/IBurnBackendExtension.cs @@ -16,30 +16,36 @@ namespace WixToolset.Extensibility void PreBackendBind(IBindContext context); /// - /// + /// Called to find a file related to another source in the authoring. For example, most often used + /// to find cabinets and uncompressed files for an MSI package. /// - /// - /// - /// - /// - /// - /// - IResolveFileResult ResolveRelatedFile(string source, string relatedSource, string type, SourceLineNumber sourceLineNumbers, BindStage bindStage); + /// Path to the source package. + /// Expected path to the related file. + /// Type of related file, such as "File" or "Cabinet" + /// Source line number of source package. + /// IResolveFileResult if the related file was found, or null for default handling. + IResolveFileResult ResolveRelatedFile(string source, string relatedSource, string type, SourceLineNumber sourceLineNumbers); /// - /// + /// Called right before the output is bound into its final format. /// - /// - /// - /// - /// - /// - /// + /// The finalized intermediate section. + void SymbolsFinalized(IntermediateSection section); + + /// + /// Called to customize the DownloadUrl provided in source cde. + /// + /// The value from the source code. May not actually be a URL. + /// The default URL if the extension does not return a value. + /// Identifier of the package. + /// Identifier of the payload. + /// Filename of the payload. + /// Url to override, or null to use default value. string ResolveUrl(string url, string fallbackUrl, string packageId, string payloadId, string fileName); /// /// Called for each extension symbol that hasn't been handled yet. - /// Use IBurnBackendHelper to add data to the appropriate data manifest. + /// Use IBurnBackendHelper to add data. /// /// The linked section. /// The current symbol. @@ -47,12 +53,7 @@ namespace WixToolset.Extensibility /// True if the extension handled the symbol, false otherwise. /// The Burn backend will warn on all unhandled symbols. /// - bool TryAddSymbolToDataManifest(IntermediateSection section, IntermediateSymbol symbol); - - /// - /// Called after all output changes occur and right before the output is bound into its final format. - /// - void BundleFinalize(); + bool TryProcessSymbol(IntermediateSection section, IntermediateSymbol symbol); /// /// Called after output is bound into its final format. diff --git a/src/WixToolset.Extensibility/IWindowsInstallerBackendBinderExtension.cs b/src/WixToolset.Extensibility/IWindowsInstallerBackendBinderExtension.cs index b913dadc..12a38b9a 100644 --- a/src/WixToolset.Extensibility/IWindowsInstallerBackendBinderExtension.cs +++ b/src/WixToolset.Extensibility/IWindowsInstallerBackendBinderExtension.cs @@ -24,10 +24,10 @@ namespace WixToolset.Extensibility void PreBackendBind(IBindContext context); /// - /// + /// Extension can process the intermediate before the Windows Installer data is created. /// - /// The resolved intermedate section. - void FullyResolved(IntermediateSection section); + /// The finalized intermediate section. + void SymbolsFinalized(IntermediateSection section); /// /// Finds an existing cabinet that contains the provided files. @@ -41,20 +41,20 @@ namespace WixToolset.Extensibility /// Override layout location for a media. /// /// Media symbol. - /// Default media layout directory. - /// Default layout directory. + /// Default media specific layout directory. + /// Default overall layout directory. /// Layout location or null to use the default processing. string ResolveMedia(MediaSymbol mediaSymbol, string mediaLayoutDirectory, string layoutDirectory); /// - /// + /// Called for each extension symbol that hasn't been handled yet. /// - /// - /// - /// Windows Installer data + /// The linked section. + /// The current symbol. + /// Windows Installer data /// Collection of table definitions available for the output. - /// True if the symbol was added to the output, or false if not. - bool TryAddSymbolToOutput(IntermediateSection section, IntermediateSymbol symbol, WindowsInstallerData output, TableDefinitionCollection tableDefinitions); + /// True if the symbol was handled, or false if not. + bool TryProcessSymbol(IntermediateSection section, IntermediateSymbol symbol, WindowsInstallerData data, TableDefinitionCollection tableDefinitions); /// /// Called after all output changes occur and right before the output is bound into its final format. -- cgit v1.2.3-55-g6feb From 7595e8b7bc4ee2bf4507208c9df74dc173f3dfb1 Mon Sep 17 00:00:00 2001 From: Rob Mensching Date: Tue, 23 Feb 2021 07:52:31 -0800 Subject: Rename IBurnBackendExtension to IBurnBackendBinderExtension This will allow other backend extensions in the future, such as a Burn decompiler extension. --- .../BaseBurnBackendBinderExtension.cs | 94 ++++++++++++++++++++++ .../BaseBurnBackendExtension.cs | 94 ---------------------- .../IBurnBackendBinderExtension.cs | 64 +++++++++++++++ .../IBurnBackendExtension.cs | 64 --------------- 4 files changed, 158 insertions(+), 158 deletions(-) create mode 100644 src/WixToolset.Extensibility/BaseBurnBackendBinderExtension.cs delete mode 100644 src/WixToolset.Extensibility/BaseBurnBackendExtension.cs create mode 100644 src/WixToolset.Extensibility/IBurnBackendBinderExtension.cs delete mode 100644 src/WixToolset.Extensibility/IBurnBackendExtension.cs diff --git a/src/WixToolset.Extensibility/BaseBurnBackendBinderExtension.cs b/src/WixToolset.Extensibility/BaseBurnBackendBinderExtension.cs new file mode 100644 index 00000000..3afc8678 --- /dev/null +++ b/src/WixToolset.Extensibility/BaseBurnBackendBinderExtension.cs @@ -0,0 +1,94 @@ +// 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. + +namespace WixToolset.Extensibility +{ + using System; + using System.Collections.Generic; + using System.Linq; + using WixToolset.Data; + using WixToolset.Data.Burn; + using WixToolset.Extensibility.Data; + using WixToolset.Extensibility.Services; + + /// + /// Base class for creating a Burn backend extension. + /// + public abstract class BaseBurnBackendBinderExtension : IBurnBackendBinderExtension + { + /// + /// Context for use by the extension. + /// + protected IBindContext Context { get; private set; } + + /// + /// Messaging for use by the extension. + /// + protected IMessaging Messaging { get; private set; } + + /// + /// Backend helper for use by the extension. + /// + protected IBurnBackendHelper BackendHelper { get; private set; } + + /// + /// Optional symbol definitions. + /// + protected virtual IEnumerable SymbolDefinitions => Enumerable.Empty(); + + /// + /// See + /// + public virtual void PreBackendBind(IBindContext context) + { + this.Context = context; + this.Messaging = context.ServiceProvider.GetService(); + this.BackendHelper = context.ServiceProvider.GetService(); + } + + /// + /// See + /// + public virtual IResolveFileResult ResolveRelatedFile(string source, string relatedSource, string type, SourceLineNumber sourceLineNumbers) + { + return null; + } + + /// + /// See + /// + public virtual void SymbolsFinalized(IntermediateSection section) + { + } + + /// + /// See + /// + public virtual string ResolveUrl(string url, string fallbackUrl, string packageId, string payloadId, string fileName) + { + return null; + } + + /// + /// See + /// + public virtual bool TryProcessSymbol(IntermediateSection section, IntermediateSymbol symbol) + { + if (this.SymbolDefinitions.Any(t => t == symbol.Definition) && + symbol.Definition.HasTag(BurnConstants.BootstrapperApplicationDataSymbolDefinitionTag)) + { + this.BackendHelper.AddBootstrapperApplicationData(symbol); + return true; + } + + return false; + } + + /// + /// See + /// + /// + public virtual void PostBackendBind(IBindResult result) + { + } + } +} diff --git a/src/WixToolset.Extensibility/BaseBurnBackendExtension.cs b/src/WixToolset.Extensibility/BaseBurnBackendExtension.cs deleted file mode 100644 index 488f882a..00000000 --- a/src/WixToolset.Extensibility/BaseBurnBackendExtension.cs +++ /dev/null @@ -1,94 +0,0 @@ -// 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. - -namespace WixToolset.Extensibility -{ - using System; - using System.Collections.Generic; - using System.Linq; - using WixToolset.Data; - using WixToolset.Data.Burn; - using WixToolset.Extensibility.Data; - using WixToolset.Extensibility.Services; - - /// - /// Base class for creating a Burn backend extension. - /// - public abstract class BaseBurnBackendExtension : IBurnBackendExtension - { - /// - /// Context for use by the extension. - /// - protected IBindContext Context { get; private set; } - - /// - /// Messaging for use by the extension. - /// - protected IMessaging Messaging { get; private set; } - - /// - /// Backend helper for use by the extension. - /// - protected IBurnBackendHelper BackendHelper { get; private set; } - - /// - /// Optional symbol definitions. - /// - protected virtual IEnumerable SymbolDefinitions => Enumerable.Empty(); - - /// - /// See - /// - public virtual void PreBackendBind(IBindContext context) - { - this.Context = context; - this.Messaging = context.ServiceProvider.GetService(); - this.BackendHelper = context.ServiceProvider.GetService(); - } - - /// - /// See - /// - public virtual IResolveFileResult ResolveRelatedFile(string source, string relatedSource, string type, SourceLineNumber sourceLineNumbers) - { - return null; - } - - /// - /// See - /// - public virtual void SymbolsFinalized(IntermediateSection section) - { - } - - /// - /// See - /// - public virtual string ResolveUrl(string url, string fallbackUrl, string packageId, string payloadId, string fileName) - { - return null; - } - - /// - /// See - /// - public virtual bool TryProcessSymbol(IntermediateSection section, IntermediateSymbol symbol) - { - if (this.SymbolDefinitions.Any(t => t == symbol.Definition) && - symbol.Definition.HasTag(BurnConstants.BootstrapperApplicationDataSymbolDefinitionTag)) - { - this.BackendHelper.AddBootstrapperApplicationData(symbol); - return true; - } - - return false; - } - - /// - /// See - /// - /// - public virtual void PostBackendBind(IBindResult result) - { - } - } -} diff --git a/src/WixToolset.Extensibility/IBurnBackendBinderExtension.cs b/src/WixToolset.Extensibility/IBurnBackendBinderExtension.cs new file mode 100644 index 00000000..1dd4d9b1 --- /dev/null +++ b/src/WixToolset.Extensibility/IBurnBackendBinderExtension.cs @@ -0,0 +1,64 @@ +// 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. + +namespace WixToolset.Extensibility +{ + using WixToolset.Data; + using WixToolset.Extensibility.Data; + + /// + /// Interface all Burn backend extensions implement. + /// + public interface IBurnBackendBinderExtension + { + /// + /// Called before binding occurs. + /// + void PreBackendBind(IBindContext context); + + /// + /// Called to find a file related to another source in the authoring. For example, most often used + /// to find cabinets and uncompressed files for an MSI package. + /// + /// Path to the source package. + /// Expected path to the related file. + /// Type of related file, such as "File" or "Cabinet" + /// Source line number of source package. + /// IResolveFileResult if the related file was found, or null for default handling. + IResolveFileResult ResolveRelatedFile(string source, string relatedSource, string type, SourceLineNumber sourceLineNumbers); + + /// + /// Called right before the output is bound into its final format. + /// + /// The finalized intermediate section. + void SymbolsFinalized(IntermediateSection section); + + /// + /// Called to customize the DownloadUrl provided in source cde. + /// + /// The value from the source code. May not actually be a URL. + /// The default URL if the extension does not return a value. + /// Identifier of the package. + /// Identifier of the payload. + /// Filename of the payload. + /// Url to override, or null to use default value. + string ResolveUrl(string url, string fallbackUrl, string packageId, string payloadId, string fileName); + + /// + /// Called for each extension symbol that hasn't been handled yet. + /// Use IBurnBackendHelper to add data. + /// + /// The linked section. + /// The current symbol. + /// + /// True if the extension handled the symbol, false otherwise. + /// The Burn backend will warn on all unhandled symbols. + /// + bool TryProcessSymbol(IntermediateSection section, IntermediateSymbol symbol); + + /// + /// Called after output is bound into its final format. + /// + /// + void PostBackendBind(IBindResult result); + } +} diff --git a/src/WixToolset.Extensibility/IBurnBackendExtension.cs b/src/WixToolset.Extensibility/IBurnBackendExtension.cs deleted file mode 100644 index 07f5cd1b..00000000 --- a/src/WixToolset.Extensibility/IBurnBackendExtension.cs +++ /dev/null @@ -1,64 +0,0 @@ -// 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. - -namespace WixToolset.Extensibility -{ - using WixToolset.Data; - using WixToolset.Extensibility.Data; - - /// - /// Interface all Burn backend extensions implement. - /// - public interface IBurnBackendExtension - { - /// - /// Called before binding occurs. - /// - void PreBackendBind(IBindContext context); - - /// - /// Called to find a file related to another source in the authoring. For example, most often used - /// to find cabinets and uncompressed files for an MSI package. - /// - /// Path to the source package. - /// Expected path to the related file. - /// Type of related file, such as "File" or "Cabinet" - /// Source line number of source package. - /// IResolveFileResult if the related file was found, or null for default handling. - IResolveFileResult ResolveRelatedFile(string source, string relatedSource, string type, SourceLineNumber sourceLineNumbers); - - /// - /// Called right before the output is bound into its final format. - /// - /// The finalized intermediate section. - void SymbolsFinalized(IntermediateSection section); - - /// - /// Called to customize the DownloadUrl provided in source cde. - /// - /// The value from the source code. May not actually be a URL. - /// The default URL if the extension does not return a value. - /// Identifier of the package. - /// Identifier of the payload. - /// Filename of the payload. - /// Url to override, or null to use default value. - string ResolveUrl(string url, string fallbackUrl, string packageId, string payloadId, string fileName); - - /// - /// Called for each extension symbol that hasn't been handled yet. - /// Use IBurnBackendHelper to add data. - /// - /// The linked section. - /// The current symbol. - /// - /// True if the extension handled the symbol, false otherwise. - /// The Burn backend will warn on all unhandled symbols. - /// - bool TryProcessSymbol(IntermediateSection section, IntermediateSymbol symbol); - - /// - /// Called after output is bound into its final format. - /// - /// - void PostBackendBind(IBindResult result); - } -} -- cgit v1.2.3-55-g6feb From d56e7495c0eceaa1a67bbb324f8c5d7e34566081 Mon Sep 17 00:00:00 2001 From: Rob Mensching Date: Tue, 2 Mar 2021 00:48:46 -0800 Subject: Remove references to "Output" and use "Data" instead --- .../BaseWindowsInstallerBackendBinderExtension.cs | 2 +- .../Services/IWindowsInstallerBackendHelper.cs | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/WixToolset.Extensibility/BaseWindowsInstallerBackendBinderExtension.cs b/src/WixToolset.Extensibility/BaseWindowsInstallerBackendBinderExtension.cs index 47777fae..93d8a1df 100644 --- a/src/WixToolset.Extensibility/BaseWindowsInstallerBackendBinderExtension.cs +++ b/src/WixToolset.Extensibility/BaseWindowsInstallerBackendBinderExtension.cs @@ -76,7 +76,7 @@ namespace WixToolset.Extensibility { if (this.TableDefinitions.Any(t => t.SymbolDefinition == symbol.Definition)) { - return this.BackendHelper.TryAddSymbolToOutputMatchingTableDefinitions(section, symbol, data, tableDefinitions); + return this.BackendHelper.TryAddSymbolToMatchingTableDefinitions(section, symbol, data, tableDefinitions); } return false; diff --git a/src/WixToolset.Extensibility/Services/IWindowsInstallerBackendHelper.cs b/src/WixToolset.Extensibility/Services/IWindowsInstallerBackendHelper.cs index 23e046fa..80d49d54 100644 --- a/src/WixToolset.Extensibility/Services/IWindowsInstallerBackendHelper.cs +++ b/src/WixToolset.Extensibility/Services/IWindowsInstallerBackendHelper.cs @@ -15,10 +15,10 @@ namespace WixToolset.Extensibility.Services /// /// Parent section. /// Symbol with line information for the row. - /// Current context. + /// Windows Installer data. /// Table definition for the row. /// - Row CreateRow(IntermediateSection section, IntermediateSymbol symbol, WindowsInstallerData output, TableDefinition tableDefinition); + Row CreateRow(IntermediateSection section, IntermediateSymbol symbol, WindowsInstallerData data, TableDefinition tableDefinition); /// /// Looks up the registered for the given and creates a in that table. @@ -27,9 +27,9 @@ namespace WixToolset.Extensibility.Services /// /// Parent section. /// Symbol to create the row from. - /// Current context. + /// Windows Installer data. /// Table definitions that have been registered with the binder. /// True if a row was created. - bool TryAddSymbolToOutputMatchingTableDefinitions(IntermediateSection section, IntermediateSymbol symbol, WindowsInstallerData output, TableDefinitionCollection tableDefinitions); + bool TryAddSymbolToMatchingTableDefinitions(IntermediateSection section, IntermediateSymbol symbol, WindowsInstallerData data, TableDefinitionCollection tableDefinitions); } } -- cgit v1.2.3-55-g6feb From dd1c4360b5f50271a5efd531e4dd3be24cd39b58 Mon Sep 17 00:00:00 2001 From: Rob Mensching Date: Tue, 2 Mar 2021 00:54:30 -0800 Subject: Remove v3 based functions from IWindowsInstallerBackendDecompilerExtension New design is necessary to meet v4 needs. --- .../IWindowsInstallerBackendDecompilerExtension.cs | 19 +------------------ 1 file changed, 1 insertion(+), 18 deletions(-) diff --git a/src/WixToolset.Extensibility/IWindowsInstallerBackendDecompilerExtension.cs b/src/WixToolset.Extensibility/IWindowsInstallerBackendDecompilerExtension.cs index f858610b..a56b63c3 100644 --- a/src/WixToolset.Extensibility/IWindowsInstallerBackendDecompilerExtension.cs +++ b/src/WixToolset.Extensibility/IWindowsInstallerBackendDecompilerExtension.cs @@ -16,24 +16,7 @@ namespace WixToolset.Extensibility /// void PreBackendDecompile(IDecompileContext context); - /// - /// Gets the table definitions this extension decompiles. - /// - /// Table definitions this extension decompiles. - TableDefinitionCollection TableDefinitions { get; } - - /// - /// Gets the library that this decompiler wants removed from the decomipiled output. - /// - /// The table definitions to use while loading the library. - /// The library for this extension or null if there is no library to be removed. - Library GetLibraryToRemove(TableDefinitionCollection tableDefinitions); - - /// - /// Decompiles an extension table. - /// - /// The table to decompile. - void DecompileTable(Table table); + // TODO: Redesign this interface to be useful. /// /// Called after all output changes occur and right before the output is bound into its final format. -- cgit v1.2.3-55-g6feb From b8a6dcabf49c0d2048aa7e19a1b51cdd138ba51f Mon Sep 17 00:00:00 2001 From: Rob Mensching Date: Tue, 2 Mar 2021 01:01:26 -0800 Subject: Short names are now created in the backend not the frontend --- src/WixToolset.Extensibility/Services/IParseHelper.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/WixToolset.Extensibility/Services/IParseHelper.cs b/src/WixToolset.Extensibility/Services/IParseHelper.cs index 93144629..d64efecd 100644 --- a/src/WixToolset.Extensibility/Services/IParseHelper.cs +++ b/src/WixToolset.Extensibility/Services/IParseHelper.cs @@ -115,6 +115,7 @@ namespace WixToolset.Extensibility.Services /// true if wildcards are allowed in the filename. /// Any additional information to include in the hash for the generated short name. /// The generated 8.3-compliant short file/directory name. + [Obsolete] string CreateShortName(string longName, bool keepExtension, bool allowWildcards, params string[] args); /// -- cgit v1.2.3-55-g6feb From 5d2f6b097147a8ca1574724d6393b96f971808ea Mon Sep 17 00:00:00 2001 From: Rob Mensching Date: Tue, 2 Mar 2021 01:43:52 -0800 Subject: Fix warnings in XML doc --- src/WixToolset.Extensibility/BaseCompilerExtension.cs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/WixToolset.Extensibility/BaseCompilerExtension.cs b/src/WixToolset.Extensibility/BaseCompilerExtension.cs index 2eac3706..3e185e14 100644 --- a/src/WixToolset.Extensibility/BaseCompilerExtension.cs +++ b/src/WixToolset.Extensibility/BaseCompilerExtension.cs @@ -2,6 +2,7 @@ namespace WixToolset.Extensibility { + using System; using System.Collections.Generic; using System.Xml.Linq; using WixToolset.Data; @@ -52,7 +53,7 @@ namespace WixToolset.Extensibility } /// - /// See + /// See /// public virtual void ParseAttribute(Intermediate intermediate, IntermediateSection section, XElement parentElement, XAttribute attribute, IDictionary context) { @@ -60,7 +61,7 @@ namespace WixToolset.Extensibility } /// - /// See + /// See /// public virtual void ParseElement(Intermediate intermediate, IntermediateSection section, XElement parentElement, XElement element, IDictionary context) { @@ -68,7 +69,7 @@ namespace WixToolset.Extensibility } /// - /// See + /// See /// public virtual IComponentKeyPath ParsePossibleKeyPathElement(Intermediate intermediate, IntermediateSection section, XElement parentElement, XElement element, IDictionary context) { -- cgit v1.2.3-55-g6feb From 0a1b870e33c1ef741950e26377f8eaa834dc4116 Mon Sep 17 00:00:00 2001 From: Sean Hall Date: Tue, 2 Mar 2021 15:25:45 -0600 Subject: In Extensibility projects, treat warnings as errors. --- src/Custom.Build.props | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 src/Custom.Build.props diff --git a/src/Custom.Build.props b/src/Custom.Build.props new file mode 100644 index 00000000..889fb62e --- /dev/null +++ b/src/Custom.Build.props @@ -0,0 +1,6 @@ + + + + true + + -- cgit v1.2.3-55-g6feb From f4af6bf27abaaac7f0508ce2beafb31b5a64b53f Mon Sep 17 00:00:00 2001 From: Rob Mensching Date: Sun, 14 Mar 2021 07:30:15 -0700 Subject: Minimize public surface area of Core Part of wixtoolset/issues#6374 --- src/WixToolset.Extensibility/Data/IFileFacade.cs | 126 +++++++++++++++++++++ .../Services/IBackendHelper.cs | 125 ++++++++++++++++++++ .../Services/IParseHelper.cs | 15 +-- .../Services/IPathResolver.cs | 5 +- .../Services/IWindowsInstallerBackendHelper.cs | 2 +- .../Services/IWixBranding.cs | 26 +++++ 6 files changed, 283 insertions(+), 16 deletions(-) create mode 100644 src/WixToolset.Extensibility/Data/IFileFacade.cs create mode 100644 src/WixToolset.Extensibility/Services/IWixBranding.cs diff --git a/src/WixToolset.Extensibility/Data/IFileFacade.cs b/src/WixToolset.Extensibility/Data/IFileFacade.cs new file mode 100644 index 00000000..fea00d4e --- /dev/null +++ b/src/WixToolset.Extensibility/Data/IFileFacade.cs @@ -0,0 +1,126 @@ +// 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. + +namespace WixToolset.Extensibility.Data +{ + using System.Collections.Generic; + using WixToolset.Data; + using WixToolset.Data.Symbols; + using WixToolset.Data.WindowsInstaller.Rows; + + /// + /// Interface that provides a common facade over FileSymbol and FileRow. + /// + public interface IFileFacade + { + /// + /// Reference to assembly application for this file. + /// + string AssemblyApplicationFileRef { get; } + + /// + /// Reference to assembly manifest for this file. + /// + string AssemblyManifestFileRef { get; } + + /// + /// List of assembly name values in the file. + /// + List AssemblyNames { get; set; } + + /// + /// Optionally indicates what sort of assembly the file is. + /// + AssemblyType? AssemblyType { get; } + + /// + /// Component containing the file. + /// + string ComponentRef { get; } + + /// + /// Indicates whether the file is compressed. + /// + bool Compressed { get; } + + /// + /// Disk Id for the file. + /// + int DiskId { get; set; } + + /// + /// Name of the file. + /// + string FileName { get; } + + /// + /// Size of the file. + /// + int FileSize { get; set; } + + /// + /// Indicates whether the file came from a merge module. + /// + bool FromModule { get; } + + /// + /// Indicates whether the file came from a transform. + /// + bool FromTransform { get; } + + /// + /// Hash symbol of the file. + /// + MsiFileHashSymbol Hash { get; set; } + + /// + /// Underlying identifier of the file. + /// + Identifier Identifier { get; } + + /// + /// Helper accessor for the Id of the Identifier. + /// + string Id { get; } + + /// + /// Language of the file. + /// + string Language { get; set; } + + /// + /// Optional patch group for the file. + /// + int? PatchGroup { get; } + + /// + /// Sequence of the file. + /// + int Sequence { get; set; } + + /// + /// Source line number that define the file. + /// + SourceLineNumber SourceLineNumber { get; } + + /// + /// Source to the file. + /// + string SourcePath { get; } + + /// + /// Indicates whether the file is to be uncompressed. + /// + bool Uncompressed { get; } + + /// + /// Version of the file. + /// + string Version { get; set; } + + /// + /// Gets the underlying FileRow if one is present. + /// + /// FileRow if one is present, otherwise throws. + FileRow GetFileRow(); + } +} diff --git a/src/WixToolset.Extensibility/Services/IBackendHelper.cs b/src/WixToolset.Extensibility/Services/IBackendHelper.cs index 0c8578b2..ce3ddc89 100644 --- a/src/WixToolset.Extensibility/Services/IBackendHelper.cs +++ b/src/WixToolset.Extensibility/Services/IBackendHelper.cs @@ -3,7 +3,10 @@ namespace WixToolset.Extensibility.Services { using System; + using System.Collections.Generic; using WixToolset.Data; + using WixToolset.Data.Symbols; + using WixToolset.Data.WindowsInstaller.Rows; using WixToolset.Extensibility.Data; /// @@ -11,6 +14,28 @@ namespace WixToolset.Extensibility.Services /// public interface IBackendHelper { + /// + /// Creates a file facade from a FileSymbol and possible AssemblySymbol. + /// + /// FileSymbol backing the facade. + /// AssemblySymbol backing the facade. + /// + IFileFacade CreateFileFacade(FileSymbol file, AssemblySymbol assembly); + + /// + /// Creates a file facade from a File row. + /// + /// FileRow + /// New IFileFacade. + IFileFacade CreateFileFacade(FileRow fileRow); + + /// + /// Creates a file facade from a Merge Module's File symbol. + /// + /// FileSymbol created from a Merge Module. + /// New IFileFacade. + IFileFacade CreateFileFacadeFromMergeModule(FileSymbol fileSymbol); + /// /// Creates a file transfer and marks it redundant if the source and destination are identical. /// @@ -20,6 +45,12 @@ namespace WixToolset.Extensibility.Services /// Optional source line numbers that requested the file transfer. IFileTransfer CreateFileTransfer(string source, string destination, bool move, SourceLineNumber sourceLineNumbers = null); + /// + /// Creates a MSI compatible GUID. + /// + /// Creates an uppercase GUID with braces. + string CreateGuid(); + /// /// Creates a version 3 name-based UUID. /// @@ -36,6 +67,21 @@ namespace WixToolset.Extensibility.Services /// Resolved directory. IResolvedDirectory CreateResolvedDirectory(string directoryParent, string name); + /// + /// Extracts embedded files. + /// + /// Embedded files to extract. + /// ITrackedFile for each embedded file extracted. + IEnumerable ExtractEmbeddedFiles(IEnumerable embeddedFiles); + + /// + /// Generate an identifier by hashing data from the row. + /// + /// Three letter or less prefix for generated row identifier. + /// Information to hash. + /// The generated identifier. + string GenerateIdentifier(string prefix, params string[] args); + /// /// Validates path is relative and canonicalizes it. /// For example, "a\..\c\.\d.exe" => "c\d.exe". @@ -47,6 +93,85 @@ namespace WixToolset.Extensibility.Services /// The original value if not relative, otherwise the canonicalized relative path. string GetCanonicalRelativePath(SourceLineNumber sourceLineNumbers, string elementName, string attributeName, string relativePath); + /// + /// Gets a valid code page from the given web name or integer value. + /// + /// A code page web name or integer value as a string. + /// Whether to allow -1 which does not change the database code pages. This may be the case with wxl files. + /// Whether to allow Unicode (UCS) or UTF code pages. + /// Source line information for the current authoring. + /// A valid code page number. + /// The value is an integer less than 0 or greater than 65535. + /// is null. + /// The value doesn't not represent a valid code page name or integer value. + /// The code page is invalid for summary information. + int GetValidCodePage(string value, bool allowNoChange = false, bool onlyAnsi = false, SourceLineNumber sourceLineNumbers = null); + + /// + /// Get a source/target and short/long file name from an MSI Filename column. + /// + /// The Filename value. + /// true to get a source name; false to get a target name + /// true to get a long name; false to get a short name + /// The name. + string GetMsiFileName(string value, bool source, bool longName); + + /// + /// Verifies if an identifier is a valid binder variable name. + /// + /// Binder variable name to verify. + /// True if the identifier is a valid binder variable name. + bool IsValidBinderVariable(string variable); + + /// + /// Verifies the given string is a valid 4-part version module or bundle version. + /// + /// The version to verify. + /// True if version is a valid module or bundle version. + bool IsValidFourPartVersion(string version); + + /// + /// Determines if value is a valid identifier. + /// + /// Identifier to validate. + /// True if valid identifier, otherwise false. + bool IsValidIdentifier(string id); + + /// + /// Verifies the given string is a valid long filename. + /// + /// The filename to verify. + /// Allow wildcards in the filename. + /// Allow long file name to be a relative path. + /// True if filename is a valid long filename. + bool IsValidLongFilename(string filename, bool allowWildcards, bool allowRelative); + + /// + /// Verifies the given string is a valid short filename. + /// + /// The filename to verify. + /// Allow wildcards in the filename. + /// True if filename is a valid short filename. + bool IsValidShortFilename(string filename, bool allowWildcards); + + /// + /// Resolve delayed fields. + /// + /// The fields which had resolution delayed. + /// The cached variable values used when resolving delayed fields. + void ResolveDelayedFields(IEnumerable delayedFields, Dictionary variableCache); + + /// + /// Get the source/target and short/long file names from an MSI Filename column. + /// + /// The Filename value. + /// An array of strings of length 4. The contents are: short target, long target, short source, and long source. + /// + /// If any particular file name part is not parsed, its set to null in the appropriate location of the returned array of strings. + /// Thus the returned array will always be of length 4. + /// + string[] SplitMsiFileName(string value); + /// /// Creates a tracked file. /// diff --git a/src/WixToolset.Extensibility/Services/IParseHelper.cs b/src/WixToolset.Extensibility/Services/IParseHelper.cs index d64efecd..83c66540 100644 --- a/src/WixToolset.Extensibility/Services/IParseHelper.cs +++ b/src/WixToolset.Extensibility/Services/IParseHelper.cs @@ -107,17 +107,6 @@ namespace WixToolset.Extensibility.Services /// If true, "escape" leading '#' characters so the value is written as a REG_SZ. Identifier CreateRegistrySymbol(IntermediateSection section, SourceLineNumber sourceLineNumbers, RegistryRootType root, string key, string name, string value, string componentId, bool escapeLeadingHash); - /// - /// Creates a short file/directory name using an identifier and long file/directory name as input. - /// - /// The long file/directory name. - /// The option to keep the extension on generated short names. - /// true if wildcards are allowed in the filename. - /// Any additional information to include in the hash for the generated short name. - /// The generated 8.3-compliant short file/directory name. - [Obsolete] - string CreateShortName(string longName, bool keepExtension, bool allowWildcards, params string[] args); - /// /// Create a WixSimpleReference symbol in the active section. /// @@ -394,9 +383,9 @@ namespace WixToolset.Extensibility.Services /// Verifies if a filename is a valid short filename. /// /// Filename to verify. - /// true if wildcards are allowed in the filename. + /// Indicates whether wildcards are allowed in the filename. /// True if the filename is a valid short filename - bool IsValidShortFilename(string filename, bool allowWildcards = false); + bool IsValidShortFilename(string filename, bool allowWildcards); /// /// Attempts to use an extension to parse the attribute. diff --git a/src/WixToolset.Extensibility/Services/IPathResolver.cs b/src/WixToolset.Extensibility/Services/IPathResolver.cs index 5be0c4d3..64362174 100644 --- a/src/WixToolset.Extensibility/Services/IPathResolver.cs +++ b/src/WixToolset.Extensibility/Services/IPathResolver.cs @@ -6,9 +6,10 @@ namespace WixToolset.Extensibility.Services using WixToolset.Data; using WixToolset.Extensibility.Data; -#pragma warning disable 1591 // TODO: add documentation + /// + /// Support for processing paths. + /// public interface IPathResolver -#pragma warning restore 1591 { /// /// Get the canonical source path of a directory. diff --git a/src/WixToolset.Extensibility/Services/IWindowsInstallerBackendHelper.cs b/src/WixToolset.Extensibility/Services/IWindowsInstallerBackendHelper.cs index 80d49d54..81325131 100644 --- a/src/WixToolset.Extensibility/Services/IWindowsInstallerBackendHelper.cs +++ b/src/WixToolset.Extensibility/Services/IWindowsInstallerBackendHelper.cs @@ -17,7 +17,7 @@ namespace WixToolset.Extensibility.Services /// Symbol with line information for the row. /// Windows Installer data. /// Table definition for the row. - /// + /// Row created in the . Row CreateRow(IntermediateSection section, IntermediateSymbol symbol, WindowsInstallerData data, TableDefinition tableDefinition); /// diff --git a/src/WixToolset.Extensibility/Services/IWixBranding.cs b/src/WixToolset.Extensibility/Services/IWixBranding.cs new file mode 100644 index 00000000..4bac9ccd --- /dev/null +++ b/src/WixToolset.Extensibility/Services/IWixBranding.cs @@ -0,0 +1,26 @@ +// 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. + +namespace WixToolset.Extensibility.Services +{ + using System.Reflection; + + /// + /// WiX branding interface. + /// + public interface IWixBranding + { + /// + /// Gets the value for CreatingApplication field (MSI Summary Information Stream). + /// + /// String for creating application. + string GetCreatingApplication(); + + /// + /// Replaces branding placeholders in original string. + /// + /// Original string containing placeholders to replace. + /// Optional assembly with branding information, if not specified core branding is used. + /// + string ReplacePlaceholders(string original, Assembly assembly = null); + } +} -- cgit v1.2.3-55-g6feb From 9aae370eee18b4c87300f333fa52f3cd0d7f34d1 Mon Sep 17 00:00:00 2001 From: Rob Mensching Date: Sun, 14 Mar 2021 11:17:20 -0700 Subject: Use extension methods instead of a custom interface for IServiceProvider There are several helpful methods for getting services out of an IServiceProvider. Instead of introducing a custom interface to inject those methods into the inheritance tree, this change uses extension methods to add the helper methods and reduce the number of custom interfaces. --- src/WixToolset.Extensibility/Data/IBindContext.cs | 67 ++++++++++++++++++++-- .../Data/ICommandLineContext.cs | 2 +- .../Data/ICompileContext.cs | 4 +- .../Data/IDecompileContext.cs | 2 +- .../Data/IFileSystemContext.cs | 2 +- .../Data/IInscribeContext.cs | 2 +- .../Data/ILayoutContext.cs | 4 +- .../Data/ILibraryContext.cs | 4 +- src/WixToolset.Extensibility/Data/ILinkContext.cs | 4 +- .../Data/IPreprocessContext.cs | 4 +- .../Data/IResolveContext.cs | 4 +- .../Data/IUnbindContext.cs | 3 +- .../Services/IWixToolsetServiceProvider.cs | 34 ----------- .../Services/IWixtoolsetCoreServiceProvider.cs | 2 +- .../Services/ServiceProviderExtensions.cs | 48 ++++++++++++++++ 15 files changed, 129 insertions(+), 57 deletions(-) delete mode 100644 src/WixToolset.Extensibility/Services/IWixToolsetServiceProvider.cs create mode 100644 src/WixToolset.Extensibility/Services/ServiceProviderExtensions.cs diff --git a/src/WixToolset.Extensibility/Data/IBindContext.cs b/src/WixToolset.Extensibility/Data/IBindContext.cs index fd5a3ee4..ee165671 100644 --- a/src/WixToolset.Extensibility/Data/IBindContext.cs +++ b/src/WixToolset.Extensibility/Data/IBindContext.cs @@ -2,50 +2,109 @@ namespace WixToolset.Extensibility.Data { + using System; using System.Collections.Generic; using System.Threading; using WixToolset.Data; - using WixToolset.Extensibility.Services; -#pragma warning disable 1591 // TODO: add documentation + /// + /// Bind context. + /// public interface IBindContext { - IWixToolsetServiceProvider ServiceProvider { get; } - + /// + /// Service provider. + /// + IServiceProvider ServiceProvider { get; } + + /// + /// Counnt of threads to use in cabbing. + /// int CabbingThreadCount { get; set; } + /// + /// Cabinet cache path. + /// string CabCachePath { get; set; } + /// + /// Codepage for result. + /// int Codepage { get; set; } + /// + /// Default compression level. + /// CompressionLevel? DefaultCompressionLevel { get; set; } + /// + /// Delayed fields that need to be resolved again. + /// IEnumerable DelayedFields { get; set; } + /// + /// Embedded files to extract. + /// IEnumerable ExpectedEmbeddedFiles { get; set; } + /// + /// Binder extensions. + /// IEnumerable Extensions { get; set; } + /// + /// File system extensions. + /// IEnumerable FileSystemExtensions { get; set; } + /// + /// Set of ICEs to execute. + /// IEnumerable Ices { get; set; } + /// + /// Intermedaite folder. + /// string IntermediateFolder { get; set; } + /// + /// Intermediate representation to bind. + /// Intermediate IntermediateRepresentation { get; set; } + /// + /// Output path to bind to. + /// string OutputPath { get; set; } + /// + /// Type of PDB to create. + /// PdbType PdbType { get; set; } + /// + /// Output path for PDB. + /// string PdbPath { get; set; } + /// + /// Set of ICEs to skip. + /// IEnumerable SuppressIces { get; set; } + /// + /// Skip all ICEs. + /// bool SuppressValidation { get; set; } + /// + /// Skip creation of output. + /// bool SuppressLayout { get; set; } + /// + /// Cancellation token. + /// CancellationToken CancellationToken { get; set; } } } diff --git a/src/WixToolset.Extensibility/Data/ICommandLineContext.cs b/src/WixToolset.Extensibility/Data/ICommandLineContext.cs index fbaa84d1..d8c9469e 100644 --- a/src/WixToolset.Extensibility/Data/ICommandLineContext.cs +++ b/src/WixToolset.Extensibility/Data/ICommandLineContext.cs @@ -8,7 +8,7 @@ namespace WixToolset.Extensibility.Data #pragma warning disable 1591 // TODO: add documentation public interface ICommandLineContext { - IWixToolsetServiceProvider ServiceProvider { get; } + IServiceProvider ServiceProvider { get; } IExtensionManager ExtensionManager { get; set; } diff --git a/src/WixToolset.Extensibility/Data/ICompileContext.cs b/src/WixToolset.Extensibility/Data/ICompileContext.cs index 5da5ca84..a86fee1a 100644 --- a/src/WixToolset.Extensibility/Data/ICompileContext.cs +++ b/src/WixToolset.Extensibility/Data/ICompileContext.cs @@ -2,11 +2,11 @@ namespace WixToolset.Extensibility.Data { + using System; using System.Collections.Generic; using System.Threading; using System.Xml.Linq; using WixToolset.Data; - using WixToolset.Extensibility.Services; /// /// Context provided to the compiler. @@ -16,7 +16,7 @@ namespace WixToolset.Extensibility.Data /// /// Service provider made available to the compiler and its extensions. /// - IWixToolsetServiceProvider ServiceProvider { get; } + IServiceProvider ServiceProvider { get; } /// /// Unique identifier for the compilation. diff --git a/src/WixToolset.Extensibility/Data/IDecompileContext.cs b/src/WixToolset.Extensibility/Data/IDecompileContext.cs index f783a31e..63ed27d5 100644 --- a/src/WixToolset.Extensibility/Data/IDecompileContext.cs +++ b/src/WixToolset.Extensibility/Data/IDecompileContext.cs @@ -10,7 +10,7 @@ namespace WixToolset.Extensibility.Data #pragma warning disable 1591 // TODO: add documentation public interface IDecompileContext { - IWixToolsetServiceProvider ServiceProvider { get; } + IServiceProvider ServiceProvider { get; } string DecompilePath { get; set; } diff --git a/src/WixToolset.Extensibility/Data/IFileSystemContext.cs b/src/WixToolset.Extensibility/Data/IFileSystemContext.cs index 321fa83c..2e58059a 100644 --- a/src/WixToolset.Extensibility/Data/IFileSystemContext.cs +++ b/src/WixToolset.Extensibility/Data/IFileSystemContext.cs @@ -9,7 +9,7 @@ namespace WixToolset.Extensibility.Data #pragma warning disable 1591 // TODO: add documentation public interface IFileSystemContext { - IWixToolsetServiceProvider ServiceProvider { get; } + IServiceProvider ServiceProvider { get; } string CabCachePath { get; set; } diff --git a/src/WixToolset.Extensibility/Data/IInscribeContext.cs b/src/WixToolset.Extensibility/Data/IInscribeContext.cs index 79d4d1f5..31c66aad 100644 --- a/src/WixToolset.Extensibility/Data/IInscribeContext.cs +++ b/src/WixToolset.Extensibility/Data/IInscribeContext.cs @@ -8,7 +8,7 @@ namespace WixToolset.Extensibility.Data #pragma warning disable 1591 // TODO: add documentation public interface IInscribeContext { - IWixToolsetServiceProvider ServiceProvider { get; } + IServiceProvider ServiceProvider { get; } string InputFilePath { get; set; } diff --git a/src/WixToolset.Extensibility/Data/ILayoutContext.cs b/src/WixToolset.Extensibility/Data/ILayoutContext.cs index 89d61d5c..6b6c280a 100644 --- a/src/WixToolset.Extensibility/Data/ILayoutContext.cs +++ b/src/WixToolset.Extensibility/Data/ILayoutContext.cs @@ -2,14 +2,14 @@ namespace WixToolset.Extensibility.Data { + using System; using System.Collections.Generic; using System.Threading; - using WixToolset.Extensibility.Services; #pragma warning disable 1591 // TODO: add documentation public interface ILayoutContext { - IWixToolsetServiceProvider ServiceProvider { get; } + IServiceProvider ServiceProvider { get; } IEnumerable Extensions { get; set; } diff --git a/src/WixToolset.Extensibility/Data/ILibraryContext.cs b/src/WixToolset.Extensibility/Data/ILibraryContext.cs index 68a9faa9..d6359ffc 100644 --- a/src/WixToolset.Extensibility/Data/ILibraryContext.cs +++ b/src/WixToolset.Extensibility/Data/ILibraryContext.cs @@ -2,15 +2,15 @@ namespace WixToolset.Extensibility.Data { + using System; using System.Collections.Generic; using System.Threading; using WixToolset.Data; - using WixToolset.Extensibility.Services; #pragma warning disable 1591 // TODO: add documentation public interface ILibraryContext { - IWixToolsetServiceProvider ServiceProvider { get; } + IServiceProvider ServiceProvider { get; } bool BindFiles { get; set; } diff --git a/src/WixToolset.Extensibility/Data/ILinkContext.cs b/src/WixToolset.Extensibility/Data/ILinkContext.cs index c6c9cf7d..7524d18c 100644 --- a/src/WixToolset.Extensibility/Data/ILinkContext.cs +++ b/src/WixToolset.Extensibility/Data/ILinkContext.cs @@ -2,15 +2,15 @@ namespace WixToolset.Extensibility.Data { + using System; using System.Collections.Generic; using System.Threading; using WixToolset.Data; - using WixToolset.Extensibility.Services; #pragma warning disable 1591 // TODO: add documentation public interface ILinkContext { - IWixToolsetServiceProvider ServiceProvider { get; } + IServiceProvider ServiceProvider { get; } IEnumerable Extensions { get; set; } diff --git a/src/WixToolset.Extensibility/Data/IPreprocessContext.cs b/src/WixToolset.Extensibility/Data/IPreprocessContext.cs index b07fb81f..c6bdfe3a 100644 --- a/src/WixToolset.Extensibility/Data/IPreprocessContext.cs +++ b/src/WixToolset.Extensibility/Data/IPreprocessContext.cs @@ -2,15 +2,15 @@ namespace WixToolset.Extensibility.Data { + using System; using System.Collections.Generic; using System.Threading; using WixToolset.Data; - using WixToolset.Extensibility.Services; #pragma warning disable 1591 // TODO: add documentation public interface IPreprocessContext { - IWixToolsetServiceProvider ServiceProvider { get; } + IServiceProvider ServiceProvider { get; } IEnumerable Extensions { get; set; } diff --git a/src/WixToolset.Extensibility/Data/IResolveContext.cs b/src/WixToolset.Extensibility/Data/IResolveContext.cs index 2c775932..79191a15 100644 --- a/src/WixToolset.Extensibility/Data/IResolveContext.cs +++ b/src/WixToolset.Extensibility/Data/IResolveContext.cs @@ -2,15 +2,15 @@ namespace WixToolset.Extensibility.Data { + using System; using System.Collections.Generic; using System.Threading; using WixToolset.Data; - using WixToolset.Extensibility.Services; #pragma warning disable 1591 // TODO: add documentation public interface IResolveContext { - IWixToolsetServiceProvider ServiceProvider { get; } + IServiceProvider ServiceProvider { get; } IEnumerable BindPaths { get; set; } diff --git a/src/WixToolset.Extensibility/Data/IUnbindContext.cs b/src/WixToolset.Extensibility/Data/IUnbindContext.cs index faf77f5d..6427422f 100644 --- a/src/WixToolset.Extensibility/Data/IUnbindContext.cs +++ b/src/WixToolset.Extensibility/Data/IUnbindContext.cs @@ -3,12 +3,11 @@ namespace WixToolset.Extensibility.Data { using System; - using WixToolset.Extensibility.Services; #pragma warning disable 1591 // TODO: add documentation public interface IUnbindContext { - IWixToolsetServiceProvider ServiceProvider { get; } + IServiceProvider ServiceProvider { get; } string ExportBasePath { get; set; } diff --git a/src/WixToolset.Extensibility/Services/IWixToolsetServiceProvider.cs b/src/WixToolset.Extensibility/Services/IWixToolsetServiceProvider.cs deleted file mode 100644 index 0315f7ed..00000000 --- a/src/WixToolset.Extensibility/Services/IWixToolsetServiceProvider.cs +++ /dev/null @@ -1,34 +0,0 @@ -// 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. - -namespace WixToolset.Extensibility.Services -{ - using System; - - /// - /// Service provider. - /// - public interface IWixToolsetServiceProvider : IServiceProvider - { - /// - /// Gets a service from the service provider. - /// - /// Type of service to get. - T GetService() where T : class; - - /// - /// Gets a service from the service provider. - /// - /// Type of service to get. - /// Retrieved service. - /// True if the service was found, otherwise false - bool TryGetService(Type serviceType, out object service); - - /// - /// Gets a service from the service provider. - /// - /// Type of service to get. - /// Retrieved service. - /// True if the service was found, otherwise false - bool TryGetService(out T service) where T : class; - } -} diff --git a/src/WixToolset.Extensibility/Services/IWixtoolsetCoreServiceProvider.cs b/src/WixToolset.Extensibility/Services/IWixtoolsetCoreServiceProvider.cs index 2d0450dc..f5fb28fb 100644 --- a/src/WixToolset.Extensibility/Services/IWixtoolsetCoreServiceProvider.cs +++ b/src/WixToolset.Extensibility/Services/IWixtoolsetCoreServiceProvider.cs @@ -8,7 +8,7 @@ namespace WixToolset.Extensibility.Services /// /// The core of the service provider used to add services to the service provider. /// - public interface IWixToolsetCoreServiceProvider : IWixToolsetServiceProvider + public interface IWixToolsetCoreServiceProvider : IServiceProvider { /// /// Adds a service to the service locator. diff --git a/src/WixToolset.Extensibility/Services/ServiceProviderExtensions.cs b/src/WixToolset.Extensibility/Services/ServiceProviderExtensions.cs new file mode 100644 index 00000000..68484d09 --- /dev/null +++ b/src/WixToolset.Extensibility/Services/ServiceProviderExtensions.cs @@ -0,0 +1,48 @@ +// 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. + +namespace WixToolset.Extensibility.Services +{ + using System; + + /// + /// Service provider extensions. + /// + public static class ServiceProviderExtensions + { + /// + /// Gets a service from the service provider. + /// + /// Type of service to get. + /// Service provider. + public static T GetService(this IServiceProvider provider) where T : class + { + return provider.GetService(typeof(T)) as T; + } + + /// + /// Gets a service from the service provider. + /// + /// Service provider. + /// Type of service to get. + /// Retrieved service. + /// True if the service was found, otherwise false + public static bool TryGetService(this IServiceProvider provider, Type serviceType, out object service) + { + service = provider.GetService(serviceType); + return service != null; + } + + /// + /// Gets a service from the service provider. + /// + /// Type of service to get. + /// Service provider. + /// Retrieved service. + /// True if the service was found, otherwise false + public static bool TryGetService(this IServiceProvider provider, out T service) where T : class + { + service = provider.GetService(typeof(T)) as T; + return service != null; + } + } +} -- cgit v1.2.3-55-g6feb From 2d064ab1c2c33685d0ea9ef6e702ff8100f4dade Mon Sep 17 00:00:00 2001 From: Rob Mensching Date: Tue, 16 Mar 2021 14:39:02 -0700 Subject: Add method to disallow inner text Part of wixtoolset/issues#6237 --- src/WixToolset.Extensibility/Services/IParseHelper.cs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/WixToolset.Extensibility/Services/IParseHelper.cs b/src/WixToolset.Extensibility/Services/IParseHelper.cs index 83c66540..fbe5aae4 100644 --- a/src/WixToolset.Extensibility/Services/IParseHelper.cs +++ b/src/WixToolset.Extensibility/Services/IParseHelper.cs @@ -356,6 +356,12 @@ namespace WixToolset.Extensibility.Services [Obsolete] string GetTrimmedInnerText(XElement element); + /// + /// Validates that the element does not contain inner text. + /// + /// Element to check for inner text. + void InnerTextDisallowed(XElement element); + /// /// Verifies that a value is a legal identifier. /// -- cgit v1.2.3-55-g6feb From 6c58ee03306e50e44c6a7f57a991da9572811c49 Mon Sep 17 00:00:00 2001 From: Rob Mensching Date: Tue, 16 Mar 2021 16:10:25 -0700 Subject: Make ResetAcl opt-in instead of opt-out --- .../Data/ILayoutContext.cs | 36 ++++++++++++++++++++-- 1 file changed, 34 insertions(+), 2 deletions(-) diff --git a/src/WixToolset.Extensibility/Data/ILayoutContext.cs b/src/WixToolset.Extensibility/Data/ILayoutContext.cs index 6b6c280a..3d49b877 100644 --- a/src/WixToolset.Extensibility/Data/ILayoutContext.cs +++ b/src/WixToolset.Extensibility/Data/ILayoutContext.cs @@ -6,27 +6,59 @@ namespace WixToolset.Extensibility.Data using System.Collections.Generic; using System.Threading; -#pragma warning disable 1591 // TODO: add documentation + /// + /// Context for laying out files. + /// public interface ILayoutContext { + /// + /// Service provider. + /// IServiceProvider ServiceProvider { get; } + /// + /// Extensions for use during layout. + /// IEnumerable Extensions { get; set; } + /// + /// Set of tracked of files created during processing to be cleaned up. + /// IEnumerable TrackedFiles { get; set; } + /// + /// Set of files to transfer. + /// IEnumerable FileTransfers { get; set; } + /// + /// File to capture list of content files. + /// string ContentsFile { get; set; } + /// + /// File to capture list of output files. + /// string OutputsFile { get; set; } + /// + /// Intermediate folder. + /// string IntermediateFolder { get; set; } + /// + /// List of built output files. + /// string BuiltOutputsFile { get; set; } - bool SuppressAclReset { get; set; } + /// + /// Reset ACLs on file transfers. + /// + bool ResetAcls { get; set; } + /// + /// Cancellation token. + /// CancellationToken CancellationToken { get; set; } } } -- cgit v1.2.3-55-g6feb From f85e509dcb6da33c22f45ee27eff428398bbacf2 Mon Sep 17 00:00:00 2001 From: Rob Mensching Date: Thu, 25 Mar 2021 21:59:47 -0700 Subject: Add XML doc to IVariableResolution --- .../Services/IVariableResolution.cs | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/WixToolset.Extensibility/Services/IVariableResolution.cs b/src/WixToolset.Extensibility/Services/IVariableResolution.cs index 82bacb31..adcec47f 100644 --- a/src/WixToolset.Extensibility/Services/IVariableResolution.cs +++ b/src/WixToolset.Extensibility/Services/IVariableResolution.cs @@ -2,15 +2,29 @@ namespace WixToolset.Extensibility.Services { -#pragma warning disable 1591 // TODO: add documentation + /// + /// Result when resolving a variable. + /// public interface IVariableResolution { + /// + /// Indicates if the value contains variables that cannot be resolved yet. + /// bool DelayedResolve { get; set; } + /// + /// Indicates whether a bind variables default value was used in the resolution. + /// bool IsDefault { get; set; } + /// + /// Indicates whether the resolution updated the value. + /// bool UpdatedValue { get; set; } + /// + /// The resolved value. + /// string Value { get; set; } } } -- cgit v1.2.3-55-g6feb From 4041669e1f3b3f094579e4f3368e6f57f46d7177 Mon Sep 17 00:00:00 2001 From: Rob Mensching Date: Fri, 2 Apr 2021 14:00:05 -0700 Subject: Add resolved codepage and LCID to bind context Plus some XML documentation updates. Contributes to wixtoolset/issues#5801 --- src/WixToolset.Extensibility/Data/IBindContext.cs | 20 +++++++++---- .../Data/IResolveContext.cs | 34 +++++++++++++++++++++- .../Data/IResolveResult.cs | 28 ++++++++++++++++-- 3 files changed, 74 insertions(+), 8 deletions(-) diff --git a/src/WixToolset.Extensibility/Data/IBindContext.cs b/src/WixToolset.Extensibility/Data/IBindContext.cs index ee165671..f1977c01 100644 --- a/src/WixToolset.Extensibility/Data/IBindContext.cs +++ b/src/WixToolset.Extensibility/Data/IBindContext.cs @@ -27,11 +27,6 @@ namespace WixToolset.Extensibility.Data /// string CabCachePath { get; set; } - /// - /// Codepage for result. - /// - int Codepage { get; set; } - /// /// Default compression level. /// @@ -87,6 +82,21 @@ namespace WixToolset.Extensibility.Data /// string PdbPath { get; set; } + /// + /// Codepage from resolve. + /// + int? ResolvedCodepage { get; set; } + + /// + /// Summary information codepage from resolve. + /// + int? ResolvedSummaryInformationCodepage { get; set; } + + /// + /// LCID from resolve. + /// + int? ResolvedLcid { get; set; } + /// /// Set of ICEs to skip. /// diff --git a/src/WixToolset.Extensibility/Data/IResolveContext.cs b/src/WixToolset.Extensibility/Data/IResolveContext.cs index 79191a15..6ab5b545 100644 --- a/src/WixToolset.Extensibility/Data/IResolveContext.cs +++ b/src/WixToolset.Extensibility/Data/IResolveContext.cs @@ -7,27 +7,59 @@ namespace WixToolset.Extensibility.Data using System.Threading; using WixToolset.Data; -#pragma warning disable 1591 // TODO: add documentation + /// + /// Context for resolve. + /// public interface IResolveContext { + /// + /// Service provider. + /// IServiceProvider ServiceProvider { get; } + /// + /// Bind paths used during resolution. + /// IEnumerable BindPaths { get; set; } + /// + /// Resolve extensions. + /// IEnumerable Extensions { get; set; } + /// + /// Extension data. + /// IEnumerable ExtensionData { get; set; } + /// + /// List of cultures to filter the localizations. + /// IEnumerable FilterCultures { get; set; } + /// + /// Intermediate folder. + /// string IntermediateFolder { get; set; } + /// + /// Intermediate to resolve. + /// Intermediate IntermediateRepresentation { get; set; } + /// + /// Localizations used to resolve. + /// IEnumerable Localizations { get; set; } + /// + /// Indicates whether to allow localization and bind variables to remain unresolved. + /// bool AllowUnresolvedVariables { get; set; } + /// + /// Cancellation token. + /// CancellationToken CancellationToken { get; set; } } } diff --git a/src/WixToolset.Extensibility/Data/IResolveResult.cs b/src/WixToolset.Extensibility/Data/IResolveResult.cs index 7c3403d4..abffb415 100644 --- a/src/WixToolset.Extensibility/Data/IResolveResult.cs +++ b/src/WixToolset.Extensibility/Data/IResolveResult.cs @@ -5,15 +5,39 @@ namespace WixToolset.Extensibility.Data using System.Collections.Generic; using WixToolset.Data; -#pragma warning disable 1591 // TODO: add documentation + /// + /// Result of resolving localization and bind variables. + /// public interface IResolveResult { - int Codepage { get; set; } + /// + /// Resolved codepage, if provided. + /// + int? Codepage { get; set; } + /// + /// Resolved summary information codepage, if provided. + /// + int? SummaryInformationCodepage { get; set; } + + /// + /// Resolved package language, if provided. + /// + int? PackageLcid { get; set; } + + /// + /// Fields still requiring resolution. + /// IEnumerable DelayedFields { get; set; } + /// + /// Files to extract from embedded .wixlibs. + /// IEnumerable ExpectedEmbeddedFiles { get; set; } + /// + /// Resolved intermediate. + /// Intermediate IntermediateRepresentation { get; set; } } } -- cgit v1.2.3-55-g6feb From a4c7643523a3fc79c2a79292d22487196ea388fb Mon Sep 17 00:00:00 2001 From: Rob Mensching Date: Mon, 19 Apr 2021 16:09:46 -0700 Subject: Prefer IReadOnlyCollection<> or IReadOnlyList<> over IEnumerable<> Part of wixtoolset/issues#6422 --- .../BaseBurnBackendBinderExtension.cs | 2 +- .../BaseExtensionCommandLine.cs | 4 +-- .../BaseExtensionFactory.cs | 2 +- .../BaseLibrarianExtension.cs | 2 +- .../BaseWindowsInstallerBackendBinderExtension.cs | 3 +- src/WixToolset.Extensibility/Data/IBindContext.cs | 12 ++++---- src/WixToolset.Extensibility/Data/IBindResult.cs | 17 ++++++++-- .../Data/ICompileContext.cs | 2 +- .../Data/IDecompileContext.cs | 2 +- .../Data/IDecompileResult.cs | 2 +- .../Data/ILayoutContext.cs | 6 ++-- .../Data/ILibraryContext.cs | 36 +++++++++++++++++++--- src/WixToolset.Extensibility/Data/ILinkContext.cs | 31 ++++++++++++++++--- .../Data/IPreprocessContext.cs | 29 +++++++++++++++-- .../Data/IPreprocessResult.cs | 12 ++++++-- .../Data/IResolveContext.cs | 10 +++--- .../Data/IResolveFileResult.cs | 12 ++++++-- .../Data/IResolveResult.cs | 4 +-- .../IExtensionCommandLine.cs | 2 +- .../IWindowsInstallerBackendBinderExtension.cs | 2 +- .../Services/IBackendHelper.cs | 2 +- .../Services/IExtensionManager.cs | 2 +- 22 files changed, 148 insertions(+), 48 deletions(-) diff --git a/src/WixToolset.Extensibility/BaseBurnBackendBinderExtension.cs b/src/WixToolset.Extensibility/BaseBurnBackendBinderExtension.cs index 3afc8678..da570af0 100644 --- a/src/WixToolset.Extensibility/BaseBurnBackendBinderExtension.cs +++ b/src/WixToolset.Extensibility/BaseBurnBackendBinderExtension.cs @@ -33,7 +33,7 @@ namespace WixToolset.Extensibility /// /// Optional symbol definitions. /// - protected virtual IEnumerable SymbolDefinitions => Enumerable.Empty(); + protected virtual IReadOnlyCollection SymbolDefinitions => Array.Empty(); /// /// See diff --git a/src/WixToolset.Extensibility/BaseExtensionCommandLine.cs b/src/WixToolset.Extensibility/BaseExtensionCommandLine.cs index 8a336e1b..c716ac7e 100644 --- a/src/WixToolset.Extensibility/BaseExtensionCommandLine.cs +++ b/src/WixToolset.Extensibility/BaseExtensionCommandLine.cs @@ -2,8 +2,8 @@ namespace WixToolset.Extensibility { + using System; using System.Collections.Generic; - using System.Linq; using WixToolset.Extensibility.Data; using WixToolset.Extensibility.Services; @@ -15,7 +15,7 @@ namespace WixToolset.Extensibility /// /// See /// - public virtual IEnumerable CommandLineSwitches => Enumerable.Empty(); + public virtual IReadOnlyCollection CommandLineSwitches => Array.Empty(); /// /// See diff --git a/src/WixToolset.Extensibility/BaseExtensionFactory.cs b/src/WixToolset.Extensibility/BaseExtensionFactory.cs index 2e21b51b..8b6dc566 100644 --- a/src/WixToolset.Extensibility/BaseExtensionFactory.cs +++ b/src/WixToolset.Extensibility/BaseExtensionFactory.cs @@ -15,7 +15,7 @@ namespace WixToolset.Extensibility /// /// The extension types of the WiX extension. /// - protected abstract IEnumerable ExtensionTypes { get; } + protected abstract IReadOnlyCollection ExtensionTypes { get; } /// /// See diff --git a/src/WixToolset.Extensibility/BaseLibrarianExtension.cs b/src/WixToolset.Extensibility/BaseLibrarianExtension.cs index 1f231ba6..cbc9e4ba 100644 --- a/src/WixToolset.Extensibility/BaseLibrarianExtension.cs +++ b/src/WixToolset.Extensibility/BaseLibrarianExtension.cs @@ -59,7 +59,7 @@ namespace WixToolset.Extensibility /// Optional resolved path to file. /// Optional collection of paths checked for the file. /// Resolved file result. - protected IResolveFileResult CreateResolveFileResult(string path = null, IEnumerable checkedPaths = null) + protected IResolveFileResult CreateResolveFileResult(string path = null, IReadOnlyCollection checkedPaths = null) { var result = this.Context.ServiceProvider.GetService(); result.Path = path; diff --git a/src/WixToolset.Extensibility/BaseWindowsInstallerBackendBinderExtension.cs b/src/WixToolset.Extensibility/BaseWindowsInstallerBackendBinderExtension.cs index 93d8a1df..ffff186b 100644 --- a/src/WixToolset.Extensibility/BaseWindowsInstallerBackendBinderExtension.cs +++ b/src/WixToolset.Extensibility/BaseWindowsInstallerBackendBinderExtension.cs @@ -2,6 +2,7 @@ namespace WixToolset.Extensibility { + using System; using System.Collections.Generic; using System.Linq; using WixToolset.Data; @@ -33,7 +34,7 @@ namespace WixToolset.Extensibility /// /// Optional table definitions. /// - public virtual IEnumerable TableDefinitions => Enumerable.Empty(); + public virtual IReadOnlyCollection TableDefinitions => Array.Empty(); /// /// Creates a resolved cabinet result. diff --git a/src/WixToolset.Extensibility/Data/IBindContext.cs b/src/WixToolset.Extensibility/Data/IBindContext.cs index f1977c01..d0c65683 100644 --- a/src/WixToolset.Extensibility/Data/IBindContext.cs +++ b/src/WixToolset.Extensibility/Data/IBindContext.cs @@ -35,27 +35,27 @@ namespace WixToolset.Extensibility.Data /// /// Delayed fields that need to be resolved again. /// - IEnumerable DelayedFields { get; set; } + IReadOnlyCollection DelayedFields { get; set; } /// /// Embedded files to extract. /// - IEnumerable ExpectedEmbeddedFiles { get; set; } + IReadOnlyCollection ExpectedEmbeddedFiles { get; set; } /// /// Binder extensions. /// - IEnumerable Extensions { get; set; } + IReadOnlyCollection Extensions { get; set; } /// /// File system extensions. /// - IEnumerable FileSystemExtensions { get; set; } + IReadOnlyCollection FileSystemExtensions { get; set; } /// /// Set of ICEs to execute. /// - IEnumerable Ices { get; set; } + IReadOnlyCollection Ices { get; set; } /// /// Intermedaite folder. @@ -100,7 +100,7 @@ namespace WixToolset.Extensibility.Data /// /// Set of ICEs to skip. /// - IEnumerable SuppressIces { get; set; } + IReadOnlyCollection SuppressIces { get; set; } /// /// Skip all ICEs. diff --git a/src/WixToolset.Extensibility/Data/IBindResult.cs b/src/WixToolset.Extensibility/Data/IBindResult.cs index 1654f24d..7fc52bd7 100644 --- a/src/WixToolset.Extensibility/Data/IBindResult.cs +++ b/src/WixToolset.Extensibility/Data/IBindResult.cs @@ -6,13 +6,24 @@ namespace WixToolset.Extensibility.Data using System.Collections.Generic; using WixToolset.Data; -#pragma warning disable 1591 // TODO: add documentation + /// + /// Result of bind operation. + /// public interface IBindResult : IDisposable { - IEnumerable FileTransfers { get; set; } + /// + /// Collection of file transfers to complete. + /// + IReadOnlyCollection FileTransfers { get; set; } - IEnumerable TrackedFiles { get; set; } + /// + /// Collection of files tracked during binding. + /// + IReadOnlyCollection TrackedFiles { get; set; } + /// + /// Ouput of binding. + /// WixOutput Wixout { get; set; } } } diff --git a/src/WixToolset.Extensibility/Data/ICompileContext.cs b/src/WixToolset.Extensibility/Data/ICompileContext.cs index a86fee1a..2ee8f2a1 100644 --- a/src/WixToolset.Extensibility/Data/ICompileContext.cs +++ b/src/WixToolset.Extensibility/Data/ICompileContext.cs @@ -26,7 +26,7 @@ namespace WixToolset.Extensibility.Data /// /// Set of extensions provided to the compiler. /// - IEnumerable Extensions { get; set; } + IReadOnlyCollection Extensions { get; set; } /// /// Gets or sets the platform which the compiler will use when defaulting 64-bit attributes and elements. diff --git a/src/WixToolset.Extensibility/Data/IDecompileContext.cs b/src/WixToolset.Extensibility/Data/IDecompileContext.cs index 63ed27d5..fe7d0465 100644 --- a/src/WixToolset.Extensibility/Data/IDecompileContext.cs +++ b/src/WixToolset.Extensibility/Data/IDecompileContext.cs @@ -16,7 +16,7 @@ namespace WixToolset.Extensibility.Data OutputType DecompileType { get; set; } - IEnumerable Extensions { get; set; } + IReadOnlyCollection Extensions { get; set; } string ExtractFolder { get; set; } diff --git a/src/WixToolset.Extensibility/Data/IDecompileResult.cs b/src/WixToolset.Extensibility/Data/IDecompileResult.cs index ad4d0841..cffd0976 100644 --- a/src/WixToolset.Extensibility/Data/IDecompileResult.cs +++ b/src/WixToolset.Extensibility/Data/IDecompileResult.cs @@ -11,7 +11,7 @@ namespace WixToolset.Extensibility.Data { XDocument Document { get; set; } - IEnumerable ExtractedFilePaths { get; set; } + IReadOnlyCollection ExtractedFilePaths { get; set; } Platform? Platform { get; set; } } diff --git a/src/WixToolset.Extensibility/Data/ILayoutContext.cs b/src/WixToolset.Extensibility/Data/ILayoutContext.cs index 3d49b877..b11b4d13 100644 --- a/src/WixToolset.Extensibility/Data/ILayoutContext.cs +++ b/src/WixToolset.Extensibility/Data/ILayoutContext.cs @@ -19,17 +19,17 @@ namespace WixToolset.Extensibility.Data /// /// Extensions for use during layout. /// - IEnumerable Extensions { get; set; } + IReadOnlyCollection Extensions { get; set; } /// /// Set of tracked of files created during processing to be cleaned up. /// - IEnumerable TrackedFiles { get; set; } + IReadOnlyCollection TrackedFiles { get; set; } /// /// Set of files to transfer. /// - IEnumerable FileTransfers { get; set; } + IReadOnlyCollection FileTransfers { get; set; } /// /// File to capture list of content files. diff --git a/src/WixToolset.Extensibility/Data/ILibraryContext.cs b/src/WixToolset.Extensibility/Data/ILibraryContext.cs index d6359ffc..208b6f73 100644 --- a/src/WixToolset.Extensibility/Data/ILibraryContext.cs +++ b/src/WixToolset.Extensibility/Data/ILibraryContext.cs @@ -7,23 +7,49 @@ namespace WixToolset.Extensibility.Data using System.Threading; using WixToolset.Data; -#pragma warning disable 1591 // TODO: add documentation + /// + /// Context provided during library creation operations. + /// public interface ILibraryContext { + /// + /// Service provider. + /// IServiceProvider ServiceProvider { get; } + /// + /// Indicates whether files should be bound into the library. + /// bool BindFiles { get; set; } - IEnumerable BindPaths { get; set; } + /// + /// Collection of bindpaths used to bind files. + /// + IReadOnlyCollection BindPaths { get; set; } - IEnumerable Extensions { get; set; } + /// + /// Collection of extensions used during creation of library. + /// + IReadOnlyCollection Extensions { get; set; } + /// + /// Identifier of the library. + /// string LibraryId { get; set; } - IEnumerable Localizations { get; set; } + /// + /// Collection of localization files to use in the library. + /// + IReadOnlyCollection Localizations { get; set; } - IEnumerable Intermediates { get; set; } + /// + /// Collection of intermediates to include in the library. + /// + IReadOnlyCollection Intermediates { get; set; } + /// + /// Cancellation token. + /// CancellationToken CancellationToken { get; set; } } } diff --git a/src/WixToolset.Extensibility/Data/ILinkContext.cs b/src/WixToolset.Extensibility/Data/ILinkContext.cs index 7524d18c..d56866f7 100644 --- a/src/WixToolset.Extensibility/Data/ILinkContext.cs +++ b/src/WixToolset.Extensibility/Data/ILinkContext.cs @@ -7,21 +7,44 @@ namespace WixToolset.Extensibility.Data using System.Threading; using WixToolset.Data; -#pragma warning disable 1591 // TODO: add documentation + /// + /// Context provided during linking. + /// public interface ILinkContext { + /// + /// Service provider. + /// IServiceProvider ServiceProvider { get; } - IEnumerable Extensions { get; set; } + /// + /// Collection of extensions to use during linking. + /// + IReadOnlyCollection Extensions { get; set; } - IEnumerable ExtensionData { get; set; } + /// + /// Collection of extension data to use during linking. + /// + IReadOnlyCollection ExtensionData { get; set; } + /// + /// Expected output type. + /// OutputType ExpectedOutputType { get; set; } - IEnumerable Intermediates { get; set; } + /// + /// Collection of intermediates to link. + /// + IReadOnlyCollection Intermediates { get; set; } + /// + /// Symbol definition creator used to load extension data. + /// ISymbolDefinitionCreator SymbolDefinitionCreator { get; set; } + /// + /// Cancellation token. + /// CancellationToken CancellationToken { get; set; } } } diff --git a/src/WixToolset.Extensibility/Data/IPreprocessContext.cs b/src/WixToolset.Extensibility/Data/IPreprocessContext.cs index c6bdfe3a..69057c33 100644 --- a/src/WixToolset.Extensibility/Data/IPreprocessContext.cs +++ b/src/WixToolset.Extensibility/Data/IPreprocessContext.cs @@ -7,14 +7,25 @@ namespace WixToolset.Extensibility.Data using System.Threading; using WixToolset.Data; -#pragma warning disable 1591 // TODO: add documentation + /// + /// Preprocessor context. + /// public interface IPreprocessContext { + /// + /// Service provider. + /// IServiceProvider ServiceProvider { get; } - IEnumerable Extensions { get; set; } + /// + /// Collection of extensions to use during preprocessing. + /// + IReadOnlyCollection Extensions { get; set; } - IEnumerable IncludeSearchPaths { get; set; } + /// + /// Collection of search paths to find include files. + /// + IReadOnlyCollection IncludeSearchPaths { get; set; } /// /// Gets the platform which the compiler will use when defaulting 64-bit attributes and elements. @@ -22,12 +33,24 @@ namespace WixToolset.Extensibility.Data /// The platform which the compiler will use when defaulting 64-bit attributes and elements. Platform Platform { get; set; } + /// + /// Path to the source file being preprocessed. + /// string SourcePath { get; set; } + /// + /// Collection of name/value pairs used as preprocessor variables. + /// IDictionary Variables { get; set; } + /// + /// Current source line number of the preprocessor. + /// SourceLineNumber CurrentSourceLineNumber { get; set; } + /// + /// Cancellation token. + /// CancellationToken CancellationToken { get; set; } } } diff --git a/src/WixToolset.Extensibility/Data/IPreprocessResult.cs b/src/WixToolset.Extensibility/Data/IPreprocessResult.cs index d46c8147..af224c1e 100644 --- a/src/WixToolset.Extensibility/Data/IPreprocessResult.cs +++ b/src/WixToolset.Extensibility/Data/IPreprocessResult.cs @@ -5,11 +5,19 @@ namespace WixToolset.Extensibility.Data using System.Collections.Generic; using System.Xml.Linq; -#pragma warning disable 1591 // TODO: add documentation + /// + /// Result of preprocessing. + /// public interface IPreprocessResult { + /// + /// Document result of preprocessor. + /// XDocument Document { get; set; } - IEnumerable IncludedFiles { get; set; } + /// + /// Collection of files included during preprocessing. + /// + IReadOnlyCollection IncludedFiles { get; set; } } } diff --git a/src/WixToolset.Extensibility/Data/IResolveContext.cs b/src/WixToolset.Extensibility/Data/IResolveContext.cs index 6ab5b545..63159ccb 100644 --- a/src/WixToolset.Extensibility/Data/IResolveContext.cs +++ b/src/WixToolset.Extensibility/Data/IResolveContext.cs @@ -20,22 +20,22 @@ namespace WixToolset.Extensibility.Data /// /// Bind paths used during resolution. /// - IEnumerable BindPaths { get; set; } + IReadOnlyCollection BindPaths { get; set; } /// /// Resolve extensions. /// - IEnumerable Extensions { get; set; } + IReadOnlyCollection Extensions { get; set; } /// /// Extension data. /// - IEnumerable ExtensionData { get; set; } + IReadOnlyCollection ExtensionData { get; set; } /// /// List of cultures to filter the localizations. /// - IEnumerable FilterCultures { get; set; } + IReadOnlyCollection FilterCultures { get; set; } /// /// Intermediate folder. @@ -50,7 +50,7 @@ namespace WixToolset.Extensibility.Data /// /// Localizations used to resolve. /// - IEnumerable Localizations { get; set; } + IReadOnlyCollection Localizations { get; set; } /// /// Indicates whether to allow localization and bind variables to remain unresolved. diff --git a/src/WixToolset.Extensibility/Data/IResolveFileResult.cs b/src/WixToolset.Extensibility/Data/IResolveFileResult.cs index c8dca81a..2f0df96c 100644 --- a/src/WixToolset.Extensibility/Data/IResolveFileResult.cs +++ b/src/WixToolset.Extensibility/Data/IResolveFileResult.cs @@ -4,11 +4,19 @@ namespace WixToolset.Extensibility.Data { using System.Collections.Generic; -#pragma warning disable 1591 // TODO: add documentation + /// + /// Result of resolving a file. + /// public interface IResolveFileResult { - IEnumerable CheckedPaths { get; set; } + /// + /// Collection of paths checked to find file. + /// + IReadOnlyCollection CheckedPaths { get; set; } + /// + /// Path to found file, if found. + /// string Path { get; set; } } } diff --git a/src/WixToolset.Extensibility/Data/IResolveResult.cs b/src/WixToolset.Extensibility/Data/IResolveResult.cs index abffb415..0c5e0ccf 100644 --- a/src/WixToolset.Extensibility/Data/IResolveResult.cs +++ b/src/WixToolset.Extensibility/Data/IResolveResult.cs @@ -28,12 +28,12 @@ namespace WixToolset.Extensibility.Data /// /// Fields still requiring resolution. /// - IEnumerable DelayedFields { get; set; } + IReadOnlyCollection DelayedFields { get; set; } /// /// Files to extract from embedded .wixlibs. /// - IEnumerable ExpectedEmbeddedFiles { get; set; } + IReadOnlyCollection ExpectedEmbeddedFiles { get; set; } /// /// Resolved intermediate. diff --git a/src/WixToolset.Extensibility/IExtensionCommandLine.cs b/src/WixToolset.Extensibility/IExtensionCommandLine.cs index 2c7d0a7e..f7b19955 100644 --- a/src/WixToolset.Extensibility/IExtensionCommandLine.cs +++ b/src/WixToolset.Extensibility/IExtensionCommandLine.cs @@ -15,7 +15,7 @@ namespace WixToolset.Extensibility /// Gets the supported command line types for this extension. /// /// The supported command line types for this extension. - IEnumerable CommandLineSwitches { get; } + IReadOnlyCollection CommandLineSwitches { get; } /// /// Called before the command-line is parsed. diff --git a/src/WixToolset.Extensibility/IWindowsInstallerBackendBinderExtension.cs b/src/WixToolset.Extensibility/IWindowsInstallerBackendBinderExtension.cs index 12a38b9a..067745c2 100644 --- a/src/WixToolset.Extensibility/IWindowsInstallerBackendBinderExtension.cs +++ b/src/WixToolset.Extensibility/IWindowsInstallerBackendBinderExtension.cs @@ -16,7 +16,7 @@ namespace WixToolset.Extensibility /// /// Table definitions provided by the extension. /// - IEnumerable TableDefinitions { get; } + IReadOnlyCollection TableDefinitions { get; } /// /// Called before binding occurs. diff --git a/src/WixToolset.Extensibility/Services/IBackendHelper.cs b/src/WixToolset.Extensibility/Services/IBackendHelper.cs index ce3ddc89..5c4d9a68 100644 --- a/src/WixToolset.Extensibility/Services/IBackendHelper.cs +++ b/src/WixToolset.Extensibility/Services/IBackendHelper.cs @@ -72,7 +72,7 @@ namespace WixToolset.Extensibility.Services /// /// Embedded files to extract. /// ITrackedFile for each embedded file extracted. - IEnumerable ExtractEmbeddedFiles(IEnumerable embeddedFiles); + IReadOnlyList ExtractEmbeddedFiles(IEnumerable embeddedFiles); /// /// Generate an identifier by hashing data from the row. diff --git a/src/WixToolset.Extensibility/Services/IExtensionManager.cs b/src/WixToolset.Extensibility/Services/IExtensionManager.cs index a8087941..8e49c38d 100644 --- a/src/WixToolset.Extensibility/Services/IExtensionManager.cs +++ b/src/WixToolset.Extensibility/Services/IExtensionManager.cs @@ -37,6 +37,6 @@ namespace WixToolset.Extensibility.Services /// /// Type of extension to get. /// Extensions of the specified type. - IEnumerable GetServices() where T : class; + IReadOnlyCollection GetServices() where T : class; } } -- cgit v1.2.3-55-g6feb From f304c5eb86a1493139ec86eddd808f8ca53adf9d Mon Sep 17 00:00:00 2001 From: Sean Hall Date: Mon, 19 Apr 2021 23:15:54 -0500 Subject: Fix typo. --- src/WixToolset.Extensibility/Data/IBindResult.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/WixToolset.Extensibility/Data/IBindResult.cs b/src/WixToolset.Extensibility/Data/IBindResult.cs index 7fc52bd7..3738ef17 100644 --- a/src/WixToolset.Extensibility/Data/IBindResult.cs +++ b/src/WixToolset.Extensibility/Data/IBindResult.cs @@ -22,7 +22,7 @@ namespace WixToolset.Extensibility.Data IReadOnlyCollection TrackedFiles { get; set; } /// - /// Ouput of binding. + /// Output of binding. /// WixOutput Wixout { get; set; } } -- cgit v1.2.3-55-g6feb From 54d6c752a1dfbe70c0eb59241c74c89b9ca93290 Mon Sep 17 00:00:00 2001 From: Rob Mensching Date: Tue, 20 Apr 2021 02:23:52 -0700 Subject: Improve documentation --- src/WixToolset.Extensibility/IMessageListener.cs | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/src/WixToolset.Extensibility/IMessageListener.cs b/src/WixToolset.Extensibility/IMessageListener.cs index ea103538..a04e9c98 100644 --- a/src/WixToolset.Extensibility/IMessageListener.cs +++ b/src/WixToolset.Extensibility/IMessageListener.cs @@ -5,13 +5,30 @@ namespace WixToolset.Extensibility using WixToolset.Data; using WixToolset.Extensibility.Services; -#pragma warning disable 1591 // TODO: add documentation + /// + /// Message listener. + /// public interface IMessageListener { + /// + /// Calculate a new level for a message. + /// + /// Messaging object. + /// Message to evaluate. + /// Current message level. + /// MessageLevel CalculateMessageLevel(IMessaging messaging, Message message, MessageLevel defaultMessageLevel); + /// + /// Writes a message. + /// + /// Message to write. void Write(Message message); + /// + /// Writes a string message. + /// + /// String message to write. void Write(string message); } } -- cgit v1.2.3-55-g6feb From 679a1da6b60acd9dc992658ec53c41f6ae2fccdf Mon Sep 17 00:00:00 2001 From: Sean Hall Date: Sun, 25 Apr 2021 22:58:45 -0500 Subject: One shiny NuGet package, please and thank you. --- README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/README.md b/README.md index e7464013..003acd4d 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,2 @@ # Extensibility WixToolset.Extensibility - interfaces to extend the WiX Toolset - -- cgit v1.2.3-55-g6feb From 7417dc10c4cf9da821984cbe9930d93ed879962e Mon Sep 17 00:00:00 2001 From: Rob Mensching Date: Thu, 22 Apr 2021 06:14:17 -0700 Subject: Move Extensiblity into API/wix --- .editorconfig | 37 -- README.md | 2 - WixToolset.Extensibility.sln | 36 -- appveyor.cmd | 7 - appveyor.yml | 40 -- nuget.config | 9 - src/.editorconfig | 37 ++ src/CSharp.Build.props | 13 - src/Custom.Build.props | 6 - src/Directory.Build.props | 29 -- src/Directory.Build.targets | 56 --- src/WixToolset.Extensibility/AssemblyInfo.cs | 9 - .../BaseBinderExtension.cs | 47 --- .../BaseBurnBackendBinderExtension.cs | 94 ----- .../BaseCompilerExtension.cs | 87 ---- .../BaseExtensionCommandLine.cs | 51 --- src/WixToolset.Extensibility/BaseExtensionData.cs | 34 -- .../BaseExtensionFactory.cs | 39 -- .../BaseLayoutExtension.cs | 62 --- .../BaseLibrarianExtension.cs | 71 ---- .../BaseLinkerExtension.cs | 41 -- .../BasePreprocessorExtension.cs | 91 ---- .../BaseResolverExtension.cs | 59 --- .../BaseWindowsInstallerBackendBinderExtension.cs | 93 ---- src/WixToolset.Extensibility/CompilerConstants.cs | 42 -- src/WixToolset.Extensibility/Data/BindStage.cs | 25 -- src/WixToolset.Extensibility/Data/BurnPlatforms.cs | 25 -- .../Data/CabinetBuildOption.cs | 25 -- .../Data/CustomActionPlatforms.cs | 25 -- .../Data/ExtensionCommandLineSwitch.cs | 20 - src/WixToolset.Extensibility/Data/IBindContext.cs | 120 ------ .../Data/IBindFileWithPath.cs | 12 - src/WixToolset.Extensibility/Data/IBindPath.cs | 25 -- src/WixToolset.Extensibility/Data/IBindResult.cs | 29 -- .../Data/ICommandLineArguments.cs | 39 -- .../Data/ICommandLineCommand.cs | 39 -- .../Data/ICommandLineContext.cs | 17 - .../Data/ICompileContext.cs | 52 --- .../Data/IComponentKeyPath.cs | 14 - .../Data/IDecompileContext.cs | 59 --- .../Data/IDecompileResult.cs | 18 - src/WixToolset.Extensibility/Data/IDelayedField.cs | 14 - .../Data/IExpectedExtractFile.cs | 16 - src/WixToolset.Extensibility/Data/IFileFacade.cs | 126 ------ .../Data/IFileSystemContext.cs | 24 -- src/WixToolset.Extensibility/Data/IFileTransfer.cs | 27 -- src/WixToolset.Extensibility/Data/IIncludedFile.cs | 24 -- .../Data/IInscribeContext.cs | 21 - .../Data/ILayoutContext.cs | 64 --- .../Data/ILibraryContext.cs | 55 --- src/WixToolset.Extensibility/Data/ILinkContext.cs | 50 --- .../Data/IPreprocessContext.cs | 56 --- .../Data/IPreprocessResult.cs | 23 - .../Data/IResolveContext.cs | 65 --- .../Data/IResolveFileResult.cs | 22 - .../Data/IResolveResult.cs | 43 -- .../Data/IResolvedCabinet.cs | 12 - .../Data/IResolvedDirectory.cs | 19 - src/WixToolset.Extensibility/Data/ITrackedFile.cs | 32 -- .../Data/IUnbindContext.cs | 24 -- .../Data/PossibleKeyPathType.cs | 40 -- .../Data/TrackedFileType.cs | 33 -- .../DecompilerConstants.cs | 20 - .../DecompilerExtension.cs | 61 --- src/WixToolset.Extensibility/ExtensionHelper.cs | 55 --- src/WixToolset.Extensibility/IBackend.cs | 19 - src/WixToolset.Extensibility/IBackendFactory.cs | 10 - src/WixToolset.Extensibility/IBinderExtension.cs | 22 - .../IBurnBackendBinderExtension.cs | 64 --- src/WixToolset.Extensibility/ICompilerExtension.cs | 61 --- .../IDecompilerExtension.cs | 22 - .../IExtensionCommandLine.cs | 48 --- src/WixToolset.Extensibility/IExtensionData.cs | 33 -- src/WixToolset.Extensibility/IExtensionFactory.cs | 20 - .../IFileSystemExtension.cs | 17 - src/WixToolset.Extensibility/IInspectorCore.cs | 15 - .../IInspectorExtension.cs | 60 --- src/WixToolset.Extensibility/ILayoutExtension.cs | 28 -- .../ILibrarianExtension.cs | 17 - src/WixToolset.Extensibility/ILinkerExtension.cs | 23 - src/WixToolset.Extensibility/IMessageListener.cs | 34 -- .../IPreprocessorExtension.cs | 57 --- src/WixToolset.Extensibility/IResolverExtension.cs | 28 -- src/WixToolset.Extensibility/IUnbinderExtension.cs | 18 - .../IWindowsInstallerBackendBinderExtension.cs | 65 --- .../IWindowsInstallerBackendDecompilerExtension.cs | 26 -- src/WixToolset.Extensibility/InspectorExtension.cs | 63 --- .../Services/IBackendHelper.cs | 183 -------- .../Services/IBurnBackendHelper.cs | 50 --- .../Services/ICommandLine.cs | 33 -- .../Services/ICommandLineParser.cs | 40 -- .../Services/IExtensionManager.cs | 42 -- .../Services/IMessaging.cs | 73 ---- .../Services/IParseHelper.cs | 466 --------------------- .../Services/IPathResolver.cs | 43 -- .../Services/IPreprocessHelper.cs | 90 ---- .../Services/IVariableResolution.cs | 30 -- .../Services/IVariableResolver.cs | 48 --- .../Services/IWindowsInstallerBackendHelper.cs | 35 -- .../Services/IWixBranding.cs | 26 -- .../Services/IWixtoolsetCoreServiceProvider.cs | 34 -- .../Services/ServiceProviderExtensions.cs | 48 --- .../WixToolset.Extensibility.csproj | 23 - .../WixToolset.Extensibility.v3.ncrunchproject | 7 - src/api/wix/CSharp.Build.props | 13 + src/api/wix/Custom.Build.props | 6 + src/api/wix/Directory.Build.props | 29 ++ src/api/wix/Directory.Build.targets | 56 +++ src/api/wix/README-Extensibility.md | 2 + src/api/wix/WixToolset.Extensibility.sln | 36 ++ .../wix/WixToolset.Extensibility/AssemblyInfo.cs | 9 + .../BaseBinderExtension.cs | 47 +++ .../BaseBurnBackendBinderExtension.cs | 94 +++++ .../BaseCompilerExtension.cs | 87 ++++ .../BaseExtensionCommandLine.cs | 51 +++ .../WixToolset.Extensibility/BaseExtensionData.cs | 34 ++ .../BaseExtensionFactory.cs | 39 ++ .../BaseLayoutExtension.cs | 62 +++ .../BaseLibrarianExtension.cs | 71 ++++ .../BaseLinkerExtension.cs | 41 ++ .../BasePreprocessorExtension.cs | 91 ++++ .../BaseResolverExtension.cs | 59 +++ .../BaseWindowsInstallerBackendBinderExtension.cs | 93 ++++ .../WixToolset.Extensibility/CompilerConstants.cs | 42 ++ .../wix/WixToolset.Extensibility/Data/BindStage.cs | 25 ++ .../WixToolset.Extensibility/Data/BurnPlatforms.cs | 25 ++ .../Data/CabinetBuildOption.cs | 25 ++ .../Data/CustomActionPlatforms.cs | 25 ++ .../Data/ExtensionCommandLineSwitch.cs | 20 + .../WixToolset.Extensibility/Data/IBindContext.cs | 120 ++++++ .../Data/IBindFileWithPath.cs | 12 + .../wix/WixToolset.Extensibility/Data/IBindPath.cs | 25 ++ .../WixToolset.Extensibility/Data/IBindResult.cs | 29 ++ .../Data/ICommandLineArguments.cs | 39 ++ .../Data/ICommandLineCommand.cs | 39 ++ .../Data/ICommandLineContext.cs | 17 + .../Data/ICompileContext.cs | 52 +++ .../Data/IComponentKeyPath.cs | 14 + .../Data/IDecompileContext.cs | 59 +++ .../Data/IDecompileResult.cs | 18 + .../WixToolset.Extensibility/Data/IDelayedField.cs | 14 + .../Data/IExpectedExtractFile.cs | 16 + .../WixToolset.Extensibility/Data/IFileFacade.cs | 126 ++++++ .../Data/IFileSystemContext.cs | 24 ++ .../WixToolset.Extensibility/Data/IFileTransfer.cs | 27 ++ .../WixToolset.Extensibility/Data/IIncludedFile.cs | 24 ++ .../Data/IInscribeContext.cs | 21 + .../Data/ILayoutContext.cs | 64 +++ .../Data/ILibraryContext.cs | 55 +++ .../WixToolset.Extensibility/Data/ILinkContext.cs | 50 +++ .../Data/IPreprocessContext.cs | 56 +++ .../Data/IPreprocessResult.cs | 23 + .../Data/IResolveContext.cs | 65 +++ .../Data/IResolveFileResult.cs | 22 + .../Data/IResolveResult.cs | 43 ++ .../Data/IResolvedCabinet.cs | 12 + .../Data/IResolvedDirectory.cs | 19 + .../WixToolset.Extensibility/Data/ITrackedFile.cs | 32 ++ .../Data/IUnbindContext.cs | 24 ++ .../Data/PossibleKeyPathType.cs | 40 ++ .../Data/TrackedFileType.cs | 33 ++ .../DecompilerConstants.cs | 20 + .../DecompilerExtension.cs | 61 +++ .../WixToolset.Extensibility/ExtensionHelper.cs | 55 +++ src/api/wix/WixToolset.Extensibility/IBackend.cs | 19 + .../WixToolset.Extensibility/IBackendFactory.cs | 10 + .../WixToolset.Extensibility/IBinderExtension.cs | 22 + .../IBurnBackendBinderExtension.cs | 64 +++ .../WixToolset.Extensibility/ICompilerExtension.cs | 61 +++ .../IDecompilerExtension.cs | 22 + .../IExtensionCommandLine.cs | 48 +++ .../wix/WixToolset.Extensibility/IExtensionData.cs | 33 ++ .../WixToolset.Extensibility/IExtensionFactory.cs | 20 + .../IFileSystemExtension.cs | 17 + .../wix/WixToolset.Extensibility/IInspectorCore.cs | 15 + .../IInspectorExtension.cs | 60 +++ .../WixToolset.Extensibility/ILayoutExtension.cs | 28 ++ .../ILibrarianExtension.cs | 17 + .../WixToolset.Extensibility/ILinkerExtension.cs | 23 + .../WixToolset.Extensibility/IMessageListener.cs | 34 ++ .../IPreprocessorExtension.cs | 57 +++ .../WixToolset.Extensibility/IResolverExtension.cs | 28 ++ .../WixToolset.Extensibility/IUnbinderExtension.cs | 18 + .../IWindowsInstallerBackendBinderExtension.cs | 65 +++ .../IWindowsInstallerBackendDecompilerExtension.cs | 26 ++ .../WixToolset.Extensibility/InspectorExtension.cs | 63 +++ .../Services/IBackendHelper.cs | 183 ++++++++ .../Services/IBurnBackendHelper.cs | 50 +++ .../Services/ICommandLine.cs | 33 ++ .../Services/ICommandLineParser.cs | 40 ++ .../Services/IExtensionManager.cs | 42 ++ .../Services/IMessaging.cs | 73 ++++ .../Services/IParseHelper.cs | 466 +++++++++++++++++++++ .../Services/IPathResolver.cs | 43 ++ .../Services/IPreprocessHelper.cs | 90 ++++ .../Services/IVariableResolution.cs | 30 ++ .../Services/IVariableResolver.cs | 48 +++ .../Services/IWindowsInstallerBackendHelper.cs | 35 ++ .../Services/IWixBranding.cs | 26 ++ .../Services/IWixtoolsetCoreServiceProvider.cs | 34 ++ .../Services/ServiceProviderExtensions.cs | 48 +++ .../WixToolset.Extensibility.csproj | 23 + .../WixToolset.Extensibility.v3.ncrunchproject | 7 + src/api/wix/appveyor-Extensibility.cmd | 7 + src/api/wix/appveyor-Extensibility.yml | 40 ++ src/api/wix/nuget-Extensibility.config | 9 + src/version.json | 11 + version.json | 11 - 208 files changed, 4557 insertions(+), 4557 deletions(-) delete mode 100644 .editorconfig delete mode 100644 README.md delete mode 100644 WixToolset.Extensibility.sln delete mode 100644 appveyor.cmd delete mode 100644 appveyor.yml delete mode 100644 nuget.config create mode 100644 src/.editorconfig delete mode 100644 src/CSharp.Build.props delete mode 100644 src/Custom.Build.props delete mode 100644 src/Directory.Build.props delete mode 100644 src/Directory.Build.targets delete mode 100644 src/WixToolset.Extensibility/AssemblyInfo.cs delete mode 100644 src/WixToolset.Extensibility/BaseBinderExtension.cs delete mode 100644 src/WixToolset.Extensibility/BaseBurnBackendBinderExtension.cs delete mode 100644 src/WixToolset.Extensibility/BaseCompilerExtension.cs delete mode 100644 src/WixToolset.Extensibility/BaseExtensionCommandLine.cs delete mode 100644 src/WixToolset.Extensibility/BaseExtensionData.cs delete mode 100644 src/WixToolset.Extensibility/BaseExtensionFactory.cs delete mode 100644 src/WixToolset.Extensibility/BaseLayoutExtension.cs delete mode 100644 src/WixToolset.Extensibility/BaseLibrarianExtension.cs delete mode 100644 src/WixToolset.Extensibility/BaseLinkerExtension.cs delete mode 100644 src/WixToolset.Extensibility/BasePreprocessorExtension.cs delete mode 100644 src/WixToolset.Extensibility/BaseResolverExtension.cs delete mode 100644 src/WixToolset.Extensibility/BaseWindowsInstallerBackendBinderExtension.cs delete mode 100644 src/WixToolset.Extensibility/CompilerConstants.cs delete mode 100644 src/WixToolset.Extensibility/Data/BindStage.cs delete mode 100644 src/WixToolset.Extensibility/Data/BurnPlatforms.cs delete mode 100644 src/WixToolset.Extensibility/Data/CabinetBuildOption.cs delete mode 100644 src/WixToolset.Extensibility/Data/CustomActionPlatforms.cs delete mode 100644 src/WixToolset.Extensibility/Data/ExtensionCommandLineSwitch.cs delete mode 100644 src/WixToolset.Extensibility/Data/IBindContext.cs delete mode 100644 src/WixToolset.Extensibility/Data/IBindFileWithPath.cs delete mode 100644 src/WixToolset.Extensibility/Data/IBindPath.cs delete mode 100644 src/WixToolset.Extensibility/Data/IBindResult.cs delete mode 100644 src/WixToolset.Extensibility/Data/ICommandLineArguments.cs delete mode 100644 src/WixToolset.Extensibility/Data/ICommandLineCommand.cs delete mode 100644 src/WixToolset.Extensibility/Data/ICommandLineContext.cs delete mode 100644 src/WixToolset.Extensibility/Data/ICompileContext.cs delete mode 100644 src/WixToolset.Extensibility/Data/IComponentKeyPath.cs delete mode 100644 src/WixToolset.Extensibility/Data/IDecompileContext.cs delete mode 100644 src/WixToolset.Extensibility/Data/IDecompileResult.cs delete mode 100644 src/WixToolset.Extensibility/Data/IDelayedField.cs delete mode 100644 src/WixToolset.Extensibility/Data/IExpectedExtractFile.cs delete mode 100644 src/WixToolset.Extensibility/Data/IFileFacade.cs delete mode 100644 src/WixToolset.Extensibility/Data/IFileSystemContext.cs delete mode 100644 src/WixToolset.Extensibility/Data/IFileTransfer.cs delete mode 100644 src/WixToolset.Extensibility/Data/IIncludedFile.cs delete mode 100644 src/WixToolset.Extensibility/Data/IInscribeContext.cs delete mode 100644 src/WixToolset.Extensibility/Data/ILayoutContext.cs delete mode 100644 src/WixToolset.Extensibility/Data/ILibraryContext.cs delete mode 100644 src/WixToolset.Extensibility/Data/ILinkContext.cs delete mode 100644 src/WixToolset.Extensibility/Data/IPreprocessContext.cs delete mode 100644 src/WixToolset.Extensibility/Data/IPreprocessResult.cs delete mode 100644 src/WixToolset.Extensibility/Data/IResolveContext.cs delete mode 100644 src/WixToolset.Extensibility/Data/IResolveFileResult.cs delete mode 100644 src/WixToolset.Extensibility/Data/IResolveResult.cs delete mode 100644 src/WixToolset.Extensibility/Data/IResolvedCabinet.cs delete mode 100644 src/WixToolset.Extensibility/Data/IResolvedDirectory.cs delete mode 100644 src/WixToolset.Extensibility/Data/ITrackedFile.cs delete mode 100644 src/WixToolset.Extensibility/Data/IUnbindContext.cs delete mode 100644 src/WixToolset.Extensibility/Data/PossibleKeyPathType.cs delete mode 100644 src/WixToolset.Extensibility/Data/TrackedFileType.cs delete mode 100644 src/WixToolset.Extensibility/DecompilerConstants.cs delete mode 100644 src/WixToolset.Extensibility/DecompilerExtension.cs delete mode 100644 src/WixToolset.Extensibility/ExtensionHelper.cs delete mode 100644 src/WixToolset.Extensibility/IBackend.cs delete mode 100644 src/WixToolset.Extensibility/IBackendFactory.cs delete mode 100644 src/WixToolset.Extensibility/IBinderExtension.cs delete mode 100644 src/WixToolset.Extensibility/IBurnBackendBinderExtension.cs delete mode 100644 src/WixToolset.Extensibility/ICompilerExtension.cs delete mode 100644 src/WixToolset.Extensibility/IDecompilerExtension.cs delete mode 100644 src/WixToolset.Extensibility/IExtensionCommandLine.cs delete mode 100644 src/WixToolset.Extensibility/IExtensionData.cs delete mode 100644 src/WixToolset.Extensibility/IExtensionFactory.cs delete mode 100644 src/WixToolset.Extensibility/IFileSystemExtension.cs delete mode 100644 src/WixToolset.Extensibility/IInspectorCore.cs delete mode 100644 src/WixToolset.Extensibility/IInspectorExtension.cs delete mode 100644 src/WixToolset.Extensibility/ILayoutExtension.cs delete mode 100644 src/WixToolset.Extensibility/ILibrarianExtension.cs delete mode 100644 src/WixToolset.Extensibility/ILinkerExtension.cs delete mode 100644 src/WixToolset.Extensibility/IMessageListener.cs delete mode 100644 src/WixToolset.Extensibility/IPreprocessorExtension.cs delete mode 100644 src/WixToolset.Extensibility/IResolverExtension.cs delete mode 100644 src/WixToolset.Extensibility/IUnbinderExtension.cs delete mode 100644 src/WixToolset.Extensibility/IWindowsInstallerBackendBinderExtension.cs delete mode 100644 src/WixToolset.Extensibility/IWindowsInstallerBackendDecompilerExtension.cs delete mode 100644 src/WixToolset.Extensibility/InspectorExtension.cs delete mode 100644 src/WixToolset.Extensibility/Services/IBackendHelper.cs delete mode 100644 src/WixToolset.Extensibility/Services/IBurnBackendHelper.cs delete mode 100644 src/WixToolset.Extensibility/Services/ICommandLine.cs delete mode 100644 src/WixToolset.Extensibility/Services/ICommandLineParser.cs delete mode 100644 src/WixToolset.Extensibility/Services/IExtensionManager.cs delete mode 100644 src/WixToolset.Extensibility/Services/IMessaging.cs delete mode 100644 src/WixToolset.Extensibility/Services/IParseHelper.cs delete mode 100644 src/WixToolset.Extensibility/Services/IPathResolver.cs delete mode 100644 src/WixToolset.Extensibility/Services/IPreprocessHelper.cs delete mode 100644 src/WixToolset.Extensibility/Services/IVariableResolution.cs delete mode 100644 src/WixToolset.Extensibility/Services/IVariableResolver.cs delete mode 100644 src/WixToolset.Extensibility/Services/IWindowsInstallerBackendHelper.cs delete mode 100644 src/WixToolset.Extensibility/Services/IWixBranding.cs delete mode 100644 src/WixToolset.Extensibility/Services/IWixtoolsetCoreServiceProvider.cs delete mode 100644 src/WixToolset.Extensibility/Services/ServiceProviderExtensions.cs delete mode 100644 src/WixToolset.Extensibility/WixToolset.Extensibility.csproj delete mode 100644 src/WixToolset.Extensibility/WixToolset.Extensibility.v3.ncrunchproject create mode 100644 src/api/wix/CSharp.Build.props create mode 100644 src/api/wix/Custom.Build.props create mode 100644 src/api/wix/Directory.Build.props create mode 100644 src/api/wix/Directory.Build.targets create mode 100644 src/api/wix/README-Extensibility.md create mode 100644 src/api/wix/WixToolset.Extensibility.sln create mode 100644 src/api/wix/WixToolset.Extensibility/AssemblyInfo.cs create mode 100644 src/api/wix/WixToolset.Extensibility/BaseBinderExtension.cs create mode 100644 src/api/wix/WixToolset.Extensibility/BaseBurnBackendBinderExtension.cs create mode 100644 src/api/wix/WixToolset.Extensibility/BaseCompilerExtension.cs create mode 100644 src/api/wix/WixToolset.Extensibility/BaseExtensionCommandLine.cs create mode 100644 src/api/wix/WixToolset.Extensibility/BaseExtensionData.cs create mode 100644 src/api/wix/WixToolset.Extensibility/BaseExtensionFactory.cs create mode 100644 src/api/wix/WixToolset.Extensibility/BaseLayoutExtension.cs create mode 100644 src/api/wix/WixToolset.Extensibility/BaseLibrarianExtension.cs create mode 100644 src/api/wix/WixToolset.Extensibility/BaseLinkerExtension.cs create mode 100644 src/api/wix/WixToolset.Extensibility/BasePreprocessorExtension.cs create mode 100644 src/api/wix/WixToolset.Extensibility/BaseResolverExtension.cs create mode 100644 src/api/wix/WixToolset.Extensibility/BaseWindowsInstallerBackendBinderExtension.cs create mode 100644 src/api/wix/WixToolset.Extensibility/CompilerConstants.cs create mode 100644 src/api/wix/WixToolset.Extensibility/Data/BindStage.cs create mode 100644 src/api/wix/WixToolset.Extensibility/Data/BurnPlatforms.cs create mode 100644 src/api/wix/WixToolset.Extensibility/Data/CabinetBuildOption.cs create mode 100644 src/api/wix/WixToolset.Extensibility/Data/CustomActionPlatforms.cs create mode 100644 src/api/wix/WixToolset.Extensibility/Data/ExtensionCommandLineSwitch.cs create mode 100644 src/api/wix/WixToolset.Extensibility/Data/IBindContext.cs create mode 100644 src/api/wix/WixToolset.Extensibility/Data/IBindFileWithPath.cs create mode 100644 src/api/wix/WixToolset.Extensibility/Data/IBindPath.cs create mode 100644 src/api/wix/WixToolset.Extensibility/Data/IBindResult.cs create mode 100644 src/api/wix/WixToolset.Extensibility/Data/ICommandLineArguments.cs create mode 100644 src/api/wix/WixToolset.Extensibility/Data/ICommandLineCommand.cs create mode 100644 src/api/wix/WixToolset.Extensibility/Data/ICommandLineContext.cs create mode 100644 src/api/wix/WixToolset.Extensibility/Data/ICompileContext.cs create mode 100644 src/api/wix/WixToolset.Extensibility/Data/IComponentKeyPath.cs create mode 100644 src/api/wix/WixToolset.Extensibility/Data/IDecompileContext.cs create mode 100644 src/api/wix/WixToolset.Extensibility/Data/IDecompileResult.cs create mode 100644 src/api/wix/WixToolset.Extensibility/Data/IDelayedField.cs create mode 100644 src/api/wix/WixToolset.Extensibility/Data/IExpectedExtractFile.cs create mode 100644 src/api/wix/WixToolset.Extensibility/Data/IFileFacade.cs create mode 100644 src/api/wix/WixToolset.Extensibility/Data/IFileSystemContext.cs create mode 100644 src/api/wix/WixToolset.Extensibility/Data/IFileTransfer.cs create mode 100644 src/api/wix/WixToolset.Extensibility/Data/IIncludedFile.cs create mode 100644 src/api/wix/WixToolset.Extensibility/Data/IInscribeContext.cs create mode 100644 src/api/wix/WixToolset.Extensibility/Data/ILayoutContext.cs create mode 100644 src/api/wix/WixToolset.Extensibility/Data/ILibraryContext.cs create mode 100644 src/api/wix/WixToolset.Extensibility/Data/ILinkContext.cs create mode 100644 src/api/wix/WixToolset.Extensibility/Data/IPreprocessContext.cs create mode 100644 src/api/wix/WixToolset.Extensibility/Data/IPreprocessResult.cs create mode 100644 src/api/wix/WixToolset.Extensibility/Data/IResolveContext.cs create mode 100644 src/api/wix/WixToolset.Extensibility/Data/IResolveFileResult.cs create mode 100644 src/api/wix/WixToolset.Extensibility/Data/IResolveResult.cs create mode 100644 src/api/wix/WixToolset.Extensibility/Data/IResolvedCabinet.cs create mode 100644 src/api/wix/WixToolset.Extensibility/Data/IResolvedDirectory.cs create mode 100644 src/api/wix/WixToolset.Extensibility/Data/ITrackedFile.cs create mode 100644 src/api/wix/WixToolset.Extensibility/Data/IUnbindContext.cs create mode 100644 src/api/wix/WixToolset.Extensibility/Data/PossibleKeyPathType.cs create mode 100644 src/api/wix/WixToolset.Extensibility/Data/TrackedFileType.cs create mode 100644 src/api/wix/WixToolset.Extensibility/DecompilerConstants.cs create mode 100644 src/api/wix/WixToolset.Extensibility/DecompilerExtension.cs create mode 100644 src/api/wix/WixToolset.Extensibility/ExtensionHelper.cs create mode 100644 src/api/wix/WixToolset.Extensibility/IBackend.cs create mode 100644 src/api/wix/WixToolset.Extensibility/IBackendFactory.cs create mode 100644 src/api/wix/WixToolset.Extensibility/IBinderExtension.cs create mode 100644 src/api/wix/WixToolset.Extensibility/IBurnBackendBinderExtension.cs create mode 100644 src/api/wix/WixToolset.Extensibility/ICompilerExtension.cs create mode 100644 src/api/wix/WixToolset.Extensibility/IDecompilerExtension.cs create mode 100644 src/api/wix/WixToolset.Extensibility/IExtensionCommandLine.cs create mode 100644 src/api/wix/WixToolset.Extensibility/IExtensionData.cs create mode 100644 src/api/wix/WixToolset.Extensibility/IExtensionFactory.cs create mode 100644 src/api/wix/WixToolset.Extensibility/IFileSystemExtension.cs create mode 100644 src/api/wix/WixToolset.Extensibility/IInspectorCore.cs create mode 100644 src/api/wix/WixToolset.Extensibility/IInspectorExtension.cs create mode 100644 src/api/wix/WixToolset.Extensibility/ILayoutExtension.cs create mode 100644 src/api/wix/WixToolset.Extensibility/ILibrarianExtension.cs create mode 100644 src/api/wix/WixToolset.Extensibility/ILinkerExtension.cs create mode 100644 src/api/wix/WixToolset.Extensibility/IMessageListener.cs create mode 100644 src/api/wix/WixToolset.Extensibility/IPreprocessorExtension.cs create mode 100644 src/api/wix/WixToolset.Extensibility/IResolverExtension.cs create mode 100644 src/api/wix/WixToolset.Extensibility/IUnbinderExtension.cs create mode 100644 src/api/wix/WixToolset.Extensibility/IWindowsInstallerBackendBinderExtension.cs create mode 100644 src/api/wix/WixToolset.Extensibility/IWindowsInstallerBackendDecompilerExtension.cs create mode 100644 src/api/wix/WixToolset.Extensibility/InspectorExtension.cs create mode 100644 src/api/wix/WixToolset.Extensibility/Services/IBackendHelper.cs create mode 100644 src/api/wix/WixToolset.Extensibility/Services/IBurnBackendHelper.cs create mode 100644 src/api/wix/WixToolset.Extensibility/Services/ICommandLine.cs create mode 100644 src/api/wix/WixToolset.Extensibility/Services/ICommandLineParser.cs create mode 100644 src/api/wix/WixToolset.Extensibility/Services/IExtensionManager.cs create mode 100644 src/api/wix/WixToolset.Extensibility/Services/IMessaging.cs create mode 100644 src/api/wix/WixToolset.Extensibility/Services/IParseHelper.cs create mode 100644 src/api/wix/WixToolset.Extensibility/Services/IPathResolver.cs create mode 100644 src/api/wix/WixToolset.Extensibility/Services/IPreprocessHelper.cs create mode 100644 src/api/wix/WixToolset.Extensibility/Services/IVariableResolution.cs create mode 100644 src/api/wix/WixToolset.Extensibility/Services/IVariableResolver.cs create mode 100644 src/api/wix/WixToolset.Extensibility/Services/IWindowsInstallerBackendHelper.cs create mode 100644 src/api/wix/WixToolset.Extensibility/Services/IWixBranding.cs create mode 100644 src/api/wix/WixToolset.Extensibility/Services/IWixtoolsetCoreServiceProvider.cs create mode 100644 src/api/wix/WixToolset.Extensibility/Services/ServiceProviderExtensions.cs create mode 100644 src/api/wix/WixToolset.Extensibility/WixToolset.Extensibility.csproj create mode 100644 src/api/wix/WixToolset.Extensibility/WixToolset.Extensibility.v3.ncrunchproject create mode 100644 src/api/wix/appveyor-Extensibility.cmd create mode 100644 src/api/wix/appveyor-Extensibility.yml create mode 100644 src/api/wix/nuget-Extensibility.config create mode 100644 src/version.json delete mode 100644 version.json diff --git a/.editorconfig b/.editorconfig deleted file mode 100644 index 1d72e683..00000000 --- a/.editorconfig +++ /dev/null @@ -1,37 +0,0 @@ -# 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. -# -# Do NOT modify this file. Update the canonical version in Home\repo-template\src\.editorconfig -# then update all of the repos. - -root = true - -[*] -charset = utf-8 -indent_style = space -indent_size = 4 -trim_trailing_whitespace = true - -[*.{cs,vb}] -dotnet_sort_system_directives_first = true - -[*.cs] -csharp_indent_case_contents = true : error -csharp_indent_switch_labels = true : error -csharp_new_line_before_open_brace = all -csharp_prefer_braces = true : error -csharp_style_expression_bodied_methods = when_on_single_line : suggestion -csharp_style_expression_bodied_constructors = when_on_single_line : suggestion -csharp_style_expression_bodied_operators = when_on_single_line : suggestion -csharp_style_expression_bodied_properties = when_on_single_line : suggestion -csharp_style_expression_bodied_indexers = when_on_single_line : suggestion -csharp_style_expression_bodied_accessors = when_on_single_line : suggestion -csharp_style_var_elsewhere = true : suggestion -csharp_style_var_for_built_in_types = true : suggestion -csharp_style_var_when_type_is_apparent = true : suggestion -dotnet_style_qualification_for_event = true : error -dotnet_style_qualification_for_field = true : error -dotnet_style_qualification_for_method = true : error -dotnet_style_qualification_for_property = true : error - -[*.targets] -indent_size = 2 diff --git a/README.md b/README.md deleted file mode 100644 index 003acd4d..00000000 --- a/README.md +++ /dev/null @@ -1,2 +0,0 @@ -# Extensibility -WixToolset.Extensibility - interfaces to extend the WiX Toolset diff --git a/WixToolset.Extensibility.sln b/WixToolset.Extensibility.sln deleted file mode 100644 index 94ce905c..00000000 --- a/WixToolset.Extensibility.sln +++ /dev/null @@ -1,36 +0,0 @@ -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 15 -VisualStudioVersion = 15.0.26730.8 -MinimumVisualStudioVersion = 15.0.26124.0 -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WixToolset.Extensibility", "src\WixToolset.Extensibility\WixToolset.Extensibility.csproj", "{AA049009-D7D9-4C63-8E0D-83206ADCFBD1}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Any CPU = Debug|Any CPU - Debug|x64 = Debug|x64 - Debug|x86 = Debug|x86 - Release|Any CPU = Release|Any CPU - Release|x64 = Release|x64 - Release|x86 = Release|x86 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {AA049009-D7D9-4C63-8E0D-83206ADCFBD1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {AA049009-D7D9-4C63-8E0D-83206ADCFBD1}.Debug|Any CPU.Build.0 = Debug|Any CPU - {AA049009-D7D9-4C63-8E0D-83206ADCFBD1}.Debug|x64.ActiveCfg = Debug|Any CPU - {AA049009-D7D9-4C63-8E0D-83206ADCFBD1}.Debug|x64.Build.0 = Debug|Any CPU - {AA049009-D7D9-4C63-8E0D-83206ADCFBD1}.Debug|x86.ActiveCfg = Debug|Any CPU - {AA049009-D7D9-4C63-8E0D-83206ADCFBD1}.Debug|x86.Build.0 = Debug|Any CPU - {AA049009-D7D9-4C63-8E0D-83206ADCFBD1}.Release|Any CPU.ActiveCfg = Release|Any CPU - {AA049009-D7D9-4C63-8E0D-83206ADCFBD1}.Release|Any CPU.Build.0 = Release|Any CPU - {AA049009-D7D9-4C63-8E0D-83206ADCFBD1}.Release|x64.ActiveCfg = Release|Any CPU - {AA049009-D7D9-4C63-8E0D-83206ADCFBD1}.Release|x64.Build.0 = Release|Any CPU - {AA049009-D7D9-4C63-8E0D-83206ADCFBD1}.Release|x86.ActiveCfg = Release|Any CPU - {AA049009-D7D9-4C63-8E0D-83206ADCFBD1}.Release|x86.Build.0 = Release|Any CPU - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection - GlobalSection(ExtensibilityGlobals) = postSolution - SolutionGuid = {BB8820D5-723D-426D-B4A0-4D221603C5FA} - EndGlobalSection -EndGlobal diff --git a/appveyor.cmd b/appveyor.cmd deleted file mode 100644 index e0dfe33f..00000000 --- a/appveyor.cmd +++ /dev/null @@ -1,7 +0,0 @@ -@setlocal -@pushd %~dp0 - -dotnet pack -c Release - -@popd -@endlocal \ No newline at end of file diff --git a/appveyor.yml b/appveyor.yml deleted file mode 100644 index 7c686b04..00000000 --- a/appveyor.yml +++ /dev/null @@ -1,40 +0,0 @@ -# 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. -# -# Do NOT modify this file. Update the canonical version in Home\repo-template\src\appveyor.yml -# then update all of the repos. - -branches: - only: - - master - - develop - -image: Visual Studio 2019 - -version: 0.0.0.{build} -configuration: Release - -environment: - DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true - DOTNET_CLI_TELEMETRY_OPTOUT: 1 - NUGET_XMLDOC_MODE: skip - -build_script: - - appveyor.cmd - -pull_requests: - do_not_increment_build_number: true - -nuget: - disable_publish_on_pr: true - -skip_branch_with_pr: true -skip_tags: true - -artifacts: -- path: build\Release\**\*.nupkg - name: nuget - -notifications: -- provider: Slack - incoming_webhook: - secure: p5xuu+4x2JHfwGDMDe5KcG1k7gZxqYc4jWVwvyNZv5cvkubPD2waJs5yXMAXZNN7Z63/3PWHb7q4KoY/99AjauYa1nZ4c5qYqRPFRBKTHfA= diff --git a/nuget.config b/nuget.config deleted file mode 100644 index 6ab85be3..00000000 --- a/nuget.config +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - \ No newline at end of file diff --git a/src/.editorconfig b/src/.editorconfig new file mode 100644 index 00000000..1d72e683 --- /dev/null +++ b/src/.editorconfig @@ -0,0 +1,37 @@ +# 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. +# +# Do NOT modify this file. Update the canonical version in Home\repo-template\src\.editorconfig +# then update all of the repos. + +root = true + +[*] +charset = utf-8 +indent_style = space +indent_size = 4 +trim_trailing_whitespace = true + +[*.{cs,vb}] +dotnet_sort_system_directives_first = true + +[*.cs] +csharp_indent_case_contents = true : error +csharp_indent_switch_labels = true : error +csharp_new_line_before_open_brace = all +csharp_prefer_braces = true : error +csharp_style_expression_bodied_methods = when_on_single_line : suggestion +csharp_style_expression_bodied_constructors = when_on_single_line : suggestion +csharp_style_expression_bodied_operators = when_on_single_line : suggestion +csharp_style_expression_bodied_properties = when_on_single_line : suggestion +csharp_style_expression_bodied_indexers = when_on_single_line : suggestion +csharp_style_expression_bodied_accessors = when_on_single_line : suggestion +csharp_style_var_elsewhere = true : suggestion +csharp_style_var_for_built_in_types = true : suggestion +csharp_style_var_when_type_is_apparent = true : suggestion +dotnet_style_qualification_for_event = true : error +dotnet_style_qualification_for_field = true : error +dotnet_style_qualification_for_method = true : error +dotnet_style_qualification_for_property = true : error + +[*.targets] +indent_size = 2 diff --git a/src/CSharp.Build.props b/src/CSharp.Build.props deleted file mode 100644 index 81d24ad1..00000000 --- a/src/CSharp.Build.props +++ /dev/null @@ -1,13 +0,0 @@ - - - - - true - true - $([System.IO.Path]::GetFullPath($(MSBuildThisFileDirectory)wix.snk)) - false - - diff --git a/src/Custom.Build.props b/src/Custom.Build.props deleted file mode 100644 index 889fb62e..00000000 --- a/src/Custom.Build.props +++ /dev/null @@ -1,6 +0,0 @@ - - - - true - - diff --git a/src/Directory.Build.props b/src/Directory.Build.props deleted file mode 100644 index f83cc154..00000000 --- a/src/Directory.Build.props +++ /dev/null @@ -1,29 +0,0 @@ - - - - - - Debug - false - MSB3246 - - $(MSBuildProjectName) - $([System.IO.Path]::GetFullPath($(MSBuildThisFileDirectory)..\build\)) - $(BaseOutputPath)obj\$(ProjectName)\ - $(BaseOutputPath)$(Configuration)\ - - WiX Toolset Team - WiX Toolset - Copyright (c) .NET Foundation and contributors. All rights reserved. - MS-RL - WiX Toolset - - - - - - - diff --git a/src/Directory.Build.targets b/src/Directory.Build.targets deleted file mode 100644 index cb988931..00000000 --- a/src/Directory.Build.targets +++ /dev/null @@ -1,56 +0,0 @@ - - - - - - - false - $(OutputPath)\$(AssemblyName).xml - - - - true - $(SolutionPath) - $(NCrunchOriginalSolutionPath) - - - - - - - $([System.IO.File]::ReadAllText($(TheSolutionPath))) - $([System.IO.Path]::GetDirectoryName( $(TheSolutionPath) )) - (?<="[PackageName]", ")(.*)(?=", ") - - - - - - %(Identity) - $(SolutionFileContent.Contains('\%(Identity).csproj')) - - - - - $(RegexPattern.Replace('[PackageName]','%(PackageName)') ) - $([System.Text.RegularExpressions.Regex]::Match('$(SolutionFileContent)', '%(Pattern)')) - - - - - - - - - - - - - - diff --git a/src/WixToolset.Extensibility/AssemblyInfo.cs b/src/WixToolset.Extensibility/AssemblyInfo.cs deleted file mode 100644 index b3740b2a..00000000 --- a/src/WixToolset.Extensibility/AssemblyInfo.cs +++ /dev/null @@ -1,9 +0,0 @@ -// 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. - -using System; -using System.Reflection; -using System.Runtime.InteropServices; - -[assembly: AssemblyCulture("")] -[assembly: CLSCompliant(true)] -[assembly: ComVisible(false)] diff --git a/src/WixToolset.Extensibility/BaseBinderExtension.cs b/src/WixToolset.Extensibility/BaseBinderExtension.cs deleted file mode 100644 index 3869d1ed..00000000 --- a/src/WixToolset.Extensibility/BaseBinderExtension.cs +++ /dev/null @@ -1,47 +0,0 @@ -// 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. - -namespace WixToolset.Extensibility -{ - using WixToolset.Extensibility.Data; - using WixToolset.Extensibility.Services; - - /// - /// Base class for creating a resolver extension. - /// - public abstract class BaseBinderExtension : IBinderExtension - { - /// - /// Context for use by the extension. - /// - protected IBindContext Context { get; private set; } - - /// - /// Messaging for use by the extension. - /// - protected IMessaging Messaging { get; private set; } - - /// - /// BackendHelper for use by the extension. - /// - protected IBackendHelper BackendHelper { get; private set; } - - /// - /// Called at the beginning of bind. - /// - public virtual void PreBind(IBindContext context) - { - this.Context = context; - - this.Messaging = context.ServiceProvider.GetService(); - - this.BackendHelper = context.ServiceProvider.GetService(); - } - - /// - /// Called at the end of bind. - /// - public virtual void PostBind(IBindResult result) - { - } - } -} diff --git a/src/WixToolset.Extensibility/BaseBurnBackendBinderExtension.cs b/src/WixToolset.Extensibility/BaseBurnBackendBinderExtension.cs deleted file mode 100644 index da570af0..00000000 --- a/src/WixToolset.Extensibility/BaseBurnBackendBinderExtension.cs +++ /dev/null @@ -1,94 +0,0 @@ -// 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. - -namespace WixToolset.Extensibility -{ - using System; - using System.Collections.Generic; - using System.Linq; - using WixToolset.Data; - using WixToolset.Data.Burn; - using WixToolset.Extensibility.Data; - using WixToolset.Extensibility.Services; - - /// - /// Base class for creating a Burn backend extension. - /// - public abstract class BaseBurnBackendBinderExtension : IBurnBackendBinderExtension - { - /// - /// Context for use by the extension. - /// - protected IBindContext Context { get; private set; } - - /// - /// Messaging for use by the extension. - /// - protected IMessaging Messaging { get; private set; } - - /// - /// Backend helper for use by the extension. - /// - protected IBurnBackendHelper BackendHelper { get; private set; } - - /// - /// Optional symbol definitions. - /// - protected virtual IReadOnlyCollection SymbolDefinitions => Array.Empty(); - - /// - /// See - /// - public virtual void PreBackendBind(IBindContext context) - { - this.Context = context; - this.Messaging = context.ServiceProvider.GetService(); - this.BackendHelper = context.ServiceProvider.GetService(); - } - - /// - /// See - /// - public virtual IResolveFileResult ResolveRelatedFile(string source, string relatedSource, string type, SourceLineNumber sourceLineNumbers) - { - return null; - } - - /// - /// See - /// - public virtual void SymbolsFinalized(IntermediateSection section) - { - } - - /// - /// See - /// - public virtual string ResolveUrl(string url, string fallbackUrl, string packageId, string payloadId, string fileName) - { - return null; - } - - /// - /// See - /// - public virtual bool TryProcessSymbol(IntermediateSection section, IntermediateSymbol symbol) - { - if (this.SymbolDefinitions.Any(t => t == symbol.Definition) && - symbol.Definition.HasTag(BurnConstants.BootstrapperApplicationDataSymbolDefinitionTag)) - { - this.BackendHelper.AddBootstrapperApplicationData(symbol); - return true; - } - - return false; - } - - /// - /// See - /// - /// - public virtual void PostBackendBind(IBindResult result) - { - } - } -} diff --git a/src/WixToolset.Extensibility/BaseCompilerExtension.cs b/src/WixToolset.Extensibility/BaseCompilerExtension.cs deleted file mode 100644 index 3e185e14..00000000 --- a/src/WixToolset.Extensibility/BaseCompilerExtension.cs +++ /dev/null @@ -1,87 +0,0 @@ -// 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. - -namespace WixToolset.Extensibility -{ - using System; - using System.Collections.Generic; - using System.Xml.Linq; - using WixToolset.Data; - using WixToolset.Extensibility.Data; - using WixToolset.Extensibility.Services; - - /// - /// Base class for creating a compiler extension. - /// - public abstract class BaseCompilerExtension : ICompilerExtension - { - /// - /// Context for use by the extension. - /// - protected ICompileContext Context { get; private set; } - - /// - /// Messaging for use by the extension. - /// - protected IMessaging Messaging { get; private set; } - - /// - /// ParserHelper for use by the extension. - /// - protected IParseHelper ParseHelper { get; private set; } - - /// - /// Gets the schema namespace for this extension. - /// - /// Schema namespace supported by this extension. - public abstract XNamespace Namespace { get; } - - /// - /// Creates a component key path. - /// - protected IComponentKeyPath CreateComponentKeyPath() => this.Context.ServiceProvider.GetService(); - - /// - /// Called at the beginning of the compilation of a source file. - /// - public virtual void PreCompile(ICompileContext context) - { - this.Context = context; - - this.Messaging = context.ServiceProvider.GetService(); - - this.ParseHelper = context.ServiceProvider.GetService(); - } - - /// - /// See - /// - public virtual void ParseAttribute(Intermediate intermediate, IntermediateSection section, XElement parentElement, XAttribute attribute, IDictionary context) - { - this.ParseHelper.UnexpectedAttribute(parentElement, attribute); - } - - /// - /// See - /// - public virtual void ParseElement(Intermediate intermediate, IntermediateSection section, XElement parentElement, XElement element, IDictionary context) - { - this.ParseHelper.UnexpectedElement(parentElement, element); - } - - /// - /// See - /// - public virtual IComponentKeyPath ParsePossibleKeyPathElement(Intermediate intermediate, IntermediateSection section, XElement parentElement, XElement element, IDictionary context) - { - this.ParseElement(intermediate, section, parentElement, element, context); - return null; - } - - /// - /// Called at the end of the compilation of a source file. - /// - public virtual void PostCompile(Intermediate intermediate) - { - } - } -} diff --git a/src/WixToolset.Extensibility/BaseExtensionCommandLine.cs b/src/WixToolset.Extensibility/BaseExtensionCommandLine.cs deleted file mode 100644 index c716ac7e..00000000 --- a/src/WixToolset.Extensibility/BaseExtensionCommandLine.cs +++ /dev/null @@ -1,51 +0,0 @@ -// 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. - -namespace WixToolset.Extensibility -{ - using System; - using System.Collections.Generic; - using WixToolset.Extensibility.Data; - using WixToolset.Extensibility.Services; - - /// - /// Base class for extensions to be able to parse the command-line. - /// - public abstract class BaseExtensionCommandLine : IExtensionCommandLine - { - /// - /// See - /// - public virtual IReadOnlyCollection CommandLineSwitches => Array.Empty(); - - /// - /// See - /// - public virtual void PostParse() - { - } - - /// - /// See - /// - public virtual void PreParse(ICommandLineContext context) - { - } - - /// - /// See - /// - public virtual bool TryParseArgument(ICommandLineParser parser, string argument) - { - return false; - } - - /// - /// See - /// - public virtual bool TryParseCommand(ICommandLineParser parser, string argument, out ICommandLineCommand command) - { - command = null; - return false; - } - } -} diff --git a/src/WixToolset.Extensibility/BaseExtensionData.cs b/src/WixToolset.Extensibility/BaseExtensionData.cs deleted file mode 100644 index e4a10fd9..00000000 --- a/src/WixToolset.Extensibility/BaseExtensionData.cs +++ /dev/null @@ -1,34 +0,0 @@ -// 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. - -namespace WixToolset.Extensibility -{ - using WixToolset.Data; - - /// - /// Base class for creating a resolver extension. - /// - public abstract class BaseExtensionData : IExtensionData - { - /// - /// See - /// - public virtual string DefaultCulture => null; - - /// - /// See - /// - public virtual Intermediate GetLibrary(ISymbolDefinitionCreator symbolDefinitions) - { - return null; - } - - /// - /// See - /// - public virtual bool TryGetSymbolDefinitionByName(string name, out IntermediateSymbolDefinition symbolDefinition) - { - symbolDefinition = null; - return false; - } - } -} diff --git a/src/WixToolset.Extensibility/BaseExtensionFactory.cs b/src/WixToolset.Extensibility/BaseExtensionFactory.cs deleted file mode 100644 index 8b6dc566..00000000 --- a/src/WixToolset.Extensibility/BaseExtensionFactory.cs +++ /dev/null @@ -1,39 +0,0 @@ -// 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. - -namespace WixToolset.Extensibility -{ - using System; - using System.Collections.Generic; - - /// - /// Base class for extension factories. - /// - /// Implementations may request an IWixToolsetCoreServiceProvider at instantiation by having a single parameter constructor for it. - /// - public abstract class BaseExtensionFactory : IExtensionFactory - { - /// - /// The extension types of the WiX extension. - /// - protected abstract IReadOnlyCollection ExtensionTypes { get; } - - /// - /// See - /// - public virtual bool TryCreateExtension(Type extensionType, out object extension) - { - extension = null; - - foreach (var type in this.ExtensionTypes) - { - if (extensionType.IsAssignableFrom(type)) - { - extension = Activator.CreateInstance(type); - break; - } - } - - return extension != null; - } - } -} diff --git a/src/WixToolset.Extensibility/BaseLayoutExtension.cs b/src/WixToolset.Extensibility/BaseLayoutExtension.cs deleted file mode 100644 index 21b932ff..00000000 --- a/src/WixToolset.Extensibility/BaseLayoutExtension.cs +++ /dev/null @@ -1,62 +0,0 @@ -// 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. - -namespace WixToolset.Extensibility -{ - using WixToolset.Extensibility.Data; - using WixToolset.Extensibility.Services; - - /// - /// Base class for creating a resolver extension. - /// - public abstract class BaseLayoutExtension : ILayoutExtension - { - /// - /// Context for use by the extension. - /// - protected ILayoutContext Context { get; private set; } - - /// - /// Messaging for use by the extension. - /// - protected IMessaging Messaging { get; private set; } - - /// - /// Called at the beginning of layout. - /// - public virtual void PreLayout(ILayoutContext context) - { - this.Context = context; - - this.Messaging = context.ServiceProvider.GetService(); - } - - /// - /// See - /// - /// - /// - /// - public virtual bool CopyFile(string source, string destination) - { - return false; - } - - /// - /// See - /// - /// - /// - /// - public virtual bool MoveFile(string source, string destination) - { - return false; - } - - /// - /// Called at the end of ayout. - /// - public virtual void PostLayout() - { - } - } -} diff --git a/src/WixToolset.Extensibility/BaseLibrarianExtension.cs b/src/WixToolset.Extensibility/BaseLibrarianExtension.cs deleted file mode 100644 index cbc9e4ba..00000000 --- a/src/WixToolset.Extensibility/BaseLibrarianExtension.cs +++ /dev/null @@ -1,71 +0,0 @@ -// 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. - -namespace WixToolset.Extensibility -{ - using System.Collections.Generic; - using WixToolset.Data; - using WixToolset.Extensibility.Data; - using WixToolset.Extensibility.Services; - - /// - /// Base class for creating a librarian extension. - /// - public abstract class BaseLibrarianExtension : ILibrarianExtension - { - /// - /// Context for use by the extension. - /// - protected ILibraryContext Context { get; private set; } - - /// - /// Messaging for use by the extension. - /// - protected IMessaging Messaging { get; private set; } - - /// - /// Called at the beginning of combining. - /// - /// Librarian context. - public virtual void PreCombine(ILibraryContext context) - { - this.Context = context; - - this.Messaging = context.ServiceProvider.GetService(); - } - - /// - /// Resolves a path to a file path on disk. - /// - /// Source line number for the path to resolve. - /// Symbol related to the path to resolve. - /// Path to resolve. - /// Optional resolved file result. - public virtual IResolveFileResult ResolveFile(SourceLineNumber sourceLineNumber, IntermediateSymbolDefinition symbolDefinition, string path) - { - return null; - } - - /// - /// Called at the end of combining. - /// - /// Combined library intermediate. - public virtual void PostCombine(Intermediate library) - { - } - - /// - /// Creates an IResolveFileResult. - /// - /// Optional resolved path to file. - /// Optional collection of paths checked for the file. - /// Resolved file result. - protected IResolveFileResult CreateResolveFileResult(string path = null, IReadOnlyCollection checkedPaths = null) - { - var result = this.Context.ServiceProvider.GetService(); - result.Path = path; - result.CheckedPaths = checkedPaths; - - return result; - } - } -} diff --git a/src/WixToolset.Extensibility/BaseLinkerExtension.cs b/src/WixToolset.Extensibility/BaseLinkerExtension.cs deleted file mode 100644 index 91aefc2f..00000000 --- a/src/WixToolset.Extensibility/BaseLinkerExtension.cs +++ /dev/null @@ -1,41 +0,0 @@ -// 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. - -namespace WixToolset.Extensibility -{ - using WixToolset.Data; - using WixToolset.Extensibility.Data; - using WixToolset.Extensibility.Services; - - /// - /// Base class for creating a linker extension. - /// - public abstract class BaseLinkerExtension : ILinkerExtension - { - /// - /// Context for use by the extension. - /// - protected ILinkContext Context { get; private set; } - - /// - /// Messaging for use by the extension. - /// - protected IMessaging Messaging { get; private set; } - - /// - /// Called at the beginning of the linking. - /// - public virtual void PreLink(ILinkContext context) - { - this.Context = context; - - this.Messaging = context.ServiceProvider.GetService(); - } - - /// - /// Called at the end of the linking. - /// - public virtual void PostLink(Intermediate intermediate) - { - } - } -} diff --git a/src/WixToolset.Extensibility/BasePreprocessorExtension.cs b/src/WixToolset.Extensibility/BasePreprocessorExtension.cs deleted file mode 100644 index b9a856ec..00000000 --- a/src/WixToolset.Extensibility/BasePreprocessorExtension.cs +++ /dev/null @@ -1,91 +0,0 @@ -// 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. - -namespace WixToolset.Extensibility -{ - using System.Xml.Linq; - using WixToolset.Extensibility.Data; - using WixToolset.Extensibility.Services; - - /// - /// Base class for creating a preprocessor extension. - /// - public abstract class BasePreprocessorExtension : IPreprocessorExtension - { - /// - /// Context for use by the extension. - /// - protected IPreprocessContext Context { get; private set; } - - /// - /// Messaging for use by the extension. - /// - protected IMessaging Messaging { get; private set; } - - /// - /// PreprocessHelper for use by the extension. - /// - protected IPreprocessHelper PreprocessHelper { get; private set; } - - /// - /// Gets or sets the variable prefixes for the extension. - /// - /// The variable prefixes for the extension. - public string[] Prefixes { get; protected set; } - - /// - /// Called at the beginning of the preprocessing of a source file. - /// - public virtual void PrePreprocess(IPreprocessContext context) - { - this.Context = context; - - this.Messaging = context.ServiceProvider.GetService(); - - this.PreprocessHelper = context.ServiceProvider.GetService(); - } - - /// - /// Gets the value of a variable whose prefix matches the extension. - /// - /// The prefix of the variable to be processed by the extension. - /// The name of the variable. - /// The value of the variable or null if the variable is undefined. - public virtual string GetVariableValue(string prefix, string name) - { - return null; - } - - /// - /// Evaluates a function defined in the extension. - /// - /// The prefix of the function to be processed by the extension. - /// The name of the function. - /// The list of arguments. - /// The value of the function or null if the function is not defined. - public virtual string EvaluateFunction(string prefix, string function, string[] args) - { - return null; - } - - /// - /// Processes a pragma defined in the extension. - /// - /// The prefix of the pragma to be processed by the extension. - /// The name of the pragma. - /// The pragma's arguments. - /// The parent node of the pragma. - /// false if the pragma is not defined. - /// 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. - public virtual bool ProcessPragma(string prefix, string pragma, string args, XContainer parent) - { - return false; - } - - /// - /// Called at the end of the preprocessing of a source file. - /// - public virtual void PostPreprocess(IPreprocessResult result) - { - } - } -} diff --git a/src/WixToolset.Extensibility/BaseResolverExtension.cs b/src/WixToolset.Extensibility/BaseResolverExtension.cs deleted file mode 100644 index 72dc5c41..00000000 --- a/src/WixToolset.Extensibility/BaseResolverExtension.cs +++ /dev/null @@ -1,59 +0,0 @@ -// 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. - -namespace WixToolset.Extensibility -{ - using WixToolset.Data; - using WixToolset.Extensibility.Data; - using WixToolset.Extensibility.Services; - - /// - /// Base class for creating a resolver extension. - /// - public abstract class BaseResolverExtension : IResolverExtension - { - /// - /// Context for use by the extension. - /// - protected IResolveContext Context { get; private set; } - - /// - /// Messaging for use by the extension. - /// - protected IMessaging Messaging { get; private set; } - - /// - /// Creates a resolve file result. - /// - protected IResolveFileResult CreateResolveFileResult() => this.Context.ServiceProvider.GetService(); - - /// - /// Called at the beginning of the resolving variables and files. - /// - public virtual void PreResolve(IResolveContext context) - { - this.Context = context; - - this.Messaging = context.ServiceProvider.GetService(); - } - - /// - /// See - /// - /// - /// - /// - /// - /// - public virtual IResolveFileResult ResolveFile(string source, IntermediateSymbolDefinition symbolDefinition, SourceLineNumber sourceLineNumbers, BindStage bindStage) - { - return null; - } - - /// - /// Called at the end of resolve. - /// - public virtual void PostResolve(IResolveResult result) - { - } - } -} diff --git a/src/WixToolset.Extensibility/BaseWindowsInstallerBackendBinderExtension.cs b/src/WixToolset.Extensibility/BaseWindowsInstallerBackendBinderExtension.cs deleted file mode 100644 index ffff186b..00000000 --- a/src/WixToolset.Extensibility/BaseWindowsInstallerBackendBinderExtension.cs +++ /dev/null @@ -1,93 +0,0 @@ -// 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. - -namespace WixToolset.Extensibility -{ - using System; - using System.Collections.Generic; - using System.Linq; - using WixToolset.Data; - using WixToolset.Data.Symbols; - using WixToolset.Data.WindowsInstaller; - using WixToolset.Extensibility.Data; - using WixToolset.Extensibility.Services; - - /// - /// Base class for creating a preprocessor extension. - /// - public abstract class BaseWindowsInstallerBackendBinderExtension : IWindowsInstallerBackendBinderExtension - { - /// - /// Context for use by the extension. - /// - protected IBindContext Context { get; private set; } - - /// - /// Messaging for use by the extension. - /// - protected IMessaging Messaging { get; private set; } - - /// - /// Backend helper for use by the extension. - /// - protected IWindowsInstallerBackendHelper BackendHelper { get; private set; } - - /// - /// Optional table definitions. - /// - public virtual IReadOnlyCollection TableDefinitions => Array.Empty(); - - /// - /// Creates a resolved cabinet result. - /// - protected IResolvedCabinet CreateResolvedCabinet() => this.Context.ServiceProvider.GetService(); - - /// - /// See - /// - public virtual void PreBackendBind(IBindContext context) - { - this.Context = context; - - this.Messaging = context.ServiceProvider.GetService(); - - this.BackendHelper = context.ServiceProvider.GetService(); - } - - /// - /// See - /// - public virtual void SymbolsFinalized(IntermediateSection section) - { - } - - /// - /// See - /// - public virtual IResolvedCabinet ResolveCabinet(string cabinetPath, IEnumerable files) => null; - - /// - /// See - /// - public virtual string ResolveMedia(MediaSymbol mediaRow, string mediaLayoutDirectory, string layoutDirectory) => null; - - /// - /// See - /// - public virtual bool TryProcessSymbol(IntermediateSection section, IntermediateSymbol symbol, WindowsInstallerData data, TableDefinitionCollection tableDefinitions) - { - if (this.TableDefinitions.Any(t => t.SymbolDefinition == symbol.Definition)) - { - return this.BackendHelper.TryAddSymbolToMatchingTableDefinitions(section, symbol, data, tableDefinitions); - } - - return false; - } - - /// - /// See - /// - public virtual void PostBackendBind(IBindResult result) - { - } - } -} diff --git a/src/WixToolset.Extensibility/CompilerConstants.cs b/src/WixToolset.Extensibility/CompilerConstants.cs deleted file mode 100644 index 73ff685c..00000000 --- a/src/WixToolset.Extensibility/CompilerConstants.cs +++ /dev/null @@ -1,42 +0,0 @@ -// 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. - -namespace WixToolset.Extensibility -{ - using System; - - /// - /// Constants used by compiler. - /// - public static class CompilerConstants - { - /// - /// - /// - public const int IntegerNotSet = int.MinValue; - - /// - /// - /// - public const int IllegalInteger = int.MinValue + 1; - - /// - /// - /// - public const long LongNotSet = long.MinValue; - - /// - /// - /// - public const long IllegalLong = long.MinValue + 1; - - /// - /// - /// - public const string IllegalGuid = "IllegalGuid"; - - /// - /// - /// - public static readonly Version IllegalVersion = new Version(Int32.MaxValue, Int32.MaxValue, Int32.MaxValue, Int32.MaxValue); - } -} diff --git a/src/WixToolset.Extensibility/Data/BindStage.cs b/src/WixToolset.Extensibility/Data/BindStage.cs deleted file mode 100644 index a690a896..00000000 --- a/src/WixToolset.Extensibility/Data/BindStage.cs +++ /dev/null @@ -1,25 +0,0 @@ -// 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. - -namespace WixToolset.Extensibility.Data -{ - /// - /// - /// - public enum BindStage - { - /// - /// Normal binding - /// - Normal, - - /// - /// Bind the file path of the target build file - /// - Target, - - /// - /// Bind the file path of the updated build file - /// - Updated, - } -} diff --git a/src/WixToolset.Extensibility/Data/BurnPlatforms.cs b/src/WixToolset.Extensibility/Data/BurnPlatforms.cs deleted file mode 100644 index ab4beb7d..00000000 --- a/src/WixToolset.Extensibility/Data/BurnPlatforms.cs +++ /dev/null @@ -1,25 +0,0 @@ -// 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. - -namespace WixToolset.Extensibility.Data -{ - using System; - - /// - /// Platforms that have been supported by Burn. - /// - [Flags] - public enum BurnPlatforms - { - /// Not specified. - None = 0, - - /// x86. - X86 = 0x1, - - /// x64. - X64 = 0x2, - - /// arm64. - ARM64 = 0x4, - } -} diff --git a/src/WixToolset.Extensibility/Data/CabinetBuildOption.cs b/src/WixToolset.Extensibility/Data/CabinetBuildOption.cs deleted file mode 100644 index f9938814..00000000 --- a/src/WixToolset.Extensibility/Data/CabinetBuildOption.cs +++ /dev/null @@ -1,25 +0,0 @@ -// 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. - -namespace WixToolset.Extensibility.Data -{ - /// - /// Options for building the cabinet. - /// - public enum CabinetBuildOption - { - /// - /// Build the cabinet and move it to the target location. - /// - BuildAndMove, - - /// - /// Build the cabinet and copy it to the target location. - /// - BuildAndCopy, - - /// - /// Just copy the cabinet to the target location. - /// - Copy - } -} diff --git a/src/WixToolset.Extensibility/Data/CustomActionPlatforms.cs b/src/WixToolset.Extensibility/Data/CustomActionPlatforms.cs deleted file mode 100644 index eea8a419..00000000 --- a/src/WixToolset.Extensibility/Data/CustomActionPlatforms.cs +++ /dev/null @@ -1,25 +0,0 @@ -// 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. - -namespace WixToolset.Extensibility.Data -{ - using System; - - /// - /// Platforms supported by custom actions. - /// - [Flags] - public enum CustomActionPlatforms - { - /// Not specified. - None = 0, - - /// x86. - X86 = 0x1, - - /// x64. - X64 = 0x2, - - /// arm64. - ARM64 = 0x4, - } -} diff --git a/src/WixToolset.Extensibility/Data/ExtensionCommandLineSwitch.cs b/src/WixToolset.Extensibility/Data/ExtensionCommandLineSwitch.cs deleted file mode 100644 index 14b5dabb..00000000 --- a/src/WixToolset.Extensibility/Data/ExtensionCommandLineSwitch.cs +++ /dev/null @@ -1,20 +0,0 @@ -// 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. - -namespace WixToolset.Extensibility.Data -{ - /// - /// A command line option. - /// - public struct ExtensionCommandLineSwitch - { - /// - /// - /// - public string Switch { get; set; } - - /// - /// - /// - public string Description { get; set; } - } -} diff --git a/src/WixToolset.Extensibility/Data/IBindContext.cs b/src/WixToolset.Extensibility/Data/IBindContext.cs deleted file mode 100644 index d0c65683..00000000 --- a/src/WixToolset.Extensibility/Data/IBindContext.cs +++ /dev/null @@ -1,120 +0,0 @@ -// 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. - -namespace WixToolset.Extensibility.Data -{ - using System; - using System.Collections.Generic; - using System.Threading; - using WixToolset.Data; - - /// - /// Bind context. - /// - public interface IBindContext - { - /// - /// Service provider. - /// - IServiceProvider ServiceProvider { get; } - - /// - /// Counnt of threads to use in cabbing. - /// - int CabbingThreadCount { get; set; } - - /// - /// Cabinet cache path. - /// - string CabCachePath { get; set; } - - /// - /// Default compression level. - /// - CompressionLevel? DefaultCompressionLevel { get; set; } - - /// - /// Delayed fields that need to be resolved again. - /// - IReadOnlyCollection DelayedFields { get; set; } - - /// - /// Embedded files to extract. - /// - IReadOnlyCollection ExpectedEmbeddedFiles { get; set; } - - /// - /// Binder extensions. - /// - IReadOnlyCollection Extensions { get; set; } - - /// - /// File system extensions. - /// - IReadOnlyCollection FileSystemExtensions { get; set; } - - /// - /// Set of ICEs to execute. - /// - IReadOnlyCollection Ices { get; set; } - - /// - /// Intermedaite folder. - /// - string IntermediateFolder { get; set; } - - /// - /// Intermediate representation to bind. - /// - Intermediate IntermediateRepresentation { get; set; } - - /// - /// Output path to bind to. - /// - string OutputPath { get; set; } - - /// - /// Type of PDB to create. - /// - PdbType PdbType { get; set; } - - /// - /// Output path for PDB. - /// - string PdbPath { get; set; } - - /// - /// Codepage from resolve. - /// - int? ResolvedCodepage { get; set; } - - /// - /// Summary information codepage from resolve. - /// - int? ResolvedSummaryInformationCodepage { get; set; } - - /// - /// LCID from resolve. - /// - int? ResolvedLcid { get; set; } - - /// - /// Set of ICEs to skip. - /// - IReadOnlyCollection SuppressIces { get; set; } - - /// - /// Skip all ICEs. - /// - bool SuppressValidation { get; set; } - - /// - /// Skip creation of output. - /// - bool SuppressLayout { get; set; } - - /// - /// Cancellation token. - /// - CancellationToken CancellationToken { get; set; } - } -} diff --git a/src/WixToolset.Extensibility/Data/IBindFileWithPath.cs b/src/WixToolset.Extensibility/Data/IBindFileWithPath.cs deleted file mode 100644 index 69036113..00000000 --- a/src/WixToolset.Extensibility/Data/IBindFileWithPath.cs +++ /dev/null @@ -1,12 +0,0 @@ -// 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. - -namespace WixToolset.Extensibility.Data -{ -#pragma warning disable 1591 // TODO: add documentation - public interface IBindFileWithPath - { - string Id { get; set; } - - string Path { get; set; } - } -} diff --git a/src/WixToolset.Extensibility/Data/IBindPath.cs b/src/WixToolset.Extensibility/Data/IBindPath.cs deleted file mode 100644 index 46895e89..00000000 --- a/src/WixToolset.Extensibility/Data/IBindPath.cs +++ /dev/null @@ -1,25 +0,0 @@ -// 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. - -namespace WixToolset.Extensibility.Data -{ - /// - /// Interface for a bind path. - /// - public interface IBindPath - { - /// - /// Name of the bind path or String.Empty if the path is unnamed. - /// - string Name { get; set; } - - /// - /// Path for the bind path. - /// - string Path { get; set; } - - /// - /// Stage for the bind path. - /// - BindStage Stage { get; set; } - } -} diff --git a/src/WixToolset.Extensibility/Data/IBindResult.cs b/src/WixToolset.Extensibility/Data/IBindResult.cs deleted file mode 100644 index 3738ef17..00000000 --- a/src/WixToolset.Extensibility/Data/IBindResult.cs +++ /dev/null @@ -1,29 +0,0 @@ -// 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. - -namespace WixToolset.Extensibility.Data -{ - using System; - using System.Collections.Generic; - using WixToolset.Data; - - /// - /// Result of bind operation. - /// - public interface IBindResult : IDisposable - { - /// - /// Collection of file transfers to complete. - /// - IReadOnlyCollection FileTransfers { get; set; } - - /// - /// Collection of files tracked during binding. - /// - IReadOnlyCollection TrackedFiles { get; set; } - - /// - /// Output of binding. - /// - WixOutput Wixout { get; set; } - } -} diff --git a/src/WixToolset.Extensibility/Data/ICommandLineArguments.cs b/src/WixToolset.Extensibility/Data/ICommandLineArguments.cs deleted file mode 100644 index 32ee4c09..00000000 --- a/src/WixToolset.Extensibility/Data/ICommandLineArguments.cs +++ /dev/null @@ -1,39 +0,0 @@ -// 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. - -namespace WixToolset.Extensibility.Data -{ - using WixToolset.Extensibility.Services; - - /// - /// Parsed command-line arguments. - /// - public interface ICommandLineArguments - { -#pragma warning disable 1591 // TODO: add documentation - string[] OriginalArguments { get; set; } - - string[] Arguments { get; set; } - - string[] Extensions { get; set; } - - string ErrorArgument { get; set; } - - /// - /// Populate this argument from a string. - /// - /// String to parse. - void Populate(string commandLine); - - /// - /// Populate this argument from array of strings. - /// - /// Array of strings. - void Populate(string[] args); - - /// - /// Parses this arguments after it is populated. - /// - /// Parser for this arguments. - ICommandLineParser Parse(); - } -} diff --git a/src/WixToolset.Extensibility/Data/ICommandLineCommand.cs b/src/WixToolset.Extensibility/Data/ICommandLineCommand.cs deleted file mode 100644 index b03a18f4..00000000 --- a/src/WixToolset.Extensibility/Data/ICommandLineCommand.cs +++ /dev/null @@ -1,39 +0,0 @@ -// 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. - -namespace WixToolset.Extensibility.Data -{ - using System.Threading; - using System.Threading.Tasks; - using WixToolset.Extensibility.Services; - - /// - /// Custom command. - /// - public interface ICommandLineCommand - { - /// - /// Indicates the command-line should show the command-line logo. - /// - bool ShowLogo { get; } - - /// - /// Indicates the command-line parsing can stop. - /// - bool StopParsing { get; } - - /// - /// Executes the command. - /// - /// Cancellation token. - /// Exit code for the command. - Task ExecuteAsync(CancellationToken cancellationToken); - - /// - /// Allows the command to parse command-line arguments. - /// - /// Parser to help parse the argument and additional arguments. - /// Argument to parse. - /// True if the argument is recognized; otherwise false to allow another extension to process it. - bool TryParseArgument(ICommandLineParser parser, string argument); - } -} diff --git a/src/WixToolset.Extensibility/Data/ICommandLineContext.cs b/src/WixToolset.Extensibility/Data/ICommandLineContext.cs deleted file mode 100644 index d8c9469e..00000000 --- a/src/WixToolset.Extensibility/Data/ICommandLineContext.cs +++ /dev/null @@ -1,17 +0,0 @@ -// 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. - -namespace WixToolset.Extensibility.Data -{ - using System; - using WixToolset.Extensibility.Services; - -#pragma warning disable 1591 // TODO: add documentation - public interface ICommandLineContext - { - IServiceProvider ServiceProvider { get; } - - IExtensionManager ExtensionManager { get; set; } - - ICommandLineArguments Arguments { get; set; } - } -} diff --git a/src/WixToolset.Extensibility/Data/ICompileContext.cs b/src/WixToolset.Extensibility/Data/ICompileContext.cs deleted file mode 100644 index 2ee8f2a1..00000000 --- a/src/WixToolset.Extensibility/Data/ICompileContext.cs +++ /dev/null @@ -1,52 +0,0 @@ -// 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. - -namespace WixToolset.Extensibility.Data -{ - using System; - using System.Collections.Generic; - using System.Threading; - using System.Xml.Linq; - using WixToolset.Data; - - /// - /// Context provided to the compiler. - /// - public interface ICompileContext - { - /// - /// Service provider made available to the compiler and its extensions. - /// - IServiceProvider ServiceProvider { get; } - - /// - /// Unique identifier for the compilation. - /// - string CompilationId { get; set; } - - /// - /// Set of extensions provided to the compiler. - /// - IReadOnlyCollection Extensions { get; set; } - - /// - /// Gets or sets the platform which the compiler will use when defaulting 64-bit attributes and elements. - /// - /// The platform which the compiler will use when defaulting 64-bit attributes and elements. - Platform Platform { get; set; } - - /// - /// Calculates whether the target platform for the compilation is 64-bit or not. - /// - bool IsCurrentPlatform64Bit { get; } - - /// - /// Source document being compiled. - /// - XDocument Source { get; set; } - - /// - /// Cancellation token to abort cancellation. - /// - CancellationToken CancellationToken { get; set; } - } -} diff --git a/src/WixToolset.Extensibility/Data/IComponentKeyPath.cs b/src/WixToolset.Extensibility/Data/IComponentKeyPath.cs deleted file mode 100644 index 2de9c028..00000000 --- a/src/WixToolset.Extensibility/Data/IComponentKeyPath.cs +++ /dev/null @@ -1,14 +0,0 @@ -// 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. - -namespace WixToolset.Extensibility.Data -{ -#pragma warning disable 1591 // TODO: add documentation - public interface IComponentKeyPath - { - bool Explicit { get; set; } - - string Id { get; set; } - - PossibleKeyPathType Type { get; set; } - } -} diff --git a/src/WixToolset.Extensibility/Data/IDecompileContext.cs b/src/WixToolset.Extensibility/Data/IDecompileContext.cs deleted file mode 100644 index fe7d0465..00000000 --- a/src/WixToolset.Extensibility/Data/IDecompileContext.cs +++ /dev/null @@ -1,59 +0,0 @@ -// 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. - -namespace WixToolset.Extensibility.Data -{ - using System; - using System.Collections.Generic; - using WixToolset.Data; - using WixToolset.Extensibility.Services; - -#pragma warning disable 1591 // TODO: add documentation - public interface IDecompileContext - { - IServiceProvider ServiceProvider { get; } - - string DecompilePath { get; set; } - - OutputType DecompileType { get; set; } - - IReadOnlyCollection Extensions { get; set; } - - string ExtractFolder { get; set; } - - string CabinetExtractFolder { get; set; } - - /// - /// Optional gets or sets the base path for the File/@Source. - /// - /// Default value is "SourceDir" to enable use of BindPaths. - string BaseSourcePath { get; set; } - - string IntermediateFolder { get; set; } - - bool IsAdminImage { get; set; } - - string OutputPath { get; set; } - - /// - /// Gets or sets the option to suppress custom tables. - /// - bool SuppressCustomTables { get; set; } - - /// - /// Gets or sets the option to suppress dropping empty tables. - /// - bool SuppressDroppingEmptyTables { get; set; } - - bool SuppressExtractCabinets { get; set; } - - /// - /// Gets or sets the option to suppress decompiling UI-related tables. - /// - bool SuppressUI { get; set; } - - /// - /// Gets or sets whether the decompiler should use module logic on a product output. - /// - bool TreatProductAsModule { get; set; } - } -} diff --git a/src/WixToolset.Extensibility/Data/IDecompileResult.cs b/src/WixToolset.Extensibility/Data/IDecompileResult.cs deleted file mode 100644 index cffd0976..00000000 --- a/src/WixToolset.Extensibility/Data/IDecompileResult.cs +++ /dev/null @@ -1,18 +0,0 @@ -// 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. - -namespace WixToolset.Extensibility.Data -{ - using System.Collections.Generic; - using System.Xml.Linq; - using WixToolset.Data; - -#pragma warning disable 1591 // TODO: add documentation - public interface IDecompileResult - { - XDocument Document { get; set; } - - IReadOnlyCollection ExtractedFilePaths { get; set; } - - Platform? Platform { get; set; } - } -} diff --git a/src/WixToolset.Extensibility/Data/IDelayedField.cs b/src/WixToolset.Extensibility/Data/IDelayedField.cs deleted file mode 100644 index 59a578a6..00000000 --- a/src/WixToolset.Extensibility/Data/IDelayedField.cs +++ /dev/null @@ -1,14 +0,0 @@ -// 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. - -namespace WixToolset.Extensibility.Data -{ - using WixToolset.Data; - -#pragma warning disable 1591 // TODO: add documentation - public interface IDelayedField - { - IntermediateField Field { get; } - - IntermediateSymbol Symbol { get; } - } -} diff --git a/src/WixToolset.Extensibility/Data/IExpectedExtractFile.cs b/src/WixToolset.Extensibility/Data/IExpectedExtractFile.cs deleted file mode 100644 index 4bc8cd96..00000000 --- a/src/WixToolset.Extensibility/Data/IExpectedExtractFile.cs +++ /dev/null @@ -1,16 +0,0 @@ -// 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. - -namespace WixToolset.Extensibility.Data -{ - using System; - -#pragma warning disable 1591 // TODO: add documentation - public interface IExpectedExtractFile - { - Uri Uri { get; set; } - - string EmbeddedFileId { get; set; } - - string OutputPath { get; set; } - } -} \ No newline at end of file diff --git a/src/WixToolset.Extensibility/Data/IFileFacade.cs b/src/WixToolset.Extensibility/Data/IFileFacade.cs deleted file mode 100644 index fea00d4e..00000000 --- a/src/WixToolset.Extensibility/Data/IFileFacade.cs +++ /dev/null @@ -1,126 +0,0 @@ -// 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. - -namespace WixToolset.Extensibility.Data -{ - using System.Collections.Generic; - using WixToolset.Data; - using WixToolset.Data.Symbols; - using WixToolset.Data.WindowsInstaller.Rows; - - /// - /// Interface that provides a common facade over FileSymbol and FileRow. - /// - public interface IFileFacade - { - /// - /// Reference to assembly application for this file. - /// - string AssemblyApplicationFileRef { get; } - - /// - /// Reference to assembly manifest for this file. - /// - string AssemblyManifestFileRef { get; } - - /// - /// List of assembly name values in the file. - /// - List AssemblyNames { get; set; } - - /// - /// Optionally indicates what sort of assembly the file is. - /// - AssemblyType? AssemblyType { get; } - - /// - /// Component containing the file. - /// - string ComponentRef { get; } - - /// - /// Indicates whether the file is compressed. - /// - bool Compressed { get; } - - /// - /// Disk Id for the file. - /// - int DiskId { get; set; } - - /// - /// Name of the file. - /// - string FileName { get; } - - /// - /// Size of the file. - /// - int FileSize { get; set; } - - /// - /// Indicates whether the file came from a merge module. - /// - bool FromModule { get; } - - /// - /// Indicates whether the file came from a transform. - /// - bool FromTransform { get; } - - /// - /// Hash symbol of the file. - /// - MsiFileHashSymbol Hash { get; set; } - - /// - /// Underlying identifier of the file. - /// - Identifier Identifier { get; } - - /// - /// Helper accessor for the Id of the Identifier. - /// - string Id { get; } - - /// - /// Language of the file. - /// - string Language { get; set; } - - /// - /// Optional patch group for the file. - /// - int? PatchGroup { get; } - - /// - /// Sequence of the file. - /// - int Sequence { get; set; } - - /// - /// Source line number that define the file. - /// - SourceLineNumber SourceLineNumber { get; } - - /// - /// Source to the file. - /// - string SourcePath { get; } - - /// - /// Indicates whether the file is to be uncompressed. - /// - bool Uncompressed { get; } - - /// - /// Version of the file. - /// - string Version { get; set; } - - /// - /// Gets the underlying FileRow if one is present. - /// - /// FileRow if one is present, otherwise throws. - FileRow GetFileRow(); - } -} diff --git a/src/WixToolset.Extensibility/Data/IFileSystemContext.cs b/src/WixToolset.Extensibility/Data/IFileSystemContext.cs deleted file mode 100644 index 2e58059a..00000000 --- a/src/WixToolset.Extensibility/Data/IFileSystemContext.cs +++ /dev/null @@ -1,24 +0,0 @@ -// 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. - -namespace WixToolset.Extensibility.Data -{ - using System; - using WixToolset.Data; - using WixToolset.Extensibility.Services; - -#pragma warning disable 1591 // TODO: add documentation - public interface IFileSystemContext - { - IServiceProvider ServiceProvider { get; } - - string CabCachePath { get; set; } - - string IntermediateFolder { get; set; } - - Intermediate IntermediateRepresentation { get; set; } - - string OutputPath { get; set; } - - string OutputPdbPath { get; set; } - } -} diff --git a/src/WixToolset.Extensibility/Data/IFileTransfer.cs b/src/WixToolset.Extensibility/Data/IFileTransfer.cs deleted file mode 100644 index 6f521536..00000000 --- a/src/WixToolset.Extensibility/Data/IFileTransfer.cs +++ /dev/null @@ -1,27 +0,0 @@ -// 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. - -namespace WixToolset.Extensibility.Data -{ - using WixToolset.Data; - - /// - /// Structure used for all file transfer information. - /// - public interface IFileTransfer - { - /// Destination path for file. - string Destination { get; set; } - - /// Flag if file should be moved (optimal). - bool Move { get; set; } - - /// Set during layout of media when the file transfer when the source and target resolve to the same path. - bool Redundant { get; set; } - - /// Source path to file. - string Source { get; set; } - - /// Optional source line numbers where this file transfer orginated. - SourceLineNumber SourceLineNumbers { get; set; } - } -} diff --git a/src/WixToolset.Extensibility/Data/IIncludedFile.cs b/src/WixToolset.Extensibility/Data/IIncludedFile.cs deleted file mode 100644 index e25c9f7e..00000000 --- a/src/WixToolset.Extensibility/Data/IIncludedFile.cs +++ /dev/null @@ -1,24 +0,0 @@ -// 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. - -namespace WixToolset.Extensibility.Data -{ - using WixToolset.Data; - - /// - /// Interface for an included file. - /// - public interface IIncludedFile - { - /// - /// Gets the full path of the included file. - /// - /// The full path of the included file. - string Path { get; set; } - - /// - /// Gets the source line numbers. - /// - /// The source line numbers. - SourceLineNumber SourceLineNumbers { get; set; } - } -} diff --git a/src/WixToolset.Extensibility/Data/IInscribeContext.cs b/src/WixToolset.Extensibility/Data/IInscribeContext.cs deleted file mode 100644 index 31c66aad..00000000 --- a/src/WixToolset.Extensibility/Data/IInscribeContext.cs +++ /dev/null @@ -1,21 +0,0 @@ -// 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. - -namespace WixToolset.Extensibility.Data -{ - using System; - using WixToolset.Extensibility.Services; - -#pragma warning disable 1591 // TODO: add documentation - public interface IInscribeContext - { - IServiceProvider ServiceProvider { get; } - - string InputFilePath { get; set; } - - string IntermediateFolder { get; set; } - - string OutputFile { get; set; } - - string SignedEngineFile { get; set; } - } -} diff --git a/src/WixToolset.Extensibility/Data/ILayoutContext.cs b/src/WixToolset.Extensibility/Data/ILayoutContext.cs deleted file mode 100644 index b11b4d13..00000000 --- a/src/WixToolset.Extensibility/Data/ILayoutContext.cs +++ /dev/null @@ -1,64 +0,0 @@ -// 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. - -namespace WixToolset.Extensibility.Data -{ - using System; - using System.Collections.Generic; - using System.Threading; - - /// - /// Context for laying out files. - /// - public interface ILayoutContext - { - /// - /// Service provider. - /// - IServiceProvider ServiceProvider { get; } - - /// - /// Extensions for use during layout. - /// - IReadOnlyCollection Extensions { get; set; } - - /// - /// Set of tracked of files created during processing to be cleaned up. - /// - IReadOnlyCollection TrackedFiles { get; set; } - - /// - /// Set of files to transfer. - /// - IReadOnlyCollection FileTransfers { get; set; } - - /// - /// File to capture list of content files. - /// - string ContentsFile { get; set; } - - /// - /// File to capture list of output files. - /// - string OutputsFile { get; set; } - - /// - /// Intermediate folder. - /// - string IntermediateFolder { get; set; } - - /// - /// List of built output files. - /// - string BuiltOutputsFile { get; set; } - - /// - /// Reset ACLs on file transfers. - /// - bool ResetAcls { get; set; } - - /// - /// Cancellation token. - /// - CancellationToken CancellationToken { get; set; } - } -} diff --git a/src/WixToolset.Extensibility/Data/ILibraryContext.cs b/src/WixToolset.Extensibility/Data/ILibraryContext.cs deleted file mode 100644 index 208b6f73..00000000 --- a/src/WixToolset.Extensibility/Data/ILibraryContext.cs +++ /dev/null @@ -1,55 +0,0 @@ -// 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. - -namespace WixToolset.Extensibility.Data -{ - using System; - using System.Collections.Generic; - using System.Threading; - using WixToolset.Data; - - /// - /// Context provided during library creation operations. - /// - public interface ILibraryContext - { - /// - /// Service provider. - /// - IServiceProvider ServiceProvider { get; } - - /// - /// Indicates whether files should be bound into the library. - /// - bool BindFiles { get; set; } - - /// - /// Collection of bindpaths used to bind files. - /// - IReadOnlyCollection BindPaths { get; set; } - - /// - /// Collection of extensions used during creation of library. - /// - IReadOnlyCollection Extensions { get; set; } - - /// - /// Identifier of the library. - /// - string LibraryId { get; set; } - - /// - /// Collection of localization files to use in the library. - /// - IReadOnlyCollection Localizations { get; set; } - - /// - /// Collection of intermediates to include in the library. - /// - IReadOnlyCollection Intermediates { get; set; } - - /// - /// Cancellation token. - /// - CancellationToken CancellationToken { get; set; } - } -} diff --git a/src/WixToolset.Extensibility/Data/ILinkContext.cs b/src/WixToolset.Extensibility/Data/ILinkContext.cs deleted file mode 100644 index d56866f7..00000000 --- a/src/WixToolset.Extensibility/Data/ILinkContext.cs +++ /dev/null @@ -1,50 +0,0 @@ -// 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. - -namespace WixToolset.Extensibility.Data -{ - using System; - using System.Collections.Generic; - using System.Threading; - using WixToolset.Data; - - /// - /// Context provided during linking. - /// - public interface ILinkContext - { - /// - /// Service provider. - /// - IServiceProvider ServiceProvider { get; } - - /// - /// Collection of extensions to use during linking. - /// - IReadOnlyCollection Extensions { get; set; } - - /// - /// Collection of extension data to use during linking. - /// - IReadOnlyCollection ExtensionData { get; set; } - - /// - /// Expected output type. - /// - OutputType ExpectedOutputType { get; set; } - - /// - /// Collection of intermediates to link. - /// - IReadOnlyCollection Intermediates { get; set; } - - /// - /// Symbol definition creator used to load extension data. - /// - ISymbolDefinitionCreator SymbolDefinitionCreator { get; set; } - - /// - /// Cancellation token. - /// - CancellationToken CancellationToken { get; set; } - } -} diff --git a/src/WixToolset.Extensibility/Data/IPreprocessContext.cs b/src/WixToolset.Extensibility/Data/IPreprocessContext.cs deleted file mode 100644 index 69057c33..00000000 --- a/src/WixToolset.Extensibility/Data/IPreprocessContext.cs +++ /dev/null @@ -1,56 +0,0 @@ -// 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. - -namespace WixToolset.Extensibility.Data -{ - using System; - using System.Collections.Generic; - using System.Threading; - using WixToolset.Data; - - /// - /// Preprocessor context. - /// - public interface IPreprocessContext - { - /// - /// Service provider. - /// - IServiceProvider ServiceProvider { get; } - - /// - /// Collection of extensions to use during preprocessing. - /// - IReadOnlyCollection Extensions { get; set; } - - /// - /// Collection of search paths to find include files. - /// - IReadOnlyCollection IncludeSearchPaths { get; set; } - - /// - /// Gets the platform which the compiler will use when defaulting 64-bit attributes and elements. - /// - /// The platform which the compiler will use when defaulting 64-bit attributes and elements. - Platform Platform { get; set; } - - /// - /// Path to the source file being preprocessed. - /// - string SourcePath { get; set; } - - /// - /// Collection of name/value pairs used as preprocessor variables. - /// - IDictionary Variables { get; set; } - - /// - /// Current source line number of the preprocessor. - /// - SourceLineNumber CurrentSourceLineNumber { get; set; } - - /// - /// Cancellation token. - /// - CancellationToken CancellationToken { get; set; } - } -} diff --git a/src/WixToolset.Extensibility/Data/IPreprocessResult.cs b/src/WixToolset.Extensibility/Data/IPreprocessResult.cs deleted file mode 100644 index af224c1e..00000000 --- a/src/WixToolset.Extensibility/Data/IPreprocessResult.cs +++ /dev/null @@ -1,23 +0,0 @@ -// 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. - -namespace WixToolset.Extensibility.Data -{ - using System.Collections.Generic; - using System.Xml.Linq; - - /// - /// Result of preprocessing. - /// - public interface IPreprocessResult - { - /// - /// Document result of preprocessor. - /// - XDocument Document { get; set; } - - /// - /// Collection of files included during preprocessing. - /// - IReadOnlyCollection IncludedFiles { get; set; } - } -} diff --git a/src/WixToolset.Extensibility/Data/IResolveContext.cs b/src/WixToolset.Extensibility/Data/IResolveContext.cs deleted file mode 100644 index 63159ccb..00000000 --- a/src/WixToolset.Extensibility/Data/IResolveContext.cs +++ /dev/null @@ -1,65 +0,0 @@ -// 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. - -namespace WixToolset.Extensibility.Data -{ - using System; - using System.Collections.Generic; - using System.Threading; - using WixToolset.Data; - - /// - /// Context for resolve. - /// - public interface IResolveContext - { - /// - /// Service provider. - /// - IServiceProvider ServiceProvider { get; } - - /// - /// Bind paths used during resolution. - /// - IReadOnlyCollection BindPaths { get; set; } - - /// - /// Resolve extensions. - /// - IReadOnlyCollection Extensions { get; set; } - - /// - /// Extension data. - /// - IReadOnlyCollection ExtensionData { get; set; } - - /// - /// List of cultures to filter the localizations. - /// - IReadOnlyCollection FilterCultures { get; set; } - - /// - /// Intermediate folder. - /// - string IntermediateFolder { get; set; } - - /// - /// Intermediate to resolve. - /// - Intermediate IntermediateRepresentation { get; set; } - - /// - /// Localizations used to resolve. - /// - IReadOnlyCollection Localizations { get; set; } - - /// - /// Indicates whether to allow localization and bind variables to remain unresolved. - /// - bool AllowUnresolvedVariables { get; set; } - - /// - /// Cancellation token. - /// - CancellationToken CancellationToken { get; set; } - } -} diff --git a/src/WixToolset.Extensibility/Data/IResolveFileResult.cs b/src/WixToolset.Extensibility/Data/IResolveFileResult.cs deleted file mode 100644 index 2f0df96c..00000000 --- a/src/WixToolset.Extensibility/Data/IResolveFileResult.cs +++ /dev/null @@ -1,22 +0,0 @@ -// 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. - -namespace WixToolset.Extensibility.Data -{ - using System.Collections.Generic; - - /// - /// Result of resolving a file. - /// - public interface IResolveFileResult - { - /// - /// Collection of paths checked to find file. - /// - IReadOnlyCollection CheckedPaths { get; set; } - - /// - /// Path to found file, if found. - /// - string Path { get; set; } - } -} diff --git a/src/WixToolset.Extensibility/Data/IResolveResult.cs b/src/WixToolset.Extensibility/Data/IResolveResult.cs deleted file mode 100644 index 0c5e0ccf..00000000 --- a/src/WixToolset.Extensibility/Data/IResolveResult.cs +++ /dev/null @@ -1,43 +0,0 @@ -// 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. - -namespace WixToolset.Extensibility.Data -{ - using System.Collections.Generic; - using WixToolset.Data; - - /// - /// Result of resolving localization and bind variables. - /// - public interface IResolveResult - { - /// - /// Resolved codepage, if provided. - /// - int? Codepage { get; set; } - - /// - /// Resolved summary information codepage, if provided. - /// - int? SummaryInformationCodepage { get; set; } - - /// - /// Resolved package language, if provided. - /// - int? PackageLcid { get; set; } - - /// - /// Fields still requiring resolution. - /// - IReadOnlyCollection DelayedFields { get; set; } - - /// - /// Files to extract from embedded .wixlibs. - /// - IReadOnlyCollection ExpectedEmbeddedFiles { get; set; } - - /// - /// Resolved intermediate. - /// - Intermediate IntermediateRepresentation { get; set; } - } -} diff --git a/src/WixToolset.Extensibility/Data/IResolvedCabinet.cs b/src/WixToolset.Extensibility/Data/IResolvedCabinet.cs deleted file mode 100644 index 0c07d387..00000000 --- a/src/WixToolset.Extensibility/Data/IResolvedCabinet.cs +++ /dev/null @@ -1,12 +0,0 @@ -// 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. - -namespace WixToolset.Extensibility.Data -{ -#pragma warning disable 1591 // TODO: add documentation - public interface IResolvedCabinet - { - CabinetBuildOption BuildOption { get; set; } - - string Path { get; set; } - } -} diff --git a/src/WixToolset.Extensibility/Data/IResolvedDirectory.cs b/src/WixToolset.Extensibility/Data/IResolvedDirectory.cs deleted file mode 100644 index 59de6e78..00000000 --- a/src/WixToolset.Extensibility/Data/IResolvedDirectory.cs +++ /dev/null @@ -1,19 +0,0 @@ -// 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. - -namespace WixToolset.Extensibility.Data -{ - /// - /// Used for resolved directory information. - /// - public interface IResolvedDirectory - { - /// The directory parent. - string DirectoryParent { get; set; } - - /// The name of this directory. - string Name { get; set; } - - /// The path of this directory. - string Path { get; set; } - } -} diff --git a/src/WixToolset.Extensibility/Data/ITrackedFile.cs b/src/WixToolset.Extensibility/Data/ITrackedFile.cs deleted file mode 100644 index df36bd2b..00000000 --- a/src/WixToolset.Extensibility/Data/ITrackedFile.cs +++ /dev/null @@ -1,32 +0,0 @@ -// 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. - -namespace WixToolset.Extensibility.Data -{ - using WixToolset.Data; - - /// - /// Interface used to track all files processed. - /// - public interface ITrackedFile - { - /// - /// Indicates whether the tracked file should be cleaned by the project. - /// - bool Clean { get; set; } - - /// - /// Path to tracked file. - /// - string Path { get; set; } - - /// - /// Optional source line numbers where the tracked file was created. - /// - SourceLineNumber SourceLineNumbers { get; set; } - - /// - /// Type of tracked file. - /// - TrackedFileType Type { get; set; } - } -} diff --git a/src/WixToolset.Extensibility/Data/IUnbindContext.cs b/src/WixToolset.Extensibility/Data/IUnbindContext.cs deleted file mode 100644 index 6427422f..00000000 --- a/src/WixToolset.Extensibility/Data/IUnbindContext.cs +++ /dev/null @@ -1,24 +0,0 @@ -// 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. - -namespace WixToolset.Extensibility.Data -{ - using System; - -#pragma warning disable 1591 // TODO: add documentation - public interface IUnbindContext - { - IServiceProvider ServiceProvider { get; } - - string ExportBasePath { get; set; } - - string InputFilePath { get; set; } - - string IntermediateFolder { get; set; } - - bool IsAdminImage { get; set; } - - bool SuppressDemodularization { get; set; } - - bool SuppressExtractCabinets { get; set; } - } -} \ No newline at end of file diff --git a/src/WixToolset.Extensibility/Data/PossibleKeyPathType.cs b/src/WixToolset.Extensibility/Data/PossibleKeyPathType.cs deleted file mode 100644 index 08e927e4..00000000 --- a/src/WixToolset.Extensibility/Data/PossibleKeyPathType.cs +++ /dev/null @@ -1,40 +0,0 @@ -// 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. - -namespace WixToolset.Extensibility.Data -{ - /// - /// Key path types. - /// - public enum PossibleKeyPathType - { - /// - /// Not a key path. - /// - None, - - /// - /// File resource as a key path. - /// - File, - - /// - /// Folder as a key path. - /// - Directory, - - /// - /// ODBC data source as a key path. - /// - OdbcDataSource, - - /// - /// A simple registry key acting as a key path. - /// - Registry, - - /// - /// A registry key that contains a formatted property acting as a key path. - /// - RegistryFormatted - } -} diff --git a/src/WixToolset.Extensibility/Data/TrackedFileType.cs b/src/WixToolset.Extensibility/Data/TrackedFileType.cs deleted file mode 100644 index e7f53842..00000000 --- a/src/WixToolset.Extensibility/Data/TrackedFileType.cs +++ /dev/null @@ -1,33 +0,0 @@ -// 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. - -namespace WixToolset.Extensibility.Data -{ - /// - /// Tracked file types. - /// - public enum TrackedFileType - { - /// - /// File tracked as input (like content included in an .msi). - /// - Input, - - /// - /// Temporary file (like an .idt or any other temporary file). - /// These are to be deleted before the build completes. - /// - Temporary, - - /// - /// Intermediate file (like a .cab in the cabcache). - /// These are left for subsequent builds. - /// - Intermediate, - - /// - /// Final output (like a .msi, .cab or .wixpdb). - /// These are the whole point of the build process. - /// - Final, - } -} diff --git a/src/WixToolset.Extensibility/DecompilerConstants.cs b/src/WixToolset.Extensibility/DecompilerConstants.cs deleted file mode 100644 index 22e8530d..00000000 --- a/src/WixToolset.Extensibility/DecompilerConstants.cs +++ /dev/null @@ -1,20 +0,0 @@ -// 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. - -namespace WixToolset.Extensibility -{ - /// - /// Constants used by decompiler. - /// - public static class DecompilerConstants - { - /// - /// - /// - public const char PrimaryKeyDelimiter = '/'; - - /// - /// - /// - public const string PrimaryKeyDelimiterString = "/"; - } -} diff --git a/src/WixToolset.Extensibility/DecompilerExtension.cs b/src/WixToolset.Extensibility/DecompilerExtension.cs deleted file mode 100644 index b492cf3a..00000000 --- a/src/WixToolset.Extensibility/DecompilerExtension.cs +++ /dev/null @@ -1,61 +0,0 @@ -// 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. - -namespace WixToolset.Extensibility -{ - using WixToolset.Data; - -#if BRING_BACK_LATER - /// - /// Base class for creating a decompiler extension. - /// - public abstract class DecompilerExtension : IDecompilerExtension - { - /// - /// Gets or sets the decompiler core for the extension. - /// - /// The decompiler core for the extension. - public IDecompilerCore Core { get; set; } - - /// - /// Gets the table definitions this extension decompiles. - /// - /// Table definitions this extension decompiles. - public virtual TableDefinitionCollection TableDefinitions { get; protected set; } - - /// - /// Gets the library that this decompiler wants removed from the decomipiled output. - /// - /// The table definitions to use while loading the library. - /// The library for this extension or null if there is no library to be removed. - public virtual Library GetLibraryToRemove(TableDefinitionCollection tableDefinitions) - { - return null; - } - - /// - /// Called at the beginning of the decompilation of a database. - /// - /// The collection of all tables. - public virtual void Initialize(TableIndexedCollection tables) - { - } - - /// - /// Decompiles an extension table. - /// - /// The table to decompile. - public virtual void DecompileTable(Table table) - { - this.Core.UnexpectedTable(table); - } - - /// - /// Finalize decompilation. - /// - /// The collection of all tables. - public virtual void Finish(TableIndexedCollection tables) - { - } - } -#endif -} diff --git a/src/WixToolset.Extensibility/ExtensionHelper.cs b/src/WixToolset.Extensibility/ExtensionHelper.cs deleted file mode 100644 index 6b938a65..00000000 --- a/src/WixToolset.Extensibility/ExtensionHelper.cs +++ /dev/null @@ -1,55 +0,0 @@ -// 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. - -namespace WixToolset.Extensibility -{ - using System; - using System.Collections.Specialized; - using System.IO; - using System.Reflection; - using System.Xml; - using WixToolset.Data; - using WixToolset.Extensibility; - -#if BRING_BACK_LATER - /// - /// The main class for a WiX extension. - /// - public static class ExtensionHelper - { - /// - /// Help for loading a library from an embedded resource. - /// - /// The assembly containing the embedded resource. - /// The name of the embedded resource being requested. - /// The table definitions to use while loading the library. - /// The loaded library. - public static Library LoadLibraryHelper(Assembly assembly, string resourceName, TableDefinitionCollection tableDefinitions) - { - using (Stream resourceStream = assembly.GetManifestResourceStream(resourceName)) - { - UriBuilder uriBuilder = new UriBuilder(); - uriBuilder.Scheme = "embeddedresource"; - uriBuilder.Path = assembly.Location; - uriBuilder.Fragment = resourceName; - - return Library.Load(resourceStream, uriBuilder.Uri, tableDefinitions, false); - } - } - - /// - /// Helper for loading table definitions from an embedded resource. - /// - /// The assembly containing the embedded resource. - /// The name of the embedded resource being requested. - /// The loaded table definitions. - public static TableDefinitionCollection LoadTableDefinitionHelper(Assembly assembly, string resourceName) - { - using (Stream resourceStream = assembly.GetManifestResourceStream(resourceName)) - using (XmlReader reader = XmlReader.Create(resourceStream)) - { - return TableDefinitionCollection.Load(reader); - } - } - } -#endif -} diff --git a/src/WixToolset.Extensibility/IBackend.cs b/src/WixToolset.Extensibility/IBackend.cs deleted file mode 100644 index 9579c3ca..00000000 --- a/src/WixToolset.Extensibility/IBackend.cs +++ /dev/null @@ -1,19 +0,0 @@ -// 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. - -namespace WixToolset.Extensibility -{ - using WixToolset.Data; - using WixToolset.Extensibility.Data; - -#pragma warning disable 1591 // TODO: add documentation - public interface IBackend - { - IBindResult Bind(IBindContext context); - - IDecompileResult Decompile(IDecompileContext context); - - Intermediate Unbind(IUnbindContext context); - - bool Inscribe(IInscribeContext context); - } -} diff --git a/src/WixToolset.Extensibility/IBackendFactory.cs b/src/WixToolset.Extensibility/IBackendFactory.cs deleted file mode 100644 index 99a6704f..00000000 --- a/src/WixToolset.Extensibility/IBackendFactory.cs +++ /dev/null @@ -1,10 +0,0 @@ -// 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. - -namespace WixToolset.Extensibility -{ -#pragma warning disable 1591 // TODO: add documentation - public interface IBackendFactory - { - bool TryCreateBackend(string outputType, string outputPath, out IBackend backend); - } -} diff --git a/src/WixToolset.Extensibility/IBinderExtension.cs b/src/WixToolset.Extensibility/IBinderExtension.cs deleted file mode 100644 index dba09845..00000000 --- a/src/WixToolset.Extensibility/IBinderExtension.cs +++ /dev/null @@ -1,22 +0,0 @@ -// 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. - -namespace WixToolset.Extensibility -{ - using WixToolset.Extensibility.Data; - - /// - /// Interface all binder extensions implement. - /// - public interface IBinderExtension - { - /// - /// Called before binding occurs. - /// - void PreBind(IBindContext context); - - /// - /// Called after all binding occurs. - /// - void PostBind(IBindResult result); - } -} diff --git a/src/WixToolset.Extensibility/IBurnBackendBinderExtension.cs b/src/WixToolset.Extensibility/IBurnBackendBinderExtension.cs deleted file mode 100644 index 1dd4d9b1..00000000 --- a/src/WixToolset.Extensibility/IBurnBackendBinderExtension.cs +++ /dev/null @@ -1,64 +0,0 @@ -// 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. - -namespace WixToolset.Extensibility -{ - using WixToolset.Data; - using WixToolset.Extensibility.Data; - - /// - /// Interface all Burn backend extensions implement. - /// - public interface IBurnBackendBinderExtension - { - /// - /// Called before binding occurs. - /// - void PreBackendBind(IBindContext context); - - /// - /// Called to find a file related to another source in the authoring. For example, most often used - /// to find cabinets and uncompressed files for an MSI package. - /// - /// Path to the source package. - /// Expected path to the related file. - /// Type of related file, such as "File" or "Cabinet" - /// Source line number of source package. - /// IResolveFileResult if the related file was found, or null for default handling. - IResolveFileResult ResolveRelatedFile(string source, string relatedSource, string type, SourceLineNumber sourceLineNumbers); - - /// - /// Called right before the output is bound into its final format. - /// - /// The finalized intermediate section. - void SymbolsFinalized(IntermediateSection section); - - /// - /// Called to customize the DownloadUrl provided in source cde. - /// - /// The value from the source code. May not actually be a URL. - /// The default URL if the extension does not return a value. - /// Identifier of the package. - /// Identifier of the payload. - /// Filename of the payload. - /// Url to override, or null to use default value. - string ResolveUrl(string url, string fallbackUrl, string packageId, string payloadId, string fileName); - - /// - /// Called for each extension symbol that hasn't been handled yet. - /// Use IBurnBackendHelper to add data. - /// - /// The linked section. - /// The current symbol. - /// - /// True if the extension handled the symbol, false otherwise. - /// The Burn backend will warn on all unhandled symbols. - /// - bool TryProcessSymbol(IntermediateSection section, IntermediateSymbol symbol); - - /// - /// Called after output is bound into its final format. - /// - /// - void PostBackendBind(IBindResult result); - } -} diff --git a/src/WixToolset.Extensibility/ICompilerExtension.cs b/src/WixToolset.Extensibility/ICompilerExtension.cs deleted file mode 100644 index 55ef683a..00000000 --- a/src/WixToolset.Extensibility/ICompilerExtension.cs +++ /dev/null @@ -1,61 +0,0 @@ -// 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. - -namespace WixToolset.Extensibility -{ - using System.Collections.Generic; - using System.Xml.Linq; - using WixToolset.Data; - using WixToolset.Extensibility.Data; - - /// - /// Interface all compiler extensions implement. - /// - public interface ICompilerExtension - { - /// - /// Gets the schema namespace for this extension. - /// - /// Schema namespace supported by this extension. - XNamespace Namespace { get; } - - /// - /// Called at the beginning of the compilation of a source file. - /// - void PreCompile(ICompileContext context); - - /// - /// Processes an attribute for the Compiler. - /// - /// Parent intermediate. - /// Parent section. - /// Parent element of attribute. - /// Attribute to process. - /// Extra information about the context in which this element is being parsed. - void ParseAttribute(Intermediate intermediate, IntermediateSection section, XElement parentElement, XAttribute attribute, IDictionary context); - - /// - /// Processes an element for the Compiler. - /// - /// Parent intermediate. - /// Parent section. - /// Parent element of element to process. - /// Element to process. - /// Extra information about the context in which this element is being parsed. - void ParseElement(Intermediate intermediate, IntermediateSection section, XElement parentElement, XElement element, IDictionary context); - - /// - /// Processes an element for the Compiler, with the ability to supply a component keypath. - /// - /// Parent intermediate. - /// Parent section. - /// Parent element of element to process. - /// Element to process. - /// Extra information about the context in which this element is being parsed. - IComponentKeyPath ParsePossibleKeyPathElement(Intermediate intermediate, IntermediateSection section, XElement parentElement, XElement element, IDictionary context); - - /// - /// Called at the end of the compilation of a source file. - /// - void PostCompile(Intermediate intermediate); - } -} diff --git a/src/WixToolset.Extensibility/IDecompilerExtension.cs b/src/WixToolset.Extensibility/IDecompilerExtension.cs deleted file mode 100644 index 24ef3bff..00000000 --- a/src/WixToolset.Extensibility/IDecompilerExtension.cs +++ /dev/null @@ -1,22 +0,0 @@ -// 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. - -namespace WixToolset.Extensibility -{ - using WixToolset.Extensibility.Data; - - /// - /// Base class for creating a decompiler extension. - /// - public interface IDecompilerExtension - { - /// - /// Called before decompiling occurs. - /// - void PreDecompile(IDecompileContext context); - - /// - /// Called after all decompiling occurs. - /// - void PostDecompile(IDecompileResult result); - } -} diff --git a/src/WixToolset.Extensibility/IExtensionCommandLine.cs b/src/WixToolset.Extensibility/IExtensionCommandLine.cs deleted file mode 100644 index f7b19955..00000000 --- a/src/WixToolset.Extensibility/IExtensionCommandLine.cs +++ /dev/null @@ -1,48 +0,0 @@ -// 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. - -namespace WixToolset.Extensibility -{ - using System.Collections.Generic; - using WixToolset.Extensibility.Data; - using WixToolset.Extensibility.Services; - - /// - /// Interface extensions implement to be able to parse the command-line. - /// - public interface IExtensionCommandLine - { - /// - /// Gets the supported command line types for this extension. - /// - /// The supported command line types for this extension. - IReadOnlyCollection CommandLineSwitches { get; } - - /// - /// Called before the command-line is parsed. - /// - /// Information about the command-line to be parsed. - void PreParse(ICommandLineContext context); - - /// - /// Gives the extension an opportunity pass a command-line argument for another command. - /// - /// Parser to help parse the argument and additional arguments. - /// Argument to parse. - /// True if the argument is recognized; otherwise false to allow another extension to process it. - bool TryParseArgument(ICommandLineParser parser, string argument); - - /// - /// Gives the extension an opportunity to provide a command. - /// - /// Parser to help parse the argument and additional arguments. - /// Argument to parse. - /// - /// True if the argument is recognized as a command; otherwise false to allow another extension to process it. - bool TryParseCommand(ICommandLineParser parser, string argument, out ICommandLineCommand command); - - /// - /// Called after the command-line is parsed. - /// - void PostParse(); - } -} diff --git a/src/WixToolset.Extensibility/IExtensionData.cs b/src/WixToolset.Extensibility/IExtensionData.cs deleted file mode 100644 index 823e2beb..00000000 --- a/src/WixToolset.Extensibility/IExtensionData.cs +++ /dev/null @@ -1,33 +0,0 @@ -// 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. - -namespace WixToolset.Extensibility -{ - using WixToolset.Data; - - /// - /// Interface extensions implement to provide data. - /// - public interface IExtensionData - { - /// - /// Gets the optional default culture. - /// - /// The optional default culture. - string DefaultCulture { get; } - - /// - /// - /// - /// - /// - /// True - bool TryGetSymbolDefinitionByName(string name, out IntermediateSymbolDefinition symbolDefinition); - - /// - /// Gets the library associated with this extension. - /// - /// The symbol definitions to use while loading the library. - /// The library for this extension or null if there is no library. - Intermediate GetLibrary(ISymbolDefinitionCreator symbolDefinitions); - } -} diff --git a/src/WixToolset.Extensibility/IExtensionFactory.cs b/src/WixToolset.Extensibility/IExtensionFactory.cs deleted file mode 100644 index f86fdde0..00000000 --- a/src/WixToolset.Extensibility/IExtensionFactory.cs +++ /dev/null @@ -1,20 +0,0 @@ -// 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. - -namespace WixToolset.Extensibility -{ - using System; - - /// - /// Implementations may request an IWixToolsetCoreServiceProvider at instantiation by having a single parameter constructor for it. - /// - public interface IExtensionFactory - { - /// - /// Request to create an extension of the specified type. - /// - /// Extension type to create. - /// Extension created. - /// True if extension was created; otherwise false. - bool TryCreateExtension(Type extensionType, out object extension); - } -} diff --git a/src/WixToolset.Extensibility/IFileSystemExtension.cs b/src/WixToolset.Extensibility/IFileSystemExtension.cs deleted file mode 100644 index 9807e8b9..00000000 --- a/src/WixToolset.Extensibility/IFileSystemExtension.cs +++ /dev/null @@ -1,17 +0,0 @@ -// 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. - -namespace WixToolset.Extensibility -{ - using WixToolset.Extensibility.Data; - - /// - /// Interface all file system extensions implement. - /// - public interface IFileSystemExtension - { -#pragma warning disable 1591 // TODO: add documentation - void Initialize(IFileSystemContext context); - - bool? CompareFiles(string targetFile, string updatedFile); - } -} diff --git a/src/WixToolset.Extensibility/IInspectorCore.cs b/src/WixToolset.Extensibility/IInspectorCore.cs deleted file mode 100644 index 9420ea05..00000000 --- a/src/WixToolset.Extensibility/IInspectorCore.cs +++ /dev/null @@ -1,15 +0,0 @@ -// 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. - -namespace WixToolset.Extensibility -{ - /// - /// Core facilities for inspector extensions. - /// - public interface IInspectorCore - { - /// - /// Gets whether an error occured. - /// - bool EncounteredError { get; } - } -} diff --git a/src/WixToolset.Extensibility/IInspectorExtension.cs b/src/WixToolset.Extensibility/IInspectorExtension.cs deleted file mode 100644 index 7c488a89..00000000 --- a/src/WixToolset.Extensibility/IInspectorExtension.cs +++ /dev/null @@ -1,60 +0,0 @@ -// 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. - -namespace WixToolset.Extensibility -{ - using System; - using System.IO; - using WixToolset.Data; - - /// - /// Interface for inspector extensions. - /// - /// - /// The inspector methods are stateless, but extensions are loaded once. If you want to maintain state, you should check - /// if your data is loaded for each method and, if not, load it. - /// - public interface IInspectorExtension - { - /// - /// Gets or sets the for inspector extensions to use. - /// - IInspectorCore Core { get; set; } - - /// - /// Inspect the source before preprocessing. - /// - /// The source to preprocess. - void InspectSource(Stream source); - - /// - /// Inspect the compiled output. - /// - /// The compiled output. - void InspectIntermediate(Intermediate intermediate); - -#if REWRITE - /// - /// Inspect the output. - /// - /// The output. May be called after linking or binding. - /// - /// To inspect a patch's filtered transforms, enumerate . - /// Transforms where the begins with "#" are - /// called patch transforms and instruct Windows Installer how to apply the - /// authored transforms - those that do not begin with "#". The authored - /// transforms are the primary transforms you'll typically want to inspect - /// and contain your changes to target products. - /// -#endif - /// - void InspectOutput(Intermediate output); - - /// - /// Inspect the final output after binding. - /// - /// The file path to the final bound output. - /// The that contains source line numbers - /// for the database and all rows. - void InspectDatabase(string filePath, Intermediate pdb); - } -} diff --git a/src/WixToolset.Extensibility/ILayoutExtension.cs b/src/WixToolset.Extensibility/ILayoutExtension.cs deleted file mode 100644 index ecd7d8f1..00000000 --- a/src/WixToolset.Extensibility/ILayoutExtension.cs +++ /dev/null @@ -1,28 +0,0 @@ -// 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. - -namespace WixToolset.Extensibility -{ - using WixToolset.Extensibility.Data; - - /// - /// Interface all layout extensions implement. - /// - public interface ILayoutExtension - { - /// - /// Called before layout occurs. - /// - void PreLayout(ILayoutContext context); - -#pragma warning disable 1591 // TODO: add documentation - bool CopyFile(string source, string destination); - - bool MoveFile(string source, string destination); -#pragma warning restore 1591 - - /// - /// Called after all layout occurs. - /// - void PostLayout(); - } -} diff --git a/src/WixToolset.Extensibility/ILibrarianExtension.cs b/src/WixToolset.Extensibility/ILibrarianExtension.cs deleted file mode 100644 index d9b04cd2..00000000 --- a/src/WixToolset.Extensibility/ILibrarianExtension.cs +++ /dev/null @@ -1,17 +0,0 @@ -// 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. - -namespace WixToolset.Extensibility -{ - using WixToolset.Data; - using WixToolset.Extensibility.Data; - -#pragma warning disable 1591 // TODO: add documentation - public interface ILibrarianExtension - { - void PreCombine(ILibraryContext context); - - IResolveFileResult ResolveFile(SourceLineNumber sourceLineNumber, IntermediateSymbolDefinition symbolDefinition, string path); - - void PostCombine(Intermediate library); - } -} diff --git a/src/WixToolset.Extensibility/ILinkerExtension.cs b/src/WixToolset.Extensibility/ILinkerExtension.cs deleted file mode 100644 index febca1df..00000000 --- a/src/WixToolset.Extensibility/ILinkerExtension.cs +++ /dev/null @@ -1,23 +0,0 @@ -// 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. - -namespace WixToolset.Extensibility -{ - using WixToolset.Data; - using WixToolset.Extensibility.Data; - - /// - /// Interface all binder extensions implement. - /// - public interface ILinkerExtension - { - /// - /// Called before linking occurs. - /// - void PreLink(ILinkContext context); - - /// - /// Called after all linking occurs. - /// - void PostLink(Intermediate intermediate); - } -} diff --git a/src/WixToolset.Extensibility/IMessageListener.cs b/src/WixToolset.Extensibility/IMessageListener.cs deleted file mode 100644 index a04e9c98..00000000 --- a/src/WixToolset.Extensibility/IMessageListener.cs +++ /dev/null @@ -1,34 +0,0 @@ -// 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. - -namespace WixToolset.Extensibility -{ - using WixToolset.Data; - using WixToolset.Extensibility.Services; - - /// - /// Message listener. - /// - public interface IMessageListener - { - /// - /// Calculate a new level for a message. - /// - /// Messaging object. - /// Message to evaluate. - /// Current message level. - /// - MessageLevel CalculateMessageLevel(IMessaging messaging, Message message, MessageLevel defaultMessageLevel); - - /// - /// Writes a message. - /// - /// Message to write. - void Write(Message message); - - /// - /// Writes a string message. - /// - /// String message to write. - void Write(string message); - } -} diff --git a/src/WixToolset.Extensibility/IPreprocessorExtension.cs b/src/WixToolset.Extensibility/IPreprocessorExtension.cs deleted file mode 100644 index 919ff1ae..00000000 --- a/src/WixToolset.Extensibility/IPreprocessorExtension.cs +++ /dev/null @@ -1,57 +0,0 @@ -// 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. - -namespace WixToolset.Extensibility -{ - using System.Xml.Linq; - using WixToolset.Extensibility.Data; - - /// - /// Interface for extending the WiX toolset preprocessor. - /// - public interface IPreprocessorExtension - { - /// - /// Gets the variable prefixes for the extension. - /// - /// The variable prefixes for the extension. - string[] Prefixes { get; } - - /// - /// Called at the beginning of the preprocessing of a source file. - /// - void PrePreprocess(IPreprocessContext context); - - /// - /// Gets the value of a variable whose prefix matches the extension. - /// - /// The prefix of the variable to be processed by the extension. - /// The name of the variable. - /// The value of the variable or null if the variable is undefined. - string GetVariableValue(string prefix, string name); - - /// - /// Evaluates a function defined in the extension. - /// - /// The prefix of the function to be processed by the extension. - /// The name of the function. - /// The list of arguments. - /// The value of the function or null if the function is not defined. - string EvaluateFunction(string prefix, string function, string[] args); - - /// - /// Processes a pragma defined in the extension. - /// - /// The prefix of the pragma to be processed by the extension. - /// The name of the pragma. - /// The pragma's arguments. - /// The parent node of the pragma. - /// false if the pragma is not defined. - /// Don't return false for any condition except for unrecognized pragmas. Use Core.OnMessage for errors, warnings and messages. - bool ProcessPragma(string prefix, string pragma, string args, XContainer parent); - - /// - /// Called at the end of the preprocessing of a source file. - /// - void PostPreprocess(IPreprocessResult result); - } -} diff --git a/src/WixToolset.Extensibility/IResolverExtension.cs b/src/WixToolset.Extensibility/IResolverExtension.cs deleted file mode 100644 index f77581a0..00000000 --- a/src/WixToolset.Extensibility/IResolverExtension.cs +++ /dev/null @@ -1,28 +0,0 @@ -// 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. - -namespace WixToolset.Extensibility -{ - using WixToolset.Data; - using WixToolset.Extensibility.Data; - - /// - /// Interface all resolver extensions implement. - /// - public interface IResolverExtension - { - /// - /// Called before resolving occurs. - /// - void PreResolve(IResolveContext context); - - /// - /// Called to attempt to resolve source to a file. - /// - IResolveFileResult ResolveFile(string source, IntermediateSymbolDefinition symbolDefinition, SourceLineNumber sourceLineNumbers, BindStage bindStage); - - /// - /// Called after all resolving occurs. - /// - void PostResolve(IResolveResult result); - } -} diff --git a/src/WixToolset.Extensibility/IUnbinderExtension.cs b/src/WixToolset.Extensibility/IUnbinderExtension.cs deleted file mode 100644 index 0e9a2504..00000000 --- a/src/WixToolset.Extensibility/IUnbinderExtension.cs +++ /dev/null @@ -1,18 +0,0 @@ -// 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. - -namespace WixToolset.Extensibility -{ - using System; - using WixToolset.Data; - - /// - /// Base class for creating an unbinder extension. - /// - public interface IUnbinderExtension - { - /// - /// Called during the generation of sectionIds for an admin image. - /// - void GenerateSectionIds(Intermediate output); - } -} diff --git a/src/WixToolset.Extensibility/IWindowsInstallerBackendBinderExtension.cs b/src/WixToolset.Extensibility/IWindowsInstallerBackendBinderExtension.cs deleted file mode 100644 index 067745c2..00000000 --- a/src/WixToolset.Extensibility/IWindowsInstallerBackendBinderExtension.cs +++ /dev/null @@ -1,65 +0,0 @@ -// 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. - -namespace WixToolset.Extensibility -{ - using System.Collections.Generic; - using WixToolset.Data; - using WixToolset.Data.Symbols; - using WixToolset.Data.WindowsInstaller; - using WixToolset.Extensibility.Data; - - /// - /// Interface all binder extensions implement. - /// - public interface IWindowsInstallerBackendBinderExtension - { - /// - /// Table definitions provided by the extension. - /// - IReadOnlyCollection TableDefinitions { get; } - - /// - /// Called before binding occurs. - /// - void PreBackendBind(IBindContext context); - - /// - /// Extension can process the intermediate before the Windows Installer data is created. - /// - /// The finalized intermediate section. - void SymbolsFinalized(IntermediateSection section); - - /// - /// Finds an existing cabinet that contains the provided files. - /// - /// Path to the cabinet. - /// Files contained in the cabinet. - /// Resolved cabinet options or null if the cabinet could not be found. - IResolvedCabinet ResolveCabinet(string cabinetPath, IEnumerable files); - - /// - /// Override layout location for a media. - /// - /// Media symbol. - /// Default media specific layout directory. - /// Default overall layout directory. - /// Layout location or null to use the default processing. - string ResolveMedia(MediaSymbol mediaSymbol, string mediaLayoutDirectory, string layoutDirectory); - - /// - /// Called for each extension symbol that hasn't been handled yet. - /// - /// The linked section. - /// The current symbol. - /// Windows Installer data - /// Collection of table definitions available for the output. - /// True if the symbol was handled, or false if not. - bool TryProcessSymbol(IntermediateSection section, IntermediateSymbol symbol, WindowsInstallerData data, TableDefinitionCollection tableDefinitions); - - /// - /// Called after all output changes occur and right before the output is bound into its final format. - /// - /// Bind result to process. - void PostBackendBind(IBindResult result); - } -} diff --git a/src/WixToolset.Extensibility/IWindowsInstallerBackendDecompilerExtension.cs b/src/WixToolset.Extensibility/IWindowsInstallerBackendDecompilerExtension.cs deleted file mode 100644 index a56b63c3..00000000 --- a/src/WixToolset.Extensibility/IWindowsInstallerBackendDecompilerExtension.cs +++ /dev/null @@ -1,26 +0,0 @@ -// 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. - -namespace WixToolset.Extensibility -{ - using WixToolset.Data; - using WixToolset.Data.WindowsInstaller; - using WixToolset.Extensibility.Data; - - /// - /// Interface all binder extensions implement. - /// - public interface IWindowsInstallerBackendDecompilerExtension - { - /// - /// Called before decompiling occurs. - /// - void PreBackendDecompile(IDecompileContext context); - - // TODO: Redesign this interface to be useful. - - /// - /// Called after all output changes occur and right before the output is bound into its final format. - /// - void PostBackendDecompile(IDecompileResult result); - } -} diff --git a/src/WixToolset.Extensibility/InspectorExtension.cs b/src/WixToolset.Extensibility/InspectorExtension.cs deleted file mode 100644 index 49c3f9de..00000000 --- a/src/WixToolset.Extensibility/InspectorExtension.cs +++ /dev/null @@ -1,63 +0,0 @@ -// 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. - -namespace WixToolset.Extensibility -{ - using System; - using System.IO; - using WixToolset.Data; - -#if BRING_THIS_BACK - /// - /// Opitonal base class for inspector extensions. - /// - public class InspectorExtension : IInspectorExtension - { - /// - /// Gets the for inspector extensions to use. - /// - public IInspectorCore Core { get; set; } - - /// - /// Inspect the source before preprocessing. - /// - /// The source to preprocess. - public virtual void InspectSource(Stream source) - { - } - - /// - /// Inspect the compiled output. - /// - /// The compiled output. - public virtual void InspectIntermediate(Intermediate intermediate) - { - } - - /// - /// Inspect the output. - /// - /// The output. May be called after linking or binding. - /// - /// To inspect a patch's filtered transforms, enumerate . - /// Transforms where the begins with "#" are - /// called patch transforms and instruct Windows Installer how to apply the - /// authored transforms - those that do not begin with "#". The authored - /// transforms are the primary transforms you'll typically want to inspect - /// and contain your changes to target products. - /// - public virtual void InspectOutput(Output output) - { - } - - /// - /// Inspect the final output after binding. - /// - /// The file path to the final bound output. - /// The that contains source line numbers - /// for the database and all rows. - public virtual void InspectDatabase(string filePath, Pdb pdb) - { - } - } -#endif -} diff --git a/src/WixToolset.Extensibility/Services/IBackendHelper.cs b/src/WixToolset.Extensibility/Services/IBackendHelper.cs deleted file mode 100644 index 5c4d9a68..00000000 --- a/src/WixToolset.Extensibility/Services/IBackendHelper.cs +++ /dev/null @@ -1,183 +0,0 @@ -// 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. - -namespace WixToolset.Extensibility.Services -{ - using System; - using System.Collections.Generic; - using WixToolset.Data; - using WixToolset.Data.Symbols; - using WixToolset.Data.WindowsInstaller.Rows; - using WixToolset.Extensibility.Data; - - /// - /// Interface provided to help backend extensions. - /// - public interface IBackendHelper - { - /// - /// Creates a file facade from a FileSymbol and possible AssemblySymbol. - /// - /// FileSymbol backing the facade. - /// AssemblySymbol backing the facade. - /// - IFileFacade CreateFileFacade(FileSymbol file, AssemblySymbol assembly); - - /// - /// Creates a file facade from a File row. - /// - /// FileRow - /// New IFileFacade. - IFileFacade CreateFileFacade(FileRow fileRow); - - /// - /// Creates a file facade from a Merge Module's File symbol. - /// - /// FileSymbol created from a Merge Module. - /// New IFileFacade. - IFileFacade CreateFileFacadeFromMergeModule(FileSymbol fileSymbol); - - /// - /// Creates a file transfer and marks it redundant if the source and destination are identical. - /// - /// Source for the file transfer. - /// Destination for the file transfer. - /// Indicates whether to move or copy the source file. - /// Optional source line numbers that requested the file transfer. - IFileTransfer CreateFileTransfer(string source, string destination, bool move, SourceLineNumber sourceLineNumbers = null); - - /// - /// Creates a MSI compatible GUID. - /// - /// Creates an uppercase GUID with braces. - string CreateGuid(); - - /// - /// Creates a version 3 name-based UUID. - /// - /// The namespace UUID. - /// The value. - /// The generated GUID for the given namespace and value. - string CreateGuid(Guid namespaceGuid, string value); - - /// - /// Creates a resolved directory. - /// - /// Directory parent identifier. - /// Name of directory. - /// Resolved directory. - IResolvedDirectory CreateResolvedDirectory(string directoryParent, string name); - - /// - /// Extracts embedded files. - /// - /// Embedded files to extract. - /// ITrackedFile for each embedded file extracted. - IReadOnlyList ExtractEmbeddedFiles(IEnumerable embeddedFiles); - - /// - /// Generate an identifier by hashing data from the row. - /// - /// Three letter or less prefix for generated row identifier. - /// Information to hash. - /// The generated identifier. - string GenerateIdentifier(string prefix, params string[] args); - - /// - /// Validates path is relative and canonicalizes it. - /// For example, "a\..\c\.\d.exe" => "c\d.exe". - /// - /// - /// - /// - /// - /// The original value if not relative, otherwise the canonicalized relative path. - string GetCanonicalRelativePath(SourceLineNumber sourceLineNumbers, string elementName, string attributeName, string relativePath); - - /// - /// Gets a valid code page from the given web name or integer value. - /// - /// A code page web name or integer value as a string. - /// Whether to allow -1 which does not change the database code pages. This may be the case with wxl files. - /// Whether to allow Unicode (UCS) or UTF code pages. - /// Source line information for the current authoring. - /// A valid code page number. - /// The value is an integer less than 0 or greater than 65535. - /// is null. - /// The value doesn't not represent a valid code page name or integer value. - /// The code page is invalid for summary information. - int GetValidCodePage(string value, bool allowNoChange = false, bool onlyAnsi = false, SourceLineNumber sourceLineNumbers = null); - - /// - /// Get a source/target and short/long file name from an MSI Filename column. - /// - /// The Filename value. - /// true to get a source name; false to get a target name - /// true to get a long name; false to get a short name - /// The name. - string GetMsiFileName(string value, bool source, bool longName); - - /// - /// Verifies if an identifier is a valid binder variable name. - /// - /// Binder variable name to verify. - /// True if the identifier is a valid binder variable name. - bool IsValidBinderVariable(string variable); - - /// - /// Verifies the given string is a valid 4-part version module or bundle version. - /// - /// The version to verify. - /// True if version is a valid module or bundle version. - bool IsValidFourPartVersion(string version); - - /// - /// Determines if value is a valid identifier. - /// - /// Identifier to validate. - /// True if valid identifier, otherwise false. - bool IsValidIdentifier(string id); - - /// - /// Verifies the given string is a valid long filename. - /// - /// The filename to verify. - /// Allow wildcards in the filename. - /// Allow long file name to be a relative path. - /// True if filename is a valid long filename. - bool IsValidLongFilename(string filename, bool allowWildcards, bool allowRelative); - - /// - /// Verifies the given string is a valid short filename. - /// - /// The filename to verify. - /// Allow wildcards in the filename. - /// True if filename is a valid short filename. - bool IsValidShortFilename(string filename, bool allowWildcards); - - /// - /// Resolve delayed fields. - /// - /// The fields which had resolution delayed. - /// The cached variable values used when resolving delayed fields. - void ResolveDelayedFields(IEnumerable delayedFields, Dictionary variableCache); - - /// - /// Get the source/target and short/long file names from an MSI Filename column. - /// - /// The Filename value. - /// An array of strings of length 4. The contents are: short target, long target, short source, and long source. - /// - /// If any particular file name part is not parsed, its set to null in the appropriate location of the returned array of strings. - /// Thus the returned array will always be of length 4. - /// - string[] SplitMsiFileName(string value); - - /// - /// Creates a tracked file. - /// - /// Destination path for the build output. - /// Type of tracked file to create. - /// Optional source line numbers that requested the tracked file. - ITrackedFile TrackFile(string path, TrackedFileType type, SourceLineNumber sourceLineNumbers = null); - } -} diff --git a/src/WixToolset.Extensibility/Services/IBurnBackendHelper.cs b/src/WixToolset.Extensibility/Services/IBurnBackendHelper.cs deleted file mode 100644 index ef5fcc65..00000000 --- a/src/WixToolset.Extensibility/Services/IBurnBackendHelper.cs +++ /dev/null @@ -1,50 +0,0 @@ -// 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. - -namespace WixToolset.Extensibility.Services -{ - using WixToolset.Data; - - /// - /// Interface provided to help Burn backend extensions. - /// - public interface IBurnBackendHelper : IBackendHelper - { - /// - /// Adds the given XML to the BootstrapperApplicationData manifest. - /// - /// A valid XML fragment. - void AddBootstrapperApplicationData(string xml); - - /// - /// Adds an XML element for the given symbol to the BootstrapperApplicationData manifest. - /// The symbol's name is used for the element's name. - /// All of the symbol's fields are used for the element's attributes. - /// - /// The symbol to create the element from. - /// - /// If true and the symbol has an Id, - /// then an Id attribute is created with a value of the symbol's Id. - /// - void AddBootstrapperApplicationData(IntermediateSymbol symbol, bool symbolIdIsIdAttribute = false); - - /// - /// Adds the given XML to the BundleExtensionData manifest for the given bundle extension. - /// - /// The bundle extension's id. - /// A valid XML fragment. - void AddBundleExtensionData(string extensionId, string xml); - - /// - /// Adds an XML element for the given symbol to the BundleExtensionData manifest for the given bundle extension. - /// The symbol's name is used for the element's name. - /// All of the symbol's fields are used for the element's attributes. - /// - /// The bundle extension's id. - /// The symbol to create the element from. - /// - /// If true and the symbol has an Id, - /// then an Id attribute is created with a value of the symbol's Id. - /// - void AddBundleExtensionData(string extensionId, IntermediateSymbol symbol, bool symbolIdIsIdAttribute = false); - } -} diff --git a/src/WixToolset.Extensibility/Services/ICommandLine.cs b/src/WixToolset.Extensibility/Services/ICommandLine.cs deleted file mode 100644 index 2b841af0..00000000 --- a/src/WixToolset.Extensibility/Services/ICommandLine.cs +++ /dev/null @@ -1,33 +0,0 @@ -// 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. - -namespace WixToolset.Extensibility.Services -{ - using WixToolset.Extensibility.Data; - - /// - /// Command-line parsing mechanism. - /// - public interface ICommandLine - { - /// - /// Simple way to parse arguments and create a command. - /// - /// Unparsed arguments. - /// Command if the command-line arguments can be parsed, otherwise null. - ICommandLineCommand CreateCommand(string[] args); - - /// - /// Simple way to parse arguments and create a command. - /// - /// Unparsed arguments. - /// Command if the command-line arguments can be parsed, otherwise null. - ICommandLineCommand CreateCommand(string commandLine); - - /// - /// Creates a command from populated arguments. - /// - /// Parsed arguments. - /// Command if the command-line arguments can be parsed, otherwise null. - ICommandLineCommand ParseStandardCommandLine(ICommandLineArguments arguments); - } -} diff --git a/src/WixToolset.Extensibility/Services/ICommandLineParser.cs b/src/WixToolset.Extensibility/Services/ICommandLineParser.cs deleted file mode 100644 index cd17f100..00000000 --- a/src/WixToolset.Extensibility/Services/ICommandLineParser.cs +++ /dev/null @@ -1,40 +0,0 @@ -// 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. - -namespace WixToolset.Extensibility.Services -{ - using System.Collections.Generic; - using WixToolset.Data; - -#pragma warning disable 1591 // TODO: add documentation - public interface ICommandLineParser - { - string ErrorArgument { get; } - - /// - /// Validates that a valid switch (starts with "/" or "-"), and returns a bool indicating its validity - /// - /// The string check. - /// True if a valid switch, otherwise false. - bool IsSwitch(string arg); - - string GetArgumentAsFilePathOrError(string argument, string fileType); - - void GetArgumentAsFilePathOrError(string argument, string fileType, IList paths); - - string GetNextArgumentOrError(string commandLineSwitch); - - bool GetNextArgumentOrError(string commandLineSwitch, IList argument); - - string GetNextArgumentAsDirectoryOrError(string commandLineSwitch); - - bool GetNextArgumentAsDirectoryOrError(string commandLineSwitch, IList directories); - - string GetNextArgumentAsFilePathOrError(string commandLineSwitch); - - bool GetNextArgumentAsFilePathOrError(string commandLineSwitch, string fileType, IList paths); - - void ReportErrorArgument(string argument, Message message = null); - - bool TryGetNextSwitchOrArgument(out string arg); - } -} diff --git a/src/WixToolset.Extensibility/Services/IExtensionManager.cs b/src/WixToolset.Extensibility/Services/IExtensionManager.cs deleted file mode 100644 index 8e49c38d..00000000 --- a/src/WixToolset.Extensibility/Services/IExtensionManager.cs +++ /dev/null @@ -1,42 +0,0 @@ -// 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. - -namespace WixToolset.Extensibility.Services -{ - using System.Collections.Generic; - using System.Reflection; - - /// - /// Loads extensions and uses the extensions' factories to provide services. - /// - public interface IExtensionManager - { - /// - /// Adds an extension assembly directly to the manager. - /// - /// Extension assembly. - void Add(Assembly extensionAssembly); - - /// - /// Loads an extension assembly from an extension reference string. - /// - /// Reference to the extension. - /// The loaded assembly. This assembly can be ignored since the extension manager maintains the list of loaded assemblies internally. - /// - /// can be in several different forms: - /// - /// Full path to an extension file (C:\MyExtensions\MyExtension.Example.wixext.dll) - /// Reference to latest version of an extension in the cache (MyExtension.Example.wixext) - /// Versioned reference to specific extension in the cache (MyExtension.Example.wixext/1.0.2) - /// Relative path to an extension file (..\..\MyExtensions\MyExtension.Example.wixext.dll) - /// - /// - void Load(string extensionReference); - - /// - /// Gets extensions of specified type from factories loaded into the extension manager. - /// - /// Type of extension to get. - /// Extensions of the specified type. - IReadOnlyCollection GetServices() where T : class; - } -} diff --git a/src/WixToolset.Extensibility/Services/IMessaging.cs b/src/WixToolset.Extensibility/Services/IMessaging.cs deleted file mode 100644 index fe77f2a4..00000000 --- a/src/WixToolset.Extensibility/Services/IMessaging.cs +++ /dev/null @@ -1,73 +0,0 @@ -// 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. - -namespace WixToolset.Extensibility.Services -{ - using WixToolset.Data; - - /// - /// Interface for handling messages (error/warning/verbose). - /// - public interface IMessaging - { - /// - /// Indicates whether an error has been found. - /// - /// A bool indicating whether an error has been found. - bool EncounteredError { get; } - - /// - /// Gets the last error code encountered during messaging. - /// - /// The exit code for the process. - int LastErrorNumber { get; } - - /// - /// Gets or sets the option to show verbose messages. - /// - /// The option to show verbose messages. - bool ShowVerboseMessages { get; set; } - - /// - /// Gets or sets the option to suppress all warning messages. - /// - /// The option to suppress all warning messages. - bool SuppressAllWarnings { get; set; } - - /// - /// Gets and sets the option to treat warnings as errors. - /// - /// The option to treat warnings as errors. - bool WarningsAsError { get; set; } - - /// - /// Sets the listener for messaging. - /// - /// - void SetListener(IMessageListener listener); - - /// - /// Adds a warning message id to be elevated to an error message. - /// - /// Id of the message to elevate. - void ElevateWarningMessage(int warningNumber); - - /// - /// Adds a warning message id to be suppressed in message output. - /// - /// Id of the message to suppress. - void SuppressWarningMessage(int warningNumber); - - /// - /// Sends a message with the given arguments. - /// - /// Message to write. - void Write(Message message); - - /// - /// Sends a message with the given arguments. - /// - /// Message to write. - /// Indicates where to write a verbose message. - void Write(string message, bool verbose = false); - } -} diff --git a/src/WixToolset.Extensibility/Services/IParseHelper.cs b/src/WixToolset.Extensibility/Services/IParseHelper.cs deleted file mode 100644 index fbe5aae4..00000000 --- a/src/WixToolset.Extensibility/Services/IParseHelper.cs +++ /dev/null @@ -1,466 +0,0 @@ -// 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. - -namespace WixToolset.Extensibility.Services -{ - using System; - using System.Collections.Generic; - using System.Xml.Linq; - using WixToolset.Data; - using WixToolset.Data.Symbols; - using WixToolset.Data.WindowsInstaller; - using WixToolset.Extensibility.Data; - - /// - /// Interface provided to help compiler extensions parse. - /// - public interface IParseHelper - { - /// - /// Creates a version 3 name-based UUID. - /// - /// The namespace UUID. - /// The value. - /// The generated GUID for the given namespace and value. - string CreateGuid(Guid namespaceGuid, string value); - - /// - /// Create an identifier by hashing data from the row. - /// - /// Three letter or less prefix for generated row identifier. - /// Information to hash. - /// The new identifier. - Identifier CreateIdentifier(string prefix, params string[] args); - - /// - /// Create an identifier based on passed file name - /// - /// File name to generate identifier from - /// The new identifier. - Identifier CreateIdentifierFromFilename(string filename); - - /// - /// Append a suffix to the given name based on the current platform. - /// If the current platform is not in the supported platforms, then it returns null. - /// - /// The base name for the identifier. - /// The platform being compiled. - /// The platforms for which there are specialized implementations. - /// The generated identifier value, or null if the current platform isn't supported. - string CreateIdentifierValueFromPlatform(string name, Platform currentPlatform, BurnPlatforms supportedPlatforms); - - /// - /// Creates a symbol in the section. - /// - /// Section to add the new symbol to. - /// Source and line number of current symbol. - /// Name of symbol definition. - /// Optional identifier for the symbol. - /// New symbol. - IntermediateSymbol CreateSymbol(IntermediateSection section, SourceLineNumber sourceLineNumbers, string symbolName, Identifier identifier = null); - - /// - /// Creates a symbol in the section. - /// - /// Section to add the new symbol to. - /// Source and line number of current symbol. - /// Symbol definition to create from. - /// Optional identifier for the symbol. - /// New symbol. - IntermediateSymbol CreateSymbol(IntermediateSection section, SourceLineNumber sourceLineNumbers, IntermediateSymbolDefinition symbolDefinition, Identifier identifier = null); - - /// - /// Creates a directory row from a name. - /// - /// Section to add the new symbol to. - /// Source line information. - /// Optional identifier for the new row. - /// Optional identifier for the parent row. - /// Long name of the directory. - /// Optional short name of the directory. - /// Optional source name for the directory. - /// Optional short source name for the directory. - /// Identifier for the newly created row. - Identifier CreateDirectorySymbol(IntermediateSection section, SourceLineNumber sourceLineNumbers, Identifier id, string parentId, string name, string shortName = null, string sourceName = null, string shortSourceName = null); - - /// - /// Creates directories using the inline directory syntax. - /// - /// Section to add the new symbol to. - /// Source line information. - /// Attribute containing the inline syntax. - /// Optional identifier of parent directory. - /// Optional inline syntax to override attribute's value. - /// Mapping of inline directory syntax to ids for the section. - /// Identifier of the leaf directory created. - string CreateDirectoryReferenceFromInlineSyntax(IntermediateSection section, SourceLineNumber sourceLineNumbers, XAttribute attribute, string parentId, string inlineSyntax, IDictionary sectionCachedInlinedDirectoryIds); - - /// - /// Creates a Registry symbol in the active section. - /// - /// Active section. - /// Source and line number of the current symbol. - /// The registry entry root. - /// The registry entry key. - /// The registry entry name. - /// The registry entry value. - /// The component which will control installation/uninstallation of the registry entry. - /// If true, "escape" leading '#' characters so the value is written as a REG_SZ. - Identifier CreateRegistrySymbol(IntermediateSection section, SourceLineNumber sourceLineNumbers, RegistryRootType root, string key, string name, string value, string componentId, bool escapeLeadingHash); - - /// - /// Create a WixSimpleReference symbol in the active section. - /// - /// Active section. - /// Source line information for the row. - /// The symbol name of the simple reference. - /// The primary key of the simple reference. - void CreateSimpleReference(IntermediateSection section, SourceLineNumber sourceLineNumbers, string symbolName, string primaryKey); - - /// - /// Create a WixSimpleReference symbol in the active section. - /// - /// Active section. - /// Source line information for the row. - /// The symbol name of the simple reference. - /// The primary keys of the simple reference. - void CreateSimpleReference(IntermediateSection section, SourceLineNumber sourceLineNumbers, string symbolName, params string[] primaryKeys); - - /// - /// Create a WixSimpleReference symbol in the active section. - /// - /// Active section. - /// Source line information for the row. - /// The symbol definition of the simple reference. - /// The primary key of the simple reference. - void CreateSimpleReference(IntermediateSection section, SourceLineNumber sourceLineNumbers, IntermediateSymbolDefinition symbolDefinition, string primaryKey); - - /// - /// Create a WixSimpleReference symbol in the active section. - /// - /// Active section. - /// Source line information for the row. - /// The symbol definition of the simple reference. - /// The primary keys of the simple reference. - void CreateSimpleReference(IntermediateSection section, SourceLineNumber sourceLineNumbers, IntermediateSymbolDefinition symbolDefinition, params string[] primaryKeys); - - /// - /// Create a reference in the specified section for a custom action specialized for specific platforms, - /// given standard prefixes for naming and suffixes for platforms. - /// - /// Source line information. - /// Section to create the reference in. - /// The custom action base name. - /// The platform being compiled. - /// The platforms for which there are specialized custom actions. - void CreateCustomActionReference(SourceLineNumber sourceLineNumbers, IntermediateSection section, string customAction, Platform platform, CustomActionPlatforms supportedPlatforms); - - /// - /// Creates WixComplexReference and WixGroup symbols in the active section. - /// - /// Section to create the reference in. - /// Source line information. - /// The parent type. - /// The parent id. - /// The parent language. - /// The child type. - /// The child id. - /// Whether the child is primary. - void CreateComplexReference(IntermediateSection section, SourceLineNumber sourceLineNumbers, ComplexReferenceParentType parentType, string parentId, string parentLanguage, ComplexReferenceChildType childType, string childId, bool isPrimary); - - /// - /// A symbol in the WixGroup table is added for this child node and its parent node. - /// - /// Section to create the reference in. - /// Source line information for the row. - /// Type of child's complex reference parent. - /// Id of the parenet node. - /// Complex reference type of child - /// Id of the Child Node. - void CreateWixGroupSymbol(IntermediateSection section, SourceLineNumber sourceLineNumbers, ComplexReferenceParentType parentType, string parentId, ComplexReferenceChildType childType, string childId); - - /// - /// Creates a symbol in the WixSearch table. - /// - /// Section to create the reference in. - /// Source line number for the search element. - /// Name of search element. - /// Identifier of the search. - /// The Burn variable to store the result into. - /// A condition to test before evaluating the search. - /// The search that this one will execute after. - /// The id of the bundle extension that handles this search. - void CreateWixSearchSymbol(IntermediateSection section, SourceLineNumber sourceLineNumbers, string elementName, Identifier id, string variable, string condition, string after, string bundleExtensionId); - - /// - /// - /// - /// Section to create the reference in. - /// Source line number for the parent element. - /// Identifier of the search (key into the WixSearch table) - /// Identifier of the search that comes before (key into the WixSearch table) - /// Further details about the relation between id and parentId. - void CreateWixSearchRelationSymbol(IntermediateSection section, SourceLineNumber sourceLineNumbers, Identifier id, string parentId, int attributes); - - /// - /// Checks if the string contains a property (i.e. "foo[Property]bar") - /// - /// String to evaluate for properties. - /// True if a property is found in the string. - bool ContainsProperty(string possibleProperty); - - /// - /// Add the appropriate symbols to make sure that the given table shows up in the resulting output. - /// - /// Active section. - /// Source line numbers. - /// Name of the table to ensure existance of. - void EnsureTable(IntermediateSection section, SourceLineNumber sourceLineNumbers, string tableName); - - /// - /// Add the appropriate symbols to make sure that the given table shows up in the resulting output. - /// - /// Active section. - /// Source line numbers. - /// Definition of the table to ensure existance of. - void EnsureTable(IntermediateSection section, SourceLineNumber sourceLineNumbers, TableDefinition tableDefinition); - - /// - /// Get an attribute value and displays an error if the value is empty by default. - /// - /// Source line information about the owner element. - /// The attribute containing the value to get. - /// A rule for the contents of the value. If the contents do not follow the rule, an error is thrown. - /// The attribute's value. - string GetAttributeValue(SourceLineNumber sourceLineNumbers, XAttribute attribute, EmptyRule emptyRule = EmptyRule.CanBeWhitespaceOnly); - - /// - /// Get a guid attribute value and displays an error for an illegal guid value. - /// - /// Source line information about the owner element. - /// The attribute containing the value to get. - /// Determines whether the guid can be automatically generated. - /// If true, no error is raised on empty value. If false, an error is raised. - /// The attribute's guid value or a special value if an error occurred. - string GetAttributeGuidValue(SourceLineNumber sourceLineNumbers, XAttribute attribute, bool generatable = false, bool canBeEmpty = false); - - /// - /// Get an identifier attribute value and displays an error for an illegal identifier value. - /// - /// Source line information about the owner element. - /// The attribute containing the value to get. - /// The attribute's identifier value or a special value if an error occurred. - Identifier GetAttributeIdentifier(SourceLineNumber sourceLineNumbers, XAttribute attribute); - - /// - /// Get an identifier attribute value and displays an error for an illegal identifier value. - /// - /// Source line information about the owner element. - /// The attribute containing the value to get. - /// The attribute's identifier value or a special value if an error occurred. - string GetAttributeIdentifierValue(SourceLineNumber sourceLineNumbers, XAttribute attribute); - - /// - /// Get an integer attribute value and displays an error for an illegal integer value. - /// - /// Source line information about the owner element. - /// The attribute containing the value to get. - /// The minimum legal value. - /// The maximum legal value. - /// The attribute's integer value or a special value if an error occurred during conversion. - int GetAttributeIntegerValue(SourceLineNumber sourceLineNumbers, XAttribute attribute, int minimum, int maximum); - - /// - /// Get a long integral attribute value and displays an error for an illegal long value. - /// - /// Source line information about the owner element. - /// The attribute containing the value to get. - /// The minimum legal value. - /// The maximum legal value. - /// The attribute's long value or a special value if an error occurred during conversion. - long GetAttributeLongValue(SourceLineNumber sourceLineNumbers, XAttribute attribute, long minimum, long maximum); - - /// - /// Gets a long filename value and displays an error for an illegal long filename value. - /// - /// Source line information about the owner element. - /// The attribute containing the value to get. - /// true if wildcards are allowed in the filename. - /// true if relative paths are allowed in the filename. - /// The attribute's long filename value. - string GetAttributeLongFilename(SourceLineNumber sourceLineNumbers, XAttribute attribute, bool allowWildcards = false, bool allowRelative = false); - - /// - /// Gets a RegistryRootType value and displays an error for an illegal value. - /// - /// Source line information about the owner element. - /// The attribute containing the value to get. - /// Whether HKMU is returned as -1 (true), or treated as an error (false). - /// The attribute's RegisitryRootType value. - RegistryRootType? GetAttributeRegistryRootValue(SourceLineNumber sourceLineNumbers, XAttribute attribute, bool allowHkmu); - - /// - /// Gets a version value or possibly a binder variable and displays an error for an illegal version value. - /// - /// Source line information about the owner element. - /// The attribute containing the value to get. - /// The attribute's version value. - string GetAttributeVersionValue(SourceLineNumber sourceLineNumbers, XAttribute attribute); - - /// - /// Gets a yes/no value and displays an error for an illegal yes/no value. - /// - /// Source line information about the owner element. - /// The attribute containing the value to get. - /// The attribute's YesNoType value. - YesNoType GetAttributeYesNoValue(SourceLineNumber sourceLineNumbers, XAttribute attribute); - - /// - /// Gets a yes/no/default value and displays an error for an illegal yes/no/default value. - /// - /// Source line information about the owner element. - /// The attribute containing the value to get. - /// The attribute's YesNoType value. - YesNoDefaultType GetAttributeYesNoDefaultValue(SourceLineNumber sourceLineNumbers, XAttribute attribute); - - /// - /// Validates path is relative and canonicalizes it. - /// For example, "a\..\c\.\d.exe" => "c\d.exe". - /// - /// - /// - /// - /// - /// The original value if not relative, otherwise the canonicalized relative path. - string GetCanonicalRelativePath(SourceLineNumber sourceLineNumbers, string elementName, string attributeName, string relativePath); - - /// - /// Gets a source line number for an element. - /// - /// Element to get source line number. - /// Source line number. - SourceLineNumber GetSourceLineNumbers(XElement element); - - /// - /// Gets node's inner text and ensure's it is safe for use in a condition by trimming any extra whitespace. - /// - /// The node to ensure inner text is a condition. - /// The value converted into a safe condition. - [Obsolete] - string GetConditionInnerText(XElement node); - - /// - /// Get an element's inner text and trims any extra whitespace. - /// - /// The element with inner text to be trimmed. - /// The node's inner text trimmed. - [Obsolete] - string GetTrimmedInnerText(XElement element); - - /// - /// Validates that the element does not contain inner text. - /// - /// Element to check for inner text. - void InnerTextDisallowed(XElement element); - - /// - /// Verifies that a value is a legal identifier. - /// - /// The value to verify. - /// true if the value is an identifier; false otherwise. - bool IsValidIdentifier(string value); - - /// - /// Verifies if an identifier is a valid loc identifier. - /// - /// Identifier to verify. - /// True if the identifier is a valid loc identifier. - bool IsValidLocIdentifier(string identifier); - - /// - /// Verifies if a filename is a valid long filename. - /// - /// Filename to verify. - /// true if wildcards are allowed in the filename. - /// true if relative paths are allowed in the filename. - /// True if the filename is a valid long filename - bool IsValidLongFilename(string filename, bool allowWildcards = false, bool allowRelative = false); - - /// - /// Verifies if a filename is a valid short filename. - /// - /// Filename to verify. - /// Indicates whether wildcards are allowed in the filename. - /// True if the filename is a valid short filename - bool IsValidShortFilename(string filename, bool allowWildcards); - - /// - /// Attempts to use an extension to parse the attribute. - /// - /// - /// Parent intermediate. - /// Parent section. - /// Element containing attribute to be parsed. - /// Attribute to be parsed. - /// Extra information about the context in which this element is being parsed. - void ParseExtensionAttribute(IEnumerable extensions, Intermediate intermediate, IntermediateSection section, XElement element, XAttribute attribute, IDictionary context = null); - - /// - /// Attempts to use an extension to parse the element. - /// - /// - /// Parent intermediate. - /// Parent section. - /// Element containing element to be parsed. - /// Element to be parsed. - /// Extra information about the context in which this element is being parsed. - void ParseExtensionElement(IEnumerable extensions, Intermediate intermediate, IntermediateSection section, XElement parentElement, XElement element, IDictionary context = null); - - /// - /// Attempts to use an extension to parse the element, with support for setting component keypath. - /// - /// - /// Parent intermediate. - /// Parent section. - /// Element containing element to be parsed. - /// Element to be parsed. - /// Extra information about the context in which this element is being parsed. - IComponentKeyPath ParsePossibleKeyPathExtensionElement(IEnumerable extensions, Intermediate intermediate, IntermediateSection section, XElement parentElement, XElement element, IDictionary context); - - /// - /// Process all children of the element looking for extensions and erroring on the unexpected. - /// - /// - /// Parent intermediate. - /// Parent section. - /// Element to parse children. - void ParseForExtensionElements(IEnumerable extensions, Intermediate intermediate, IntermediateSection section, XElement element); - - /// - /// Schedules an action symbol. - /// - /// Section to add the symbol to. - /// Source line information about the owner element. - /// Access modifier for the scheduled action. - /// Sequence to add the action to. - /// Name of action. - /// Optional condition of action. - /// Optional action to schedule before. - /// Option action to schedule after. - /// Optional overridable flag. - WixActionSymbol ScheduleActionSymbol(IntermediateSection section, SourceLineNumber sourceLineNumbers, AccessModifier access, SequenceTable sequence, string name, string condition, string beforeAction, string afterAction, bool overridable = false); - - /// - /// Called when the compiler encounters an unexpected attribute. - /// - /// Parent element that found unexpected attribute. - /// Unexpected attribute. - void UnexpectedAttribute(XElement element, XAttribute attribute); - - /// - /// Called when the compiler encounters an unexpected child element. - /// - /// Parent element that found unexpected child. - /// Unexpected child element. - void UnexpectedElement(XElement parentElement, XElement childElement); - } -} diff --git a/src/WixToolset.Extensibility/Services/IPathResolver.cs b/src/WixToolset.Extensibility/Services/IPathResolver.cs deleted file mode 100644 index 64362174..00000000 --- a/src/WixToolset.Extensibility/Services/IPathResolver.cs +++ /dev/null @@ -1,43 +0,0 @@ -// 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. - -namespace WixToolset.Extensibility.Services -{ - using System.Collections.Generic; - using WixToolset.Data; - using WixToolset.Extensibility.Data; - - /// - /// Support for processing paths. - /// - public interface IPathResolver - { - /// - /// Get the canonical source path of a directory. - /// - /// All cached directories. - /// Hash table of Component GUID generation seeds indexed by directory id. - /// Directory identifier. - /// Current platform. - /// Source path of a directory. - string GetCanonicalDirectoryPath(Dictionary directories, Dictionary componentIdGenSeeds, string directory, Platform platform); - - /// - /// Get the source path of a directory. - /// - /// All cached directories. - /// Directory identifier. - /// Source path of a directory. - string GetDirectoryPath(Dictionary directories, string directory); - - /// - /// Gets the source path of a file. - /// - /// All cached directories in . - /// Parent directory identifier. - /// File name (in long|source format). - /// Specifies the package is compressed. - /// Specifies the package uses long file names. - /// Source path of file relative to package directory. - string GetFileSourcePath(Dictionary directories, string directoryId, string fileName, bool compressed, bool useLongName); - } -} diff --git a/src/WixToolset.Extensibility/Services/IPreprocessHelper.cs b/src/WixToolset.Extensibility/Services/IPreprocessHelper.cs deleted file mode 100644 index f7973ac2..00000000 --- a/src/WixToolset.Extensibility/Services/IPreprocessHelper.cs +++ /dev/null @@ -1,90 +0,0 @@ -// 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. - -namespace WixToolset.Extensibility.Services -{ - using System.Xml.Linq; - using WixToolset.Extensibility.Data; - - /// - /// Interface provided to help preprocessor extensions. - /// - public interface IPreprocessHelper - { - /// - /// Add a variable. - /// - /// The preprocess context. - /// The variable name. - /// The variable value. - void AddVariable(IPreprocessContext context, string name, string value); - - /// - /// Add a variable. - /// - /// The preprocess context. - /// The variable name. - /// The variable value. - /// Set to true to show variable overwrite warning. - void AddVariable(IPreprocessContext context, string name, string value, bool showWarning); - - /// - /// Evaluate a function. - /// - /// The preprocess context. - /// The function expression including the prefix and name. - /// The function value. - string EvaluateFunction(IPreprocessContext context, string function); - - /// - /// Evaluate a function. - /// - /// The preprocess context. - /// The function prefix. - /// The function name. - /// The arguments for the function. - /// The function value or null if the function is not defined. - string EvaluateFunction(IPreprocessContext context, string prefix, string function, string[] args); - - /// - /// Get the value of a variable expression like var.name. - /// - /// The preprocess context. - /// The variable expression including the optional prefix and name. - /// true to allow the variable prefix to be missing. - /// The variable value. - string GetVariableValue(IPreprocessContext context, string variable, bool allowMissingPrefix); - - /// - /// Get the value of a variable. - /// - /// The preprocess context. - /// The variable prefix. - /// The variable name. - /// The variable value or null if the variable is not set. - string GetVariableValue(IPreprocessContext context, string prefix, string name); - - /// - /// Evaluate a Pragma. - /// - /// The preprocess context. - /// The pragma's full name (<prefix>.<pragma>). - /// The arguments to the pragma. - /// The parent element of the pragma. - void PreprocessPragma(IPreprocessContext context, string pragmaName, string args, XContainer parent); - - /// - /// Replaces parameters in the source text. - /// - /// The preprocess context. - /// Text that may contain parameters to replace. - /// Text after parameters have been replaced. - string PreprocessString(IPreprocessContext context, string value); - - /// - /// Remove a variable. - /// - /// The preprocess context. - /// The variable name. - void RemoveVariable(IPreprocessContext context, string name); - } -} diff --git a/src/WixToolset.Extensibility/Services/IVariableResolution.cs b/src/WixToolset.Extensibility/Services/IVariableResolution.cs deleted file mode 100644 index adcec47f..00000000 --- a/src/WixToolset.Extensibility/Services/IVariableResolution.cs +++ /dev/null @@ -1,30 +0,0 @@ -// 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. - -namespace WixToolset.Extensibility.Services -{ - /// - /// Result when resolving a variable. - /// - public interface IVariableResolution - { - /// - /// Indicates if the value contains variables that cannot be resolved yet. - /// - bool DelayedResolve { get; set; } - - /// - /// Indicates whether a bind variables default value was used in the resolution. - /// - bool IsDefault { get; set; } - - /// - /// Indicates whether the resolution updated the value. - /// - bool UpdatedValue { get; set; } - - /// - /// The resolved value. - /// - string Value { get; set; } - } -} diff --git a/src/WixToolset.Extensibility/Services/IVariableResolver.cs b/src/WixToolset.Extensibility/Services/IVariableResolver.cs deleted file mode 100644 index 285f1fd1..00000000 --- a/src/WixToolset.Extensibility/Services/IVariableResolver.cs +++ /dev/null @@ -1,48 +0,0 @@ -// 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. - -namespace WixToolset.Extensibility.Services -{ - using WixToolset.Data; - -#pragma warning disable 1591 // TODO: add documentation - public interface IVariableResolver - { - void AddLocalization(Localization localization); -#pragma warning restore 1591 - - /// - /// Add a variable. - /// - /// The source line information for the value. - /// The name of the variable. - /// The value of the variable. - /// Indicates whether the variable can be overridden by an existing variable. - void AddVariable(SourceLineNumber sourceLineNumber, string name, string value, bool overridable); - - /// - /// Resolve the wix variables in a value. - /// - /// The source line information for the value. - /// The value to resolve. - /// The resolved result. - IVariableResolution ResolveVariables(SourceLineNumber sourceLineNumbers, string value); - - /// - /// Resolve the wix variables in a value. - /// - /// The source line information for the value. - /// The value to resolve. - /// true if unknown variables should throw errors. - /// The resolved value. - IVariableResolution ResolveVariables(SourceLineNumber sourceLineNumbers, string value, bool errorOnUnknown); - - /// - /// Try to find localization information for dialog and (optional) control. - /// - /// Dialog identifier. - /// Optional control identifier. - /// Found localization information. - /// True if localized control was found, otherwise false. - bool TryGetLocalizedControl(string dialog, string control, out LocalizedControl localizedControl); - } -} diff --git a/src/WixToolset.Extensibility/Services/IWindowsInstallerBackendHelper.cs b/src/WixToolset.Extensibility/Services/IWindowsInstallerBackendHelper.cs deleted file mode 100644 index 81325131..00000000 --- a/src/WixToolset.Extensibility/Services/IWindowsInstallerBackendHelper.cs +++ /dev/null @@ -1,35 +0,0 @@ -// 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. - -namespace WixToolset.Extensibility.Services -{ - using WixToolset.Data; - using WixToolset.Data.WindowsInstaller; - - /// - /// Interface provided to help Windows Installer backend extensions. - /// - public interface IWindowsInstallerBackendHelper : IBackendHelper - { - /// - /// Creates a in the specified table. - /// - /// Parent section. - /// Symbol with line information for the row. - /// Windows Installer data. - /// Table definition for the row. - /// Row created in the . - Row CreateRow(IntermediateSection section, IntermediateSymbol symbol, WindowsInstallerData data, TableDefinition tableDefinition); - - /// - /// Looks up the registered for the given and creates a in that table. - /// Goes sequentially through each field in the symbol and assigns the value to the column with the same index as the field. - /// 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. - /// - /// Parent section. - /// Symbol to create the row from. - /// Windows Installer data. - /// Table definitions that have been registered with the binder. - /// True if a row was created. - bool TryAddSymbolToMatchingTableDefinitions(IntermediateSection section, IntermediateSymbol symbol, WindowsInstallerData data, TableDefinitionCollection tableDefinitions); - } -} diff --git a/src/WixToolset.Extensibility/Services/IWixBranding.cs b/src/WixToolset.Extensibility/Services/IWixBranding.cs deleted file mode 100644 index 4bac9ccd..00000000 --- a/src/WixToolset.Extensibility/Services/IWixBranding.cs +++ /dev/null @@ -1,26 +0,0 @@ -// 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. - -namespace WixToolset.Extensibility.Services -{ - using System.Reflection; - - /// - /// WiX branding interface. - /// - public interface IWixBranding - { - /// - /// Gets the value for CreatingApplication field (MSI Summary Information Stream). - /// - /// String for creating application. - string GetCreatingApplication(); - - /// - /// Replaces branding placeholders in original string. - /// - /// Original string containing placeholders to replace. - /// Optional assembly with branding information, if not specified core branding is used. - /// - string ReplacePlaceholders(string original, Assembly assembly = null); - } -} diff --git a/src/WixToolset.Extensibility/Services/IWixtoolsetCoreServiceProvider.cs b/src/WixToolset.Extensibility/Services/IWixtoolsetCoreServiceProvider.cs deleted file mode 100644 index f5fb28fb..00000000 --- a/src/WixToolset.Extensibility/Services/IWixtoolsetCoreServiceProvider.cs +++ /dev/null @@ -1,34 +0,0 @@ -// 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. - -namespace WixToolset.Extensibility.Services -{ - using System; - using System.Collections.Generic; - - /// - /// The core of the service provider used to add services to the service provider. - /// - public interface IWixToolsetCoreServiceProvider : IServiceProvider - { - /// - /// Adds a service to the service locator. - /// - /// Type of the service to add. - /// - /// A function that creates the service. The create function is provided the service provider - /// itself to resolve additional services and a type dictionary that stores singleton services - /// the creation function can add its service to. - /// - void AddService(Type serviceType, Func, object> creationFunction); - - /// - /// Adds a service to the service locator. - /// - /// - /// A function that creates the service. The create function is provided the service provider - /// itself to resolve additional services and a type dictionary that stores singleton services - /// the creation function can add its service to. - /// - void AddService(Func, T> creationFunction) where T : class; - } -} diff --git a/src/WixToolset.Extensibility/Services/ServiceProviderExtensions.cs b/src/WixToolset.Extensibility/Services/ServiceProviderExtensions.cs deleted file mode 100644 index 68484d09..00000000 --- a/src/WixToolset.Extensibility/Services/ServiceProviderExtensions.cs +++ /dev/null @@ -1,48 +0,0 @@ -// 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. - -namespace WixToolset.Extensibility.Services -{ - using System; - - /// - /// Service provider extensions. - /// - public static class ServiceProviderExtensions - { - /// - /// Gets a service from the service provider. - /// - /// Type of service to get. - /// Service provider. - public static T GetService(this IServiceProvider provider) where T : class - { - return provider.GetService(typeof(T)) as T; - } - - /// - /// Gets a service from the service provider. - /// - /// Service provider. - /// Type of service to get. - /// Retrieved service. - /// True if the service was found, otherwise false - public static bool TryGetService(this IServiceProvider provider, Type serviceType, out object service) - { - service = provider.GetService(serviceType); - return service != null; - } - - /// - /// Gets a service from the service provider. - /// - /// Type of service to get. - /// Service provider. - /// Retrieved service. - /// True if the service was found, otherwise false - public static bool TryGetService(this IServiceProvider provider, out T service) where T : class - { - service = provider.GetService(typeof(T)) as T; - return service != null; - } - } -} diff --git a/src/WixToolset.Extensibility/WixToolset.Extensibility.csproj b/src/WixToolset.Extensibility/WixToolset.Extensibility.csproj deleted file mode 100644 index 8b18c0ed..00000000 --- a/src/WixToolset.Extensibility/WixToolset.Extensibility.csproj +++ /dev/null @@ -1,23 +0,0 @@ - - - - - - netstandard2.0 - $(TargetFrameworks);net461;net472 - WiX Toolset Extensibility - - embedded - true - true - - - - - - - - - - - diff --git a/src/WixToolset.Extensibility/WixToolset.Extensibility.v3.ncrunchproject b/src/WixToolset.Extensibility/WixToolset.Extensibility.v3.ncrunchproject deleted file mode 100644 index c6001ebe..00000000 --- a/src/WixToolset.Extensibility/WixToolset.Extensibility.v3.ncrunchproject +++ /dev/null @@ -1,7 +0,0 @@ - - - - ..\..\version.json - - - \ No newline at end of file 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 @@ + + + + + true + true + $([System.IO.Path]::GetFullPath($(MSBuildThisFileDirectory)wix.snk)) + false + + 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 @@ + + + + true + + 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 @@ + + + + + + Debug + false + MSB3246 + + $(MSBuildProjectName) + $([System.IO.Path]::GetFullPath($(MSBuildThisFileDirectory)..\build\)) + $(BaseOutputPath)obj\$(ProjectName)\ + $(BaseOutputPath)$(Configuration)\ + + WiX Toolset Team + WiX Toolset + Copyright (c) .NET Foundation and contributors. All rights reserved. + MS-RL + WiX Toolset + + + + + + + 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 @@ + + + + + + + false + $(OutputPath)\$(AssemblyName).xml + + + + true + $(SolutionPath) + $(NCrunchOriginalSolutionPath) + + + + + + + $([System.IO.File]::ReadAllText($(TheSolutionPath))) + $([System.IO.Path]::GetDirectoryName( $(TheSolutionPath) )) + (?<="[PackageName]", ")(.*)(?=", ") + + + + + + %(Identity) + $(SolutionFileContent.Contains('\%(Identity).csproj')) + + + + + $(RegexPattern.Replace('[PackageName]','%(PackageName)') ) + $([System.Text.RegularExpressions.Regex]::Match('$(SolutionFileContent)', '%(Pattern)')) + + + + + + + + + + + + + + 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 @@ +# Extensibility +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 @@ +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +VisualStudioVersion = 15.0.26730.8 +MinimumVisualStudioVersion = 15.0.26124.0 +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WixToolset.Extensibility", "src\WixToolset.Extensibility\WixToolset.Extensibility.csproj", "{AA049009-D7D9-4C63-8E0D-83206ADCFBD1}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 + Release|Any CPU = Release|Any CPU + Release|x64 = Release|x64 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {AA049009-D7D9-4C63-8E0D-83206ADCFBD1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {AA049009-D7D9-4C63-8E0D-83206ADCFBD1}.Debug|Any CPU.Build.0 = Debug|Any CPU + {AA049009-D7D9-4C63-8E0D-83206ADCFBD1}.Debug|x64.ActiveCfg = Debug|Any CPU + {AA049009-D7D9-4C63-8E0D-83206ADCFBD1}.Debug|x64.Build.0 = Debug|Any CPU + {AA049009-D7D9-4C63-8E0D-83206ADCFBD1}.Debug|x86.ActiveCfg = Debug|Any CPU + {AA049009-D7D9-4C63-8E0D-83206ADCFBD1}.Debug|x86.Build.0 = Debug|Any CPU + {AA049009-D7D9-4C63-8E0D-83206ADCFBD1}.Release|Any CPU.ActiveCfg = Release|Any CPU + {AA049009-D7D9-4C63-8E0D-83206ADCFBD1}.Release|Any CPU.Build.0 = Release|Any CPU + {AA049009-D7D9-4C63-8E0D-83206ADCFBD1}.Release|x64.ActiveCfg = Release|Any CPU + {AA049009-D7D9-4C63-8E0D-83206ADCFBD1}.Release|x64.Build.0 = Release|Any CPU + {AA049009-D7D9-4C63-8E0D-83206ADCFBD1}.Release|x86.ActiveCfg = Release|Any CPU + {AA049009-D7D9-4C63-8E0D-83206ADCFBD1}.Release|x86.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {BB8820D5-723D-426D-B4A0-4D221603C5FA} + EndGlobalSection +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 @@ +// 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. + +using System; +using System.Reflection; +using System.Runtime.InteropServices; + +[assembly: AssemblyCulture("")] +[assembly: CLSCompliant(true)] +[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 @@ +// 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. + +namespace WixToolset.Extensibility +{ + using WixToolset.Extensibility.Data; + using WixToolset.Extensibility.Services; + + /// + /// Base class for creating a resolver extension. + /// + public abstract class BaseBinderExtension : IBinderExtension + { + /// + /// Context for use by the extension. + /// + protected IBindContext Context { get; private set; } + + /// + /// Messaging for use by the extension. + /// + protected IMessaging Messaging { get; private set; } + + /// + /// BackendHelper for use by the extension. + /// + protected IBackendHelper BackendHelper { get; private set; } + + /// + /// Called at the beginning of bind. + /// + public virtual void PreBind(IBindContext context) + { + this.Context = context; + + this.Messaging = context.ServiceProvider.GetService(); + + this.BackendHelper = context.ServiceProvider.GetService(); + } + + /// + /// Called at the end of bind. + /// + public virtual void PostBind(IBindResult result) + { + } + } +} 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 @@ +// 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. + +namespace WixToolset.Extensibility +{ + using System; + using System.Collections.Generic; + using System.Linq; + using WixToolset.Data; + using WixToolset.Data.Burn; + using WixToolset.Extensibility.Data; + using WixToolset.Extensibility.Services; + + /// + /// Base class for creating a Burn backend extension. + /// + public abstract class BaseBurnBackendBinderExtension : IBurnBackendBinderExtension + { + /// + /// Context for use by the extension. + /// + protected IBindContext Context { get; private set; } + + /// + /// Messaging for use by the extension. + /// + protected IMessaging Messaging { get; private set; } + + /// + /// Backend helper for use by the extension. + /// + protected IBurnBackendHelper BackendHelper { get; private set; } + + /// + /// Optional symbol definitions. + /// + protected virtual IReadOnlyCollection SymbolDefinitions => Array.Empty(); + + /// + /// See + /// + public virtual void PreBackendBind(IBindContext context) + { + this.Context = context; + this.Messaging = context.ServiceProvider.GetService(); + this.BackendHelper = context.ServiceProvider.GetService(); + } + + /// + /// See + /// + public virtual IResolveFileResult ResolveRelatedFile(string source, string relatedSource, string type, SourceLineNumber sourceLineNumbers) + { + return null; + } + + /// + /// See + /// + public virtual void SymbolsFinalized(IntermediateSection section) + { + } + + /// + /// See + /// + public virtual string ResolveUrl(string url, string fallbackUrl, string packageId, string payloadId, string fileName) + { + return null; + } + + /// + /// See + /// + public virtual bool TryProcessSymbol(IntermediateSection section, IntermediateSymbol symbol) + { + if (this.SymbolDefinitions.Any(t => t == symbol.Definition) && + symbol.Definition.HasTag(BurnConstants.BootstrapperApplicationDataSymbolDefinitionTag)) + { + this.BackendHelper.AddBootstrapperApplicationData(symbol); + return true; + } + + return false; + } + + /// + /// See + /// + /// + public virtual void PostBackendBind(IBindResult result) + { + } + } +} 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 @@ +// 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. + +namespace WixToolset.Extensibility +{ + using System; + using System.Collections.Generic; + using System.Xml.Linq; + using WixToolset.Data; + using WixToolset.Extensibility.Data; + using WixToolset.Extensibility.Services; + + /// + /// Base class for creating a compiler extension. + /// + public abstract class BaseCompilerExtension : ICompilerExtension + { + /// + /// Context for use by the extension. + /// + protected ICompileContext Context { get; private set; } + + /// + /// Messaging for use by the extension. + /// + protected IMessaging Messaging { get; private set; } + + /// + /// ParserHelper for use by the extension. + /// + protected IParseHelper ParseHelper { get; private set; } + + /// + /// Gets the schema namespace for this extension. + /// + /// Schema namespace supported by this extension. + public abstract XNamespace Namespace { get; } + + /// + /// Creates a component key path. + /// + protected IComponentKeyPath CreateComponentKeyPath() => this.Context.ServiceProvider.GetService(); + + /// + /// Called at the beginning of the compilation of a source file. + /// + public virtual void PreCompile(ICompileContext context) + { + this.Context = context; + + this.Messaging = context.ServiceProvider.GetService(); + + this.ParseHelper = context.ServiceProvider.GetService(); + } + + /// + /// See + /// + public virtual void ParseAttribute(Intermediate intermediate, IntermediateSection section, XElement parentElement, XAttribute attribute, IDictionary context) + { + this.ParseHelper.UnexpectedAttribute(parentElement, attribute); + } + + /// + /// See + /// + public virtual void ParseElement(Intermediate intermediate, IntermediateSection section, XElement parentElement, XElement element, IDictionary context) + { + this.ParseHelper.UnexpectedElement(parentElement, element); + } + + /// + /// See + /// + public virtual IComponentKeyPath ParsePossibleKeyPathElement(Intermediate intermediate, IntermediateSection section, XElement parentElement, XElement element, IDictionary context) + { + this.ParseElement(intermediate, section, parentElement, element, context); + return null; + } + + /// + /// Called at the end of the compilation of a source file. + /// + public virtual void PostCompile(Intermediate intermediate) + { + } + } +} 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 @@ +// 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. + +namespace WixToolset.Extensibility +{ + using System; + using System.Collections.Generic; + using WixToolset.Extensibility.Data; + using WixToolset.Extensibility.Services; + + /// + /// Base class for extensions to be able to parse the command-line. + /// + public abstract class BaseExtensionCommandLine : IExtensionCommandLine + { + /// + /// See + /// + public virtual IReadOnlyCollection CommandLineSwitches => Array.Empty(); + + /// + /// See + /// + public virtual void PostParse() + { + } + + /// + /// See + /// + public virtual void PreParse(ICommandLineContext context) + { + } + + /// + /// See + /// + public virtual bool TryParseArgument(ICommandLineParser parser, string argument) + { + return false; + } + + /// + /// See + /// + public virtual bool TryParseCommand(ICommandLineParser parser, string argument, out ICommandLineCommand command) + { + command = null; + return false; + } + } +} 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 @@ +// 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. + +namespace WixToolset.Extensibility +{ + using WixToolset.Data; + + /// + /// Base class for creating a resolver extension. + /// + public abstract class BaseExtensionData : IExtensionData + { + /// + /// See + /// + public virtual string DefaultCulture => null; + + /// + /// See + /// + public virtual Intermediate GetLibrary(ISymbolDefinitionCreator symbolDefinitions) + { + return null; + } + + /// + /// See + /// + public virtual bool TryGetSymbolDefinitionByName(string name, out IntermediateSymbolDefinition symbolDefinition) + { + symbolDefinition = null; + return false; + } + } +} 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 @@ +// 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. + +namespace WixToolset.Extensibility +{ + using System; + using System.Collections.Generic; + + /// + /// Base class for extension factories. + /// + /// Implementations may request an IWixToolsetCoreServiceProvider at instantiation by having a single parameter constructor for it. + /// + public abstract class BaseExtensionFactory : IExtensionFactory + { + /// + /// The extension types of the WiX extension. + /// + protected abstract IReadOnlyCollection ExtensionTypes { get; } + + /// + /// See + /// + public virtual bool TryCreateExtension(Type extensionType, out object extension) + { + extension = null; + + foreach (var type in this.ExtensionTypes) + { + if (extensionType.IsAssignableFrom(type)) + { + extension = Activator.CreateInstance(type); + break; + } + } + + return extension != null; + } + } +} 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 @@ +// 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. + +namespace WixToolset.Extensibility +{ + using WixToolset.Extensibility.Data; + using WixToolset.Extensibility.Services; + + /// + /// Base class for creating a resolver extension. + /// + public abstract class BaseLayoutExtension : ILayoutExtension + { + /// + /// Context for use by the extension. + /// + protected ILayoutContext Context { get; private set; } + + /// + /// Messaging for use by the extension. + /// + protected IMessaging Messaging { get; private set; } + + /// + /// Called at the beginning of layout. + /// + public virtual void PreLayout(ILayoutContext context) + { + this.Context = context; + + this.Messaging = context.ServiceProvider.GetService(); + } + + /// + /// See + /// + /// + /// + /// + public virtual bool CopyFile(string source, string destination) + { + return false; + } + + /// + /// See + /// + /// + /// + /// + public virtual bool MoveFile(string source, string destination) + { + return false; + } + + /// + /// Called at the end of ayout. + /// + public virtual void PostLayout() + { + } + } +} 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 @@ +// 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. + +namespace WixToolset.Extensibility +{ + using System.Collections.Generic; + using WixToolset.Data; + using WixToolset.Extensibility.Data; + using WixToolset.Extensibility.Services; + + /// + /// Base class for creating a librarian extension. + /// + public abstract class BaseLibrarianExtension : ILibrarianExtension + { + /// + /// Context for use by the extension. + /// + protected ILibraryContext Context { get; private set; } + + /// + /// Messaging for use by the extension. + /// + protected IMessaging Messaging { get; private set; } + + /// + /// Called at the beginning of combining. + /// + /// Librarian context. + public virtual void PreCombine(ILibraryContext context) + { + this.Context = context; + + this.Messaging = context.ServiceProvider.GetService(); + } + + /// + /// Resolves a path to a file path on disk. + /// + /// Source line number for the path to resolve. + /// Symbol related to the path to resolve. + /// Path to resolve. + /// Optional resolved file result. + public virtual IResolveFileResult ResolveFile(SourceLineNumber sourceLineNumber, IntermediateSymbolDefinition symbolDefinition, string path) + { + return null; + } + + /// + /// Called at the end of combining. + /// + /// Combined library intermediate. + public virtual void PostCombine(Intermediate library) + { + } + + /// + /// Creates an IResolveFileResult. + /// + /// Optional resolved path to file. + /// Optional collection of paths checked for the file. + /// Resolved file result. + protected IResolveFileResult CreateResolveFileResult(string path = null, IReadOnlyCollection checkedPaths = null) + { + var result = this.Context.ServiceProvider.GetService(); + result.Path = path; + result.CheckedPaths = checkedPaths; + + return result; + } + } +} 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 @@ +// 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. + +namespace WixToolset.Extensibility +{ + using WixToolset.Data; + using WixToolset.Extensibility.Data; + using WixToolset.Extensibility.Services; + + /// + /// Base class for creating a linker extension. + /// + public abstract class BaseLinkerExtension : ILinkerExtension + { + /// + /// Context for use by the extension. + /// + protected ILinkContext Context { get; private set; } + + /// + /// Messaging for use by the extension. + /// + protected IMessaging Messaging { get; private set; } + + /// + /// Called at the beginning of the linking. + /// + public virtual void PreLink(ILinkContext context) + { + this.Context = context; + + this.Messaging = context.ServiceProvider.GetService(); + } + + /// + /// Called at the end of the linking. + /// + public virtual void PostLink(Intermediate intermediate) + { + } + } +} 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 @@ +// 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. + +namespace WixToolset.Extensibility +{ + using System.Xml.Linq; + using WixToolset.Extensibility.Data; + using WixToolset.Extensibility.Services; + + /// + /// Base class for creating a preprocessor extension. + /// + public abstract class BasePreprocessorExtension : IPreprocessorExtension + { + /// + /// Context for use by the extension. + /// + protected IPreprocessContext Context { get; private set; } + + /// + /// Messaging for use by the extension. + /// + protected IMessaging Messaging { get; private set; } + + /// + /// PreprocessHelper for use by the extension. + /// + protected IPreprocessHelper PreprocessHelper { get; private set; } + + /// + /// Gets or sets the variable prefixes for the extension. + /// + /// The variable prefixes for the extension. + public string[] Prefixes { get; protected set; } + + /// + /// Called at the beginning of the preprocessing of a source file. + /// + public virtual void PrePreprocess(IPreprocessContext context) + { + this.Context = context; + + this.Messaging = context.ServiceProvider.GetService(); + + this.PreprocessHelper = context.ServiceProvider.GetService(); + } + + /// + /// Gets the value of a variable whose prefix matches the extension. + /// + /// The prefix of the variable to be processed by the extension. + /// The name of the variable. + /// The value of the variable or null if the variable is undefined. + public virtual string GetVariableValue(string prefix, string name) + { + return null; + } + + /// + /// Evaluates a function defined in the extension. + /// + /// The prefix of the function to be processed by the extension. + /// The name of the function. + /// The list of arguments. + /// The value of the function or null if the function is not defined. + public virtual string EvaluateFunction(string prefix, string function, string[] args) + { + return null; + } + + /// + /// Processes a pragma defined in the extension. + /// + /// The prefix of the pragma to be processed by the extension. + /// The name of the pragma. + /// The pragma's arguments. + /// The parent node of the pragma. + /// false if the pragma is not defined. + /// 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. + public virtual bool ProcessPragma(string prefix, string pragma, string args, XContainer parent) + { + return false; + } + + /// + /// Called at the end of the preprocessing of a source file. + /// + public virtual void PostPreprocess(IPreprocessResult result) + { + } + } +} 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 @@ +// 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. + +namespace WixToolset.Extensibility +{ + using WixToolset.Data; + using WixToolset.Extensibility.Data; + using WixToolset.Extensibility.Services; + + /// + /// Base class for creating a resolver extension. + /// + public abstract class BaseResolverExtension : IResolverExtension + { + /// + /// Context for use by the extension. + /// + protected IResolveContext Context { get; private set; } + + /// + /// Messaging for use by the extension. + /// + protected IMessaging Messaging { get; private set; } + + /// + /// Creates a resolve file result. + /// + protected IResolveFileResult CreateResolveFileResult() => this.Context.ServiceProvider.GetService(); + + /// + /// Called at the beginning of the resolving variables and files. + /// + public virtual void PreResolve(IResolveContext context) + { + this.Context = context; + + this.Messaging = context.ServiceProvider.GetService(); + } + + /// + /// See + /// + /// + /// + /// + /// + /// + public virtual IResolveFileResult ResolveFile(string source, IntermediateSymbolDefinition symbolDefinition, SourceLineNumber sourceLineNumbers, BindStage bindStage) + { + return null; + } + + /// + /// Called at the end of resolve. + /// + public virtual void PostResolve(IResolveResult result) + { + } + } +} 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 @@ +// 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. + +namespace WixToolset.Extensibility +{ + using System; + using System.Collections.Generic; + using System.Linq; + using WixToolset.Data; + using WixToolset.Data.Symbols; + using WixToolset.Data.WindowsInstaller; + using WixToolset.Extensibility.Data; + using WixToolset.Extensibility.Services; + + /// + /// Base class for creating a preprocessor extension. + /// + public abstract class BaseWindowsInstallerBackendBinderExtension : IWindowsInstallerBackendBinderExtension + { + /// + /// Context for use by the extension. + /// + protected IBindContext Context { get; private set; } + + /// + /// Messaging for use by the extension. + /// + protected IMessaging Messaging { get; private set; } + + /// + /// Backend helper for use by the extension. + /// + protected IWindowsInstallerBackendHelper BackendHelper { get; private set; } + + /// + /// Optional table definitions. + /// + public virtual IReadOnlyCollection TableDefinitions => Array.Empty(); + + /// + /// Creates a resolved cabinet result. + /// + protected IResolvedCabinet CreateResolvedCabinet() => this.Context.ServiceProvider.GetService(); + + /// + /// See + /// + public virtual void PreBackendBind(IBindContext context) + { + this.Context = context; + + this.Messaging = context.ServiceProvider.GetService(); + + this.BackendHelper = context.ServiceProvider.GetService(); + } + + /// + /// See + /// + public virtual void SymbolsFinalized(IntermediateSection section) + { + } + + /// + /// See + /// + public virtual IResolvedCabinet ResolveCabinet(string cabinetPath, IEnumerable files) => null; + + /// + /// See + /// + public virtual string ResolveMedia(MediaSymbol mediaRow, string mediaLayoutDirectory, string layoutDirectory) => null; + + /// + /// See + /// + public virtual bool TryProcessSymbol(IntermediateSection section, IntermediateSymbol symbol, WindowsInstallerData data, TableDefinitionCollection tableDefinitions) + { + if (this.TableDefinitions.Any(t => t.SymbolDefinition == symbol.Definition)) + { + return this.BackendHelper.TryAddSymbolToMatchingTableDefinitions(section, symbol, data, tableDefinitions); + } + + return false; + } + + /// + /// See + /// + public virtual void PostBackendBind(IBindResult result) + { + } + } +} 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 @@ +// 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. + +namespace WixToolset.Extensibility +{ + using System; + + /// + /// Constants used by compiler. + /// + public static class CompilerConstants + { + /// + /// + /// + public const int IntegerNotSet = int.MinValue; + + /// + /// + /// + public const int IllegalInteger = int.MinValue + 1; + + /// + /// + /// + public const long LongNotSet = long.MinValue; + + /// + /// + /// + public const long IllegalLong = long.MinValue + 1; + + /// + /// + /// + public const string IllegalGuid = "IllegalGuid"; + + /// + /// + /// + public static readonly Version IllegalVersion = new Version(Int32.MaxValue, Int32.MaxValue, Int32.MaxValue, Int32.MaxValue); + } +} 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 @@ +// 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. + +namespace WixToolset.Extensibility.Data +{ + /// + /// + /// + public enum BindStage + { + /// + /// Normal binding + /// + Normal, + + /// + /// Bind the file path of the target build file + /// + Target, + + /// + /// Bind the file path of the updated build file + /// + Updated, + } +} 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 @@ +// 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. + +namespace WixToolset.Extensibility.Data +{ + using System; + + /// + /// Platforms that have been supported by Burn. + /// + [Flags] + public enum BurnPlatforms + { + /// Not specified. + None = 0, + + /// x86. + X86 = 0x1, + + /// x64. + X64 = 0x2, + + /// arm64. + ARM64 = 0x4, + } +} 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 @@ +// 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. + +namespace WixToolset.Extensibility.Data +{ + /// + /// Options for building the cabinet. + /// + public enum CabinetBuildOption + { + /// + /// Build the cabinet and move it to the target location. + /// + BuildAndMove, + + /// + /// Build the cabinet and copy it to the target location. + /// + BuildAndCopy, + + /// + /// Just copy the cabinet to the target location. + /// + Copy + } +} 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 @@ +// 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. + +namespace WixToolset.Extensibility.Data +{ + using System; + + /// + /// Platforms supported by custom actions. + /// + [Flags] + public enum CustomActionPlatforms + { + /// Not specified. + None = 0, + + /// x86. + X86 = 0x1, + + /// x64. + X64 = 0x2, + + /// arm64. + ARM64 = 0x4, + } +} 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 @@ +// 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. + +namespace WixToolset.Extensibility.Data +{ + /// + /// A command line option. + /// + public struct ExtensionCommandLineSwitch + { + /// + /// + /// + public string Switch { get; set; } + + /// + /// + /// + public string Description { get; set; } + } +} 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 @@ +// 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. + +namespace WixToolset.Extensibility.Data +{ + using System; + using System.Collections.Generic; + using System.Threading; + using WixToolset.Data; + + /// + /// Bind context. + /// + public interface IBindContext + { + /// + /// Service provider. + /// + IServiceProvider ServiceProvider { get; } + + /// + /// Counnt of threads to use in cabbing. + /// + int CabbingThreadCount { get; set; } + + /// + /// Cabinet cache path. + /// + string CabCachePath { get; set; } + + /// + /// Default compression level. + /// + CompressionLevel? DefaultCompressionLevel { get; set; } + + /// + /// Delayed fields that need to be resolved again. + /// + IReadOnlyCollection DelayedFields { get; set; } + + /// + /// Embedded files to extract. + /// + IReadOnlyCollection ExpectedEmbeddedFiles { get; set; } + + /// + /// Binder extensions. + /// + IReadOnlyCollection Extensions { get; set; } + + /// + /// File system extensions. + /// + IReadOnlyCollection FileSystemExtensions { get; set; } + + /// + /// Set of ICEs to execute. + /// + IReadOnlyCollection Ices { get; set; } + + /// + /// Intermedaite folder. + /// + string IntermediateFolder { get; set; } + + /// + /// Intermediate representation to bind. + /// + Intermediate IntermediateRepresentation { get; set; } + + /// + /// Output path to bind to. + /// + string OutputPath { get; set; } + + /// + /// Type of PDB to create. + /// + PdbType PdbType { get; set; } + + /// + /// Output path for PDB. + /// + string PdbPath { get; set; } + + /// + /// Codepage from resolve. + /// + int? ResolvedCodepage { get; set; } + + /// + /// Summary information codepage from resolve. + /// + int? ResolvedSummaryInformationCodepage { get; set; } + + /// + /// LCID from resolve. + /// + int? ResolvedLcid { get; set; } + + /// + /// Set of ICEs to skip. + /// + IReadOnlyCollection SuppressIces { get; set; } + + /// + /// Skip all ICEs. + /// + bool SuppressValidation { get; set; } + + /// + /// Skip creation of output. + /// + bool SuppressLayout { get; set; } + + /// + /// Cancellation token. + /// + CancellationToken CancellationToken { get; set; } + } +} 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 @@ +// 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. + +namespace WixToolset.Extensibility.Data +{ +#pragma warning disable 1591 // TODO: add documentation + public interface IBindFileWithPath + { + string Id { get; set; } + + string Path { get; set; } + } +} 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 @@ +// 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. + +namespace WixToolset.Extensibility.Data +{ + /// + /// Interface for a bind path. + /// + public interface IBindPath + { + /// + /// Name of the bind path or String.Empty if the path is unnamed. + /// + string Name { get; set; } + + /// + /// Path for the bind path. + /// + string Path { get; set; } + + /// + /// Stage for the bind path. + /// + BindStage Stage { get; set; } + } +} 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 @@ +// 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. + +namespace WixToolset.Extensibility.Data +{ + using System; + using System.Collections.Generic; + using WixToolset.Data; + + /// + /// Result of bind operation. + /// + public interface IBindResult : IDisposable + { + /// + /// Collection of file transfers to complete. + /// + IReadOnlyCollection FileTransfers { get; set; } + + /// + /// Collection of files tracked during binding. + /// + IReadOnlyCollection TrackedFiles { get; set; } + + /// + /// Output of binding. + /// + WixOutput Wixout { get; set; } + } +} 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 @@ +// 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. + +namespace WixToolset.Extensibility.Data +{ + using WixToolset.Extensibility.Services; + + /// + /// Parsed command-line arguments. + /// + public interface ICommandLineArguments + { +#pragma warning disable 1591 // TODO: add documentation + string[] OriginalArguments { get; set; } + + string[] Arguments { get; set; } + + string[] Extensions { get; set; } + + string ErrorArgument { get; set; } + + /// + /// Populate this argument from a string. + /// + /// String to parse. + void Populate(string commandLine); + + /// + /// Populate this argument from array of strings. + /// + /// Array of strings. + void Populate(string[] args); + + /// + /// Parses this arguments after it is populated. + /// + /// Parser for this arguments. + ICommandLineParser Parse(); + } +} 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 @@ +// 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. + +namespace WixToolset.Extensibility.Data +{ + using System.Threading; + using System.Threading.Tasks; + using WixToolset.Extensibility.Services; + + /// + /// Custom command. + /// + public interface ICommandLineCommand + { + /// + /// Indicates the command-line should show the command-line logo. + /// + bool ShowLogo { get; } + + /// + /// Indicates the command-line parsing can stop. + /// + bool StopParsing { get; } + + /// + /// Executes the command. + /// + /// Cancellation token. + /// Exit code for the command. + Task ExecuteAsync(CancellationToken cancellationToken); + + /// + /// Allows the command to parse command-line arguments. + /// + /// Parser to help parse the argument and additional arguments. + /// Argument to parse. + /// True if the argument is recognized; otherwise false to allow another extension to process it. + bool TryParseArgument(ICommandLineParser parser, string argument); + } +} 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 @@ +// 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. + +namespace WixToolset.Extensibility.Data +{ + using System; + using WixToolset.Extensibility.Services; + +#pragma warning disable 1591 // TODO: add documentation + public interface ICommandLineContext + { + IServiceProvider ServiceProvider { get; } + + IExtensionManager ExtensionManager { get; set; } + + ICommandLineArguments Arguments { get; set; } + } +} 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 @@ +// 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. + +namespace WixToolset.Extensibility.Data +{ + using System; + using System.Collections.Generic; + using System.Threading; + using System.Xml.Linq; + using WixToolset.Data; + + /// + /// Context provided to the compiler. + /// + public interface ICompileContext + { + /// + /// Service provider made available to the compiler and its extensions. + /// + IServiceProvider ServiceProvider { get; } + + /// + /// Unique identifier for the compilation. + /// + string CompilationId { get; set; } + + /// + /// Set of extensions provided to the compiler. + /// + IReadOnlyCollection Extensions { get; set; } + + /// + /// Gets or sets the platform which the compiler will use when defaulting 64-bit attributes and elements. + /// + /// The platform which the compiler will use when defaulting 64-bit attributes and elements. + Platform Platform { get; set; } + + /// + /// Calculates whether the target platform for the compilation is 64-bit or not. + /// + bool IsCurrentPlatform64Bit { get; } + + /// + /// Source document being compiled. + /// + XDocument Source { get; set; } + + /// + /// Cancellation token to abort cancellation. + /// + CancellationToken CancellationToken { get; set; } + } +} 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 @@ +// 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. + +namespace WixToolset.Extensibility.Data +{ +#pragma warning disable 1591 // TODO: add documentation + public interface IComponentKeyPath + { + bool Explicit { get; set; } + + string Id { get; set; } + + PossibleKeyPathType Type { get; set; } + } +} 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 @@ +// 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. + +namespace WixToolset.Extensibility.Data +{ + using System; + using System.Collections.Generic; + using WixToolset.Data; + using WixToolset.Extensibility.Services; + +#pragma warning disable 1591 // TODO: add documentation + public interface IDecompileContext + { + IServiceProvider ServiceProvider { get; } + + string DecompilePath { get; set; } + + OutputType DecompileType { get; set; } + + IReadOnlyCollection Extensions { get; set; } + + string ExtractFolder { get; set; } + + string CabinetExtractFolder { get; set; } + + /// + /// Optional gets or sets the base path for the File/@Source. + /// + /// Default value is "SourceDir" to enable use of BindPaths. + string BaseSourcePath { get; set; } + + string IntermediateFolder { get; set; } + + bool IsAdminImage { get; set; } + + string OutputPath { get; set; } + + /// + /// Gets or sets the option to suppress custom tables. + /// + bool SuppressCustomTables { get; set; } + + /// + /// Gets or sets the option to suppress dropping empty tables. + /// + bool SuppressDroppingEmptyTables { get; set; } + + bool SuppressExtractCabinets { get; set; } + + /// + /// Gets or sets the option to suppress decompiling UI-related tables. + /// + bool SuppressUI { get; set; } + + /// + /// Gets or sets whether the decompiler should use module logic on a product output. + /// + bool TreatProductAsModule { get; set; } + } +} 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 @@ +// 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. + +namespace WixToolset.Extensibility.Data +{ + using System.Collections.Generic; + using System.Xml.Linq; + using WixToolset.Data; + +#pragma warning disable 1591 // TODO: add documentation + public interface IDecompileResult + { + XDocument Document { get; set; } + + IReadOnlyCollection ExtractedFilePaths { get; set; } + + Platform? Platform { get; set; } + } +} 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 @@ +// 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. + +namespace WixToolset.Extensibility.Data +{ + using WixToolset.Data; + +#pragma warning disable 1591 // TODO: add documentation + public interface IDelayedField + { + IntermediateField Field { get; } + + IntermediateSymbol Symbol { get; } + } +} 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 @@ +// 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. + +namespace WixToolset.Extensibility.Data +{ + using System; + +#pragma warning disable 1591 // TODO: add documentation + public interface IExpectedExtractFile + { + Uri Uri { get; set; } + + string EmbeddedFileId { get; set; } + + string OutputPath { get; set; } + } +} \ 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 @@ +// 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. + +namespace WixToolset.Extensibility.Data +{ + using System.Collections.Generic; + using WixToolset.Data; + using WixToolset.Data.Symbols; + using WixToolset.Data.WindowsInstaller.Rows; + + /// + /// Interface that provides a common facade over FileSymbol and FileRow. + /// + public interface IFileFacade + { + /// + /// Reference to assembly application for this file. + /// + string AssemblyApplicationFileRef { get; } + + /// + /// Reference to assembly manifest for this file. + /// + string AssemblyManifestFileRef { get; } + + /// + /// List of assembly name values in the file. + /// + List AssemblyNames { get; set; } + + /// + /// Optionally indicates what sort of assembly the file is. + /// + AssemblyType? AssemblyType { get; } + + /// + /// Component containing the file. + /// + string ComponentRef { get; } + + /// + /// Indicates whether the file is compressed. + /// + bool Compressed { get; } + + /// + /// Disk Id for the file. + /// + int DiskId { get; set; } + + /// + /// Name of the file. + /// + string FileName { get; } + + /// + /// Size of the file. + /// + int FileSize { get; set; } + + /// + /// Indicates whether the file came from a merge module. + /// + bool FromModule { get; } + + /// + /// Indicates whether the file came from a transform. + /// + bool FromTransform { get; } + + /// + /// Hash symbol of the file. + /// + MsiFileHashSymbol Hash { get; set; } + + /// + /// Underlying identifier of the file. + /// + Identifier Identifier { get; } + + /// + /// Helper accessor for the Id of the Identifier. + /// + string Id { get; } + + /// + /// Language of the file. + /// + string Language { get; set; } + + /// + /// Optional patch group for the file. + /// + int? PatchGroup { get; } + + /// + /// Sequence of the file. + /// + int Sequence { get; set; } + + /// + /// Source line number that define the file. + /// + SourceLineNumber SourceLineNumber { get; } + + /// + /// Source to the file. + /// + string SourcePath { get; } + + /// + /// Indicates whether the file is to be uncompressed. + /// + bool Uncompressed { get; } + + /// + /// Version of the file. + /// + string Version { get; set; } + + /// + /// Gets the underlying FileRow if one is present. + /// + /// FileRow if one is present, otherwise throws. + FileRow GetFileRow(); + } +} 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 @@ +// 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. + +namespace WixToolset.Extensibility.Data +{ + using System; + using WixToolset.Data; + using WixToolset.Extensibility.Services; + +#pragma warning disable 1591 // TODO: add documentation + public interface IFileSystemContext + { + IServiceProvider ServiceProvider { get; } + + string CabCachePath { get; set; } + + string IntermediateFolder { get; set; } + + Intermediate IntermediateRepresentation { get; set; } + + string OutputPath { get; set; } + + string OutputPdbPath { get; set; } + } +} 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 @@ +// 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. + +namespace WixToolset.Extensibility.Data +{ + using WixToolset.Data; + + /// + /// Structure used for all file transfer information. + /// + public interface IFileTransfer + { + /// Destination path for file. + string Destination { get; set; } + + /// Flag if file should be moved (optimal). + bool Move { get; set; } + + /// Set during layout of media when the file transfer when the source and target resolve to the same path. + bool Redundant { get; set; } + + /// Source path to file. + string Source { get; set; } + + /// Optional source line numbers where this file transfer orginated. + SourceLineNumber SourceLineNumbers { get; set; } + } +} 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 @@ +// 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. + +namespace WixToolset.Extensibility.Data +{ + using WixToolset.Data; + + /// + /// Interface for an included file. + /// + public interface IIncludedFile + { + /// + /// Gets the full path of the included file. + /// + /// The full path of the included file. + string Path { get; set; } + + /// + /// Gets the source line numbers. + /// + /// The source line numbers. + SourceLineNumber SourceLineNumbers { get; set; } + } +} 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 @@ +// 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. + +namespace WixToolset.Extensibility.Data +{ + using System; + using WixToolset.Extensibility.Services; + +#pragma warning disable 1591 // TODO: add documentation + public interface IInscribeContext + { + IServiceProvider ServiceProvider { get; } + + string InputFilePath { get; set; } + + string IntermediateFolder { get; set; } + + string OutputFile { get; set; } + + string SignedEngineFile { get; set; } + } +} 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 @@ +// 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. + +namespace WixToolset.Extensibility.Data +{ + using System; + using System.Collections.Generic; + using System.Threading; + + /// + /// Context for laying out files. + /// + public interface ILayoutContext + { + /// + /// Service provider. + /// + IServiceProvider ServiceProvider { get; } + + /// + /// Extensions for use during layout. + /// + IReadOnlyCollection Extensions { get; set; } + + /// + /// Set of tracked of files created during processing to be cleaned up. + /// + IReadOnlyCollection TrackedFiles { get; set; } + + /// + /// Set of files to transfer. + /// + IReadOnlyCollection FileTransfers { get; set; } + + /// + /// File to capture list of content files. + /// + string ContentsFile { get; set; } + + /// + /// File to capture list of output files. + /// + string OutputsFile { get; set; } + + /// + /// Intermediate folder. + /// + string IntermediateFolder { get; set; } + + /// + /// List of built output files. + /// + string BuiltOutputsFile { get; set; } + + /// + /// Reset ACLs on file transfers. + /// + bool ResetAcls { get; set; } + + /// + /// Cancellation token. + /// + CancellationToken CancellationToken { get; set; } + } +} 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 @@ +// 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. + +namespace WixToolset.Extensibility.Data +{ + using System; + using System.Collections.Generic; + using System.Threading; + using WixToolset.Data; + + /// + /// Context provided during library creation operations. + /// + public interface ILibraryContext + { + /// + /// Service provider. + /// + IServiceProvider ServiceProvider { get; } + + /// + /// Indicates whether files should be bound into the library. + /// + bool BindFiles { get; set; } + + /// + /// Collection of bindpaths used to bind files. + /// + IReadOnlyCollection BindPaths { get; set; } + + /// + /// Collection of extensions used during creation of library. + /// + IReadOnlyCollection Extensions { get; set; } + + /// + /// Identifier of the library. + /// + string LibraryId { get; set; } + + /// + /// Collection of localization files to use in the library. + /// + IReadOnlyCollection Localizations { get; set; } + + /// + /// Collection of intermediates to include in the library. + /// + IReadOnlyCollection Intermediates { get; set; } + + /// + /// Cancellation token. + /// + CancellationToken CancellationToken { get; set; } + } +} 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 @@ +// 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. + +namespace WixToolset.Extensibility.Data +{ + using System; + using System.Collections.Generic; + using System.Threading; + using WixToolset.Data; + + /// + /// Context provided during linking. + /// + public interface ILinkContext + { + /// + /// Service provider. + /// + IServiceProvider ServiceProvider { get; } + + /// + /// Collection of extensions to use during linking. + /// + IReadOnlyCollection Extensions { get; set; } + + /// + /// Collection of extension data to use during linking. + /// + IReadOnlyCollection ExtensionData { get; set; } + + /// + /// Expected output type. + /// + OutputType ExpectedOutputType { get; set; } + + /// + /// Collection of intermediates to link. + /// + IReadOnlyCollection Intermediates { get; set; } + + /// + /// Symbol definition creator used to load extension data. + /// + ISymbolDefinitionCreator SymbolDefinitionCreator { get; set; } + + /// + /// Cancellation token. + /// + CancellationToken CancellationToken { get; set; } + } +} 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 @@ +// 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. + +namespace WixToolset.Extensibility.Data +{ + using System; + using System.Collections.Generic; + using System.Threading; + using WixToolset.Data; + + /// + /// Preprocessor context. + /// + public interface IPreprocessContext + { + /// + /// Service provider. + /// + IServiceProvider ServiceProvider { get; } + + /// + /// Collection of extensions to use during preprocessing. + /// + IReadOnlyCollection Extensions { get; set; } + + /// + /// Collection of search paths to find include files. + /// + IReadOnlyCollection IncludeSearchPaths { get; set; } + + /// + /// Gets the platform which the compiler will use when defaulting 64-bit attributes and elements. + /// + /// The platform which the compiler will use when defaulting 64-bit attributes and elements. + Platform Platform { get; set; } + + /// + /// Path to the source file being preprocessed. + /// + string SourcePath { get; set; } + + /// + /// Collection of name/value pairs used as preprocessor variables. + /// + IDictionary Variables { get; set; } + + /// + /// Current source line number of the preprocessor. + /// + SourceLineNumber CurrentSourceLineNumber { get; set; } + + /// + /// Cancellation token. + /// + CancellationToken CancellationToken { get; set; } + } +} 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 @@ +// 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. + +namespace WixToolset.Extensibility.Data +{ + using System.Collections.Generic; + using System.Xml.Linq; + + /// + /// Result of preprocessing. + /// + public interface IPreprocessResult + { + /// + /// Document result of preprocessor. + /// + XDocument Document { get; set; } + + /// + /// Collection of files included during preprocessing. + /// + IReadOnlyCollection IncludedFiles { get; set; } + } +} 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 @@ +// 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. + +namespace WixToolset.Extensibility.Data +{ + using System; + using System.Collections.Generic; + using System.Threading; + using WixToolset.Data; + + /// + /// Context for resolve. + /// + public interface IResolveContext + { + /// + /// Service provider. + /// + IServiceProvider ServiceProvider { get; } + + /// + /// Bind paths used during resolution. + /// + IReadOnlyCollection BindPaths { get; set; } + + /// + /// Resolve extensions. + /// + IReadOnlyCollection Extensions { get; set; } + + /// + /// Extension data. + /// + IReadOnlyCollection ExtensionData { get; set; } + + /// + /// List of cultures to filter the localizations. + /// + IReadOnlyCollection FilterCultures { get; set; } + + /// + /// Intermediate folder. + /// + string IntermediateFolder { get; set; } + + /// + /// Intermediate to resolve. + /// + Intermediate IntermediateRepresentation { get; set; } + + /// + /// Localizations used to resolve. + /// + IReadOnlyCollection Localizations { get; set; } + + /// + /// Indicates whether to allow localization and bind variables to remain unresolved. + /// + bool AllowUnresolvedVariables { get; set; } + + /// + /// Cancellation token. + /// + CancellationToken CancellationToken { get; set; } + } +} 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 @@ +// 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. + +namespace WixToolset.Extensibility.Data +{ + using System.Collections.Generic; + + /// + /// Result of resolving a file. + /// + public interface IResolveFileResult + { + /// + /// Collection of paths checked to find file. + /// + IReadOnlyCollection CheckedPaths { get; set; } + + /// + /// Path to found file, if found. + /// + string Path { get; set; } + } +} 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 @@ +// 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. + +namespace WixToolset.Extensibility.Data +{ + using System.Collections.Generic; + using WixToolset.Data; + + /// + /// Result of resolving localization and bind variables. + /// + public interface IResolveResult + { + /// + /// Resolved codepage, if provided. + /// + int? Codepage { get; set; } + + /// + /// Resolved summary information codepage, if provided. + /// + int? SummaryInformationCodepage { get; set; } + + /// + /// Resolved package language, if provided. + /// + int? PackageLcid { get; set; } + + /// + /// Fields still requiring resolution. + /// + IReadOnlyCollection DelayedFields { get; set; } + + /// + /// Files to extract from embedded .wixlibs. + /// + IReadOnlyCollection ExpectedEmbeddedFiles { get; set; } + + /// + /// Resolved intermediate. + /// + Intermediate IntermediateRepresentation { get; set; } + } +} 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 @@ +// 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. + +namespace WixToolset.Extensibility.Data +{ +#pragma warning disable 1591 // TODO: add documentation + public interface IResolvedCabinet + { + CabinetBuildOption BuildOption { get; set; } + + string Path { get; set; } + } +} 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 @@ +// 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. + +namespace WixToolset.Extensibility.Data +{ + /// + /// Used for resolved directory information. + /// + public interface IResolvedDirectory + { + /// The directory parent. + string DirectoryParent { get; set; } + + /// The name of this directory. + string Name { get; set; } + + /// The path of this directory. + string Path { get; set; } + } +} 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 @@ +// 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. + +namespace WixToolset.Extensibility.Data +{ + using WixToolset.Data; + + /// + /// Interface used to track all files processed. + /// + public interface ITrackedFile + { + /// + /// Indicates whether the tracked file should be cleaned by the project. + /// + bool Clean { get; set; } + + /// + /// Path to tracked file. + /// + string Path { get; set; } + + /// + /// Optional source line numbers where the tracked file was created. + /// + SourceLineNumber SourceLineNumbers { get; set; } + + /// + /// Type of tracked file. + /// + TrackedFileType Type { get; set; } + } +} 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 @@ +// 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. + +namespace WixToolset.Extensibility.Data +{ + using System; + +#pragma warning disable 1591 // TODO: add documentation + public interface IUnbindContext + { + IServiceProvider ServiceProvider { get; } + + string ExportBasePath { get; set; } + + string InputFilePath { get; set; } + + string IntermediateFolder { get; set; } + + bool IsAdminImage { get; set; } + + bool SuppressDemodularization { get; set; } + + bool SuppressExtractCabinets { get; set; } + } +} \ 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 @@ +// 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. + +namespace WixToolset.Extensibility.Data +{ + /// + /// Key path types. + /// + public enum PossibleKeyPathType + { + /// + /// Not a key path. + /// + None, + + /// + /// File resource as a key path. + /// + File, + + /// + /// Folder as a key path. + /// + Directory, + + /// + /// ODBC data source as a key path. + /// + OdbcDataSource, + + /// + /// A simple registry key acting as a key path. + /// + Registry, + + /// + /// A registry key that contains a formatted property acting as a key path. + /// + RegistryFormatted + } +} 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 @@ +// 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. + +namespace WixToolset.Extensibility.Data +{ + /// + /// Tracked file types. + /// + public enum TrackedFileType + { + /// + /// File tracked as input (like content included in an .msi). + /// + Input, + + /// + /// Temporary file (like an .idt or any other temporary file). + /// These are to be deleted before the build completes. + /// + Temporary, + + /// + /// Intermediate file (like a .cab in the cabcache). + /// These are left for subsequent builds. + /// + Intermediate, + + /// + /// Final output (like a .msi, .cab or .wixpdb). + /// These are the whole point of the build process. + /// + Final, + } +} 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 @@ +// 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. + +namespace WixToolset.Extensibility +{ + /// + /// Constants used by decompiler. + /// + public static class DecompilerConstants + { + /// + /// + /// + public const char PrimaryKeyDelimiter = '/'; + + /// + /// + /// + public const string PrimaryKeyDelimiterString = "/"; + } +} 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 @@ +// 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. + +namespace WixToolset.Extensibility +{ + using WixToolset.Data; + +#if BRING_BACK_LATER + /// + /// Base class for creating a decompiler extension. + /// + public abstract class DecompilerExtension : IDecompilerExtension + { + /// + /// Gets or sets the decompiler core for the extension. + /// + /// The decompiler core for the extension. + public IDecompilerCore Core { get; set; } + + /// + /// Gets the table definitions this extension decompiles. + /// + /// Table definitions this extension decompiles. + public virtual TableDefinitionCollection TableDefinitions { get; protected set; } + + /// + /// Gets the library that this decompiler wants removed from the decomipiled output. + /// + /// The table definitions to use while loading the library. + /// The library for this extension or null if there is no library to be removed. + public virtual Library GetLibraryToRemove(TableDefinitionCollection tableDefinitions) + { + return null; + } + + /// + /// Called at the beginning of the decompilation of a database. + /// + /// The collection of all tables. + public virtual void Initialize(TableIndexedCollection tables) + { + } + + /// + /// Decompiles an extension table. + /// + /// The table to decompile. + public virtual void DecompileTable(Table table) + { + this.Core.UnexpectedTable(table); + } + + /// + /// Finalize decompilation. + /// + /// The collection of all tables. + public virtual void Finish(TableIndexedCollection tables) + { + } + } +#endif +} 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 @@ +// 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. + +namespace WixToolset.Extensibility +{ + using System; + using System.Collections.Specialized; + using System.IO; + using System.Reflection; + using System.Xml; + using WixToolset.Data; + using WixToolset.Extensibility; + +#if BRING_BACK_LATER + /// + /// The main class for a WiX extension. + /// + public static class ExtensionHelper + { + /// + /// Help for loading a library from an embedded resource. + /// + /// The assembly containing the embedded resource. + /// The name of the embedded resource being requested. + /// The table definitions to use while loading the library. + /// The loaded library. + public static Library LoadLibraryHelper(Assembly assembly, string resourceName, TableDefinitionCollection tableDefinitions) + { + using (Stream resourceStream = assembly.GetManifestResourceStream(resourceName)) + { + UriBuilder uriBuilder = new UriBuilder(); + uriBuilder.Scheme = "embeddedresource"; + uriBuilder.Path = assembly.Location; + uriBuilder.Fragment = resourceName; + + return Library.Load(resourceStream, uriBuilder.Uri, tableDefinitions, false); + } + } + + /// + /// Helper for loading table definitions from an embedded resource. + /// + /// The assembly containing the embedded resource. + /// The name of the embedded resource being requested. + /// The loaded table definitions. + public static TableDefinitionCollection LoadTableDefinitionHelper(Assembly assembly, string resourceName) + { + using (Stream resourceStream = assembly.GetManifestResourceStream(resourceName)) + using (XmlReader reader = XmlReader.Create(resourceStream)) + { + return TableDefinitionCollection.Load(reader); + } + } + } +#endif +} 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 @@ +// 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. + +namespace WixToolset.Extensibility +{ + using WixToolset.Data; + using WixToolset.Extensibility.Data; + +#pragma warning disable 1591 // TODO: add documentation + public interface IBackend + { + IBindResult Bind(IBindContext context); + + IDecompileResult Decompile(IDecompileContext context); + + Intermediate Unbind(IUnbindContext context); + + bool Inscribe(IInscribeContext context); + } +} 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 @@ +// 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. + +namespace WixToolset.Extensibility +{ +#pragma warning disable 1591 // TODO: add documentation + public interface IBackendFactory + { + bool TryCreateBackend(string outputType, string outputPath, out IBackend backend); + } +} 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 @@ +// 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. + +namespace WixToolset.Extensibility +{ + using WixToolset.Extensibility.Data; + + /// + /// Interface all binder extensions implement. + /// + public interface IBinderExtension + { + /// + /// Called before binding occurs. + /// + void PreBind(IBindContext context); + + /// + /// Called after all binding occurs. + /// + void PostBind(IBindResult result); + } +} 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 @@ +// 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. + +namespace WixToolset.Extensibility +{ + using WixToolset.Data; + using WixToolset.Extensibility.Data; + + /// + /// Interface all Burn backend extensions implement. + /// + public interface IBurnBackendBinderExtension + { + /// + /// Called before binding occurs. + /// + void PreBackendBind(IBindContext context); + + /// + /// Called to find a file related to another source in the authoring. For example, most often used + /// to find cabinets and uncompressed files for an MSI package. + /// + /// Path to the source package. + /// Expected path to the related file. + /// Type of related file, such as "File" or "Cabinet" + /// Source line number of source package. + /// IResolveFileResult if the related file was found, or null for default handling. + IResolveFileResult ResolveRelatedFile(string source, string relatedSource, string type, SourceLineNumber sourceLineNumbers); + + /// + /// Called right before the output is bound into its final format. + /// + /// The finalized intermediate section. + void SymbolsFinalized(IntermediateSection section); + + /// + /// Called to customize the DownloadUrl provided in source cde. + /// + /// The value from the source code. May not actually be a URL. + /// The default URL if the extension does not return a value. + /// Identifier of the package. + /// Identifier of the payload. + /// Filename of the payload. + /// Url to override, or null to use default value. + string ResolveUrl(string url, string fallbackUrl, string packageId, string payloadId, string fileName); + + /// + /// Called for each extension symbol that hasn't been handled yet. + /// Use IBurnBackendHelper to add data. + /// + /// The linked section. + /// The current symbol. + /// + /// True if the extension handled the symbol, false otherwise. + /// The Burn backend will warn on all unhandled symbols. + /// + bool TryProcessSymbol(IntermediateSection section, IntermediateSymbol symbol); + + /// + /// Called after output is bound into its final format. + /// + /// + void PostBackendBind(IBindResult result); + } +} 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 @@ +// 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. + +namespace WixToolset.Extensibility +{ + using System.Collections.Generic; + using System.Xml.Linq; + using WixToolset.Data; + using WixToolset.Extensibility.Data; + + /// + /// Interface all compiler extensions implement. + /// + public interface ICompilerExtension + { + /// + /// Gets the schema namespace for this extension. + /// + /// Schema namespace supported by this extension. + XNamespace Namespace { get; } + + /// + /// Called at the beginning of the compilation of a source file. + /// + void PreCompile(ICompileContext context); + + /// + /// Processes an attribute for the Compiler. + /// + /// Parent intermediate. + /// Parent section. + /// Parent element of attribute. + /// Attribute to process. + /// Extra information about the context in which this element is being parsed. + void ParseAttribute(Intermediate intermediate, IntermediateSection section, XElement parentElement, XAttribute attribute, IDictionary context); + + /// + /// Processes an element for the Compiler. + /// + /// Parent intermediate. + /// Parent section. + /// Parent element of element to process. + /// Element to process. + /// Extra information about the context in which this element is being parsed. + void ParseElement(Intermediate intermediate, IntermediateSection section, XElement parentElement, XElement element, IDictionary context); + + /// + /// Processes an element for the Compiler, with the ability to supply a component keypath. + /// + /// Parent intermediate. + /// Parent section. + /// Parent element of element to process. + /// Element to process. + /// Extra information about the context in which this element is being parsed. + IComponentKeyPath ParsePossibleKeyPathElement(Intermediate intermediate, IntermediateSection section, XElement parentElement, XElement element, IDictionary context); + + /// + /// Called at the end of the compilation of a source file. + /// + void PostCompile(Intermediate intermediate); + } +} 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 @@ +// 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. + +namespace WixToolset.Extensibility +{ + using WixToolset.Extensibility.Data; + + /// + /// Base class for creating a decompiler extension. + /// + public interface IDecompilerExtension + { + /// + /// Called before decompiling occurs. + /// + void PreDecompile(IDecompileContext context); + + /// + /// Called after all decompiling occurs. + /// + void PostDecompile(IDecompileResult result); + } +} 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 @@ +// 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. + +namespace WixToolset.Extensibility +{ + using System.Collections.Generic; + using WixToolset.Extensibility.Data; + using WixToolset.Extensibility.Services; + + /// + /// Interface extensions implement to be able to parse the command-line. + /// + public interface IExtensionCommandLine + { + /// + /// Gets the supported command line types for this extension. + /// + /// The supported command line types for this extension. + IReadOnlyCollection CommandLineSwitches { get; } + + /// + /// Called before the command-line is parsed. + /// + /// Information about the command-line to be parsed. + void PreParse(ICommandLineContext context); + + /// + /// Gives the extension an opportunity pass a command-line argument for another command. + /// + /// Parser to help parse the argument and additional arguments. + /// Argument to parse. + /// True if the argument is recognized; otherwise false to allow another extension to process it. + bool TryParseArgument(ICommandLineParser parser, string argument); + + /// + /// Gives the extension an opportunity to provide a command. + /// + /// Parser to help parse the argument and additional arguments. + /// Argument to parse. + /// + /// True if the argument is recognized as a command; otherwise false to allow another extension to process it. + bool TryParseCommand(ICommandLineParser parser, string argument, out ICommandLineCommand command); + + /// + /// Called after the command-line is parsed. + /// + void PostParse(); + } +} 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 @@ +// 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. + +namespace WixToolset.Extensibility +{ + using WixToolset.Data; + + /// + /// Interface extensions implement to provide data. + /// + public interface IExtensionData + { + /// + /// Gets the optional default culture. + /// + /// The optional default culture. + string DefaultCulture { get; } + + /// + /// + /// + /// + /// + /// True + bool TryGetSymbolDefinitionByName(string name, out IntermediateSymbolDefinition symbolDefinition); + + /// + /// Gets the library associated with this extension. + /// + /// The symbol definitions to use while loading the library. + /// The library for this extension or null if there is no library. + Intermediate GetLibrary(ISymbolDefinitionCreator symbolDefinitions); + } +} 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 @@ +// 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. + +namespace WixToolset.Extensibility +{ + using System; + + /// + /// Implementations may request an IWixToolsetCoreServiceProvider at instantiation by having a single parameter constructor for it. + /// + public interface IExtensionFactory + { + /// + /// Request to create an extension of the specified type. + /// + /// Extension type to create. + /// Extension created. + /// True if extension was created; otherwise false. + bool TryCreateExtension(Type extensionType, out object extension); + } +} 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 @@ +// 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. + +namespace WixToolset.Extensibility +{ + using WixToolset.Extensibility.Data; + + /// + /// Interface all file system extensions implement. + /// + public interface IFileSystemExtension + { +#pragma warning disable 1591 // TODO: add documentation + void Initialize(IFileSystemContext context); + + bool? CompareFiles(string targetFile, string updatedFile); + } +} 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 @@ +// 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. + +namespace WixToolset.Extensibility +{ + /// + /// Core facilities for inspector extensions. + /// + public interface IInspectorCore + { + /// + /// Gets whether an error occured. + /// + bool EncounteredError { get; } + } +} 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 @@ +// 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. + +namespace WixToolset.Extensibility +{ + using System; + using System.IO; + using WixToolset.Data; + + /// + /// Interface for inspector extensions. + /// + /// + /// The inspector methods are stateless, but extensions are loaded once. If you want to maintain state, you should check + /// if your data is loaded for each method and, if not, load it. + /// + public interface IInspectorExtension + { + /// + /// Gets or sets the for inspector extensions to use. + /// + IInspectorCore Core { get; set; } + + /// + /// Inspect the source before preprocessing. + /// + /// The source to preprocess. + void InspectSource(Stream source); + + /// + /// Inspect the compiled output. + /// + /// The compiled output. + void InspectIntermediate(Intermediate intermediate); + +#if REWRITE + /// + /// Inspect the output. + /// + /// The output. May be called after linking or binding. + /// + /// To inspect a patch's filtered transforms, enumerate . + /// Transforms where the begins with "#" are + /// called patch transforms and instruct Windows Installer how to apply the + /// authored transforms - those that do not begin with "#". The authored + /// transforms are the primary transforms you'll typically want to inspect + /// and contain your changes to target products. + /// +#endif + /// + void InspectOutput(Intermediate output); + + /// + /// Inspect the final output after binding. + /// + /// The file path to the final bound output. + /// The that contains source line numbers + /// for the database and all rows. + void InspectDatabase(string filePath, Intermediate pdb); + } +} 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 @@ +// 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. + +namespace WixToolset.Extensibility +{ + using WixToolset.Extensibility.Data; + + /// + /// Interface all layout extensions implement. + /// + public interface ILayoutExtension + { + /// + /// Called before layout occurs. + /// + void PreLayout(ILayoutContext context); + +#pragma warning disable 1591 // TODO: add documentation + bool CopyFile(string source, string destination); + + bool MoveFile(string source, string destination); +#pragma warning restore 1591 + + /// + /// Called after all layout occurs. + /// + void PostLayout(); + } +} 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 @@ +// 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. + +namespace WixToolset.Extensibility +{ + using WixToolset.Data; + using WixToolset.Extensibility.Data; + +#pragma warning disable 1591 // TODO: add documentation + public interface ILibrarianExtension + { + void PreCombine(ILibraryContext context); + + IResolveFileResult ResolveFile(SourceLineNumber sourceLineNumber, IntermediateSymbolDefinition symbolDefinition, string path); + + void PostCombine(Intermediate library); + } +} 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 @@ +// 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. + +namespace WixToolset.Extensibility +{ + using WixToolset.Data; + using WixToolset.Extensibility.Data; + + /// + /// Interface all binder extensions implement. + /// + public interface ILinkerExtension + { + /// + /// Called before linking occurs. + /// + void PreLink(ILinkContext context); + + /// + /// Called after all linking occurs. + /// + void PostLink(Intermediate intermediate); + } +} 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 @@ +// 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. + +namespace WixToolset.Extensibility +{ + using WixToolset.Data; + using WixToolset.Extensibility.Services; + + /// + /// Message listener. + /// + public interface IMessageListener + { + /// + /// Calculate a new level for a message. + /// + /// Messaging object. + /// Message to evaluate. + /// Current message level. + /// + MessageLevel CalculateMessageLevel(IMessaging messaging, Message message, MessageLevel defaultMessageLevel); + + /// + /// Writes a message. + /// + /// Message to write. + void Write(Message message); + + /// + /// Writes a string message. + /// + /// String message to write. + void Write(string message); + } +} 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 @@ +// 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. + +namespace WixToolset.Extensibility +{ + using System.Xml.Linq; + using WixToolset.Extensibility.Data; + + /// + /// Interface for extending the WiX toolset preprocessor. + /// + public interface IPreprocessorExtension + { + /// + /// Gets the variable prefixes for the extension. + /// + /// The variable prefixes for the extension. + string[] Prefixes { get; } + + /// + /// Called at the beginning of the preprocessing of a source file. + /// + void PrePreprocess(IPreprocessContext context); + + /// + /// Gets the value of a variable whose prefix matches the extension. + /// + /// The prefix of the variable to be processed by the extension. + /// The name of the variable. + /// The value of the variable or null if the variable is undefined. + string GetVariableValue(string prefix, string name); + + /// + /// Evaluates a function defined in the extension. + /// + /// The prefix of the function to be processed by the extension. + /// The name of the function. + /// The list of arguments. + /// The value of the function or null if the function is not defined. + string EvaluateFunction(string prefix, string function, string[] args); + + /// + /// Processes a pragma defined in the extension. + /// + /// The prefix of the pragma to be processed by the extension. + /// The name of the pragma. + /// The pragma's arguments. + /// The parent node of the pragma. + /// false if the pragma is not defined. + /// Don't return false for any condition except for unrecognized pragmas. Use Core.OnMessage for errors, warnings and messages. + bool ProcessPragma(string prefix, string pragma, string args, XContainer parent); + + /// + /// Called at the end of the preprocessing of a source file. + /// + void PostPreprocess(IPreprocessResult result); + } +} 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 @@ +// 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. + +namespace WixToolset.Extensibility +{ + using WixToolset.Data; + using WixToolset.Extensibility.Data; + + /// + /// Interface all resolver extensions implement. + /// + public interface IResolverExtension + { + /// + /// Called before resolving occurs. + /// + void PreResolve(IResolveContext context); + + /// + /// Called to attempt to resolve source to a file. + /// + IResolveFileResult ResolveFile(string source, IntermediateSymbolDefinition symbolDefinition, SourceLineNumber sourceLineNumbers, BindStage bindStage); + + /// + /// Called after all resolving occurs. + /// + void PostResolve(IResolveResult result); + } +} 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 @@ +// 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. + +namespace WixToolset.Extensibility +{ + using System; + using WixToolset.Data; + + /// + /// Base class for creating an unbinder extension. + /// + public interface IUnbinderExtension + { + /// + /// Called during the generation of sectionIds for an admin image. + /// + void GenerateSectionIds(Intermediate output); + } +} 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 @@ +// 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. + +namespace WixToolset.Extensibility +{ + using System.Collections.Generic; + using WixToolset.Data; + using WixToolset.Data.Symbols; + using WixToolset.Data.WindowsInstaller; + using WixToolset.Extensibility.Data; + + /// + /// Interface all binder extensions implement. + /// + public interface IWindowsInstallerBackendBinderExtension + { + /// + /// Table definitions provided by the extension. + /// + IReadOnlyCollection TableDefinitions { get; } + + /// + /// Called before binding occurs. + /// + void PreBackendBind(IBindContext context); + + /// + /// Extension can process the intermediate before the Windows Installer data is created. + /// + /// The finalized intermediate section. + void SymbolsFinalized(IntermediateSection section); + + /// + /// Finds an existing cabinet that contains the provided files. + /// + /// Path to the cabinet. + /// Files contained in the cabinet. + /// Resolved cabinet options or null if the cabinet could not be found. + IResolvedCabinet ResolveCabinet(string cabinetPath, IEnumerable files); + + /// + /// Override layout location for a media. + /// + /// Media symbol. + /// Default media specific layout directory. + /// Default overall layout directory. + /// Layout location or null to use the default processing. + string ResolveMedia(MediaSymbol mediaSymbol, string mediaLayoutDirectory, string layoutDirectory); + + /// + /// Called for each extension symbol that hasn't been handled yet. + /// + /// The linked section. + /// The current symbol. + /// Windows Installer data + /// Collection of table definitions available for the output. + /// True if the symbol was handled, or false if not. + bool TryProcessSymbol(IntermediateSection section, IntermediateSymbol symbol, WindowsInstallerData data, TableDefinitionCollection tableDefinitions); + + /// + /// Called after all output changes occur and right before the output is bound into its final format. + /// + /// Bind result to process. + void PostBackendBind(IBindResult result); + } +} 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 @@ +// 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. + +namespace WixToolset.Extensibility +{ + using WixToolset.Data; + using WixToolset.Data.WindowsInstaller; + using WixToolset.Extensibility.Data; + + /// + /// Interface all binder extensions implement. + /// + public interface IWindowsInstallerBackendDecompilerExtension + { + /// + /// Called before decompiling occurs. + /// + void PreBackendDecompile(IDecompileContext context); + + // TODO: Redesign this interface to be useful. + + /// + /// Called after all output changes occur and right before the output is bound into its final format. + /// + void PostBackendDecompile(IDecompileResult result); + } +} 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 @@ +// 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. + +namespace WixToolset.Extensibility +{ + using System; + using System.IO; + using WixToolset.Data; + +#if BRING_THIS_BACK + /// + /// Opitonal base class for inspector extensions. + /// + public class InspectorExtension : IInspectorExtension + { + /// + /// Gets the for inspector extensions to use. + /// + public IInspectorCore Core { get; set; } + + /// + /// Inspect the source before preprocessing. + /// + /// The source to preprocess. + public virtual void InspectSource(Stream source) + { + } + + /// + /// Inspect the compiled output. + /// + /// The compiled output. + public virtual void InspectIntermediate(Intermediate intermediate) + { + } + + /// + /// Inspect the output. + /// + /// The output. May be called after linking or binding. + /// + /// To inspect a patch's filtered transforms, enumerate . + /// Transforms where the begins with "#" are + /// called patch transforms and instruct Windows Installer how to apply the + /// authored transforms - those that do not begin with "#". The authored + /// transforms are the primary transforms you'll typically want to inspect + /// and contain your changes to target products. + /// + public virtual void InspectOutput(Output output) + { + } + + /// + /// Inspect the final output after binding. + /// + /// The file path to the final bound output. + /// The that contains source line numbers + /// for the database and all rows. + public virtual void InspectDatabase(string filePath, Pdb pdb) + { + } + } +#endif +} 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 @@ +// 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. + +namespace WixToolset.Extensibility.Services +{ + using System; + using System.Collections.Generic; + using WixToolset.Data; + using WixToolset.Data.Symbols; + using WixToolset.Data.WindowsInstaller.Rows; + using WixToolset.Extensibility.Data; + + /// + /// Interface provided to help backend extensions. + /// + public interface IBackendHelper + { + /// + /// Creates a file facade from a FileSymbol and possible AssemblySymbol. + /// + /// FileSymbol backing the facade. + /// AssemblySymbol backing the facade. + /// + IFileFacade CreateFileFacade(FileSymbol file, AssemblySymbol assembly); + + /// + /// Creates a file facade from a File row. + /// + /// FileRow + /// New IFileFacade. + IFileFacade CreateFileFacade(FileRow fileRow); + + /// + /// Creates a file facade from a Merge Module's File symbol. + /// + /// FileSymbol created from a Merge Module. + /// New IFileFacade. + IFileFacade CreateFileFacadeFromMergeModule(FileSymbol fileSymbol); + + /// + /// Creates a file transfer and marks it redundant if the source and destination are identical. + /// + /// Source for the file transfer. + /// Destination for the file transfer. + /// Indicates whether to move or copy the source file. + /// Optional source line numbers that requested the file transfer. + IFileTransfer CreateFileTransfer(string source, string destination, bool move, SourceLineNumber sourceLineNumbers = null); + + /// + /// Creates a MSI compatible GUID. + /// + /// Creates an uppercase GUID with braces. + string CreateGuid(); + + /// + /// Creates a version 3 name-based UUID. + /// + /// The namespace UUID. + /// The value. + /// The generated GUID for the given namespace and value. + string CreateGuid(Guid namespaceGuid, string value); + + /// + /// Creates a resolved directory. + /// + /// Directory parent identifier. + /// Name of directory. + /// Resolved directory. + IResolvedDirectory CreateResolvedDirectory(string directoryParent, string name); + + /// + /// Extracts embedded files. + /// + /// Embedded files to extract. + /// ITrackedFile for each embedded file extracted. + IReadOnlyList ExtractEmbeddedFiles(IEnumerable embeddedFiles); + + /// + /// Generate an identifier by hashing data from the row. + /// + /// Three letter or less prefix for generated row identifier. + /// Information to hash. + /// The generated identifier. + string GenerateIdentifier(string prefix, params string[] args); + + /// + /// Validates path is relative and canonicalizes it. + /// For example, "a\..\c\.\d.exe" => "c\d.exe". + /// + /// + /// + /// + /// + /// The original value if not relative, otherwise the canonicalized relative path. + string GetCanonicalRelativePath(SourceLineNumber sourceLineNumbers, string elementName, string attributeName, string relativePath); + + /// + /// Gets a valid code page from the given web name or integer value. + /// + /// A code page web name or integer value as a string. + /// Whether to allow -1 which does not change the database code pages. This may be the case with wxl files. + /// Whether to allow Unicode (UCS) or UTF code pages. + /// Source line information for the current authoring. + /// A valid code page number. + /// The value is an integer less than 0 or greater than 65535. + /// is null. + /// The value doesn't not represent a valid code page name or integer value. + /// The code page is invalid for summary information. + int GetValidCodePage(string value, bool allowNoChange = false, bool onlyAnsi = false, SourceLineNumber sourceLineNumbers = null); + + /// + /// Get a source/target and short/long file name from an MSI Filename column. + /// + /// The Filename value. + /// true to get a source name; false to get a target name + /// true to get a long name; false to get a short name + /// The name. + string GetMsiFileName(string value, bool source, bool longName); + + /// + /// Verifies if an identifier is a valid binder variable name. + /// + /// Binder variable name to verify. + /// True if the identifier is a valid binder variable name. + bool IsValidBinderVariable(string variable); + + /// + /// Verifies the given string is a valid 4-part version module or bundle version. + /// + /// The version to verify. + /// True if version is a valid module or bundle version. + bool IsValidFourPartVersion(string version); + + /// + /// Determines if value is a valid identifier. + /// + /// Identifier to validate. + /// True if valid identifier, otherwise false. + bool IsValidIdentifier(string id); + + /// + /// Verifies the given string is a valid long filename. + /// + /// The filename to verify. + /// Allow wildcards in the filename. + /// Allow long file name to be a relative path. + /// True if filename is a valid long filename. + bool IsValidLongFilename(string filename, bool allowWildcards, bool allowRelative); + + /// + /// Verifies the given string is a valid short filename. + /// + /// The filename to verify. + /// Allow wildcards in the filename. + /// True if filename is a valid short filename. + bool IsValidShortFilename(string filename, bool allowWildcards); + + /// + /// Resolve delayed fields. + /// + /// The fields which had resolution delayed. + /// The cached variable values used when resolving delayed fields. + void ResolveDelayedFields(IEnumerable delayedFields, Dictionary variableCache); + + /// + /// Get the source/target and short/long file names from an MSI Filename column. + /// + /// The Filename value. + /// An array of strings of length 4. The contents are: short target, long target, short source, and long source. + /// + /// If any particular file name part is not parsed, its set to null in the appropriate location of the returned array of strings. + /// Thus the returned array will always be of length 4. + /// + string[] SplitMsiFileName(string value); + + /// + /// Creates a tracked file. + /// + /// Destination path for the build output. + /// Type of tracked file to create. + /// Optional source line numbers that requested the tracked file. + ITrackedFile TrackFile(string path, TrackedFileType type, SourceLineNumber sourceLineNumbers = null); + } +} 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 @@ +// 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. + +namespace WixToolset.Extensibility.Services +{ + using WixToolset.Data; + + /// + /// Interface provided to help Burn backend extensions. + /// + public interface IBurnBackendHelper : IBackendHelper + { + /// + /// Adds the given XML to the BootstrapperApplicationData manifest. + /// + /// A valid XML fragment. + void AddBootstrapperApplicationData(string xml); + + /// + /// Adds an XML element for the given symbol to the BootstrapperApplicationData manifest. + /// The symbol's name is used for the element's name. + /// All of the symbol's fields are used for the element's attributes. + /// + /// The symbol to create the element from. + /// + /// If true and the symbol has an Id, + /// then an Id attribute is created with a value of the symbol's Id. + /// + void AddBootstrapperApplicationData(IntermediateSymbol symbol, bool symbolIdIsIdAttribute = false); + + /// + /// Adds the given XML to the BundleExtensionData manifest for the given bundle extension. + /// + /// The bundle extension's id. + /// A valid XML fragment. + void AddBundleExtensionData(string extensionId, string xml); + + /// + /// Adds an XML element for the given symbol to the BundleExtensionData manifest for the given bundle extension. + /// The symbol's name is used for the element's name. + /// All of the symbol's fields are used for the element's attributes. + /// + /// The bundle extension's id. + /// The symbol to create the element from. + /// + /// If true and the symbol has an Id, + /// then an Id attribute is created with a value of the symbol's Id. + /// + void AddBundleExtensionData(string extensionId, IntermediateSymbol symbol, bool symbolIdIsIdAttribute = false); + } +} 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 @@ +// 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. + +namespace WixToolset.Extensibility.Services +{ + using WixToolset.Extensibility.Data; + + /// + /// Command-line parsing mechanism. + /// + public interface ICommandLine + { + /// + /// Simple way to parse arguments and create a command. + /// + /// Unparsed arguments. + /// Command if the command-line arguments can be parsed, otherwise null. + ICommandLineCommand CreateCommand(string[] args); + + /// + /// Simple way to parse arguments and create a command. + /// + /// Unparsed arguments. + /// Command if the command-line arguments can be parsed, otherwise null. + ICommandLineCommand CreateCommand(string commandLine); + + /// + /// Creates a command from populated arguments. + /// + /// Parsed arguments. + /// Command if the command-line arguments can be parsed, otherwise null. + ICommandLineCommand ParseStandardCommandLine(ICommandLineArguments arguments); + } +} 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 @@ +// 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. + +namespace WixToolset.Extensibility.Services +{ + using System.Collections.Generic; + using WixToolset.Data; + +#pragma warning disable 1591 // TODO: add documentation + public interface ICommandLineParser + { + string ErrorArgument { get; } + + /// + /// Validates that a valid switch (starts with "/" or "-"), and returns a bool indicating its validity + /// + /// The string check. + /// True if a valid switch, otherwise false. + bool IsSwitch(string arg); + + string GetArgumentAsFilePathOrError(string argument, string fileType); + + void GetArgumentAsFilePathOrError(string argument, string fileType, IList paths); + + string GetNextArgumentOrError(string commandLineSwitch); + + bool GetNextArgumentOrError(string commandLineSwitch, IList argument); + + string GetNextArgumentAsDirectoryOrError(string commandLineSwitch); + + bool GetNextArgumentAsDirectoryOrError(string commandLineSwitch, IList directories); + + string GetNextArgumentAsFilePathOrError(string commandLineSwitch); + + bool GetNextArgumentAsFilePathOrError(string commandLineSwitch, string fileType, IList paths); + + void ReportErrorArgument(string argument, Message message = null); + + bool TryGetNextSwitchOrArgument(out string arg); + } +} 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 @@ +// 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. + +namespace WixToolset.Extensibility.Services +{ + using System.Collections.Generic; + using System.Reflection; + + /// + /// Loads extensions and uses the extensions' factories to provide services. + /// + public interface IExtensionManager + { + /// + /// Adds an extension assembly directly to the manager. + /// + /// Extension assembly. + void Add(Assembly extensionAssembly); + + /// + /// Loads an extension assembly from an extension reference string. + /// + /// Reference to the extension. + /// The loaded assembly. This assembly can be ignored since the extension manager maintains the list of loaded assemblies internally. + /// + /// can be in several different forms: + /// + /// Full path to an extension file (C:\MyExtensions\MyExtension.Example.wixext.dll) + /// Reference to latest version of an extension in the cache (MyExtension.Example.wixext) + /// Versioned reference to specific extension in the cache (MyExtension.Example.wixext/1.0.2) + /// Relative path to an extension file (..\..\MyExtensions\MyExtension.Example.wixext.dll) + /// + /// + void Load(string extensionReference); + + /// + /// Gets extensions of specified type from factories loaded into the extension manager. + /// + /// Type of extension to get. + /// Extensions of the specified type. + IReadOnlyCollection GetServices() where T : class; + } +} 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 @@ +// 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. + +namespace WixToolset.Extensibility.Services +{ + using WixToolset.Data; + + /// + /// Interface for handling messages (error/warning/verbose). + /// + public interface IMessaging + { + /// + /// Indicates whether an error has been found. + /// + /// A bool indicating whether an error has been found. + bool EncounteredError { get; } + + /// + /// Gets the last error code encountered during messaging. + /// + /// The exit code for the process. + int LastErrorNumber { get; } + + /// + /// Gets or sets the option to show verbose messages. + /// + /// The option to show verbose messages. + bool ShowVerboseMessages { get; set; } + + /// + /// Gets or sets the option to suppress all warning messages. + /// + /// The option to suppress all warning messages. + bool SuppressAllWarnings { get; set; } + + /// + /// Gets and sets the option to treat warnings as errors. + /// + /// The option to treat warnings as errors. + bool WarningsAsError { get; set; } + + /// + /// Sets the listener for messaging. + /// + /// + void SetListener(IMessageListener listener); + + /// + /// Adds a warning message id to be elevated to an error message. + /// + /// Id of the message to elevate. + void ElevateWarningMessage(int warningNumber); + + /// + /// Adds a warning message id to be suppressed in message output. + /// + /// Id of the message to suppress. + void SuppressWarningMessage(int warningNumber); + + /// + /// Sends a message with the given arguments. + /// + /// Message to write. + void Write(Message message); + + /// + /// Sends a message with the given arguments. + /// + /// Message to write. + /// Indicates where to write a verbose message. + void Write(string message, bool verbose = false); + } +} 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 @@ +// 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. + +namespace WixToolset.Extensibility.Services +{ + using System; + using System.Collections.Generic; + using System.Xml.Linq; + using WixToolset.Data; + using WixToolset.Data.Symbols; + using WixToolset.Data.WindowsInstaller; + using WixToolset.Extensibility.Data; + + /// + /// Interface provided to help compiler extensions parse. + /// + public interface IParseHelper + { + /// + /// Creates a version 3 name-based UUID. + /// + /// The namespace UUID. + /// The value. + /// The generated GUID for the given namespace and value. + string CreateGuid(Guid namespaceGuid, string value); + + /// + /// Create an identifier by hashing data from the row. + /// + /// Three letter or less prefix for generated row identifier. + /// Information to hash. + /// The new identifier. + Identifier CreateIdentifier(string prefix, params string[] args); + + /// + /// Create an identifier based on passed file name + /// + /// File name to generate identifier from + /// The new identifier. + Identifier CreateIdentifierFromFilename(string filename); + + /// + /// Append a suffix to the given name based on the current platform. + /// If the current platform is not in the supported platforms, then it returns null. + /// + /// The base name for the identifier. + /// The platform being compiled. + /// The platforms for which there are specialized implementations. + /// The generated identifier value, or null if the current platform isn't supported. + string CreateIdentifierValueFromPlatform(string name, Platform currentPlatform, BurnPlatforms supportedPlatforms); + + /// + /// Creates a symbol in the section. + /// + /// Section to add the new symbol to. + /// Source and line number of current symbol. + /// Name of symbol definition. + /// Optional identifier for the symbol. + /// New symbol. + IntermediateSymbol CreateSymbol(IntermediateSection section, SourceLineNumber sourceLineNumbers, string symbolName, Identifier identifier = null); + + /// + /// Creates a symbol in the section. + /// + /// Section to add the new symbol to. + /// Source and line number of current symbol. + /// Symbol definition to create from. + /// Optional identifier for the symbol. + /// New symbol. + IntermediateSymbol CreateSymbol(IntermediateSection section, SourceLineNumber sourceLineNumbers, IntermediateSymbolDefinition symbolDefinition, Identifier identifier = null); + + /// + /// Creates a directory row from a name. + /// + /// Section to add the new symbol to. + /// Source line information. + /// Optional identifier for the new row. + /// Optional identifier for the parent row. + /// Long name of the directory. + /// Optional short name of the directory. + /// Optional source name for the directory. + /// Optional short source name for the directory. + /// Identifier for the newly created row. + Identifier CreateDirectorySymbol(IntermediateSection section, SourceLineNumber sourceLineNumbers, Identifier id, string parentId, string name, string shortName = null, string sourceName = null, string shortSourceName = null); + + /// + /// Creates directories using the inline directory syntax. + /// + /// Section to add the new symbol to. + /// Source line information. + /// Attribute containing the inline syntax. + /// Optional identifier of parent directory. + /// Optional inline syntax to override attribute's value. + /// Mapping of inline directory syntax to ids for the section. + /// Identifier of the leaf directory created. + string CreateDirectoryReferenceFromInlineSyntax(IntermediateSection section, SourceLineNumber sourceLineNumbers, XAttribute attribute, string parentId, string inlineSyntax, IDictionary sectionCachedInlinedDirectoryIds); + + /// + /// Creates a Registry symbol in the active section. + /// + /// Active section. + /// Source and line number of the current symbol. + /// The registry entry root. + /// The registry entry key. + /// The registry entry name. + /// The registry entry value. + /// The component which will control installation/uninstallation of the registry entry. + /// If true, "escape" leading '#' characters so the value is written as a REG_SZ. + Identifier CreateRegistrySymbol(IntermediateSection section, SourceLineNumber sourceLineNumbers, RegistryRootType root, string key, string name, string value, string componentId, bool escapeLeadingHash); + + /// + /// Create a WixSimpleReference symbol in the active section. + /// + /// Active section. + /// Source line information for the row. + /// The symbol name of the simple reference. + /// The primary key of the simple reference. + void CreateSimpleReference(IntermediateSection section, SourceLineNumber sourceLineNumbers, string symbolName, string primaryKey); + + /// + /// Create a WixSimpleReference symbol in the active section. + /// + /// Active section. + /// Source line information for the row. + /// The symbol name of the simple reference. + /// The primary keys of the simple reference. + void CreateSimpleReference(IntermediateSection section, SourceLineNumber sourceLineNumbers, string symbolName, params string[] primaryKeys); + + /// + /// Create a WixSimpleReference symbol in the active section. + /// + /// Active section. + /// Source line information for the row. + /// The symbol definition of the simple reference. + /// The primary key of the simple reference. + void CreateSimpleReference(IntermediateSection section, SourceLineNumber sourceLineNumbers, IntermediateSymbolDefinition symbolDefinition, string primaryKey); + + /// + /// Create a WixSimpleReference symbol in the active section. + /// + /// Active section. + /// Source line information for the row. + /// The symbol definition of the simple reference. + /// The primary keys of the simple reference. + void CreateSimpleReference(IntermediateSection section, SourceLineNumber sourceLineNumbers, IntermediateSymbolDefinition symbolDefinition, params string[] primaryKeys); + + /// + /// Create a reference in the specified section for a custom action specialized for specific platforms, + /// given standard prefixes for naming and suffixes for platforms. + /// + /// Source line information. + /// Section to create the reference in. + /// The custom action base name. + /// The platform being compiled. + /// The platforms for which there are specialized custom actions. + void CreateCustomActionReference(SourceLineNumber sourceLineNumbers, IntermediateSection section, string customAction, Platform platform, CustomActionPlatforms supportedPlatforms); + + /// + /// Creates WixComplexReference and WixGroup symbols in the active section. + /// + /// Section to create the reference in. + /// Source line information. + /// The parent type. + /// The parent id. + /// The parent language. + /// The child type. + /// The child id. + /// Whether the child is primary. + void CreateComplexReference(IntermediateSection section, SourceLineNumber sourceLineNumbers, ComplexReferenceParentType parentType, string parentId, string parentLanguage, ComplexReferenceChildType childType, string childId, bool isPrimary); + + /// + /// A symbol in the WixGroup table is added for this child node and its parent node. + /// + /// Section to create the reference in. + /// Source line information for the row. + /// Type of child's complex reference parent. + /// Id of the parenet node. + /// Complex reference type of child + /// Id of the Child Node. + void CreateWixGroupSymbol(IntermediateSection section, SourceLineNumber sourceLineNumbers, ComplexReferenceParentType parentType, string parentId, ComplexReferenceChildType childType, string childId); + + /// + /// Creates a symbol in the WixSearch table. + /// + /// Section to create the reference in. + /// Source line number for the search element. + /// Name of search element. + /// Identifier of the search. + /// The Burn variable to store the result into. + /// A condition to test before evaluating the search. + /// The search that this one will execute after. + /// The id of the bundle extension that handles this search. + void CreateWixSearchSymbol(IntermediateSection section, SourceLineNumber sourceLineNumbers, string elementName, Identifier id, string variable, string condition, string after, string bundleExtensionId); + + /// + /// + /// + /// Section to create the reference in. + /// Source line number for the parent element. + /// Identifier of the search (key into the WixSearch table) + /// Identifier of the search that comes before (key into the WixSearch table) + /// Further details about the relation between id and parentId. + void CreateWixSearchRelationSymbol(IntermediateSection section, SourceLineNumber sourceLineNumbers, Identifier id, string parentId, int attributes); + + /// + /// Checks if the string contains a property (i.e. "foo[Property]bar") + /// + /// String to evaluate for properties. + /// True if a property is found in the string. + bool ContainsProperty(string possibleProperty); + + /// + /// Add the appropriate symbols to make sure that the given table shows up in the resulting output. + /// + /// Active section. + /// Source line numbers. + /// Name of the table to ensure existance of. + void EnsureTable(IntermediateSection section, SourceLineNumber sourceLineNumbers, string tableName); + + /// + /// Add the appropriate symbols to make sure that the given table shows up in the resulting output. + /// + /// Active section. + /// Source line numbers. + /// Definition of the table to ensure existance of. + void EnsureTable(IntermediateSection section, SourceLineNumber sourceLineNumbers, TableDefinition tableDefinition); + + /// + /// Get an attribute value and displays an error if the value is empty by default. + /// + /// Source line information about the owner element. + /// The attribute containing the value to get. + /// A rule for the contents of the value. If the contents do not follow the rule, an error is thrown. + /// The attribute's value. + string GetAttributeValue(SourceLineNumber sourceLineNumbers, XAttribute attribute, EmptyRule emptyRule = EmptyRule.CanBeWhitespaceOnly); + + /// + /// Get a guid attribute value and displays an error for an illegal guid value. + /// + /// Source line information about the owner element. + /// The attribute containing the value to get. + /// Determines whether the guid can be automatically generated. + /// If true, no error is raised on empty value. If false, an error is raised. + /// The attribute's guid value or a special value if an error occurred. + string GetAttributeGuidValue(SourceLineNumber sourceLineNumbers, XAttribute attribute, bool generatable = false, bool canBeEmpty = false); + + /// + /// Get an identifier attribute value and displays an error for an illegal identifier value. + /// + /// Source line information about the owner element. + /// The attribute containing the value to get. + /// The attribute's identifier value or a special value if an error occurred. + Identifier GetAttributeIdentifier(SourceLineNumber sourceLineNumbers, XAttribute attribute); + + /// + /// Get an identifier attribute value and displays an error for an illegal identifier value. + /// + /// Source line information about the owner element. + /// The attribute containing the value to get. + /// The attribute's identifier value or a special value if an error occurred. + string GetAttributeIdentifierValue(SourceLineNumber sourceLineNumbers, XAttribute attribute); + + /// + /// Get an integer attribute value and displays an error for an illegal integer value. + /// + /// Source line information about the owner element. + /// The attribute containing the value to get. + /// The minimum legal value. + /// The maximum legal value. + /// The attribute's integer value or a special value if an error occurred during conversion. + int GetAttributeIntegerValue(SourceLineNumber sourceLineNumbers, XAttribute attribute, int minimum, int maximum); + + /// + /// Get a long integral attribute value and displays an error for an illegal long value. + /// + /// Source line information about the owner element. + /// The attribute containing the value to get. + /// The minimum legal value. + /// The maximum legal value. + /// The attribute's long value or a special value if an error occurred during conversion. + long GetAttributeLongValue(SourceLineNumber sourceLineNumbers, XAttribute attribute, long minimum, long maximum); + + /// + /// Gets a long filename value and displays an error for an illegal long filename value. + /// + /// Source line information about the owner element. + /// The attribute containing the value to get. + /// true if wildcards are allowed in the filename. + /// true if relative paths are allowed in the filename. + /// The attribute's long filename value. + string GetAttributeLongFilename(SourceLineNumber sourceLineNumbers, XAttribute attribute, bool allowWildcards = false, bool allowRelative = false); + + /// + /// Gets a RegistryRootType value and displays an error for an illegal value. + /// + /// Source line information about the owner element. + /// The attribute containing the value to get. + /// Whether HKMU is returned as -1 (true), or treated as an error (false). + /// The attribute's RegisitryRootType value. + RegistryRootType? GetAttributeRegistryRootValue(SourceLineNumber sourceLineNumbers, XAttribute attribute, bool allowHkmu); + + /// + /// Gets a version value or possibly a binder variable and displays an error for an illegal version value. + /// + /// Source line information about the owner element. + /// The attribute containing the value to get. + /// The attribute's version value. + string GetAttributeVersionValue(SourceLineNumber sourceLineNumbers, XAttribute attribute); + + /// + /// Gets a yes/no value and displays an error for an illegal yes/no value. + /// + /// Source line information about the owner element. + /// The attribute containing the value to get. + /// The attribute's YesNoType value. + YesNoType GetAttributeYesNoValue(SourceLineNumber sourceLineNumbers, XAttribute attribute); + + /// + /// Gets a yes/no/default value and displays an error for an illegal yes/no/default value. + /// + /// Source line information about the owner element. + /// The attribute containing the value to get. + /// The attribute's YesNoType value. + YesNoDefaultType GetAttributeYesNoDefaultValue(SourceLineNumber sourceLineNumbers, XAttribute attribute); + + /// + /// Validates path is relative and canonicalizes it. + /// For example, "a\..\c\.\d.exe" => "c\d.exe". + /// + /// + /// + /// + /// + /// The original value if not relative, otherwise the canonicalized relative path. + string GetCanonicalRelativePath(SourceLineNumber sourceLineNumbers, string elementName, string attributeName, string relativePath); + + /// + /// Gets a source line number for an element. + /// + /// Element to get source line number. + /// Source line number. + SourceLineNumber GetSourceLineNumbers(XElement element); + + /// + /// Gets node's inner text and ensure's it is safe for use in a condition by trimming any extra whitespace. + /// + /// The node to ensure inner text is a condition. + /// The value converted into a safe condition. + [Obsolete] + string GetConditionInnerText(XElement node); + + /// + /// Get an element's inner text and trims any extra whitespace. + /// + /// The element with inner text to be trimmed. + /// The node's inner text trimmed. + [Obsolete] + string GetTrimmedInnerText(XElement element); + + /// + /// Validates that the element does not contain inner text. + /// + /// Element to check for inner text. + void InnerTextDisallowed(XElement element); + + /// + /// Verifies that a value is a legal identifier. + /// + /// The value to verify. + /// true if the value is an identifier; false otherwise. + bool IsValidIdentifier(string value); + + /// + /// Verifies if an identifier is a valid loc identifier. + /// + /// Identifier to verify. + /// True if the identifier is a valid loc identifier. + bool IsValidLocIdentifier(string identifier); + + /// + /// Verifies if a filename is a valid long filename. + /// + /// Filename to verify. + /// true if wildcards are allowed in the filename. + /// true if relative paths are allowed in the filename. + /// True if the filename is a valid long filename + bool IsValidLongFilename(string filename, bool allowWildcards = false, bool allowRelative = false); + + /// + /// Verifies if a filename is a valid short filename. + /// + /// Filename to verify. + /// Indicates whether wildcards are allowed in the filename. + /// True if the filename is a valid short filename + bool IsValidShortFilename(string filename, bool allowWildcards); + + /// + /// Attempts to use an extension to parse the attribute. + /// + /// + /// Parent intermediate. + /// Parent section. + /// Element containing attribute to be parsed. + /// Attribute to be parsed. + /// Extra information about the context in which this element is being parsed. + void ParseExtensionAttribute(IEnumerable extensions, Intermediate intermediate, IntermediateSection section, XElement element, XAttribute attribute, IDictionary context = null); + + /// + /// Attempts to use an extension to parse the element. + /// + /// + /// Parent intermediate. + /// Parent section. + /// Element containing element to be parsed. + /// Element to be parsed. + /// Extra information about the context in which this element is being parsed. + void ParseExtensionElement(IEnumerable extensions, Intermediate intermediate, IntermediateSection section, XElement parentElement, XElement element, IDictionary context = null); + + /// + /// Attempts to use an extension to parse the element, with support for setting component keypath. + /// + /// + /// Parent intermediate. + /// Parent section. + /// Element containing element to be parsed. + /// Element to be parsed. + /// Extra information about the context in which this element is being parsed. + IComponentKeyPath ParsePossibleKeyPathExtensionElement(IEnumerable extensions, Intermediate intermediate, IntermediateSection section, XElement parentElement, XElement element, IDictionary context); + + /// + /// Process all children of the element looking for extensions and erroring on the unexpected. + /// + /// + /// Parent intermediate. + /// Parent section. + /// Element to parse children. + void ParseForExtensionElements(IEnumerable extensions, Intermediate intermediate, IntermediateSection section, XElement element); + + /// + /// Schedules an action symbol. + /// + /// Section to add the symbol to. + /// Source line information about the owner element. + /// Access modifier for the scheduled action. + /// Sequence to add the action to. + /// Name of action. + /// Optional condition of action. + /// Optional action to schedule before. + /// Option action to schedule after. + /// Optional overridable flag. + WixActionSymbol ScheduleActionSymbol(IntermediateSection section, SourceLineNumber sourceLineNumbers, AccessModifier access, SequenceTable sequence, string name, string condition, string beforeAction, string afterAction, bool overridable = false); + + /// + /// Called when the compiler encounters an unexpected attribute. + /// + /// Parent element that found unexpected attribute. + /// Unexpected attribute. + void UnexpectedAttribute(XElement element, XAttribute attribute); + + /// + /// Called when the compiler encounters an unexpected child element. + /// + /// Parent element that found unexpected child. + /// Unexpected child element. + void UnexpectedElement(XElement parentElement, XElement childElement); + } +} 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 @@ +// 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. + +namespace WixToolset.Extensibility.Services +{ + using System.Collections.Generic; + using WixToolset.Data; + using WixToolset.Extensibility.Data; + + /// + /// Support for processing paths. + /// + public interface IPathResolver + { + /// + /// Get the canonical source path of a directory. + /// + /// All cached directories. + /// Hash table of Component GUID generation seeds indexed by directory id. + /// Directory identifier. + /// Current platform. + /// Source path of a directory. + string GetCanonicalDirectoryPath(Dictionary directories, Dictionary componentIdGenSeeds, string directory, Platform platform); + + /// + /// Get the source path of a directory. + /// + /// All cached directories. + /// Directory identifier. + /// Source path of a directory. + string GetDirectoryPath(Dictionary directories, string directory); + + /// + /// Gets the source path of a file. + /// + /// All cached directories in . + /// Parent directory identifier. + /// File name (in long|source format). + /// Specifies the package is compressed. + /// Specifies the package uses long file names. + /// Source path of file relative to package directory. + string GetFileSourcePath(Dictionary directories, string directoryId, string fileName, bool compressed, bool useLongName); + } +} 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 @@ +// 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. + +namespace WixToolset.Extensibility.Services +{ + using System.Xml.Linq; + using WixToolset.Extensibility.Data; + + /// + /// Interface provided to help preprocessor extensions. + /// + public interface IPreprocessHelper + { + /// + /// Add a variable. + /// + /// The preprocess context. + /// The variable name. + /// The variable value. + void AddVariable(IPreprocessContext context, string name, string value); + + /// + /// Add a variable. + /// + /// The preprocess context. + /// The variable name. + /// The variable value. + /// Set to true to show variable overwrite warning. + void AddVariable(IPreprocessContext context, string name, string value, bool showWarning); + + /// + /// Evaluate a function. + /// + /// The preprocess context. + /// The function expression including the prefix and name. + /// The function value. + string EvaluateFunction(IPreprocessContext context, string function); + + /// + /// Evaluate a function. + /// + /// The preprocess context. + /// The function prefix. + /// The function name. + /// The arguments for the function. + /// The function value or null if the function is not defined. + string EvaluateFunction(IPreprocessContext context, string prefix, string function, string[] args); + + /// + /// Get the value of a variable expression like var.name. + /// + /// The preprocess context. + /// The variable expression including the optional prefix and name. + /// true to allow the variable prefix to be missing. + /// The variable value. + string GetVariableValue(IPreprocessContext context, string variable, bool allowMissingPrefix); + + /// + /// Get the value of a variable. + /// + /// The preprocess context. + /// The variable prefix. + /// The variable name. + /// The variable value or null if the variable is not set. + string GetVariableValue(IPreprocessContext context, string prefix, string name); + + /// + /// Evaluate a Pragma. + /// + /// The preprocess context. + /// The pragma's full name (<prefix>.<pragma>). + /// The arguments to the pragma. + /// The parent element of the pragma. + void PreprocessPragma(IPreprocessContext context, string pragmaName, string args, XContainer parent); + + /// + /// Replaces parameters in the source text. + /// + /// The preprocess context. + /// Text that may contain parameters to replace. + /// Text after parameters have been replaced. + string PreprocessString(IPreprocessContext context, string value); + + /// + /// Remove a variable. + /// + /// The preprocess context. + /// The variable name. + void RemoveVariable(IPreprocessContext context, string name); + } +} 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 @@ +// 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. + +namespace WixToolset.Extensibility.Services +{ + /// + /// Result when resolving a variable. + /// + public interface IVariableResolution + { + /// + /// Indicates if the value contains variables that cannot be resolved yet. + /// + bool DelayedResolve { get; set; } + + /// + /// Indicates whether a bind variables default value was used in the resolution. + /// + bool IsDefault { get; set; } + + /// + /// Indicates whether the resolution updated the value. + /// + bool UpdatedValue { get; set; } + + /// + /// The resolved value. + /// + string Value { get; set; } + } +} 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 @@ +// 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. + +namespace WixToolset.Extensibility.Services +{ + using WixToolset.Data; + +#pragma warning disable 1591 // TODO: add documentation + public interface IVariableResolver + { + void AddLocalization(Localization localization); +#pragma warning restore 1591 + + /// + /// Add a variable. + /// + /// The source line information for the value. + /// The name of the variable. + /// The value of the variable. + /// Indicates whether the variable can be overridden by an existing variable. + void AddVariable(SourceLineNumber sourceLineNumber, string name, string value, bool overridable); + + /// + /// Resolve the wix variables in a value. + /// + /// The source line information for the value. + /// The value to resolve. + /// The resolved result. + IVariableResolution ResolveVariables(SourceLineNumber sourceLineNumbers, string value); + + /// + /// Resolve the wix variables in a value. + /// + /// The source line information for the value. + /// The value to resolve. + /// true if unknown variables should throw errors. + /// The resolved value. + IVariableResolution ResolveVariables(SourceLineNumber sourceLineNumbers, string value, bool errorOnUnknown); + + /// + /// Try to find localization information for dialog and (optional) control. + /// + /// Dialog identifier. + /// Optional control identifier. + /// Found localization information. + /// True if localized control was found, otherwise false. + bool TryGetLocalizedControl(string dialog, string control, out LocalizedControl localizedControl); + } +} 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 @@ +// 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. + +namespace WixToolset.Extensibility.Services +{ + using WixToolset.Data; + using WixToolset.Data.WindowsInstaller; + + /// + /// Interface provided to help Windows Installer backend extensions. + /// + public interface IWindowsInstallerBackendHelper : IBackendHelper + { + /// + /// Creates a in the specified table. + /// + /// Parent section. + /// Symbol with line information for the row. + /// Windows Installer data. + /// Table definition for the row. + /// Row created in the . + Row CreateRow(IntermediateSection section, IntermediateSymbol symbol, WindowsInstallerData data, TableDefinition tableDefinition); + + /// + /// Looks up the registered for the given and creates a in that table. + /// Goes sequentially through each field in the symbol and assigns the value to the column with the same index as the field. + /// 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. + /// + /// Parent section. + /// Symbol to create the row from. + /// Windows Installer data. + /// Table definitions that have been registered with the binder. + /// True if a row was created. + bool TryAddSymbolToMatchingTableDefinitions(IntermediateSection section, IntermediateSymbol symbol, WindowsInstallerData data, TableDefinitionCollection tableDefinitions); + } +} 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 @@ +// 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. + +namespace WixToolset.Extensibility.Services +{ + using System.Reflection; + + /// + /// WiX branding interface. + /// + public interface IWixBranding + { + /// + /// Gets the value for CreatingApplication field (MSI Summary Information Stream). + /// + /// String for creating application. + string GetCreatingApplication(); + + /// + /// Replaces branding placeholders in original string. + /// + /// Original string containing placeholders to replace. + /// Optional assembly with branding information, if not specified core branding is used. + /// + string ReplacePlaceholders(string original, Assembly assembly = null); + } +} 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 @@ +// 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. + +namespace WixToolset.Extensibility.Services +{ + using System; + using System.Collections.Generic; + + /// + /// The core of the service provider used to add services to the service provider. + /// + public interface IWixToolsetCoreServiceProvider : IServiceProvider + { + /// + /// Adds a service to the service locator. + /// + /// Type of the service to add. + /// + /// A function that creates the service. The create function is provided the service provider + /// itself to resolve additional services and a type dictionary that stores singleton services + /// the creation function can add its service to. + /// + void AddService(Type serviceType, Func, object> creationFunction); + + /// + /// Adds a service to the service locator. + /// + /// + /// A function that creates the service. The create function is provided the service provider + /// itself to resolve additional services and a type dictionary that stores singleton services + /// the creation function can add its service to. + /// + void AddService(Func, T> creationFunction) where T : class; + } +} 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 @@ +// 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. + +namespace WixToolset.Extensibility.Services +{ + using System; + + /// + /// Service provider extensions. + /// + public static class ServiceProviderExtensions + { + /// + /// Gets a service from the service provider. + /// + /// Type of service to get. + /// Service provider. + public static T GetService(this IServiceProvider provider) where T : class + { + return provider.GetService(typeof(T)) as T; + } + + /// + /// Gets a service from the service provider. + /// + /// Service provider. + /// Type of service to get. + /// Retrieved service. + /// True if the service was found, otherwise false + public static bool TryGetService(this IServiceProvider provider, Type serviceType, out object service) + { + service = provider.GetService(serviceType); + return service != null; + } + + /// + /// Gets a service from the service provider. + /// + /// Type of service to get. + /// Service provider. + /// Retrieved service. + /// True if the service was found, otherwise false + public static bool TryGetService(this IServiceProvider provider, out T service) where T : class + { + service = provider.GetService(typeof(T)) as T; + return service != null; + } + } +} 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 @@ + + + + + + netstandard2.0 + $(TargetFrameworks);net461;net472 + WiX Toolset Extensibility + + embedded + true + true + + + + + + + + + + + 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 @@ + + + + ..\..\version.json + + + \ 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 @@ +@setlocal +@pushd %~dp0 + +dotnet pack -c Release + +@popd +@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 @@ +# 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. +# +# Do NOT modify this file. Update the canonical version in Home\repo-template\src\appveyor.yml +# then update all of the repos. + +branches: + only: + - master + - develop + +image: Visual Studio 2019 + +version: 0.0.0.{build} +configuration: Release + +environment: + DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true + DOTNET_CLI_TELEMETRY_OPTOUT: 1 + NUGET_XMLDOC_MODE: skip + +build_script: + - appveyor.cmd + +pull_requests: + do_not_increment_build_number: true + +nuget: + disable_publish_on_pr: true + +skip_branch_with_pr: true +skip_tags: true + +artifacts: +- path: build\Release\**\*.nupkg + name: nuget + +notifications: +- provider: Slack + incoming_webhook: + 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 @@ + + + + + + + + + \ No newline at end of file diff --git a/src/version.json b/src/version.json new file mode 100644 index 00000000..5f857771 --- /dev/null +++ b/src/version.json @@ -0,0 +1,11 @@ +{ + "version": "4.0", + "publicReleaseRefSpec": [ + "^refs/heads/master$" + ], + "cloudBuild": { + "buildNumber": { + "enabled": true + } + } +} diff --git a/version.json b/version.json deleted file mode 100644 index 5f857771..00000000 --- a/version.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "version": "4.0", - "publicReleaseRefSpec": [ - "^refs/heads/master$" - ], - "cloudBuild": { - "buildNumber": { - "enabled": true - } - } -} -- cgit v1.2.3-55-g6feb