From fe2f7e06c595a4e7115d83c4cc8a05b28db5002a Mon Sep 17 00:00:00 2001 From: Rob Mensching Date: Tue, 4 May 2021 22:45:02 -0700 Subject: Move DirectX.wixext into ext --- src/ext/DirectX/CSharp.Build.props | 11 +++ src/ext/DirectX/Cpp.Build.props | 86 ++++++++++++++++++ src/ext/DirectX/DirectX.wixext.sln | 61 +++++++++++++ src/ext/DirectX/Directory.Build.props | 29 +++++++ src/ext/DirectX/Directory.Build.targets | 48 +++++++++++ src/ext/DirectX/README.md | 2 + src/ext/DirectX/appveyor.cmd | 14 +++ src/ext/DirectX/appveyor.yml | 40 +++++++++ src/ext/DirectX/ca/directx.cpp | 49 +++++++++++ src/ext/DirectX/ca/directx.def | 7 ++ src/ext/DirectX/ca/directxca.vcxproj | 70 +++++++++++++++ src/ext/DirectX/ca/dllmain.cpp | 26 ++++++ src/ext/DirectX/ca/packages.config | 5 ++ src/ext/DirectX/ca/precomp.h | 11 +++ src/ext/DirectX/nuget.config | 17 ++++ .../DirectXExtensionFixture.cs | 32 +++++++ .../UsingPixelShaderVersion/Package.en-us.wxl | 11 +++ .../TestData/UsingPixelShaderVersion/Package.wxs | 15 ++++ .../UsingPixelShaderVersion/PackageComponents.wxs | 11 +++ .../TestData/UsingPixelShaderVersion/example.txt | 1 + .../WixToolsetTest.DirectX.csproj | 41 +++++++++ src/ext/DirectX/wix.snk | Bin 0 -> 596 bytes src/ext/DirectX/wixext/DirectXDecompiler.cs | 72 ++++++++++++++++ src/ext/DirectX/wixext/DirectXExtensionData.cs | 24 ++++++ src/ext/DirectX/wixext/DirectXExtensionFactory.cs | 16 ++++ .../wixext/WixToolset.DirectX.wixext.csproj | 31 +++++++ .../wixext/WixToolset.DirectX.wixext.targets | 11 +++ src/ext/DirectX/wixlib/DirectXExtension.wxs | 33 +++++++ src/ext/DirectX/wixlib/caerr.wxi | 96 +++++++++++++++++++++ src/ext/DirectX/wixlib/directx.wixproj | 13 +++ src/ext/global.json | 5 ++ 31 files changed, 888 insertions(+) create mode 100644 src/ext/DirectX/CSharp.Build.props create mode 100644 src/ext/DirectX/Cpp.Build.props create mode 100644 src/ext/DirectX/DirectX.wixext.sln create mode 100644 src/ext/DirectX/Directory.Build.props create mode 100644 src/ext/DirectX/Directory.Build.targets create mode 100644 src/ext/DirectX/README.md create mode 100644 src/ext/DirectX/appveyor.cmd create mode 100644 src/ext/DirectX/appveyor.yml create mode 100644 src/ext/DirectX/ca/directx.cpp create mode 100644 src/ext/DirectX/ca/directx.def create mode 100644 src/ext/DirectX/ca/directxca.vcxproj create mode 100644 src/ext/DirectX/ca/dllmain.cpp create mode 100644 src/ext/DirectX/ca/packages.config create mode 100644 src/ext/DirectX/ca/precomp.h create mode 100644 src/ext/DirectX/nuget.config create mode 100644 src/ext/DirectX/test/WixToolsetTest.DirectX/DirectXExtensionFixture.cs create mode 100644 src/ext/DirectX/test/WixToolsetTest.DirectX/TestData/UsingPixelShaderVersion/Package.en-us.wxl create mode 100644 src/ext/DirectX/test/WixToolsetTest.DirectX/TestData/UsingPixelShaderVersion/Package.wxs create mode 100644 src/ext/DirectX/test/WixToolsetTest.DirectX/TestData/UsingPixelShaderVersion/PackageComponents.wxs create mode 100644 src/ext/DirectX/test/WixToolsetTest.DirectX/TestData/UsingPixelShaderVersion/example.txt create mode 100644 src/ext/DirectX/test/WixToolsetTest.DirectX/WixToolsetTest.DirectX.csproj create mode 100644 src/ext/DirectX/wix.snk create mode 100644 src/ext/DirectX/wixext/DirectXDecompiler.cs create mode 100644 src/ext/DirectX/wixext/DirectXExtensionData.cs create mode 100644 src/ext/DirectX/wixext/DirectXExtensionFactory.cs create mode 100644 src/ext/DirectX/wixext/WixToolset.DirectX.wixext.csproj create mode 100644 src/ext/DirectX/wixext/WixToolset.DirectX.wixext.targets create mode 100644 src/ext/DirectX/wixlib/DirectXExtension.wxs create mode 100644 src/ext/DirectX/wixlib/caerr.wxi create mode 100644 src/ext/DirectX/wixlib/directx.wixproj create mode 100644 src/ext/global.json (limited to 'src/ext') diff --git a/src/ext/DirectX/CSharp.Build.props b/src/ext/DirectX/CSharp.Build.props new file mode 100644 index 00000000..b12f4c6e --- /dev/null +++ b/src/ext/DirectX/CSharp.Build.props @@ -0,0 +1,11 @@ + + + + + true + $([System.IO.Path]::GetFullPath($(MSBuildThisFileDirectory)wix.snk)) + + diff --git a/src/ext/DirectX/Cpp.Build.props b/src/ext/DirectX/Cpp.Build.props new file mode 100644 index 00000000..9b7a1bb5 --- /dev/null +++ b/src/ext/DirectX/Cpp.Build.props @@ -0,0 +1,86 @@ + + + + + + Win32 + $(BaseIntermediateOutputPath)$(Configuration)\$(Platform)\ + $(OutputPath)$(Platform)\ + + + + $([Microsoft.Build.Utilities.ToolLocationHelper]::GetLatestSDKTargetPlatformVersion('Windows', '10.0')) + + + + + $(DisableSpecificCompilerWarnings) + Level4 + $(ProjectDir)inc;$(MSBuildProjectDirectory);$(IntDir);$(SqlCESdkIncludePath);$(ProjectAdditionalIncludeDirectories);%(AdditionalIncludeDirectories) + WIN32;_WINDOWS;_WIN32_MSI=500;_WIN32_WINNT=0x0501;$(ArmPreprocessorDefinitions);$(UnicodePreprocessorDefinitions);_CRT_STDIO_LEGACY_WIDE_SPECIFIERS;_WINSOCK_DEPRECATED_NO_WARNINGS;%(PreprocessorDefinitions) + Use + precomp.h + StdCall + true + false + -YlprecompDefine + /Zc:threadSafeInit- %(AdditionalOptions) + true + + + $(ArmPreprocessorDefinitions);%(PreprocessorDefinitions) + $(ProjectAdditionalResourceIncludeDirectories);%(AdditionalIncludeDirectories) + + + $(OutDir);$(AdditionalMultiTargetLibraryPath);$(ProjectAdditionalLibraryDirectories);%(AdditionalLibraryDirectories) + + + $(ProjectSubSystem) + $(ProjectModuleDefinitionFile) + $(ResourceOnlyDll) + true + $(ProjectAdditionalLinkLibraries);advapi32.lib;comdlg32.lib;user32.lib;oleaut32.lib;gdi32.lib;shell32.lib;ole32.lib;version.lib;%(AdditionalDependencies) + $(OutDir);$(AdditionalMultiTargetLibraryPath);$(ArmLibraryDirectories);$(ProjectAdditionalLinkLibraryDirectories);%(AdditionalLibraryDirectories) + /IGNORE:4099 %(AdditionalOptions) + + + + + + NoExtensions + + + + + CDecl + + + + + OldStyle + true + true + + + + + Disabled + EnableFastChecks + _DEBUG;DEBUG;%(PreprocessorDefinitions) + MultiThreadedDebug + + + + + MinSpace + NDEBUG;%(PreprocessorDefinitions) + true + true + MultiThreaded + + + true + true + + + diff --git a/src/ext/DirectX/DirectX.wixext.sln b/src/ext/DirectX/DirectX.wixext.sln new file mode 100644 index 00000000..2ec5721f --- /dev/null +++ b/src/ext/DirectX/DirectX.wixext.sln @@ -0,0 +1,61 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.30204.135 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "directxca", "src\ca\directxca.vcxproj", "{76542B28-0FFD-47D3-AD6A-D0F20FA875AC}" +EndProject +Project("{930C7802-8A8C-48F9-8165-68863BCCD9DD}") = "directx", "src\wixlib\directx.wixproj", "{4D8DDEC7-AAAC-4A32-87D0-5992FE382ED9}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WixToolset.DirectX.wixext", "src\wixext\WixToolset.DirectX.wixext.csproj", "{6182DBCA-146A-4F37-8406-3139BBE04636}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WixToolsetTest.DirectX", "src\test\WixToolsetTest.DirectX\WixToolsetTest.DirectX.csproj", "{508A3DD0-FE58-4150-A1F6-A803A377012A}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Debug|x86 = Debug|x86 + Release|Any CPU = Release|Any CPU + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {76542B28-0FFD-47D3-AD6A-D0F20FA875AC}.Debug|Any CPU.ActiveCfg = Debug|Win32 + {76542B28-0FFD-47D3-AD6A-D0F20FA875AC}.Debug|Any CPU.Build.0 = Debug|Win32 + {76542B28-0FFD-47D3-AD6A-D0F20FA875AC}.Debug|x86.ActiveCfg = Debug|Win32 + {76542B28-0FFD-47D3-AD6A-D0F20FA875AC}.Debug|x86.Build.0 = Debug|Win32 + {76542B28-0FFD-47D3-AD6A-D0F20FA875AC}.Release|Any CPU.ActiveCfg = Release|Win32 + {76542B28-0FFD-47D3-AD6A-D0F20FA875AC}.Release|Any CPU.Build.0 = Release|Win32 + {76542B28-0FFD-47D3-AD6A-D0F20FA875AC}.Release|x86.ActiveCfg = Release|Win32 + {76542B28-0FFD-47D3-AD6A-D0F20FA875AC}.Release|x86.Build.0 = Release|Win32 + {4D8DDEC7-AAAC-4A32-87D0-5992FE382ED9}.Debug|Any CPU.ActiveCfg = Debug|x86 + {4D8DDEC7-AAAC-4A32-87D0-5992FE382ED9}.Debug|Any CPU.Build.0 = Debug|x86 + {4D8DDEC7-AAAC-4A32-87D0-5992FE382ED9}.Debug|x86.ActiveCfg = Debug|x86 + {4D8DDEC7-AAAC-4A32-87D0-5992FE382ED9}.Debug|x86.Build.0 = Debug|x86 + {4D8DDEC7-AAAC-4A32-87D0-5992FE382ED9}.Release|Any CPU.ActiveCfg = Release|x86 + {4D8DDEC7-AAAC-4A32-87D0-5992FE382ED9}.Release|Any CPU.Build.0 = Release|x86 + {4D8DDEC7-AAAC-4A32-87D0-5992FE382ED9}.Release|x86.ActiveCfg = Release|x86 + {4D8DDEC7-AAAC-4A32-87D0-5992FE382ED9}.Release|x86.Build.0 = Release|x86 + {6182DBCA-146A-4F37-8406-3139BBE04636}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {6182DBCA-146A-4F37-8406-3139BBE04636}.Debug|Any CPU.Build.0 = Debug|Any CPU + {6182DBCA-146A-4F37-8406-3139BBE04636}.Debug|x86.ActiveCfg = Debug|Any CPU + {6182DBCA-146A-4F37-8406-3139BBE04636}.Debug|x86.Build.0 = Debug|Any CPU + {6182DBCA-146A-4F37-8406-3139BBE04636}.Release|Any CPU.ActiveCfg = Release|Any CPU + {6182DBCA-146A-4F37-8406-3139BBE04636}.Release|Any CPU.Build.0 = Release|Any CPU + {6182DBCA-146A-4F37-8406-3139BBE04636}.Release|x86.ActiveCfg = Release|Any CPU + {6182DBCA-146A-4F37-8406-3139BBE04636}.Release|x86.Build.0 = Release|Any CPU + {508A3DD0-FE58-4150-A1F6-A803A377012A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {508A3DD0-FE58-4150-A1F6-A803A377012A}.Debug|Any CPU.Build.0 = Debug|Any CPU + {508A3DD0-FE58-4150-A1F6-A803A377012A}.Debug|x86.ActiveCfg = Debug|Any CPU + {508A3DD0-FE58-4150-A1F6-A803A377012A}.Debug|x86.Build.0 = Debug|Any CPU + {508A3DD0-FE58-4150-A1F6-A803A377012A}.Release|Any CPU.ActiveCfg = Release|Any CPU + {508A3DD0-FE58-4150-A1F6-A803A377012A}.Release|Any CPU.Build.0 = Release|Any CPU + {508A3DD0-FE58-4150-A1F6-A803A377012A}.Release|x86.ActiveCfg = Release|Any CPU + {508A3DD0-FE58-4150-A1F6-A803A377012A}.Release|x86.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {A32D323A-3843-410E-BB3A-A97ABA6E4107} + EndGlobalSection +EndGlobal diff --git a/src/ext/DirectX/Directory.Build.props b/src/ext/DirectX/Directory.Build.props new file mode 100644 index 00000000..f83cc154 --- /dev/null +++ b/src/ext/DirectX/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/ext/DirectX/Directory.Build.targets b/src/ext/DirectX/Directory.Build.targets new file mode 100644 index 00000000..dac7452a --- /dev/null +++ b/src/ext/DirectX/Directory.Build.targets @@ -0,0 +1,48 @@ + + + + + + + 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/ext/DirectX/README.md b/src/ext/DirectX/README.md new file mode 100644 index 00000000..6131cf35 --- /dev/null +++ b/src/ext/DirectX/README.md @@ -0,0 +1,2 @@ +# DirectX.wixext +WixToolset.DirectX.wixext - DirectX WiX Toolset Extension diff --git a/src/ext/DirectX/appveyor.cmd b/src/ext/DirectX/appveyor.cmd new file mode 100644 index 00000000..3a7e2d72 --- /dev/null +++ b/src/ext/DirectX/appveyor.cmd @@ -0,0 +1,14 @@ +@setlocal +@pushd %~dp0 + +nuget restore || exit /b + +msbuild -p:Configuration=Release -t:Restore || exit /b + +msbuild -p:Configuration=Release src\test\WixToolsetTest.DirectX\WixToolsetTest.DirectX.csproj || exit /b +dotnet test -c Release --no-build src\test\WixToolsetTest.DirectX || exit /b + +msbuild -p:Configuration=Release -t:Pack src\wixext\WixToolset.DirectX.wixext.csproj || exit /b + +@popd +@endlocal \ No newline at end of file diff --git a/src/ext/DirectX/appveyor.yml b/src/ext/DirectX/appveyor.yml new file mode 100644 index 00000000..7c686b04 --- /dev/null +++ b/src/ext/DirectX/appveyor.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/ext/DirectX/ca/directx.cpp b/src/ext/DirectX/ca/directx.cpp new file mode 100644 index 00000000..21838262 --- /dev/null +++ b/src/ext/DirectX/ca/directx.cpp @@ -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. + +#include "precomp.h" + +/******************************************************************** +WixQueryDirectXCaps - entry point for WixQueryDirectXCaps CA + + Called as Type 1 custom action (DLL from the Binary table) from + Windows Installer to set properties that identify the DirectX + capabilities ("caps") of the system. +********************************************************************/ +extern "C" UINT __stdcall WixQueryDirectXCaps( + __in MSIHANDLE hInstall + ) +{ +#if 0 + ::MessageBoxA(0, "break into debugger now please", "---->> ATTACH TO ME!", MB_ICONEXCLAMATION); +#endif + + HRESULT hr = S_OK; + DWORD er = ERROR_SUCCESS; + LPDIRECT3D9 pD3D = NULL; + + hr = WcaInitialize(hInstall, "WixQueryDirectXCaps"); + ExitOnFailure(hr, "failed to initialize"); + + pD3D = Direct3DCreate9(D3D_SDK_VERSION); + ExitOnNull(pD3D, hr, E_FAIL, "Direct3DCreate9 failed"); + + D3DCAPS9 d3dCaps; + hr = pD3D->GetDeviceCaps( + 0, // first adapter + D3DDEVTYPE_HAL, // fail on non-HAL devices + &d3dCaps + ); + ExitOnFailure(hr, "GetDeviceCaps call failed"); + + int iVertexShaderVersion = D3DSHADER_VERSION_MAJOR(d3dCaps.VertexShaderVersion) * 100 + D3DSHADER_VERSION_MINOR(d3dCaps.VertexShaderVersion); + WcaSetIntProperty(L"WIX_DIRECTX_VERTEXSHADERVERSION", iVertexShaderVersion); + + int iPixelShaderVersion = D3DSHADER_VERSION_MAJOR(d3dCaps.PixelShaderVersion) * 100 + D3DSHADER_VERSION_MINOR(d3dCaps.PixelShaderVersion); + WcaSetIntProperty(L"WIX_DIRECTX_PIXELSHADERVERSION", iPixelShaderVersion); + +LExit: + ReleaseObject(pD3D); + return WcaFinalize(er = FAILED(hr) ? ERROR_INSTALL_FAILURE : er); +} + + diff --git a/src/ext/DirectX/ca/directx.def b/src/ext/DirectX/ca/directx.def new file mode 100644 index 00000000..8f46f9a8 --- /dev/null +++ b/src/ext/DirectX/ca/directx.def @@ -0,0 +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. + + +LIBRARY "directxca" + +EXPORTS + WixQueryDirectXCaps diff --git a/src/ext/DirectX/ca/directxca.vcxproj b/src/ext/DirectX/ca/directxca.vcxproj new file mode 100644 index 00000000..e772009a --- /dev/null +++ b/src/ext/DirectX/ca/directxca.vcxproj @@ -0,0 +1,70 @@ + + + + + + + + + Debug + Win32 + + + Release + Win32 + + + Debug + x64 + + + Release + x64 + + + Debug + ARM64 + + + Release + ARM64 + + + + + {76542B28-0FFD-47D3-AD6A-D0F20FA875AC} + DynamicLibrary + v142 + Unicode + directxca + directx.def + WiX Toolset DirectX CustomAction + + + + + + + d3d9.lib;msi.lib + + + + + + Create + + + + + + + + + + + This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. + + + + + \ No newline at end of file diff --git a/src/ext/DirectX/ca/dllmain.cpp b/src/ext/DirectX/ca/dllmain.cpp new file mode 100644 index 00000000..df53f872 --- /dev/null +++ b/src/ext/DirectX/ca/dllmain.cpp @@ -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. + +#include "precomp.h" + +/******************************************************************** +DllMain - standard entry point for all WiX CustomActions + +********************************************************************/ +extern "C" BOOL WINAPI DllMain( + IN HINSTANCE hInst, + IN ULONG ulReason, + IN LPVOID) +{ + switch(ulReason) + { + case DLL_PROCESS_ATTACH: + WcaGlobalInitialize(hInst); + break; + + case DLL_PROCESS_DETACH: + WcaGlobalFinalize(); + break; + } + + return TRUE; +} diff --git a/src/ext/DirectX/ca/packages.config b/src/ext/DirectX/ca/packages.config new file mode 100644 index 00000000..e3dc0e43 --- /dev/null +++ b/src/ext/DirectX/ca/packages.config @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/src/ext/DirectX/ca/precomp.h b/src/ext/DirectX/ca/precomp.h new file mode 100644 index 00000000..75a15829 --- /dev/null +++ b/src/ext/DirectX/ca/precomp.h @@ -0,0 +1,11 @@ +#pragma once +// Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. + + +#include +#include +#include +#include + +#include "wcautil.h" +#include "strutil.h" diff --git a/src/ext/DirectX/nuget.config b/src/ext/DirectX/nuget.config new file mode 100644 index 00000000..db7aba29 --- /dev/null +++ b/src/ext/DirectX/nuget.config @@ -0,0 +1,17 @@ + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/ext/DirectX/test/WixToolsetTest.DirectX/DirectXExtensionFixture.cs b/src/ext/DirectX/test/WixToolsetTest.DirectX/DirectXExtensionFixture.cs new file mode 100644 index 00000000..81a5fb00 --- /dev/null +++ b/src/ext/DirectX/test/WixToolsetTest.DirectX/DirectXExtensionFixture.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 WixToolsetTest.DirectX +{ + using System.Linq; + using WixBuildTools.TestSupport; + using WixToolset.Core.TestPackage; + using WixToolset.DirectX; + using Xunit; + + public class DirectXExtensionFixture + { + [Fact] + public void CanBuildUsingPixelShaderVersion() + { + var folder = TestData.Get(@"TestData\UsingPixelShaderVersion"); + var build = new Builder(folder, typeof(DirectXExtensionFactory), new[] { folder }); + + var results = build.BuildAndQuery(Build, "CustomAction"); + Assert.Equal(new[] + { + "CustomAction:WixQueryDirectXCaps\t65\tDirectXCA\tWixQueryDirectXCaps\t", + }, results); + } + + private static void Build(string[] args) + { + var result = WixRunner.Execute(args) + .AssertSuccess(); + } + } +} diff --git a/src/ext/DirectX/test/WixToolsetTest.DirectX/TestData/UsingPixelShaderVersion/Package.en-us.wxl b/src/ext/DirectX/test/WixToolsetTest.DirectX/TestData/UsingPixelShaderVersion/Package.en-us.wxl new file mode 100644 index 00000000..38c12ac1 --- /dev/null +++ b/src/ext/DirectX/test/WixToolsetTest.DirectX/TestData/UsingPixelShaderVersion/Package.en-us.wxl @@ -0,0 +1,11 @@ + + + + + + A newer version of [ProductName] is already installed. + MsiPackage + + diff --git a/src/ext/DirectX/test/WixToolsetTest.DirectX/TestData/UsingPixelShaderVersion/Package.wxs b/src/ext/DirectX/test/WixToolsetTest.DirectX/TestData/UsingPixelShaderVersion/Package.wxs new file mode 100644 index 00000000..bd31e81f --- /dev/null +++ b/src/ext/DirectX/test/WixToolsetTest.DirectX/TestData/UsingPixelShaderVersion/Package.wxs @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + diff --git a/src/ext/DirectX/test/WixToolsetTest.DirectX/TestData/UsingPixelShaderVersion/PackageComponents.wxs b/src/ext/DirectX/test/WixToolsetTest.DirectX/TestData/UsingPixelShaderVersion/PackageComponents.wxs new file mode 100644 index 00000000..f3a2ae92 --- /dev/null +++ b/src/ext/DirectX/test/WixToolsetTest.DirectX/TestData/UsingPixelShaderVersion/PackageComponents.wxs @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/src/ext/DirectX/test/WixToolsetTest.DirectX/TestData/UsingPixelShaderVersion/example.txt b/src/ext/DirectX/test/WixToolsetTest.DirectX/TestData/UsingPixelShaderVersion/example.txt new file mode 100644 index 00000000..1b4ffe8a --- /dev/null +++ b/src/ext/DirectX/test/WixToolsetTest.DirectX/TestData/UsingPixelShaderVersion/example.txt @@ -0,0 +1 @@ +This is example.txt. \ No newline at end of file diff --git a/src/ext/DirectX/test/WixToolsetTest.DirectX/WixToolsetTest.DirectX.csproj b/src/ext/DirectX/test/WixToolsetTest.DirectX/WixToolsetTest.DirectX.csproj new file mode 100644 index 00000000..1722a613 --- /dev/null +++ b/src/ext/DirectX/test/WixToolsetTest.DirectX/WixToolsetTest.DirectX.csproj @@ -0,0 +1,41 @@ + + + + + + netcoreapp3.1 + false + + + + NU1701 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/ext/DirectX/wix.snk b/src/ext/DirectX/wix.snk new file mode 100644 index 00000000..3908a66a Binary files /dev/null and b/src/ext/DirectX/wix.snk differ diff --git a/src/ext/DirectX/wixext/DirectXDecompiler.cs b/src/ext/DirectX/wixext/DirectXDecompiler.cs new file mode 100644 index 00000000..03f90163 --- /dev/null +++ b/src/ext/DirectX/wixext/DirectXDecompiler.cs @@ -0,0 +1,72 @@ +// Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. + +namespace WixToolset.DirectX +{ +#if TODO_CONSIDER_DECOMPILER + using System; + using System.Text; + using WixToolset.Data; + using WixToolset.Extensibility; + using Wix = WixToolset.Data.Serialize; + + /// + /// The WiX Toolset DirectX Extension. + /// + public sealed class DirectXDecompiler : DecompilerExtension + { + /// + /// Get the extensions library to be removed. + /// + /// Table definitions for library. + /// Library to remove from decompiled output. + public override Library GetLibraryToRemove(TableDefinitionCollection tableDefinitions) + { + return DirectXExtensionData.GetExtensionLibrary(tableDefinitions); + } + + /// + /// Called at the beginning of the decompilation of a database. + /// + /// The collection of all tables. + public override void Initialize(TableIndexedCollection tables) + { + Table propertyTable = tables["Property"]; + + if (null != propertyTable) + { + foreach (Row row in propertyTable.Rows) + { + if ("SecureCustomProperties" == row[0].ToString()) + { + // if we've referenced any of the DirectX properties, add + // a PropertyRef to pick up the CA from the extension and then remove + // it from the SecureCustomExtensions property so we don't get duplicates + StringBuilder remainingProperties = new StringBuilder(); + string[] secureCustomProperties = row[1].ToString().Split(';'); + foreach (string property in secureCustomProperties) + { + if (property.StartsWith("WIX_DIRECTX_")) + { + Wix.PropertyRef propertyRef = new Wix.PropertyRef(); + propertyRef.Id = property; + this.Core.RootElement.AddChild(propertyRef); + } + else + { + if (0 < remainingProperties.Length) + { + remainingProperties.Append(";"); + } + remainingProperties.Append(property); + } + } + + row[1] = remainingProperties.ToString(); + break; + } + } + } + } + } +#endif +} diff --git a/src/ext/DirectX/wixext/DirectXExtensionData.cs b/src/ext/DirectX/wixext/DirectXExtensionData.cs new file mode 100644 index 00000000..d61af23f --- /dev/null +++ b/src/ext/DirectX/wixext/DirectXExtensionData.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.DirectX +{ + using WixToolset.Data; + using WixToolset.Extensibility; + + /// + /// The WiX Toolset DirectX Extension. + /// + public sealed class DirectXExtensionData : BaseExtensionData + { + /// + /// Gets the default culture. + /// + /// The default culture. + public override string DefaultCulture => "en-US"; + + public override Intermediate GetLibrary(ISymbolDefinitionCreator symbolDefinitions) + { + return Intermediate.Load(typeof(DirectXExtensionData).Assembly, "WixToolset.DirectX.directx.wixlib", symbolDefinitions); + } + } +} diff --git a/src/ext/DirectX/wixext/DirectXExtensionFactory.cs b/src/ext/DirectX/wixext/DirectXExtensionFactory.cs new file mode 100644 index 00000000..fb7f84aa --- /dev/null +++ b/src/ext/DirectX/wixext/DirectXExtensionFactory.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.DirectX +{ + using System; + using System.Collections.Generic; + using WixToolset.Extensibility; + + public class DirectXExtensionFactory : BaseExtensionFactory + { + protected override IReadOnlyCollection ExtensionTypes => new[] + { + typeof(DirectXExtensionData), + }; + } +} diff --git a/src/ext/DirectX/wixext/WixToolset.DirectX.wixext.csproj b/src/ext/DirectX/wixext/WixToolset.DirectX.wixext.csproj new file mode 100644 index 00000000..a848ff9a --- /dev/null +++ b/src/ext/DirectX/wixext/WixToolset.DirectX.wixext.csproj @@ -0,0 +1,31 @@ + + + + + + netstandard2.0 + WixToolset.DirectX + WiX Toolset DirectX Extension + WiX Toolset DirectX Extension + true + build + + + + + + + + + + + + + + + + + + + + diff --git a/src/ext/DirectX/wixext/WixToolset.DirectX.wixext.targets b/src/ext/DirectX/wixext/WixToolset.DirectX.wixext.targets new file mode 100644 index 00000000..4e27a6da --- /dev/null +++ b/src/ext/DirectX/wixext/WixToolset.DirectX.wixext.targets @@ -0,0 +1,11 @@ + + + + + + $(MSBuildThisFileDirectory)..\tools\WixToolset.DirectX.wixext.dll + + + + + diff --git a/src/ext/DirectX/wixlib/DirectXExtension.wxs b/src/ext/DirectX/wixlib/DirectXExtension.wxs new file mode 100644 index 00000000..b83dc98d --- /dev/null +++ b/src/ext/DirectX/wixlib/DirectXExtension.wxs @@ -0,0 +1,33 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/ext/DirectX/wixlib/caerr.wxi b/src/ext/DirectX/wixlib/caerr.wxi new file mode 100644 index 00000000..ff7ec121 --- /dev/null +++ b/src/ext/DirectX/wixlib/caerr.wxi @@ -0,0 +1,96 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/ext/DirectX/wixlib/directx.wixproj b/src/ext/DirectX/wixlib/directx.wixproj new file mode 100644 index 00000000..bdad24a4 --- /dev/null +++ b/src/ext/DirectX/wixlib/directx.wixproj @@ -0,0 +1,13 @@ + + + + Library + true + + + + + + + + \ No newline at end of file diff --git a/src/ext/global.json b/src/ext/global.json new file mode 100644 index 00000000..23dd3fa6 --- /dev/null +++ b/src/ext/global.json @@ -0,0 +1,5 @@ +{ + "msbuild-sdks": { + "WixToolset.Sdk": "4.0.0-build-0211" + } +} -- cgit v1.2.3-55-g6feb