From 6a24996a2e831cfe402398af65b31fb1ecd575a9 Mon Sep 17 00:00:00 2001 From: Rob Mensching Date: Thu, 22 Apr 2021 16:36:39 -0700 Subject: Move WixBuildTools into internal --- .../AssemblyInfo.cpp | 17 +++++ .../NativeAssert.h | 85 ++++++++++++++++++++++ .../WixBuildTools.TestSupport.Native.nuspec | 26 +++++++ .../WixBuildTools.TestSupport.Native.vcxproj | 85 ++++++++++++++++++++++ ...ixBuildTools.TestSupport.Native.vcxproj.filters | 33 +++++++++ .../build/WixBuildTools.TestSupport.Native.props | 29 ++++++++ .../build/WixBuildTools.TestSupport.Native.targets | 19 +++++ .../packages.config | 17 +++++ .../WixBuildTools.TestSupport.Native/precomp.cpp | 3 + .../WixBuildTools.TestSupport.Native/precomp.h | 11 +++ 10 files changed, 325 insertions(+) create mode 100644 src/internal/WixBuildTools.TestSupport.Native/AssemblyInfo.cpp create mode 100644 src/internal/WixBuildTools.TestSupport.Native/NativeAssert.h create mode 100644 src/internal/WixBuildTools.TestSupport.Native/WixBuildTools.TestSupport.Native.nuspec create mode 100644 src/internal/WixBuildTools.TestSupport.Native/WixBuildTools.TestSupport.Native.vcxproj create mode 100644 src/internal/WixBuildTools.TestSupport.Native/WixBuildTools.TestSupport.Native.vcxproj.filters create mode 100644 src/internal/WixBuildTools.TestSupport.Native/build/WixBuildTools.TestSupport.Native.props create mode 100644 src/internal/WixBuildTools.TestSupport.Native/build/WixBuildTools.TestSupport.Native.targets create mode 100644 src/internal/WixBuildTools.TestSupport.Native/packages.config create mode 100644 src/internal/WixBuildTools.TestSupport.Native/precomp.cpp create mode 100644 src/internal/WixBuildTools.TestSupport.Native/precomp.h (limited to 'src/internal/WixBuildTools.TestSupport.Native') diff --git a/src/internal/WixBuildTools.TestSupport.Native/AssemblyInfo.cpp b/src/internal/WixBuildTools.TestSupport.Native/AssemblyInfo.cpp new file mode 100644 index 00000000..23a48993 --- /dev/null +++ b/src/internal/WixBuildTools.TestSupport.Native/AssemblyInfo.cpp @@ -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. + +#include "precomp.h" + +using namespace System::Reflection; +using namespace System::Runtime::CompilerServices; +using namespace System::Runtime::InteropServices; + +// +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +// +[assembly: AssemblyTitleAttribute("WixBuildTools.TestSupport.Native")]; +[assembly: AssemblyDescriptionAttribute("")]; +[assembly: AssemblyCultureAttribute("")]; +[assembly: ComVisible(false)]; diff --git a/src/internal/WixBuildTools.TestSupport.Native/NativeAssert.h b/src/internal/WixBuildTools.TestSupport.Native/NativeAssert.h new file mode 100644 index 00000000..34af4f34 --- /dev/null +++ b/src/internal/WixBuildTools.TestSupport.Native/NativeAssert.h @@ -0,0 +1,85 @@ +#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. + + +namespace WixBuildTools { +namespace TestSupport { + + using namespace System; + using namespace System::Collections::Generic; + using namespace System::Linq; + using namespace Xunit; + + public ref class NativeAssert : WixAssert + { + public: + static void NotNull(LPCWSTR wz) + { + if (!wz) + { + Assert::NotNull(nullptr); + } + } + + // For some reason, naming these NotStringEqual methods "NotEqual" breaks Intellisense in files that call any overload of the NotEqual method. + static void NotStringEqual(LPCWSTR expected, LPCWSTR actual) + { + NativeAssert::NotStringEqual(expected, actual, FALSE); + } + + static void NotStringEqual(LPCWSTR expected, LPCWSTR actual, BOOL ignoreCase) + { + IEqualityComparer^ comparer = ignoreCase ? StringComparer::InvariantCultureIgnoreCase : StringComparer::InvariantCulture; + Assert::NotEqual(NativeAssert::LPWSTRToString(expected), NativeAssert::LPWSTRToString(actual), comparer); + } + + // For some reason, naming these StringEqual methods "Equal" breaks Intellisense in files that call any overload of the Equal method. + static void StringEqual(LPCWSTR expected, LPCWSTR actual) + { + NativeAssert::StringEqual(expected, actual, FALSE); + } + + static void StringEqual(LPCWSTR expected, LPCWSTR actual, BOOL ignoreCase) + { + IEqualityComparer^ comparer = ignoreCase ? StringComparer::InvariantCultureIgnoreCase : StringComparer::InvariantCulture; + Assert::Equal(NativeAssert::LPWSTRToString(expected), NativeAssert::LPWSTRToString(actual), comparer); + } + + static void Succeeded(HRESULT hr, LPCSTR zFormat, LPCSTR zArg, ... array^ zArgs) + { + array^ formatArgs = gcnew array(zArgs->Length + 1); + formatArgs[0] = NativeAssert::LPSTRToString(zArg); + for (int i = 0; i < zArgs->Length; ++i) + { + formatArgs[i + 1] = NativeAssert::LPSTRToString(zArgs[i]); + } + WixAssert::Succeeded(hr, gcnew String(zFormat), formatArgs); + } + + static void Succeeded(HRESULT hr, LPCSTR zFormat, ... array^ wzArgs) + { + array^ formatArgs = gcnew array(wzArgs->Length); + for (int i = 0; i < wzArgs->Length; ++i) + { + formatArgs[i] = NativeAssert::LPWSTRToString(wzArgs[i]); + } + WixAssert::Succeeded(hr, gcnew String(zFormat), formatArgs); + } + + static void ValidReturnCode(HRESULT hr, ... array^ validReturnCodes) + { + Assert::Contains(hr, (IEnumerable^)validReturnCodes); + } + + private: + static String^ LPSTRToString(LPCSTR z) + { + return z ? gcnew String(z) : nullptr; + } + static String^ LPWSTRToString(LPCWSTR wz) + { + return wz ? gcnew String(wz) : nullptr; + } + }; +} +} diff --git a/src/internal/WixBuildTools.TestSupport.Native/WixBuildTools.TestSupport.Native.nuspec b/src/internal/WixBuildTools.TestSupport.Native/WixBuildTools.TestSupport.Native.nuspec new file mode 100644 index 00000000..2852826b --- /dev/null +++ b/src/internal/WixBuildTools.TestSupport.Native/WixBuildTools.TestSupport.Native.nuspec @@ -0,0 +1,26 @@ + + + + $id$ + $version$ + $authors$ + $authors$ + MS-RL + https://github.com/wixtoolset/WixBuildTools + false + $description$ + $copyright$ + + + + + + + + + + + + + + diff --git a/src/internal/WixBuildTools.TestSupport.Native/WixBuildTools.TestSupport.Native.vcxproj b/src/internal/WixBuildTools.TestSupport.Native/WixBuildTools.TestSupport.Native.vcxproj new file mode 100644 index 00000000..aefdb4fb --- /dev/null +++ b/src/internal/WixBuildTools.TestSupport.Native/WixBuildTools.TestSupport.Native.vcxproj @@ -0,0 +1,85 @@ + + + + + + + + + + + + Debug + Win32 + + + Release + Win32 + + + + {8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942} + {95BABD97-FBDB-453A-AF8A-FA031A07B599} + WixBuildTools::TestSupport + ManagedCProj + DynamicLibrary + Unicode + true + WixBuildTools C++/CLI Test Support + + + + + + + + + + + + + + + + + + + Create + + 4564;4691 + + + + + + + + + + + + + + + + {6C57EF2C-979A-4106-A9E5-FE342810619A} + + + + + + + + + + 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/internal/WixBuildTools.TestSupport.Native/WixBuildTools.TestSupport.Native.vcxproj.filters b/src/internal/WixBuildTools.TestSupport.Native/WixBuildTools.TestSupport.Native.vcxproj.filters new file mode 100644 index 00000000..34c1380f --- /dev/null +++ b/src/internal/WixBuildTools.TestSupport.Native/WixBuildTools.TestSupport.Native.vcxproj.filters @@ -0,0 +1,33 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hh;hpp;hxx;hm;inl;inc;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms + + + + + Header Files + + + Header Files + + + + + Source Files + + + Source Files + + + \ No newline at end of file diff --git a/src/internal/WixBuildTools.TestSupport.Native/build/WixBuildTools.TestSupport.Native.props b/src/internal/WixBuildTools.TestSupport.Native/build/WixBuildTools.TestSupport.Native.props new file mode 100644 index 00000000..4a7a0035 --- /dev/null +++ b/src/internal/WixBuildTools.TestSupport.Native/build/WixBuildTools.TestSupport.Native.props @@ -0,0 +1,29 @@ + + + + + + + $([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildProjectDirectory), version.json)) + + + + + v142 + v4.7.2 + + + + $(RepoRootDir)\packages\xunit.abstractions.2.0.3\lib\netstandard2.0\xunit.abstractions.dll + + + $(RepoRootDir)\packages\xunit.assert.2.4.1\lib\netstandard1.1\xunit.assert.dll + + + $(RepoRootDir)\packages\xunit.extensibility.core.2.4.1\lib\netstandard1.1\xunit.core.dll + + + $(RepoRootDir)\packages\xunit.extensibility.execution.2.4.1\lib\net452\xunit.execution.desktop.dll + + + \ No newline at end of file diff --git a/src/internal/WixBuildTools.TestSupport.Native/build/WixBuildTools.TestSupport.Native.targets b/src/internal/WixBuildTools.TestSupport.Native/build/WixBuildTools.TestSupport.Native.targets new file mode 100644 index 00000000..77e72e95 --- /dev/null +++ b/src/internal/WixBuildTools.TestSupport.Native/build/WixBuildTools.TestSupport.Native.targets @@ -0,0 +1,19 @@ + + + + + + + + + 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/internal/WixBuildTools.TestSupport.Native/packages.config b/src/internal/WixBuildTools.TestSupport.Native/packages.config new file mode 100644 index 00000000..917d7a63 --- /dev/null +++ b/src/internal/WixBuildTools.TestSupport.Native/packages.config @@ -0,0 +1,17 @@ + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/internal/WixBuildTools.TestSupport.Native/precomp.cpp b/src/internal/WixBuildTools.TestSupport.Native/precomp.cpp new file mode 100644 index 00000000..37664a1c --- /dev/null +++ b/src/internal/WixBuildTools.TestSupport.Native/precomp.cpp @@ -0,0 +1,3 @@ +// Copyright (c) .NET 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" diff --git a/src/internal/WixBuildTools.TestSupport.Native/precomp.h b/src/internal/WixBuildTools.TestSupport.Native/precomp.h new file mode 100644 index 00000000..f54b55be --- /dev/null +++ b/src/internal/WixBuildTools.TestSupport.Native/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 "NativeAssert.h" + +#pragma managed +#include -- cgit v1.2.3-55-g6feb