diff --git a/CodeQL.yml b/CodeQL.yml index 2169a740f8d..7d2bff74107 100644 --- a/CodeQL.yml +++ b/CodeQL.yml @@ -22,7 +22,6 @@ path_classifiers: - "**/packages/integration-test-app" - "**/packages/playground" - "**/packages/sample-app-fabric" - - "**/vnext/Desktop.ABITests" - "**/vnext/Desktop.IntegrationTests" - "**/vnext/Desktop.Test.DLL" - "**/vnext/Desktop.UnitTests" diff --git a/Directory.Build.targets b/Directory.Build.targets index e822b7228d0..4264255e871 100644 --- a/Directory.Build.targets +++ b/Directory.Build.targets @@ -108,7 +108,6 @@ RnwNewArch; UseFabric; FollyDir; - IncludeFabricInterface; UseFabric; YogaDir; WinVer; diff --git a/change/react-native-windows-83a04eac-5263-4e7a-99d8-85f1ac764999.json b/change/react-native-windows-83a04eac-5263-4e7a-99d8-85f1ac764999.json new file mode 100644 index 00000000000..5d090b04031 --- /dev/null +++ b/change/react-native-windows-83a04eac-5263-4e7a-99d8-85f1ac764999.json @@ -0,0 +1,7 @@ +{ + "type": "prerelease", + "comment": "Remove CORE_ABI and bring rnwin32 and MS.RN much closer in functionality", + "packageName": "react-native-windows", + "email": "30809111+acoates-ms@users.noreply.github.com", + "dependentChangeType": "patch" +} diff --git a/vnext/Desktop.ABITests/Application.manifest b/vnext/Desktop.ABITests/Application.manifest deleted file mode 100644 index fb66d95b3ed..00000000000 --- a/vnext/Desktop.ABITests/Application.manifest +++ /dev/null @@ -1,37 +0,0 @@ - - - - - - - - - - - - - - - - diff --git a/vnext/Desktop.ABITests/DynamicReaderWriterTests.cpp b/vnext/Desktop.ABITests/DynamicReaderWriterTests.cpp deleted file mode 100644 index 4f5b68e44f7..00000000000 --- a/vnext/Desktop.ABITests/DynamicReaderWriterTests.cpp +++ /dev/null @@ -1,184 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -#include "pch.h" -#include -#include - -using namespace winrt; -using namespace winrt::Microsoft::ReactNative; - -namespace ABITests { - -// The tests here are a development staging artifact owed to the incremental buildup of the C++/WinRT-based ABI of -// the Win32 DLL. They (or their logical equivalent) should probably get rolled into other tests once C++/WinRT-based -// instance management becomes available. -TEST_CLASS (DynamicReaderWriterTests) { - public: - TEST_METHOD(WriteGetBoolean) { - TestScalar(&IJSValueWriter::WriteBoolean, &IJSValueReader::GetBoolean, JSValueType::Boolean, true); - } - - TEST_METHOD(WriteGetInt64) { - TestScalar(&IJSValueWriter::WriteInt64, &IJSValueReader::GetInt64, JSValueType::Int64, static_cast(123)); - } - - TEST_METHOD(WriteGetDouble) { - TestScalar(&IJSValueWriter::WriteDouble, &IJSValueReader::GetDouble, JSValueType::Double, 3.14); - } - - TEST_METHOD(WriteGetString) { - TestScalar( - &IJSValueWriter::WriteString, &IJSValueReader::GetString, JSValueType::String, L"abc"); - } - - TEST_METHOD(WriteNull) { - IJSValueWriter writer = Microsoft::Internal::TestController::CreateDynamicWriter(); - writer.WriteNull(); - IJSValueReader reader = Microsoft::Internal::TestController::CreateDynamicReader(writer); - TestCheckEqual(JSValueType::Null, reader.ValueType()); - } - - TEST_METHOD(WriteGetArray) { - IJSValueWriter writer = Microsoft::Internal::TestController::CreateDynamicWriter(); - writer.WriteArrayBegin(); - writer.WriteBoolean(true); - writer.WriteInt64(123); - writer.WriteString(L"abc"); - writer.WriteArrayEnd(); - - IJSValueReader reader = Microsoft::Internal::TestController::CreateDynamicReader(writer); - TestCheckEqual(JSValueType::Array, reader.ValueType()); - - TestCheck(reader.GetNextArrayItem()); - TestCheckEqual(JSValueType::Boolean, reader.ValueType()); - TestCheckEqual(true, reader.GetBoolean()); - - TestCheck(reader.GetNextArrayItem()); - TestCheckEqual(JSValueType::Int64, reader.ValueType()); - TestCheckEqual(123, reader.GetInt64()); - - TestCheck(reader.GetNextArrayItem()); - TestCheckEqual(JSValueType::String, reader.ValueType()); - TestCheckEqual(L"abc", reader.GetString()); - - TestCheck(!reader.GetNextArrayItem()); - } - - TEST_METHOD(WriteGetObject) { - IJSValueWriter writer = Microsoft::Internal::TestController::CreateDynamicWriter(); - - writer.WriteObjectBegin(); - - writer.WritePropertyName(L"Name"); - writer.WriteString(L"Bob"); - - writer.WritePropertyName(L"Age"); - writer.WriteInt64(32); - - writer.WritePropertyName(L"Married"); - writer.WriteBoolean(true); - - writer.WriteObjectEnd(); - - IJSValueReader reader = Microsoft::Internal::TestController::CreateDynamicReader(writer); - TestCheckEqual(JSValueType::Object, reader.ValueType()); - - hstring propertyName; - - TestCheck(reader.GetNextObjectProperty(/* out */ propertyName)); - TestCheckEqual(L"Name", propertyName); - TestCheckEqual(JSValueType::String, reader.ValueType()); - TestCheckEqual(L"Bob", reader.GetString()); - propertyName.clear(); - - TestCheck(reader.GetNextObjectProperty(/* out */ propertyName)); - TestCheckEqual(L"Age", propertyName); - TestCheckEqual(JSValueType::Int64, reader.ValueType()); - TestCheckEqual(32, reader.GetInt64()); - propertyName.clear(); - - TestCheck(reader.GetNextObjectProperty(/* out */ propertyName)); - TestCheckEqual(L"Married", propertyName); - TestCheckEqual(JSValueType::Boolean, reader.ValueType()); - TestCheckEqual(true, reader.GetBoolean()); - propertyName.clear(); - - TestCheck(!reader.GetNextObjectProperty(/* out */ propertyName)); - } - - TEST_METHOD(WriteGetObjectArrayMix) { - IJSValueWriter writer = Microsoft::Internal::TestController::CreateDynamicWriter(); - - writer.WriteObjectBegin(); - - writer.WritePropertyName(L"Name"); - writer.WriteString(L"Washington"); - - writer.WritePropertyName(L"Counties"); - writer.WriteArrayBegin(); - writer.WriteString(L"Snohomish"); - writer.WriteString(L"King"); - writer.WriteString(L"Pierce"); - writer.WriteArrayEnd(); - - writer.WritePropertyName(L"Area"); - writer.WriteInt64(184827); - - writer.WriteObjectEnd(); - - IJSValueReader reader = Microsoft::Internal::TestController::CreateDynamicReader(writer); - TestCheckEqual(JSValueType::Object, reader.ValueType()); - - hstring propertyName; - - TestCheck(reader.GetNextObjectProperty(/* out */ propertyName)); - TestCheckEqual(L"Name", propertyName); - TestCheckEqual(JSValueType::String, reader.ValueType()); - TestCheckEqual(L"Washington", reader.GetString()); - propertyName.clear(); - - TestCheck(reader.GetNextObjectProperty(/* out */ propertyName)); - TestCheckEqual(L"Counties", propertyName); - TestCheckEqual(JSValueType::Array, reader.ValueType()); - propertyName.clear(); - - TestCheck(reader.GetNextArrayItem()); - TestCheckEqual(JSValueType::String, reader.ValueType()); - TestCheckEqual(L"Snohomish", reader.GetString()); - - TestCheck(reader.GetNextArrayItem()); - TestCheckEqual(JSValueType::String, reader.ValueType()); - TestCheckEqual(L"King", reader.GetString()); - - TestCheck(reader.GetNextArrayItem()); - TestCheckEqual(JSValueType::String, reader.ValueType()); - TestCheckEqual(L"Pierce", reader.GetString()); - - TestCheck(!reader.GetNextArrayItem()); - - TestCheck(reader.GetNextObjectProperty(/* out */ propertyName)); - TestCheckEqual(L"Area", propertyName); - TestCheckEqual(184827, reader.GetInt64()); - propertyName.clear(); - - TestCheck(!reader.GetNextObjectProperty(/**/ propertyName)); - } - - private: - template - void TestScalar( - void(IJSValueWriter::*writerMethod)(TWriterValue) const, - TReaderValue (IJSValueReader::*readerMethod)() const, - JSValueType runtimeType, - TWriterValue value) { - IJSValueWriter writer = Microsoft::Internal::TestController::CreateDynamicWriter(); - (writer.*writerMethod)(value); - - IJSValueReader reader = Microsoft::Internal::TestController::CreateDynamicReader(writer); - TestCheckEqual(runtimeType, reader.ValueType()); - TestCheckEqual(value, (reader.*readerMethod)()); - } -}; - -} // namespace ABITests diff --git a/vnext/Desktop.ABITests/NativeLogEventTests.cpp b/vnext/Desktop.ABITests/NativeLogEventTests.cpp deleted file mode 100644 index 86c22105b95..00000000000 --- a/vnext/Desktop.ABITests/NativeLogEventTests.cpp +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -#include "pch.h" -#include -#include - -using namespace winrt::facebook::react; -using namespace winrt; - -namespace ABITests { - -TEST_CLASS (NativeLogEventTests) { - // RAII helper to ensure log handlers get unregistered - struct NativeLogInitializationGuard { - NativeLogInitializationGuard(::winrt::facebook::react::NativeLogHandler const &handler) noexcept { - m_registrationCookie = NativeLogEventSource::InitializeLogging(handler); - } - - ~NativeLogInitializationGuard() noexcept { - NativeLogEventSource::UninitializeLogging(m_registrationCookie); - } - - private: - uint32_t m_registrationCookie; - }; - - public: - TEST_METHOD(NativeLogEventHandler_Registered) { - // anticipatory, see TODO below - std::vector> logMessages; - - NativeLogHandler handler{[&logMessages](::winrt::facebook::react::LogLevel l, hstring const &m) { - logMessages.emplace_back(l, m.c_str()); - }}; - - NativeLogInitializationGuard initializationGuard{handler}; - - // TODO: - // Interact with RNW in such a way that it incurs logging, then verify the - // respective log message(s). To do that, we might have to interact via the - // existing unsafe ABI, then gradually replace those interactions with the - // safe ABI as we build it up. - } -}; - -} // namespace ABITests diff --git a/vnext/Desktop.ABITests/PerfTests.cpp b/vnext/Desktop.ABITests/PerfTests.cpp deleted file mode 100644 index 5b822be9b4b..00000000000 --- a/vnext/Desktop.ABITests/PerfTests.cpp +++ /dev/null @@ -1,73 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -#include "pch.h" -#include - -#include - -using namespace winrt::facebook::react; -using namespace winrt; - -namespace ABITests { - -#ifdef PERF_TESTS - -TEST_CLASS (PerfTests) { - static const uint32_t iterations = 100000000; - - static void HandleLogEvents(::winrt::facebook::react::LogLevel l, hstring const &m) {} - - TEST_METHOD(TimeNewAbiInitializeLogging) { - // ensure the DLL has been loaded before starting perf measurements - uint32_t loggingRegistrationToken = NativeLogEventSource::InitializeLogging(HandleLogEvents); - - LARGE_INTEGER accu{0}, a{0}, b{0}; - - NativeLogHandler logHandler = HandleLogEvents; - - QueryPerformanceCounter(&a); - - for (int i = 0; i < iterations; ++i) { - NativeLogEventSource::InitializeLogging(logHandler); - } - - QueryPerformanceCounter(&b); - accu.QuadPart = b.QuadPart - a.QuadPart; - - PrintResult("TimeNewAbiInitializeLogging", iterations, accu.QuadPart); - - NativeLogEventSource::UninitializeLogging(loggingRegistrationToken); - } - - TEST_METHOD(TimeOldAbiInitializeLogging) { - LARGE_INTEGER accu{0}, a{0}, b{0}; - - QueryPerformanceCounter(&a); - - for (int i = 0; i < iterations; ++i) { - auto callback = [](::facebook::react::RCTLogLevel l, const char *m) {}; - ::facebook::react::InitializeLogging(std::move(callback)); - } - - QueryPerformanceCounter(&b); - accu.QuadPart += b.QuadPart - a.QuadPart; - - PrintResult("TimeOldAbiInitializeLogging", iterations, accu.QuadPart); - } - - static void PrintResult(const char *testName, uint32_t iterations, LONGLONG accu) { - LARGE_INTEGER freq{0}; - Assert::IsTrue(QueryPerformanceFrequency(&freq)); - std::stringstream ss; - - double time = static_cast(accu) / freq.QuadPart; - ss << testName << ": its=" << iterations << "; accu=" << accu << "; freq=" << freq.QuadPart << "; tt=" << time - << " s; tc=" << time / iterations * std::pow(10, 9) << " ns"; - Logger::WriteMessage(ss.str().c_str()); - } -}; - -#endif // PERF_TESTS - -} // namespace ABITests diff --git a/vnext/Desktop.ABITests/React.Windows.Desktop.ABITests.vcxproj b/vnext/Desktop.ABITests/React.Windows.Desktop.ABITests.vcxproj deleted file mode 100644 index 40e7c857121..00000000000 --- a/vnext/Desktop.ABITests/React.Windows.Desktop.ABITests.vcxproj +++ /dev/null @@ -1,185 +0,0 @@ - - - - - Debug - ARM64EC - - - Debug - x64 - - - Release - ARM64EC - - - Release - x64 - - - Debug - Win32 - - - Release - Win32 - - - - true - true - true - true - {44DCED9B-9C4C-48FE-8545-0930192BBC16} - React.Windows.Desktop.ABITests - 17.0 - Win32Proj - ReactWindowsDesktopABITests - NativeUnitTestProject - win32 - - true - - true - - - - - - - Application - false - - - - - - - - - - - - - - - - $(ReactNativeWindowsDir);$(IncludePath) - - - - Use - pch.h - $(IntDir)pch.pch - pch.h - true - $(MSBuildThisFileDirectory);$(VCInstallDir)UnitTest\include;$(ReactNativeDir)\ReactCommon;%(AdditionalIncludeDirectories) - - - _CONSOLE; - CORE_ABI; - MSO_MOTIFCPP; - %(PreprocessorDefinitions) - - ProgramDatabase - true - Cdecl - - - $(VCInstallDir)UnitTest\lib;%(AdditionalLibraryDirectories) - true - Console - - - - - _DEBUG;%(PreprocessorDefinitions) - - - - - MaxSpeed - true - true - NDEBUG;%(PreprocessorDefinitions) - - - true - true - - - - - {88BAB0FA-E1AC-4DA7-A30C-F91702A8EADB} - - - - - - - $(OutputPath)..\React.Windows.Desktop\facebook.react.winmd - - - $(OutputPath)..\React.Windows.Desktop\Microsoft.Internal.winmd - - - $(OutputPath)..\React.Windows.Desktop\Microsoft.ReactNative.winmd - - - - - - - - - - - - - - - - - - - - - - - Create - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/vnext/Desktop.ABITests/React.Windows.Desktop.ABITests.vcxproj.filters b/vnext/Desktop.ABITests/React.Windows.Desktop.ABITests.vcxproj.filters deleted file mode 100644 index 89d023c562c..00000000000 --- a/vnext/Desktop.ABITests/React.Windows.Desktop.ABITests.vcxproj.filters +++ /dev/null @@ -1,64 +0,0 @@ - - - - - {dd007ef2-0241-4f4c-bac8-916c537375a3} - - - {8af93322-e15d-4a04-af2f-d9012ef7b089} - - - - - - - - - - - - - - - - - - - Utilities - - - Utilities - - - Utilities - - - Utilities - - - Utilities - - - - - Utilities - - - Utilities - - - Utilities - - - Utilities - - - - - Other files - - - - - - \ No newline at end of file diff --git a/vnext/Desktop.ABITests/ReactContextTests.cpp b/vnext/Desktop.ABITests/ReactContextTests.cpp deleted file mode 100644 index 27acfec0ea8..00000000000 --- a/vnext/Desktop.ABITests/ReactContextTests.cpp +++ /dev/null @@ -1,55 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -#include "pch.h" -#include -#include -#include - -using namespace winrt; -using namespace winrt::Microsoft::ReactNative; -using namespace winrt::Windows::Foundation; - -namespace ABITests { - -// The tests here are a development staging artifact owed to the incremental buildup of the C++/WinRT-based ABI of -// the Win32 DLL. They (or their logical equivalent) should probably get rolled into other tests once C++/WinRT-based -// instance management becomes available. -TEST_CLASS (ReactContextTests) { - public: - ReactContextTests() { - IReactPropertyBag propertyBag = ReactPropertyBagHelper::CreatePropertyBag(); - IReactNotificationService notificationService = ReactNotificationServiceHelper::CreateNotificationService(); - m_context = Microsoft::Internal::TestController::CreateContext(propertyBag, notificationService); - } - - TEST_METHOD(Properties_Get_ReturnsExpectedValue) { - auto propertyName = ReactPropertyBagHelper::GetName(nullptr, L"Age"); - m_context.Properties().Set(propertyName, box_value(28)); - auto value = m_context.Properties().Get(propertyName); - TestCheckEqual(28, unbox_value(value)); - m_context.Properties().Set(propertyName, nullptr); - } - - TEST_METHOD(Notifications_Send_NotificationReceived) { - auto notificationName = ReactPropertyBagHelper::GetName(nullptr, L"wakey-wakey"); - bool received = false; - auto subscription = m_context.Notifications().Subscribe( - notificationName, - nullptr, - [&received](IInspectable const & /* sender */, IReactNotificationArgs const & /* args */) noexcept { - received = true; - }); - m_context.Notifications().SendNotification(notificationName, nullptr, nullptr); - TestCheck(received); - subscription.Unsubscribe(); - } - - // TODO: test remaining IReactContext members (CallJSFunction, EmitJSEvent ...) once instance management has been - // hooked up - - private: - IReactContext m_context; -}; - -} // namespace ABITests diff --git a/vnext/Desktop.ABITests/ReactDispatcherTests.cpp b/vnext/Desktop.ABITests/ReactDispatcherTests.cpp deleted file mode 100644 index 5c9bbfc7040..00000000000 --- a/vnext/Desktop.ABITests/ReactDispatcherTests.cpp +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -#include "pch.h" - -#include -#include - -#include -#include - -using namespace std::chrono_literals; -using namespace winrt; -using namespace winrt::Microsoft::ReactNative; - -namespace ABITests { - -TEST_CLASS (ReactDispatcherTests) { - public: - TEST_METHOD(HasThreadAccess_FalseForTestThread) { - IReactDispatcher dispatcher = ReactDispatcherHelper::CreateSerialDispatcher(); - TestCheck(!dispatcher.HasThreadAccess()); - } - TEST_METHOD(Post_CallbackGetsExecuted) { - IReactDispatcher dispatcher = ReactDispatcherHelper::CreateSerialDispatcher(); - std::promise callbackExecutionPromise; - auto callbackExecuted = callbackExecutionPromise.get_future(); - - dispatcher.Post([&callbackExecutionPromise] { callbackExecutionPromise.set_value(); }); - - TestCheckEqual(std::future_status::ready, callbackExecuted.wait_for(500ms)); - } -}; - -} // namespace ABITests diff --git a/vnext/Desktop.ABITests/ReactModuleBuilderTests.cpp b/vnext/Desktop.ABITests/ReactModuleBuilderTests.cpp deleted file mode 100644 index e65ee569174..00000000000 --- a/vnext/Desktop.ABITests/ReactModuleBuilderTests.cpp +++ /dev/null @@ -1,56 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -#include "pch.h" -#include -#include - -using namespace winrt; -using namespace winrt::Microsoft::ReactNative; - -namespace ABITests { - -// The tests here are a development staging artifact owed to the incremental buildup of the C++/WinRT-based ABI of -// the Win32 DLL. They (or their logical equivalent) should probably get rolled into other tests once C++/WinRT-based -// instance management becomes available. -TEST_CLASS (ReactModuleBuilderTests) { - public: - ReactModuleBuilderTests() { - IReactPropertyBag propertyBag = ReactPropertyBagHelper::CreatePropertyBag(); - IReactNotificationService notificationService = ReactNotificationServiceHelper::CreateNotificationService(); - IReactContext context = Microsoft::Internal::TestController::CreateContext(propertyBag, notificationService); - m_builder = Microsoft::Internal::TestController::CreateReactModuleBuilder(context); - } - - TEST_METHOD(AddConstantProvider_IsCallable) { - m_builder.AddConstantProvider([](Microsoft::ReactNative::IJSValueWriter const &constantWriter) {}); - } - - TEST_METHOD(AddInitializer_IsCallable) { - m_builder.AddInitializer([](Microsoft::ReactNative::IReactContext const &reactContext) {}); - } - - TEST_METHOD(AddMethod_IsCallable) { - m_builder.AddMethod( - /* name */ L"MethodName", - /* returnType */ Microsoft::ReactNative::MethodReturnType::Void, - /* method */ - [](Microsoft::ReactNative::IJSValueReader const &inputReader, - Microsoft::ReactNative::IJSValueWriter const &outputWriter, - Microsoft::ReactNative::MethodResultCallback const &resolve, - Microsoft::ReactNative::MethodResultCallback const &reject) {}); - } - - TEST_METHOD(AddSyncMethod_IsCallable) { - m_builder.AddSyncMethod( - /* name */ L"MethodName", - /* method */ - [](Microsoft::ReactNative::IJSValueReader const &inputReader, - Microsoft::ReactNative::IJSValueWriter const &outputWriter) {}); - } - - private: - IReactModuleBuilder m_builder; -}; - -} // namespace ABITests \ No newline at end of file diff --git a/vnext/Desktop.ABITests/ReactNativeHostTests.cpp b/vnext/Desktop.ABITests/ReactNativeHostTests.cpp deleted file mode 100644 index 2697b469c6c..00000000000 --- a/vnext/Desktop.ABITests/ReactNativeHostTests.cpp +++ /dev/null @@ -1,44 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -#include "pch.h" -#include -#include -#include "MockReactPackageProvider.h" - -using namespace winrt::Microsoft::ReactNative; - -namespace ABITests { - -TEST_CLASS (ReactNativeHostTests) { - public: - TEST_METHOD(Activation_Succeeds) { - TestCheckNoThrow(ReactNativeHost{}); - } - - TEST_METHOD(PackageProviders_AsConstructed_IsEmpty) { - ReactNativeHost host{}; - TestCheckEqual(0u, host.PackageProviders().Size()); - } - - TEST_METHOD(PackageProviders_Append_ReflectsAddition) { - ReactNativeHost host{}; - IReactPackageProvider packageProvider = ::winrt::make(); - host.PackageProviders().Append(packageProvider); - TestCheckEqual(1u, host.PackageProviders().Size()); - } - - TEST_METHOD(InstanceSettings_BundleRootPathAsConstructed_IsEmpty) { - ReactNativeHost host{}; - TestCheck(host.InstanceSettings().BundleRootPath().empty()); - } - - TEST_METHOD(InstanceSettings_BundleRootPathAsAssigned_MatchesAssignedValue) { - const wchar_t *path = L"a/b/c"; - ReactNativeHost host{}; - host.InstanceSettings().BundleRootPath(path); - TestCheckEqual(std::wstring_view{path}, (std::wstring_view)host.InstanceSettings().BundleRootPath()); - } -}; - -} // namespace ABITests diff --git a/vnext/Desktop.ABITests/ReactNonAbiValueTests.cpp b/vnext/Desktop.ABITests/ReactNonAbiValueTests.cpp deleted file mode 100644 index aae58280fbd..00000000000 --- a/vnext/Desktop.ABITests/ReactNonAbiValueTests.cpp +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -#include "pch.h" -#include -#include - -using namespace winrt; -using namespace winrt::Microsoft::ReactNative; - -namespace ABITests { - -// The tests here are a development staging artifact owed to the incremental buildup of the C++/WinRT-based ABI of -// the Win32 DLL. They (or their logical equivalent) should probably get rolled into other tests once C++/WinRT-based -// instance management becomes available. -TEST_CLASS (ReactNonAbiValueTest) { - public: - TEST_METHOD(GetPtr_ReturnsExpectedValue) { - auto nonAbiValue = Microsoft::Internal::TestController::CreateNonAbiValue(123); - TestCheckEqual(123, *reinterpret_cast(nonAbiValue.GetPtr())); - } -}; - -} // namespace ABITests diff --git a/vnext/Desktop.ABITests/ReactPackageBuilderTests.cpp b/vnext/Desktop.ABITests/ReactPackageBuilderTests.cpp deleted file mode 100644 index d14cb410641..00000000000 --- a/vnext/Desktop.ABITests/ReactPackageBuilderTests.cpp +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -#include "pch.h" -#include -#include - -using namespace winrt; -using namespace winrt::Windows::Foundation; -using namespace winrt::Microsoft::ReactNative; - -namespace ABITests { - -// The tests here are a development staging artifact owed to the incremental buildup of the C++/WinRT-based ABI of -// the Win32 DLL. They (or their logical equivalent) should probably get rolled into other tests once C++/WinRT-based -// instance management becomes available. -TEST_CLASS (ReactPackageBuilderTests) { - public: - TEST_METHOD(AddModule_IsCallable) { - IReactPackageBuilder builder = Microsoft::Internal::TestController::CreateReactPackageBuilder(); - builder.AddModule( - /* moduleName*/ L"ModuleName", - /* moduleProvider */ [](Microsoft::ReactNative::IReactModuleBuilder const &moduleBuilder) { - return IInspectable{}; - }); - } -}; - -} // namespace ABITests diff --git a/vnext/Desktop.ABITests/ReactPackageProviderTests.cpp b/vnext/Desktop.ABITests/ReactPackageProviderTests.cpp deleted file mode 100644 index bab98b03364..00000000000 --- a/vnext/Desktop.ABITests/ReactPackageProviderTests.cpp +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -#include "pch.h" - -#include -#include -#include - -using namespace winrt; -using namespace winrt::Microsoft::ReactNative; - -namespace ABITests { - -struct MockPackageProvider : implements { - void CreatePackage(IReactPackageBuilder builder) { - OnCreatePackage(builder); - } - - std::function OnCreatePackage; -}; - -// The tests here are a development staging artifact owed to the incremental buildup of the C++/WinRT-based ABI of -// the Win32 DLL. They (or their logical equivalent) should probably get rolled into other tests once C++/WinRT-based -// instance management becomes available. -TEST_CLASS (ReactPackageProviderTests) { - public: - TEST_METHOD(CreatePackage_IsCallable) { - int createPackageCallCount = 0; - auto provider = make(); - provider.as()->OnCreatePackage = [&createPackageCallCount](IReactPackageBuilder builder) { - ++createPackageCallCount; - }; - - ReactInstanceSettings settings; - settings.PackageProviders().Append(provider); - TestCheckEqual(1ul, settings.PackageProviders().Size()); - - IReactPackageBuilder builder = Microsoft::Internal::TestController::CreateReactPackageBuilder(); - settings.PackageProviders().GetAt(0).CreatePackage(builder); - TestCheckEqual(1, createPackageCallCount); - } -}; - -} // namespace ABITests diff --git a/vnext/Desktop.ABITests/RedBoxTests.cpp b/vnext/Desktop.ABITests/RedBoxTests.cpp deleted file mode 100644 index 50cc158adb1..00000000000 --- a/vnext/Desktop.ABITests/RedBoxTests.cpp +++ /dev/null @@ -1,72 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -#include "pch.h" -#include -#include -#include - -using namespace winrt; -using namespace winrt::Microsoft::ReactNative; - -namespace ABITests { - -struct MockRedBoxHandler : implements { - void ShowNewError(IRedBoxErrorInfo info, RedBoxErrorType type) { - OnShowNewError(info, type); - } - bool IsDevSupportEnabled() { - return OnIsDevSupportEnabled(); - }; - void UpdateError(IRedBoxErrorInfo info) { - OnUpdateError(info); - } - void DismissRedBox() { - OnDismissRedBox(); - } - - std::function OnShowNewError; - std::function OnIsDevSupportEnabled; - std::function OnUpdateError; - std::function OnDismissRedBox; -}; - -// The tests here are a development staging artifact owed to the incremental buildup of the C++/WinRT-based ABI of -// the Win32 DLL. They (or their logical equivalent) should probably get rolled into other tests once C++/WinRT-based -// instance management becomes available. -TEST_CLASS (RedBoxTest) { - public: - TEST_METHOD(Handler_IsCallable) { - std::vector> showNewErrorCalls; - auto handler = make(); - handler.as()->OnShowNewError = [&showNewErrorCalls]( - IRedBoxErrorInfo info, RedBoxErrorType type) { - showNewErrorCalls.emplace_back(info, type); - }; - ReactInstanceSettings settings; - settings.RedBoxHandler(handler); - - auto frameInfo1 = Microsoft::Internal::TestController::CreateRedBoxErrorFrameInfo(L"abc.js", L"foo", 123, 11); - auto frameInfo2 = Microsoft::Internal::TestController::CreateRedBoxErrorFrameInfo(L"def.js", L"bar", 234, 22); - auto errorInfo = - Microsoft::Internal::TestController::CreateRedBoxErrorInfo(L"out of coffee", 1203, {frameInfo1, frameInfo2}); - settings.RedBoxHandler().ShowNewError(errorInfo, RedBoxErrorType::JavaScriptFatal); - - TestCheckEqual(1ul, showNewErrorCalls.size()); - TestCheckEqual(2ul, std::get<0>(showNewErrorCalls[0]).Callstack().Size()); - - TestCheckEqual(L"abc.js", std::get<0>(showNewErrorCalls[0]).Callstack().GetAt(0).File()); - TestCheckEqual(L"foo", std::get<0>(showNewErrorCalls[0]).Callstack().GetAt(0).Method()); - TestCheckEqual(123ul, std::get<0>(showNewErrorCalls[0]).Callstack().GetAt(0).Line()); - TestCheckEqual(11ul, std::get<0>(showNewErrorCalls[0]).Callstack().GetAt(0).Column()); - - TestCheckEqual(L"def.js", std::get<0>(showNewErrorCalls[0]).Callstack().GetAt(1).File()); - TestCheckEqual(L"bar", std::get<0>(showNewErrorCalls[0]).Callstack().GetAt(1).Method()); - TestCheckEqual(234ul, std::get<0>(showNewErrorCalls[0]).Callstack().GetAt(1).Line()); - TestCheckEqual(22ul, std::get<0>(showNewErrorCalls[0]).Callstack().GetAt(1).Column()); - - TestCheckEqual(RedBoxErrorType::JavaScriptFatal, std::get<1>(showNewErrorCalls[0])); - } -}; - -} // namespace ABITests diff --git a/vnext/Desktop.ABITests/SimpleMessageQueue.cpp b/vnext/Desktop.ABITests/SimpleMessageQueue.cpp deleted file mode 100644 index 248681f85a4..00000000000 --- a/vnext/Desktop.ABITests/SimpleMessageQueue.cpp +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -#include "pch.h" -#include "SimpleMessageQueue.h" - -namespace ABITests { - -void SimpleMessageQueue::Run(::winrt::facebook::react::QueueItem const &item) const { - m_items.push(item); -} - -void SimpleMessageQueue::RunSync(::winrt::facebook::react::QueueItem const &item) const { - item(); -} - -void SimpleMessageQueue::QuitSync() const {} - -bool SimpleMessageQueue::IsEmpty() const noexcept { - return m_items.empty(); -} - -bool SimpleMessageQueue::DispatchOne() { - if (m_items.empty()) - return false; - - m_items.front()(); - m_items.pop(); - - return true; -} - -} // namespace ABITests diff --git a/vnext/Desktop.ABITests/SimpleMessageQueue.h b/vnext/Desktop.ABITests/SimpleMessageQueue.h deleted file mode 100644 index 6c3b01be338..00000000000 --- a/vnext/Desktop.ABITests/SimpleMessageQueue.h +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -#pragma once -#include -#include -#include - -namespace ABITests { - -class SimpleMessageQueue : public winrt::implements { - public: - void Run(::winrt::facebook::react::QueueItem const &item) const; - void RunSync(::winrt::facebook::react::QueueItem const &item) const; - void QuitSync() const; - - bool IsEmpty() const noexcept; - bool DispatchOne(); - - private: - mutable std::queue<::winrt::facebook::react::QueueItem> m_items; -}; - -} // namespace ABITests diff --git a/vnext/Desktop.ABITests/main.cpp b/vnext/Desktop.ABITests/main.cpp deleted file mode 100644 index 58c02c61ec8..00000000000 --- a/vnext/Desktop.ABITests/main.cpp +++ /dev/null @@ -1,13 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -#include "pch.h" - -#include "gtest/gtest.h" -#include "motifCpp/gTestAdapter.h" - -int main(int argc, char **argv) { - Mso::UnitTests::GTest::RegisterUnitTests(); - ::testing::InitGoogleTest(&argc, argv); - return RUN_ALL_TESTS(); -} diff --git a/vnext/Desktop.ABITests/packages.experimentalwinui3.lock.json b/vnext/Desktop.ABITests/packages.experimentalwinui3.lock.json deleted file mode 100644 index dd014684ba2..00000000000 --- a/vnext/Desktop.ABITests/packages.experimentalwinui3.lock.json +++ /dev/null @@ -1,261 +0,0 @@ -{ - "version": 1, - "dependencies": { - "native,Version=v0.0": { - "Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn": { - "type": "Direct", - "requested": "[1.8.1.7, )", - "resolved": "1.8.1.7", - "contentHash": "FxNwT4YpsGdqforqFSTGc5f/e+qfRJ+1wf5G1w0nEEkT5pr5M95E5+fOuswpPUGXPZIXM+M7BSVGnCRcQZjomA==" - }, - "Microsoft.Windows.CppWinRT": { - "type": "Direct", - "requested": "[2.0.230706.1, )", - "resolved": "2.0.230706.1", - "contentHash": "l0D7oCw/5X+xIKHqZTi62TtV+1qeSz7KVluNFdrJ9hXsst4ghvqQ/Yhura7JqRdZWBXAuDS0G0KwALptdoxweQ==" - }, - "boost": { - "type": "Transitive", - "resolved": "1.84.0", - "contentHash": "4el2YP3cNJDVFPdzOso+LxGvdWP2rHxML4siq8VdonNypW2m4q503tHfCj6vK0L1UfxioE2hpFGb4ITEua73tg==" - }, - "Microsoft.Build.Tasks.Git": { - "type": "Transitive", - "resolved": "1.1.1", - "contentHash": "AT3HlgTjsqHnWpBHSNeR0KxbLZD7bztlZVj7I8vgeYG9SYqbeFGh0TM/KVtC6fg53nrWHl3VfZFvb5BiQFcY6Q==" - }, - "Microsoft.JavaScript.Hermes": { - "type": "Transitive", - "resolved": "0.0.0-2604.21001-94aa5e1d", - "contentHash": "8eHA3O043jIeK7E1gJbzgsdujaDTIBwLSl6pZj7CdQl+ryFqaW88XVU9ogWJPxk5lR2T4cU/OlEJfZynqoyYew==" - }, - "Microsoft.SourceLink.Common": { - "type": "Transitive", - "resolved": "1.1.1", - "contentHash": "WMcGpWKrmJmzrNeuaEb23bEMnbtR/vLmvZtkAP5qWu7vQsY59GqfRJd65sFpBszbd2k/bQ8cs8eWawQKAabkVg==" - }, - "Microsoft.SourceLink.GitHub": { - "type": "Transitive", - "resolved": "1.1.1", - "contentHash": "IaJGnOv/M7UQjRJks7B6p7pbPnOwisYGOIzqCz5ilGFTApZ3ktOR+6zJ12ZRPInulBmdAf1SrGdDG2MU8g6XTw==", - "dependencies": { - "Microsoft.Build.Tasks.Git": "1.1.1", - "Microsoft.SourceLink.Common": "1.1.1" - } - }, - "Microsoft.Web.WebView2": { - "type": "Transitive", - "resolved": "1.0.3405.78", - "contentHash": "ceiIKuPHnzOf5CUv9nGpIBx0CWCCMWcBdv05QuonmUnpPtm6XDyAh6osgvin7MTpVD5O0+NbS5ts/WU9sgXgvA==" - }, - "Microsoft.Windows.SDK.BuildTools": { - "type": "Transitive", - "resolved": "10.0.26100.4654", - "contentHash": "2mgcOlj/t2RfSyyw+pVESfO+Tk1RkfQzto9Vrq42M1lUQIfQEwbi8QLha9GXWIOj+TFzeHIEJckIoF25mgiM8A==" - }, - "Microsoft.Windows.SDK.BuildTools.MSIX": { - "type": "Transitive", - "resolved": "1.7.20250829.1", - "contentHash": "IMdvRmCIZnBS5GkYnv0po1bcx6U1OF39pqA4TphQ9evDzpCRoSE19/PkDvlUNNrBavTsLIEJgd/TAIFner75ow==" - }, - "Microsoft.WindowsAppSDK": { - "type": "Transitive", - "resolved": "2.0.0-experimental3", - "contentHash": "eP4XWWccngqnwyJVTYbdlVDyUyFW7EintimqOyq3ttk/h4dCwvW0FNTjq6qvnzkmWKiSqoXau/d5Dy27wSAKpg==", - "dependencies": { - "Microsoft.WindowsAppSDK.AI": "[2.0.57-experimental]", - "Microsoft.WindowsAppSDK.Base": "[2.0.0-experimental]", - "Microsoft.WindowsAppSDK.DWrite": "[2.0.0-experimental]", - "Microsoft.WindowsAppSDK.Foundation": "[2.0.8-experimental]", - "Microsoft.WindowsAppSDK.InteractiveExperiences": "[2.0.3-experimental]", - "Microsoft.WindowsAppSDK.ML": "[2.0.44-experimental]", - "Microsoft.WindowsAppSDK.Runtime": "[2.0.0-experimental3]", - "Microsoft.WindowsAppSDK.Widgets": "[2.0.2-experimental]", - "Microsoft.WindowsAppSDK.WinUI": "[2.0.3-experimental]" - } - }, - "Microsoft.WindowsAppSDK.AI": { - "type": "Transitive", - "resolved": "2.0.57-experimental", - "contentHash": "iCDkCyYFnryJjSRAVU3dmOyZaT3wO8COv+gCMImbDiRK6Kx047pYkJalrs/mOK2GbS8GVzgGAh4pOGaavzQmpw==", - "dependencies": { - "Microsoft.WindowsAppSDK.Base": "2.0.0-experimental", - "Microsoft.WindowsAppSDK.Foundation": "2.0.3-experimental" - } - }, - "Microsoft.WindowsAppSDK.Base": { - "type": "Transitive", - "resolved": "2.0.0-experimental", - "contentHash": "xQY42zJd61lTemFhaEl0GQ+YNHIPeeLnF5sM4lhKfOE0fX3aYCPPH5begOcJBhxsorCk90MGLvCq8dy058sBHg==", - "dependencies": { - "Microsoft.Windows.SDK.BuildTools": "10.0.26100.4654", - "Microsoft.Windows.SDK.BuildTools.MSIX": "1.7.20250829.1" - } - }, - "Microsoft.WindowsAppSDK.DWrite": { - "type": "Transitive", - "resolved": "2.0.0-experimental", - "contentHash": "B21j5wUaHab3LbyaOiGXCRlxW+D2Z7hnUZvALenLseEWDPUYyLvClZgXIYJd3s60J3B+CVQOAop9VQiOzRRquw==", - "dependencies": { - "Microsoft.WindowsAppSDK.Base": "2.0.0-experimental" - } - }, - "Microsoft.WindowsAppSDK.Foundation": { - "type": "Transitive", - "resolved": "2.0.8-experimental", - "contentHash": "8z2LKsnccAJ2RaXmLNZb7JLrSsX6Ud2nlL3Rz6YO4i1iFu9zYEuIdxz6cxsc/+ZSC8bGSQR8O/4k8NIY+qeXYA==", - "dependencies": { - "Microsoft.WindowsAppSDK.Base": "2.0.0-experimental", - "Microsoft.WindowsAppSDK.InteractiveExperiences": "2.0.3-experimental" - } - }, - "Microsoft.WindowsAppSDK.InteractiveExperiences": { - "type": "Transitive", - "resolved": "2.0.3-experimental", - "contentHash": "Ck3QUVmo/KIKYK9Fo5YzL8eoUbjkRoBkGJdTQbcXVI61CFoxkwypnNckoyWyM6PfzS8KoxasHJbI8YSt+DNgfw==", - "dependencies": { - "Microsoft.WindowsAppSDK.Base": "2.0.0-experimental" - } - }, - "Microsoft.WindowsAppSDK.ML": { - "type": "Transitive", - "resolved": "2.0.44-experimental", - "contentHash": "cnPfVfMfOhbVobG417zJVbWLA0P5QZHqrMBEDndQNOcgpUEtKJNY2mC+n3+SLr14P1mKPpzPP9vm/O9APsq4bw==", - "dependencies": { - "Microsoft.WindowsAppSDK.Base": "2.0.0-experimental", - "Microsoft.WindowsAppSDK.Foundation": "2.0.8-experimental" - } - }, - "Microsoft.WindowsAppSDK.Runtime": { - "type": "Transitive", - "resolved": "2.0.0-experimental3", - "contentHash": "ikNSjK07rUFBWdYwkM/2sSQzxieYgRwVDSM7PJxMxIkSGSeAeba8jmDST05oJfDWtXOpNqfn4CTeaZ/6y8yfNw==", - "dependencies": { - "Microsoft.WindowsAppSDK.Base": "2.0.0-experimental" - } - }, - "Microsoft.WindowsAppSDK.Widgets": { - "type": "Transitive", - "resolved": "2.0.2-experimental", - "contentHash": "+Trk3vVSlWxBWomjpUjwy5aOowkLHr2m7o7pVn58a03O2e46joBM3WdIGon/ns+BMKPow7knCS6ne6OBWGlVZg==", - "dependencies": { - "Microsoft.WindowsAppSDK.Base": "2.0.0-experimental" - } - }, - "Microsoft.WindowsAppSDK.WinUI": { - "type": "Transitive", - "resolved": "2.0.3-experimental", - "contentHash": "OuvJXiPEOqBRlai79qi8f35JK/MfvsaIBGoIMNOA5pZznigPezR1XHjwrF1lWMDR3WwJV9Q/rnKWcWfXYw24/Q==", - "dependencies": { - "Microsoft.Web.WebView2": "1.0.3405.78", - "Microsoft.WindowsAppSDK.Base": "2.0.0-experimental", - "Microsoft.WindowsAppSDK.Foundation": "2.0.8-experimental", - "Microsoft.WindowsAppSDK.InteractiveExperiences": "2.0.3-experimental" - } - }, - "ReactNative.V8Jsi.Windows": { - "type": "Transitive", - "resolved": "0.71.8", - "contentHash": "ksHjshj05AMAQ/v7Wet5Dwcwn9Up2BTOIrTv1yEW7+D23FQX0yILW5Zw0bmlWtV8MEtdY611z+06U3Xvu2ygSA==" - }, - "common": { - "type": "Project", - "dependencies": { - "boost": "[1.84.0, )" - } - }, - "react.windows.desktop": { - "type": "Project", - "dependencies": { - "Common": "[1.0.0, )", - "Microsoft.JavaScript.Hermes": "[0.0.0-2604.21001-94aa5e1d, )", - "Microsoft.SourceLink.GitHub": "[1.1.1, )", - "Microsoft.WindowsAppSDK": "[2.0.0-experimental3, )", - "ReactCommon": "[1.0.0, )", - "ReactNative.V8Jsi.Windows": "[0.71.8, )", - "boost": "[1.84.0, )" - } - }, - "react.windows.desktop.dll": { - "type": "Project", - "dependencies": { - "Microsoft.JavaScript.Hermes": "[0.0.0-2604.21001-94aa5e1d, )", - "Microsoft.SourceLink.GitHub": "[1.1.1, )", - "React.Windows.Desktop": "[1.0.0, )", - "ReactNative.V8Jsi.Windows": "[0.71.8, )", - "boost": "[1.84.0, )" - } - }, - "reactcommon": { - "type": "Project", - "dependencies": { - "boost": "[1.84.0, )" - } - } - }, - "native,Version=v0.0/win": { - "Microsoft.Web.WebView2": { - "type": "Transitive", - "resolved": "1.0.3405.78", - "contentHash": "ceiIKuPHnzOf5CUv9nGpIBx0CWCCMWcBdv05QuonmUnpPtm6XDyAh6osgvin7MTpVD5O0+NbS5ts/WU9sgXgvA==" - }, - "Microsoft.WindowsAppSDK.Foundation": { - "type": "Transitive", - "resolved": "2.0.8-experimental", - "contentHash": "8z2LKsnccAJ2RaXmLNZb7JLrSsX6Ud2nlL3Rz6YO4i1iFu9zYEuIdxz6cxsc/+ZSC8bGSQR8O/4k8NIY+qeXYA==", - "dependencies": { - "Microsoft.WindowsAppSDK.Base": "2.0.0-experimental", - "Microsoft.WindowsAppSDK.InteractiveExperiences": "2.0.3-experimental" - } - } - }, - "native,Version=v0.0/win-arm64": { - "Microsoft.Web.WebView2": { - "type": "Transitive", - "resolved": "1.0.3405.78", - "contentHash": "ceiIKuPHnzOf5CUv9nGpIBx0CWCCMWcBdv05QuonmUnpPtm6XDyAh6osgvin7MTpVD5O0+NbS5ts/WU9sgXgvA==" - }, - "Microsoft.WindowsAppSDK.Foundation": { - "type": "Transitive", - "resolved": "2.0.8-experimental", - "contentHash": "8z2LKsnccAJ2RaXmLNZb7JLrSsX6Ud2nlL3Rz6YO4i1iFu9zYEuIdxz6cxsc/+ZSC8bGSQR8O/4k8NIY+qeXYA==", - "dependencies": { - "Microsoft.WindowsAppSDK.Base": "2.0.0-experimental", - "Microsoft.WindowsAppSDK.InteractiveExperiences": "2.0.3-experimental" - } - } - }, - "native,Version=v0.0/win-x64": { - "Microsoft.Web.WebView2": { - "type": "Transitive", - "resolved": "1.0.3405.78", - "contentHash": "ceiIKuPHnzOf5CUv9nGpIBx0CWCCMWcBdv05QuonmUnpPtm6XDyAh6osgvin7MTpVD5O0+NbS5ts/WU9sgXgvA==" - }, - "Microsoft.WindowsAppSDK.Foundation": { - "type": "Transitive", - "resolved": "2.0.8-experimental", - "contentHash": "8z2LKsnccAJ2RaXmLNZb7JLrSsX6Ud2nlL3Rz6YO4i1iFu9zYEuIdxz6cxsc/+ZSC8bGSQR8O/4k8NIY+qeXYA==", - "dependencies": { - "Microsoft.WindowsAppSDK.Base": "2.0.0-experimental", - "Microsoft.WindowsAppSDK.InteractiveExperiences": "2.0.3-experimental" - } - } - }, - "native,Version=v0.0/win-x86": { - "Microsoft.Web.WebView2": { - "type": "Transitive", - "resolved": "1.0.3405.78", - "contentHash": "ceiIKuPHnzOf5CUv9nGpIBx0CWCCMWcBdv05QuonmUnpPtm6XDyAh6osgvin7MTpVD5O0+NbS5ts/WU9sgXgvA==" - }, - "Microsoft.WindowsAppSDK.Foundation": { - "type": "Transitive", - "resolved": "2.0.8-experimental", - "contentHash": "8z2LKsnccAJ2RaXmLNZb7JLrSsX6Ud2nlL3Rz6YO4i1iFu9zYEuIdxz6cxsc/+ZSC8bGSQR8O/4k8NIY+qeXYA==", - "dependencies": { - "Microsoft.WindowsAppSDK.Base": "2.0.0-experimental", - "Microsoft.WindowsAppSDK.InteractiveExperiences": "2.0.3-experimental" - } - } - } - } -} \ No newline at end of file diff --git a/vnext/Desktop.ABITests/packages.lock.json b/vnext/Desktop.ABITests/packages.lock.json deleted file mode 100644 index 2ed1b59f6a6..00000000000 --- a/vnext/Desktop.ABITests/packages.lock.json +++ /dev/null @@ -1,261 +0,0 @@ -{ - "version": 1, - "dependencies": { - "native,Version=v0.0": { - "Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn": { - "type": "Direct", - "requested": "[1.8.1.7, )", - "resolved": "1.8.1.7", - "contentHash": "FxNwT4YpsGdqforqFSTGc5f/e+qfRJ+1wf5G1w0nEEkT5pr5M95E5+fOuswpPUGXPZIXM+M7BSVGnCRcQZjomA==" - }, - "Microsoft.Windows.CppWinRT": { - "type": "Direct", - "requested": "[2.0.230706.1, )", - "resolved": "2.0.230706.1", - "contentHash": "l0D7oCw/5X+xIKHqZTi62TtV+1qeSz7KVluNFdrJ9hXsst4ghvqQ/Yhura7JqRdZWBXAuDS0G0KwALptdoxweQ==" - }, - "boost": { - "type": "Transitive", - "resolved": "1.84.0", - "contentHash": "4el2YP3cNJDVFPdzOso+LxGvdWP2rHxML4siq8VdonNypW2m4q503tHfCj6vK0L1UfxioE2hpFGb4ITEua73tg==" - }, - "Microsoft.Build.Tasks.Git": { - "type": "Transitive", - "resolved": "1.1.1", - "contentHash": "AT3HlgTjsqHnWpBHSNeR0KxbLZD7bztlZVj7I8vgeYG9SYqbeFGh0TM/KVtC6fg53nrWHl3VfZFvb5BiQFcY6Q==" - }, - "Microsoft.JavaScript.Hermes": { - "type": "Transitive", - "resolved": "0.0.0-2604.21001-94aa5e1d", - "contentHash": "8eHA3O043jIeK7E1gJbzgsdujaDTIBwLSl6pZj7CdQl+ryFqaW88XVU9ogWJPxk5lR2T4cU/OlEJfZynqoyYew==" - }, - "Microsoft.SourceLink.Common": { - "type": "Transitive", - "resolved": "1.1.1", - "contentHash": "WMcGpWKrmJmzrNeuaEb23bEMnbtR/vLmvZtkAP5qWu7vQsY59GqfRJd65sFpBszbd2k/bQ8cs8eWawQKAabkVg==" - }, - "Microsoft.SourceLink.GitHub": { - "type": "Transitive", - "resolved": "1.1.1", - "contentHash": "IaJGnOv/M7UQjRJks7B6p7pbPnOwisYGOIzqCz5ilGFTApZ3ktOR+6zJ12ZRPInulBmdAf1SrGdDG2MU8g6XTw==", - "dependencies": { - "Microsoft.Build.Tasks.Git": "1.1.1", - "Microsoft.SourceLink.Common": "1.1.1" - } - }, - "Microsoft.Web.WebView2": { - "type": "Transitive", - "resolved": "1.0.3179.45", - "contentHash": "3pokSH5CnN0G6rGhGFo1y87inxYhNxBQ2Vdf0wlvBj99KHxQJormjDACmqRnFeUsmuNFIhWwfAL1ztq7wD5qRA==" - }, - "Microsoft.Windows.SDK.BuildTools": { - "type": "Transitive", - "resolved": "10.0.26100.4654", - "contentHash": "2mgcOlj/t2RfSyyw+pVESfO+Tk1RkfQzto9Vrq42M1lUQIfQEwbi8QLha9GXWIOj+TFzeHIEJckIoF25mgiM8A==" - }, - "Microsoft.Windows.SDK.BuildTools.MSIX": { - "type": "Transitive", - "resolved": "1.7.20250829.1", - "contentHash": "IMdvRmCIZnBS5GkYnv0po1bcx6U1OF39pqA4TphQ9evDzpCRoSE19/PkDvlUNNrBavTsLIEJgd/TAIFner75ow==" - }, - "Microsoft.WindowsAppSDK": { - "type": "Transitive", - "resolved": "1.8.260209005", - "contentHash": "AGHOiZcrDrpaxpHfEFKlI8MVnibfbSixI5DlbU6ozP/9dyWN5FkTFowg+dEOnaFRCnOzTSAjBQ1HuS4lAO+aMQ==", - "dependencies": { - "Microsoft.WindowsAppSDK.AI": "[1.8.47]", - "Microsoft.WindowsAppSDK.Base": "[1.8.251216001]", - "Microsoft.WindowsAppSDK.DWrite": "[1.8.25122902]", - "Microsoft.WindowsAppSDK.Foundation": "[1.8.260203002]", - "Microsoft.WindowsAppSDK.InteractiveExperiences": "[1.8.260125001]", - "Microsoft.WindowsAppSDK.ML": "[1.8.2124]", - "Microsoft.WindowsAppSDK.Runtime": "[1.8.260209005]", - "Microsoft.WindowsAppSDK.Widgets": "[1.8.251231004]", - "Microsoft.WindowsAppSDK.WinUI": "[1.8.260204000]" - } - }, - "Microsoft.WindowsAppSDK.AI": { - "type": "Transitive", - "resolved": "1.8.47", - "contentHash": "9il8KT8WR4T826hnm3M/USZTkPtVXFGE0IztmE1l7H9DPYsa3QHEUgGHFHQg88fsMjdr3vhyMvs23AB+1IYF1w==", - "dependencies": { - "Microsoft.WindowsAppSDK.Base": "1.8.251216001", - "Microsoft.WindowsAppSDK.Foundation": "1.8.260126001" - } - }, - "Microsoft.WindowsAppSDK.Base": { - "type": "Transitive", - "resolved": "1.8.251216001", - "contentHash": "PS1wriuFknz3W2F2P/e6RvOTM35w89Lsj/f0QmUEPrJjKnc+jM0JLX1vfdytI14y1gNRUTm9uclwP0aH/SVU5w==", - "dependencies": { - "Microsoft.Windows.SDK.BuildTools": "10.0.26100.4654", - "Microsoft.Windows.SDK.BuildTools.MSIX": "1.7.20250829.1" - } - }, - "Microsoft.WindowsAppSDK.DWrite": { - "type": "Transitive", - "resolved": "1.8.25122902", - "contentHash": "zFNn07i7Cyz62Y8FnPQAyzeZK7ww3m9t42i9pzy4C04pNbyUDQ4fG7pB6VSh6n4EyFuYtuFQuDzt4mKmXFrkrg==", - "dependencies": { - "Microsoft.WindowsAppSDK.Base": "1.8.251216001" - } - }, - "Microsoft.WindowsAppSDK.Foundation": { - "type": "Transitive", - "resolved": "1.8.260203002", - "contentHash": "eKQ/prWq98mW7+E+ffot47iZNbDnq/NVN9R9Gi8vmoU/3Ka6zNNivxdICXh6j7g6REFPCV9530/nQYQC0L3fwg==", - "dependencies": { - "Microsoft.WindowsAppSDK.Base": "1.8.251216001", - "Microsoft.WindowsAppSDK.InteractiveExperiences": "1.8.260125001" - } - }, - "Microsoft.WindowsAppSDK.InteractiveExperiences": { - "type": "Transitive", - "resolved": "1.8.260125001", - "contentHash": "CTGFd1zhIDbnOltZ6piPvpNXFR1OaNyW3vHvhaILzpGziAgj5DPuVnU3PUp1p5iOBd382FLCBVM6nEPyu/LCOA==", - "dependencies": { - "Microsoft.WindowsAppSDK.Base": "1.8.251216001" - } - }, - "Microsoft.WindowsAppSDK.ML": { - "type": "Transitive", - "resolved": "1.8.2124", - "contentHash": "l7ZptLbvOWHEJgxZtCQhUzDNCakNcqSJyAa7DNXBLKxGIUMDqq9LnWyYRZZFNQwN7hRfDAR8fEAblP1UHYHGgw==", - "dependencies": { - "Microsoft.WindowsAppSDK.Base": "1.8.251216001", - "Microsoft.WindowsAppSDK.Foundation": "1.8.260126001" - } - }, - "Microsoft.WindowsAppSDK.Runtime": { - "type": "Transitive", - "resolved": "1.8.260209005", - "contentHash": "aZjMu/glUGjzACowzzhj9drn/Ddfp1yA+f7CFXpkiSk6iZ2x32vhKfcqT64RpJ6R+Dj1hl9/79aXFhIavYNj9g==", - "dependencies": { - "Microsoft.WindowsAppSDK.Base": "1.8.251216001" - } - }, - "Microsoft.WindowsAppSDK.Widgets": { - "type": "Transitive", - "resolved": "1.8.251231004", - "contentHash": "bIWqQYR8DCoB1SoPOMil5AtgtkTn438wJTdpsHgyO/6o7Eh7PMP5BzrR0KbDsFqy+4LhPWQ4vtwko5k93fECcA==", - "dependencies": { - "Microsoft.WindowsAppSDK.Base": "1.8.251216001" - } - }, - "Microsoft.WindowsAppSDK.WinUI": { - "type": "Transitive", - "resolved": "1.8.260204000", - "contentHash": "DSpA01+iPXwky4O1uZCrdClSi2aRIYTIhmsTeC1EsJmWBFpSirwNAg4EGHejijV6u4ZVkTdyv3px0Y2P3fp72Q==", - "dependencies": { - "Microsoft.Web.WebView2": "1.0.3179.45", - "Microsoft.WindowsAppSDK.Base": "1.8.251216001", - "Microsoft.WindowsAppSDK.Foundation": "1.8.260203002", - "Microsoft.WindowsAppSDK.InteractiveExperiences": "1.8.260125001" - } - }, - "ReactNative.V8Jsi.Windows": { - "type": "Transitive", - "resolved": "0.71.8", - "contentHash": "ksHjshj05AMAQ/v7Wet5Dwcwn9Up2BTOIrTv1yEW7+D23FQX0yILW5Zw0bmlWtV8MEtdY611z+06U3Xvu2ygSA==" - }, - "common": { - "type": "Project", - "dependencies": { - "boost": "[1.84.0, )" - } - }, - "react.windows.desktop": { - "type": "Project", - "dependencies": { - "Common": "[1.0.0, )", - "Microsoft.JavaScript.Hermes": "[0.0.0-2604.21001-94aa5e1d, )", - "Microsoft.SourceLink.GitHub": "[1.1.1, )", - "Microsoft.WindowsAppSDK": "[1.8.260209005, )", - "ReactCommon": "[1.0.0, )", - "ReactNative.V8Jsi.Windows": "[0.71.8, )", - "boost": "[1.84.0, )" - } - }, - "react.windows.desktop.dll": { - "type": "Project", - "dependencies": { - "Microsoft.JavaScript.Hermes": "[0.0.0-2604.21001-94aa5e1d, )", - "Microsoft.SourceLink.GitHub": "[1.1.1, )", - "React.Windows.Desktop": "[1.0.0, )", - "ReactNative.V8Jsi.Windows": "[0.71.8, )", - "boost": "[1.84.0, )" - } - }, - "reactcommon": { - "type": "Project", - "dependencies": { - "boost": "[1.84.0, )" - } - } - }, - "native,Version=v0.0/win": { - "Microsoft.Web.WebView2": { - "type": "Transitive", - "resolved": "1.0.3179.45", - "contentHash": "3pokSH5CnN0G6rGhGFo1y87inxYhNxBQ2Vdf0wlvBj99KHxQJormjDACmqRnFeUsmuNFIhWwfAL1ztq7wD5qRA==" - }, - "Microsoft.WindowsAppSDK.Foundation": { - "type": "Transitive", - "resolved": "1.8.260203002", - "contentHash": "eKQ/prWq98mW7+E+ffot47iZNbDnq/NVN9R9Gi8vmoU/3Ka6zNNivxdICXh6j7g6REFPCV9530/nQYQC0L3fwg==", - "dependencies": { - "Microsoft.WindowsAppSDK.Base": "1.8.251216001", - "Microsoft.WindowsAppSDK.InteractiveExperiences": "1.8.260125001" - } - } - }, - "native,Version=v0.0/win-arm64": { - "Microsoft.Web.WebView2": { - "type": "Transitive", - "resolved": "1.0.3179.45", - "contentHash": "3pokSH5CnN0G6rGhGFo1y87inxYhNxBQ2Vdf0wlvBj99KHxQJormjDACmqRnFeUsmuNFIhWwfAL1ztq7wD5qRA==" - }, - "Microsoft.WindowsAppSDK.Foundation": { - "type": "Transitive", - "resolved": "1.8.260203002", - "contentHash": "eKQ/prWq98mW7+E+ffot47iZNbDnq/NVN9R9Gi8vmoU/3Ka6zNNivxdICXh6j7g6REFPCV9530/nQYQC0L3fwg==", - "dependencies": { - "Microsoft.WindowsAppSDK.Base": "1.8.251216001", - "Microsoft.WindowsAppSDK.InteractiveExperiences": "1.8.260125001" - } - } - }, - "native,Version=v0.0/win-x64": { - "Microsoft.Web.WebView2": { - "type": "Transitive", - "resolved": "1.0.3179.45", - "contentHash": "3pokSH5CnN0G6rGhGFo1y87inxYhNxBQ2Vdf0wlvBj99KHxQJormjDACmqRnFeUsmuNFIhWwfAL1ztq7wD5qRA==" - }, - "Microsoft.WindowsAppSDK.Foundation": { - "type": "Transitive", - "resolved": "1.8.260203002", - "contentHash": "eKQ/prWq98mW7+E+ffot47iZNbDnq/NVN9R9Gi8vmoU/3Ka6zNNivxdICXh6j7g6REFPCV9530/nQYQC0L3fwg==", - "dependencies": { - "Microsoft.WindowsAppSDK.Base": "1.8.251216001", - "Microsoft.WindowsAppSDK.InteractiveExperiences": "1.8.260125001" - } - } - }, - "native,Version=v0.0/win-x86": { - "Microsoft.Web.WebView2": { - "type": "Transitive", - "resolved": "1.0.3179.45", - "contentHash": "3pokSH5CnN0G6rGhGFo1y87inxYhNxBQ2Vdf0wlvBj99KHxQJormjDACmqRnFeUsmuNFIhWwfAL1ztq7wD5qRA==" - }, - "Microsoft.WindowsAppSDK.Foundation": { - "type": "Transitive", - "resolved": "1.8.260203002", - "contentHash": "eKQ/prWq98mW7+E+ffot47iZNbDnq/NVN9R9Gi8vmoU/3Ka6zNNivxdICXh6j7g6REFPCV9530/nQYQC0L3fwg==", - "dependencies": { - "Microsoft.WindowsAppSDK.Base": "1.8.251216001", - "Microsoft.WindowsAppSDK.InteractiveExperiences": "1.8.260125001" - } - } - } - } -} \ No newline at end of file diff --git a/vnext/Desktop.ABITests/pch.cpp b/vnext/Desktop.ABITests/pch.cpp deleted file mode 100644 index c084a84a60a..00000000000 --- a/vnext/Desktop.ABITests/pch.cpp +++ /dev/null @@ -1,4 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -#include "pch.h" diff --git a/vnext/Desktop.ABITests/pch.h b/vnext/Desktop.ABITests/pch.h deleted file mode 100644 index 28c56bba772..00000000000 --- a/vnext/Desktop.ABITests/pch.h +++ /dev/null @@ -1,9 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -#pragma once - -#define NOMINMAX - -#include -#include diff --git a/vnext/Desktop.IntegrationTests/React.Windows.Desktop.IntegrationTests.vcxproj b/vnext/Desktop.IntegrationTests/React.Windows.Desktop.IntegrationTests.vcxproj index 69d10e47a67..2395ccaf386 100644 --- a/vnext/Desktop.IntegrationTests/React.Windows.Desktop.IntegrationTests.vcxproj +++ b/vnext/Desktop.IntegrationTests/React.Windows.Desktop.IntegrationTests.vcxproj @@ -33,8 +33,6 @@ win32 true - - true true win32 @@ -66,12 +64,9 @@ true BOOST_ASIO_HAS_IOCP; - CORE_ABI; _WIN32_WINNT=$(WinVer); WIN32; _WINDOWS; @@ -179,12 +174,6 @@ 'GetTargetFileName' MSBuild task in the 'GetRNDllPath' target below (and potentially share build logic with it). --> - - $(OutputPath)..\React.Windows.Desktop\facebook.react.winmd - - - $(OutputPath)..\React.Windows.Desktop\Microsoft.Internal.winmd - $(OutputPath)..\React.Windows.Desktop\Microsoft.ReactNative.winmd diff --git a/vnext/Desktop.UnitTests/React.Windows.Desktop.UnitTests.vcxproj b/vnext/Desktop.UnitTests/React.Windows.Desktop.UnitTests.vcxproj index 83eb2840d0a..eb085127144 100644 --- a/vnext/Desktop.UnitTests/React.Windows.Desktop.UnitTests.vcxproj +++ b/vnext/Desktop.UnitTests/React.Windows.Desktop.UnitTests.vcxproj @@ -93,10 +93,6 @@ - - - - @@ -129,11 +125,13 @@ + diff --git a/vnext/Desktop.UnitTests/UtilsTest.cpp b/vnext/Desktop.UnitTests/UtilsTest.cpp index 76ae83f5098..96ae82f5034 100644 --- a/vnext/Desktop.UnitTests/UtilsTest.cpp +++ b/vnext/Desktop.UnitTests/UtilsTest.cpp @@ -15,154 +15,11 @@ using std::string_view; namespace Microsoft::React::Test { -// We turn clang format off here because it does not work with some of the -// test macros. -// clang-format off - -TEST_CLASS(UtilsTest) -{ - - void ExpectUrl( - string urlString, - string protocol, - string host, - string port = "", - string path = "/", - string query = "") - { - - Url url(std::move(urlString)); - - Assert::AreEqual(protocol, url.scheme); - Assert::AreEqual(host, url.host); - Assert::AreEqual(port, url.port); - Assert::AreEqual(path, url.path); - Assert::AreEqual(query, url.queryString); - } - -#pragma region Url Tests - - TEST_METHOD(UtilsTest_ValidProtocols) - { - string protocols[4] { "http", "https", "ws", "wss" }; - for (auto protocol : protocols) - { - ExpectUrl(string(protocol + "://internal"), protocol, "internal"); - } - } - - TEST_METHOD(UtilsTest_IntraHost) - { - ExpectUrl("ws://internal", "ws", "internal"); - } - - TEST_METHOD(UtilsTest_IntraHostTrailing) - { - ExpectUrl("ws://internal/", "ws", "internal"); - } - - TEST_METHOD(UtilsTest_IntraHostQueryLeading) - { - ExpectUrl("ws://internal?", "ws", "internal"); - } - - TEST_METHOD(UtilsTest_IntraHostTrailingQueryLeading) - { - ExpectUrl("ws://internal/?", "ws", "internal"); - } - - TEST_METHOD(UtilsTest_NormalHostQueryLeading) - { - ExpectUrl("ws://example.com?", "ws", "example.com"); - } - - TEST_METHOD(UtilsTest_IntraPort) - { - ExpectUrl("ws://internal:5000", "ws", "internal", "5000"); - } - - TEST_METHOD(UtilsTest_NormalPort) - { - ExpectUrl("ws://example.com:443", "ws", "example.com", "443"); - } - - TEST_METHOD(UtilsTest_PortPath) - { - ExpectUrl("ws://example.com:5000/ws", "ws", "example.com", "5000", "/ws"); - } - - TEST_METHOD(UtilsTest_Query) - { - ExpectUrl( - "ws://example.com?a=1&b=2", "ws", "example.com", "", "/", "a=1&b=2"); - } - - TEST_METHOD(UtilsTest_TrailingPathQuery) - { - ExpectUrl( - "ws://example.com/?a=1&b=2", "ws", "example.com", "", "/", "a=1&b=2"); - } - - TEST_METHOD(UtilsTest_HyphenHostInternal) - { - ExpectUrl("wss://-my-hyphened-host--", "wss", "-my-hyphened-host--"); - } - - TEST_METHOD(UtilsTest_NestedPathTrailingSlashLeadingQuestionMark) - { - ExpectUrl( - "ws://example.com/the/nested/path/?", - "ws", - "example.com", - "", - "/the/nested/path/"); - } - - TEST_METHOD(UtilsTest_NestedSubdomain) - { - ExpectUrl( - "ws://nested.sub.domain.of.example.com", - "ws", - "nested.sub.domain.of.example.com"); - } - -#pragma region Url Negative Tests - - TEST_METHOD(UtilsTest_EmptyStringFails) - { - Assert::ExpectException([]() - { - Url(""); - }); - } - - TEST_METHOD(UtilsTest_WrongProtocol) - { - Assert::ExpectException([]() - { - Url("foos://internal"); - }); - } - - TEST_METHOD(UtilsTest_BadCharsInPort) - { - Assert::ExpectException([]() - { - Url("ws://internal:50O0"); - }); - } - - TEST_METHOD(UtilsTest_SpacesInProtocol) - { - Assert::ExpectException([]() - { - Url(" ws://internal"); - }); - } - -#pragma endregion - -#pragma endregion +TEST_CLASS (UtilsTest) { + public: + // We turn clang format off here because it does not work with some of the + // test macros. + // clang-format off #pragma region Base64 Tests diff --git a/vnext/Desktop/ABI/MessageQueue.idl b/vnext/Desktop/ABI/MessageQueue.idl deleted file mode 100644 index a7e8e806c1c..00000000000 --- a/vnext/Desktop/ABI/MessageQueue.idl +++ /dev/null @@ -1,16 +0,0 @@ -namespace facebook.react { - -// ABI_REVIEW: -// representing -// std::function -// arguments to MessageQueueThread::runOnQueue(), MessageQueueThread::runOnQueueSync() methods. -delegate void QueueItem(); - -interface IMessageQueue -{ - void Run(QueueItem item); - void RunSync(QueueItem item); - void QuitSync(); -}; - -} diff --git a/vnext/Desktop/ABI/MessageQueueShim.cpp b/vnext/Desktop/ABI/MessageQueueShim.cpp deleted file mode 100644 index 02230e05db8..00000000000 --- a/vnext/Desktop/ABI/MessageQueueShim.cpp +++ /dev/null @@ -1,22 +0,0 @@ -#include "pch.h" - -#include "MessageQueueShim.h" - -namespace facebook::react { - -MessageQueueShim::MessageQueueShim(const ::winrt::facebook::react::IMessageQueue &abiMessageQueue) - : m_abiMessageQueue{abiMessageQueue} {} - -void MessageQueueShim::runOnQueue(std::function &&item) { - m_abiMessageQueue.Run(std::move(item)); -} - -void MessageQueueShim::runOnQueueSync(std::function &&item) { - m_abiMessageQueue.RunSync(std::move(item)); -} - -void MessageQueueShim::quitSynchronous() { - m_abiMessageQueue.QuitSync(); -} - -} // namespace facebook::react diff --git a/vnext/Desktop/ABI/MessageQueueShim.h b/vnext/Desktop/ABI/MessageQueueShim.h deleted file mode 100644 index 0f1166f80e9..00000000000 --- a/vnext/Desktop/ABI/MessageQueueShim.h +++ /dev/null @@ -1,17 +0,0 @@ -#pragma once - -#include -#include - -namespace facebook::react { -class MessageQueueShim : public facebook::react::MessageQueueThread { - public: - MessageQueueShim(const ::winrt::facebook::react::IMessageQueue &abiMessageQueue); - virtual void runOnQueue(std::function &&item) override; - virtual void runOnQueueSync(std::function &&item) override; - virtual void quitSynchronous() override; - - private: - ::winrt::facebook::react::IMessageQueue m_abiMessageQueue; -}; -} // namespace facebook::react diff --git a/vnext/Desktop/ABI/NativeLogEventSource.cpp b/vnext/Desktop/ABI/NativeLogEventSource.cpp deleted file mode 100644 index 2084168c274..00000000000 --- a/vnext/Desktop/ABI/NativeLogEventSource.cpp +++ /dev/null @@ -1,36 +0,0 @@ -#include "pch.h" - -#include "NativeLogEventSource.h" - -#include "facebook.react.NativeLogEventSource.g.cpp" - -#include -#include - -using namespace Microsoft::Common::Unicode; - -namespace winrt::facebook::react::implementation { -namespace { -::winrt::facebook::react::NativeLogHandler g_abiHandler; -std::atomic g_abiHandlerRegistrationCookie = 0; -} // namespace - -uint32_t NativeLogEventSource::InitializeLogging(::winrt::facebook::react::NativeLogHandler const &handler) { - g_abiHandler = handler; - - std::function internalHandler = - [](::facebook::react::RCTLogLevel ll, const char *m) { - assert(g_abiHandler); - g_abiHandler(static_cast(ll), Utf8ToUtf16(m)); - }; - - ::facebook::react::InitializeLogging(std::move(internalHandler)); - - return ++g_abiHandlerRegistrationCookie; -} - -void NativeLogEventSource::UninitializeLogging(uint32_t cookie) { - assert(cookie == g_abiHandlerRegistrationCookie); - g_abiHandler = nullptr; -} -} // namespace winrt::facebook::react::implementation diff --git a/vnext/Desktop/ABI/NativeLogEventSource.h b/vnext/Desktop/ABI/NativeLogEventSource.h deleted file mode 100644 index 83049e09bfc..00000000000 --- a/vnext/Desktop/ABI/NativeLogEventSource.h +++ /dev/null @@ -1,14 +0,0 @@ -#pragma once -#include "facebook.react.NativeLogEventSource.g.h" - -namespace winrt::facebook::react::implementation { -struct NativeLogEventSource { - NativeLogEventSource() = default; - - static uint32_t InitializeLogging(facebook::react::NativeLogHandler const &handler); - static void UninitializeLogging(uint32_t cookie); -}; -} // namespace winrt::facebook::react::implementation -namespace winrt::facebook::react::factory_implementation { -struct NativeLogEventSource : NativeLogEventSourceT {}; -} // namespace winrt::facebook::react::factory_implementation diff --git a/vnext/Desktop/ABI/NativeLogging.idl b/vnext/Desktop/ABI/NativeLogging.idl deleted file mode 100644 index ddba3afa4d8..00000000000 --- a/vnext/Desktop/ABI/NativeLogging.idl +++ /dev/null @@ -1,50 +0,0 @@ -// ABI_REVIEW: -// Questions: -// - Should we approximate the existing API as closely as possible (a) or should we re-design the -// API using IDL/WinRT/COM idioms (b)? Examples for (b) are delegates, property accessors and -// events. (a) might help developers to get started quicker, simplify migration to the new -// ABI and reduce refactoring-related defects. (b) should get us closer to the "final" API and -// might foster programming paradigms that reduce defects. - -// Guidelines: -// - Follow .NET framework naming conventions. - - -// ABI_REVIEW: -// Given this is a new API without usage legacy, should we use the chance to introduce a different -// namespace, e.g. "Microsoft.React"? -namespace facebook.react { - -// ABI_REVIEW: -// representing -// enum class RCTLogLevel { Trace = 0, ... }; -enum LogLevel -{ - Trace = 0, - Info = 1, - Warning = 2, - Error = 3, - Fatal = 4 -}; - -// ABI_REVIEW: -// representing -// using NativeLoggingHook = std::function; -delegate void NativeLogHandler(LogLevel level, String message); - -static runtimeclass NativeLogEventSource -{ - // ABI_REVIEW: - // representing - // void facebook::react::InitializeLogging(NativeLoggingHook&& hook); - static UInt32 InitializeLogging(NativeLogHandler handler); - - // ABI_REVIEW: - // There is no equivalent for this in the existing ABI. I believe we need this method because - // the delegate passed into the 'InitializeLogging' method can capture arbitrary objects and we - // need a way to release those. FWIW, the old-ABI equivalent of the delegate (std::function) can - // already capture things, and absence of a method to unregister it could be problematic. - static void UninitializeLogging(UInt32 token); -}; - -} diff --git a/vnext/Desktop/ABI/TestController.cpp b/vnext/Desktop/ABI/TestController.cpp deleted file mode 100644 index 88e0ffb7716..00000000000 --- a/vnext/Desktop/ABI/TestController.cpp +++ /dev/null @@ -1,147 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -#include "pch.h" - -#include -#include -#include -#include "DynamicReader.h" -#include "DynamicWriter.h" -#include "IReactContext.h" -#include "IReactModuleBuilder.h" -#include "ReactPackageBuilder.h" -#include "RedBoxErrorFrameInfo.h" -#include "RedBoxErrorInfo.h" -#include "TestController.h" - -#include - -#include "Microsoft.Internal.TestController.g.cpp" - -using namespace winrt; -namespace msrn = ::winrt::Microsoft::ReactNative; // helps avoid collisions with 'Microsoft' namespace in unicode.h - -namespace { - -// Extends the 'DynamicReader' class with the ability the manage the lifetime of the folly::dynamic value it's reading -// from. -struct DynamicWrapperReader : public winrt::implements { - DynamicWrapperReader(folly::dynamic &&value) : m_value{std::move(value)} { - m_innerReader = make(m_value); - } - - msrn::JSValueType ValueType() noexcept { - return m_innerReader.ValueType(); - } - - bool GetNextObjectProperty(hstring &propertyName) noexcept { - return m_innerReader.GetNextObjectProperty(propertyName); - } - - bool GetNextArrayItem() noexcept { - return m_innerReader.GetNextArrayItem(); - } - - hstring GetString() noexcept { - return m_innerReader.GetString(); - } - - bool GetBoolean() noexcept { - return m_innerReader.GetBoolean(); - } - - int64_t GetInt64() noexcept { - return m_innerReader.GetInt64(); - } - - double GetDouble() noexcept { - return m_innerReader.GetDouble(); - } - - private: - msrn::IJSValueReader m_innerReader; - folly::dynamic m_value; -}; - -} // namespace - -namespace winrt::Microsoft::Internal::implementation { - -msrn::IJSValueReader TestController::CreateDynamicReader(msrn::IJSValueWriter writer) { - auto dw = writer.as(); - return make(dw->TakeValue()); -} - -msrn::IJSValueWriter TestController::CreateDynamicWriter() { - return make(); -} - -msrn::IReactContext TestController::CreateContext( - const msrn::IReactPropertyBag &propertyBag, - const msrn::IReactNotificationService ¬ificationService) { - auto innerContext = Mso::Make(nullptr, propertyBag, notificationService); - return make(std::move(innerContext)); -} - -msrn::IReactModuleBuilder TestController::CreateReactModuleBuilder(msrn::IReactContext context) { - return make(context); -} - -msrn::IReactPackageBuilder TestController::CreateReactPackageBuilder() { - auto turboModulesProvider = std::make_shared(); - return make( - turboModulesProvider, - std::shared_ptr<::Microsoft::ReactNative::WindowsComponentDescriptorRegistry>{}, - std::shared_ptr{}); -} - -msrn::IRedBoxErrorFrameInfo -TestController::CreateRedBoxErrorFrameInfo(hstring file, hstring method, uint32_t line, uint32_t column) { - Mso::React::ErrorFrameInfo frameInfo{ - /* File */ ::Microsoft::Common::Unicode::Utf16ToUtf8(file), - /* Method */ ::Microsoft::Common::Unicode::Utf16ToUtf8(method), - /* Line */ static_cast(line), - /* Columns */ static_cast(column), - /* Collapse */ false}; - - return make(std::move(frameInfo)); -} - -msrn::IRedBoxErrorInfo TestController::CreateRedBoxErrorInfo( - hstring message, - uint32_t id, - array_view callstack) { - // The repeated value conversion between CreateRedBoxErrorFrameInfo and CreateRedBoxErrorInfo is suboptimal, but - // deemed acceptable because we only need this functionality for ABI testing. - - Mso::React::ErrorInfo errorInfo; - errorInfo.Message = ::Microsoft::Common::Unicode::Utf16ToUtf8(message); - errorInfo.Id = id; - - // leaving the following ErrorInfo members out to avoid an excessive parameter list and because they probably add - // little test value - // - // errorInfo.OriginalMessage - // errorInfo.Name - // errorInfo.ComponentStack - // errorInfo.ExtraData - - for (auto const &frame : callstack) { - Mso::React::ErrorFrameInfo frameInfo{ - /* File */ ::Microsoft::Common::Unicode::Utf16ToUtf8(frame.File()), - /* Method */ ::Microsoft::Common::Unicode::Utf16ToUtf8(frame.Method()), - /* Line */ static_cast(frame.Line()), - /* Columns */ static_cast(frame.Column()), - /* Collapse */ false}; - errorInfo.Callstack.push_back(std::move(frameInfo)); - } - - return make(std::move(errorInfo)); -} - -msrn::IReactNonAbiValue TestController::CreateNonAbiValue(int32_t value) { - return make>(value); -} - -} // namespace winrt::Microsoft::Internal::implementation diff --git a/vnext/Desktop/ABI/TestController.h b/vnext/Desktop/ABI/TestController.h deleted file mode 100644 index bac6b1ff10d..00000000000 --- a/vnext/Desktop/ABI/TestController.h +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -#pragma once -#include "Microsoft.Internal.TestController.g.h" -#include "winrt/Microsoft.ReactNative.h" - -namespace winrt::Microsoft::Internal::implementation { -struct TestController { - TestController() = default; - - static Microsoft::ReactNative::IJSValueReader CreateDynamicReader(Microsoft::ReactNative::IJSValueWriter writer); - static Microsoft::ReactNative::IJSValueWriter CreateDynamicWriter(); - static Microsoft::ReactNative::IReactContext CreateContext( - const Microsoft::ReactNative::IReactPropertyBag &propertyBag, - const Microsoft::ReactNative::IReactNotificationService ¬ificationService); - static Microsoft::ReactNative::IReactModuleBuilder CreateReactModuleBuilder( - Microsoft::ReactNative::IReactContext context); - static Microsoft::ReactNative::IReactPackageBuilder CreateReactPackageBuilder(); - static Microsoft::ReactNative::IRedBoxErrorFrameInfo - CreateRedBoxErrorFrameInfo(hstring file, hstring method, uint32_t line, uint32_t column); - static Microsoft::ReactNative::IRedBoxErrorInfo CreateRedBoxErrorInfo( - hstring message, - uint32_t id, - array_view callstack); - static Microsoft::ReactNative::IReactNonAbiValue CreateNonAbiValue(int32_t value); -}; -} // namespace winrt::Microsoft::Internal::implementation - -namespace winrt::Microsoft::Internal::factory_implementation { -struct TestController : TestControllerT {}; -} // namespace winrt::Microsoft::Internal::factory_implementation diff --git a/vnext/Desktop/ABI/TestController.idl b/vnext/Desktop/ABI/TestController.idl deleted file mode 100644 index e3bd4a00d17..00000000000 --- a/vnext/Desktop/ABI/TestController.idl +++ /dev/null @@ -1,31 +0,0 @@ -import "IJSValueReader.idl"; -import "IJSValueWriter.idl"; -import "IReactContext.idl"; -import "IReactModuleBuilder.idl"; -import "IReactNonAbiValue.idl"; -import "IReactPackageBuilder.idl"; -import "RedBoxHandler.idl"; - -namespace Microsoft.Internal { - - // This class is a development staging artifact owed to the incremental buildup of the C++/WinRT-based ABI of - // the Win32 DLL. It enables testing of "peripheral" components prior to the availability of more "central" components - // (e.g. instance management components). This class should get removed once the peripheral components can get tested - // via the more central components. - static runtimeclass TestController { - static Microsoft.ReactNative.IJSValueReader CreateDynamicReader(Microsoft.ReactNative.IJSValueWriter writer); - static Microsoft.ReactNative.IJSValueWriter CreateDynamicWriter(); - static Microsoft.ReactNative.IReactContext CreateContext( - Microsoft.ReactNative.IReactPropertyBag propertyBag, - Microsoft.ReactNative.IReactNotificationService notificationService); - static Microsoft.ReactNative.IReactModuleBuilder CreateReactModuleBuilder( - Microsoft.ReactNative.IReactContext context); - static Microsoft.ReactNative.IReactPackageBuilder CreateReactPackageBuilder(); - static Microsoft.ReactNative.IRedBoxErrorFrameInfo CreateRedBoxErrorFrameInfo( - String file, String method, UInt32 line, UInt32 column); - static Microsoft.ReactNative.IRedBoxErrorInfo CreateRedBoxErrorInfo( - String message, UInt32 id, Microsoft.ReactNative.IRedBoxErrorFrameInfo[] callstack); - static Microsoft.ReactNative.IReactNonAbiValue CreateNonAbiValue(Int32 value); - }; - -} // namespace Microsoft.Internal diff --git a/vnext/Desktop/CxxReactWin32/JSBigString.cpp b/vnext/Desktop/CxxReactWin32/JSBigString.cpp deleted file mode 100644 index bc117787370..00000000000 --- a/vnext/Desktop/CxxReactWin32/JSBigString.cpp +++ /dev/null @@ -1,48 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -#include "pch.h" - -#include - -namespace facebook { -namespace react { - -// Win 32 code should not use JsBigFileString anywhere, so all member -// functions of JsBigFileString crashes for now. -// -// TODO (VSTS 2129144) We should merge JsBigFileString with -// JsBigFileStringWithExternalBuffer - -JSBigFileString::JSBigFileString(int fd, size_t size, off_t offset /*= 0*/) { - std::terminate(); -} - -#pragma warning(push) -#pragma warning(disable : 4722) // 'function' : destructor never returns, - // potential memory leak - -JSBigFileString::~JSBigFileString() { - std::terminate(); -} - -#pragma warning(pop) - -const char *JSBigFileString::c_str() const { - std::terminate(); -} - -size_t JSBigFileString::size() const { - std::terminate(); -} - -int JSBigFileString::fd() const { - std::terminate(); -} - -std::unique_ptr JSBigFileString::fromPath(const std::string &sourceURL) { - std::terminate(); -} - -} // namespace react -} // namespace facebook diff --git a/vnext/Desktop/React.Windows.Desktop.vcxproj b/vnext/Desktop/React.Windows.Desktop.vcxproj index bd5510a4aba..40406584365 100644 --- a/vnext/Desktop/React.Windows.Desktop.vcxproj +++ b/vnext/Desktop/React.Windows.Desktop.vcxproj @@ -39,19 +39,11 @@ true true -lib $(MSBuildProjectName) - Microsoft.ReactNative true {95048601-C3DC-475F-ADF8-7C0C764C10D5} React.Windows.Desktop - facebook.react + Microsoft.ReactNative en-US 17.0 C++/WinRT @@ -61,12 +53,7 @@ win32 false true - - true - - true - - true + true true @@ -104,14 +91,12 @@ BOOST_ASIO_HAS_IOCP; _WINSOCK_DEPRECATED_NO_WARNINGS; _WIN32_WINNT=$(WinVer); WIN32; - CORE_ABI; _WINDOWS; FOLLY_CFG_NO_COROUTINES; FOLLY_NO_CONFIG; @@ -143,31 +128,10 @@ $(ReactNativeWindowsDir)\Microsoft.ReactNative;$(ReactNativeWindowsDir)\Microsoft.ReactNative.Cxx; - - CORE_ABI;%(PreprocessorDefinitions) - - - - - - - ABI\MessageQueue.idl - $(IntDir)\ABI\ - - - ABI\NativeLogging.idl - $(IntDir)\ABI\ - - - ABI\TestController.idl - - @@ -176,41 +140,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - ABI\MessageQueue.idl - - - ABI\NativeLogging.idl - - - ABI\TestController.idl - ..\Microsoft.ReactNative\IJSValueReader.idl @@ -276,18 +205,4 @@ - - - - <_CppWinRTOriginalRootNamespace>$(RootNamespace) - $(CppWinRTRootNamespace) - - - - - - $(_CppWinRTOriginalRootNamespace) - <_CppWinRTOriginalRootNamespace /> - - \ No newline at end of file diff --git a/vnext/Desktop/React.Windows.Desktop.vcxproj.filters b/vnext/Desktop/React.Windows.Desktop.vcxproj.filters index 6f65cce5ea5..9634940f0a1 100644 --- a/vnext/Desktop/React.Windows.Desktop.vcxproj.filters +++ b/vnext/Desktop/React.Windows.Desktop.vcxproj.filters @@ -33,29 +33,14 @@ - - ABI - ABI - - ABI - - - ABI - - - ABI - ABI - - Source Files\CxxReactWin32 - Source Files @@ -73,12 +58,6 @@ - - ABI - - - ABI - ABI diff --git a/vnext/Desktop/module.g.cpp b/vnext/Desktop/module.g.cpp index e86a37d7065..91a76c2f5fd 100644 --- a/vnext/Desktop/module.g.cpp +++ b/vnext/Desktop/module.g.cpp @@ -5,7 +5,6 @@ #include "pch.h" #include "winrt/base.h" -void* winrt_make_Microsoft_Internal_TestController(); void* winrt_make_Microsoft_ReactNative_Color(); void* winrt_make_Microsoft_ReactNative_ReactNativeIsland(); void *winrt_make_Microsoft_ReactNative_Composition_ImageFailedResponse(); @@ -25,7 +24,6 @@ void* winrt_make_Microsoft_ReactNative_ReactPropertyBagHelper(); void* winrt_make_Microsoft_ReactNative_ReactViewOptions(); void* winrt_make_Microsoft_ReactNative_RedBoxHelper(); void* winrt_make_Microsoft_ReactNative_QuirkSettings(); -void* winrt_make_facebook_react_NativeLogEventSource(); bool __stdcall winrt_can_unload_now() noexcept { @@ -45,10 +43,6 @@ void* __stdcall winrt_get_activation_factory([[maybe_unused]] std::wstring_view return std::equal(left.rbegin(), left.rend(), right.rbegin(), right.rend()); }; - if (requal(name, L"Microsoft.Internal.TestController")) - { - return winrt_make_Microsoft_Internal_TestController(); - } if (requal(name, L"Microsoft.ReactNative.Color")) { return winrt_make_Microsoft_ReactNative_Color(); } @@ -126,12 +120,6 @@ void* __stdcall winrt_get_activation_factory([[maybe_unused]] std::wstring_view return winrt_make_Microsoft_ReactNative_QuirkSettings(); } - if (requal(name, L"facebook.react.NativeLogEventSource")) - { - return winrt_make_facebook_react_NativeLogEventSource(); - } - - return nullptr; } diff --git a/vnext/Microsoft.ReactNative.Cxx/CppWinRTIncludes.h b/vnext/Microsoft.ReactNative.Cxx/CppWinRTIncludes.h index 965ffe890ee..aa566ae280d 100644 --- a/vnext/Microsoft.ReactNative.Cxx/CppWinRTIncludes.h +++ b/vnext/Microsoft.ReactNative.Cxx/CppWinRTIncludes.h @@ -2,14 +2,11 @@ // Licensed under the MIT License. #pragma once -#include "NamespaceRedirect.h" - #include #include #include -#define XAML_CPPWINRT_NAMESPACE winrt::Microsoft::UI::Xaml namespace xaml = winrt::Microsoft::UI::Xaml; namespace comp = winrt::Microsoft::UI::Composition; namespace ui = winrt::Microsoft::UI; @@ -28,7 +25,3 @@ using namespace Windows::UI::Core; using namespace Windows::Foundation; using namespace Windows::Foundation::Collections; } // namespace winrt - -#define _QUOTE(x) L#x -#define QUOTE(x) _QUOTE(x) -#define XAML_NAMESPACE_STR QUOTE(XAML_NAMESPACE) diff --git a/vnext/Microsoft.ReactNative.Cxx/DesktopWindowBridge.h b/vnext/Microsoft.ReactNative.Cxx/DesktopWindowBridge.h index fe37c1bba0d..881093f8bd2 100644 --- a/vnext/Microsoft.ReactNative.Cxx/DesktopWindowBridge.h +++ b/vnext/Microsoft.ReactNative.Cxx/DesktopWindowBridge.h @@ -8,9 +8,6 @@ #include #include -#if !defined(CORE_ABI) && !defined(__APPLE__) && \ - WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP | WINAPI_PARTITION_SYSTEM | WINAPI_PARTITION_GAMES) - #include #include "CppWinRTIncludes.h" @@ -63,25 +60,6 @@ inline std::unordered_map SubscribeToWi return result; } -#else -namespace winrt::Microsoft::ReactNative { - -/// Stubs for UWP -template -void ForwardWindowMessage(const ReactNotificationService &svc, T &&...) noexcept {} - -template -ReactNotificationSubscription SubscribeToWindowMessage(const ReactNotificationService &svc, T &&...) noexcept { - return nullptr; -} - -template -std::unordered_map -SubscribeToWindowMessage(const ReactNotificationService &svc, std::initializer_list msgs, T &&...) noexcept { - return std::unordered_map{}; -} -#endif - namespace details { struct IndirectLibraryDeleter { void operator()(void *l) { diff --git a/vnext/Microsoft.ReactNative.Cxx/NamespaceRedirect.h b/vnext/Microsoft.ReactNative.Cxx/NamespaceRedirect.h index 73e16b5fb7d..6f70f09beec 100644 --- a/vnext/Microsoft.ReactNative.Cxx/NamespaceRedirect.h +++ b/vnext/Microsoft.ReactNative.Cxx/NamespaceRedirect.h @@ -1,4 +1 @@ #pragma once - -#define XAML_NAMESPACE Microsoft.UI.Xaml -#define COMP_NAMESPACE Microsoft.UI.Composition diff --git a/vnext/Microsoft.ReactNative.Cxx/XamlUtils.h b/vnext/Microsoft.ReactNative.Cxx/XamlUtils.h index abcadca54d7..87410debd58 100644 --- a/vnext/Microsoft.ReactNative.Cxx/XamlUtils.h +++ b/vnext/Microsoft.ReactNative.Cxx/XamlUtils.h @@ -30,12 +30,3 @@ WINRT_IMPL_GetModuleHandleW(_In_opt_ LPCWSTR lpModuleName); #endif WINRT_IMPL_LINK(GetModuleHandleW, 4); #undef WINRT_IMPL_LINK - -namespace XAML_CPPWINRT_NAMESPACE { - -// Using Windows::UI::ColorHelper causes the process to load Windows.UI.Xaml.dll which is not needed just to fill a -// Color struct -inline winrt::Windows::UI::Color FromArgb(uint8_t a, uint8_t r, uint8_t g, uint8_t b) { - return winrt::Windows::UI::Color{a, r, g, b}; -} -} // namespace XAML_CPPWINRT_NAMESPACE diff --git a/vnext/Microsoft.ReactNative.Managed/ReactContext.cs b/vnext/Microsoft.ReactNative.Managed/ReactContext.cs index 97aace98a06..711340efa36 100644 --- a/vnext/Microsoft.ReactNative.Managed/ReactContext.cs +++ b/vnext/Microsoft.ReactNative.Managed/ReactContext.cs @@ -34,15 +34,6 @@ public ReactContext(IReactContext handle) public void DispatchEvent(FrameworkElement view, string eventName, T arg) { - var argWriter = arg as JSValueArgWriter; - if (argWriter != null) - { - XamlUIService.FromContext(Handle).DispatchEvent(view, eventName, argWriter); - } - else - { - XamlUIService.FromContext(Handle).DispatchEvent(view, eventName, (IJSValueWriter writer) => writer.WriteValue(arg)); - } } public void CallJSFunction(string moduleName, string methodName) diff --git a/vnext/Microsoft.ReactNative/Fabric/Composition/CompositionContextHelper_emptyimpl.cpp b/vnext/Microsoft.ReactNative/Fabric/Composition/CompositionContextHelper_emptyimpl.cpp deleted file mode 100644 index 83f36faaef9..00000000000 --- a/vnext/Microsoft.ReactNative/Fabric/Composition/CompositionContextHelper_emptyimpl.cpp +++ /dev/null @@ -1,75 +0,0 @@ - -#include "pch.h" -#include "CompositionContextHelper.h" -#if __has_include("Composition.Experimental.SystemCompositionContextHelper.g.cpp") -#include "Composition.Experimental.SystemCompositionContextHelper.g.cpp" -#endif -#if __has_include("Composition.Experimental.MicrosoftCompositionContextHelper.g.cpp") -#include "Composition.Experimental.MicrosoftCompositionContextHelper.g.cpp" -#endif - -namespace winrt::Microsoft::ReactNative::Composition::Experimental::implementation { - -ICompositionContext SystemCompositionContextHelper::CreateContext( - winrt::Windows::UI::Composition::Compositor const &) noexcept { - return nullptr; -} - -IVisual SystemCompositionContextHelper::CreateVisual(winrt::Windows::UI::Composition::Visual const &) noexcept { - return nullptr; -} - -winrt::Windows::UI::Composition::Compositor SystemCompositionContextHelper::InnerCompositor( - ICompositionContext) noexcept { - return nullptr; -} - -winrt::Windows::UI::Composition::Visual SystemCompositionContextHelper::InnerVisual(IVisual) noexcept { - return nullptr; -} - -winrt::Windows::UI::Composition::DropShadow SystemCompositionContextHelper::InnerDropShadow(IDropShadow) noexcept { - return nullptr; -} - -winrt::Windows::UI::Composition::CompositionBrush SystemCompositionContextHelper::InnerBrush(IBrush) noexcept { - return nullptr; -} - -winrt::Windows::UI::Composition::ICompositionSurface SystemCompositionContextHelper::InnerSurface( - IDrawingSurfaceBrush) noexcept { - return nullptr; -} - -ICompositionContext MicrosoftCompositionContextHelper::CreateContext( - winrt::Microsoft::UI::Composition::Compositor const &) noexcept { - return nullptr; -} - -IVisual MicrosoftCompositionContextHelper::CreateVisual(winrt::Microsoft::UI::Composition::Visual const &) noexcept { - return nullptr; -} - -winrt::Microsoft::UI::Composition::Compositor MicrosoftCompositionContextHelper::InnerCompositor( - ICompositionContext) noexcept { - return nullptr; -} - -winrt::Microsoft::UI::Composition::Visual MicrosoftCompositionContextHelper::InnerVisual(IVisual) noexcept { - return nullptr; -} - -winrt::Microsoft::UI::Composition::DropShadow MicrosoftCompositionContextHelper::InnerDropShadow(IDropShadow) noexcept { - return nullptr; -} - -winrt::Microsoft::UI::Composition::CompositionBrush MicrosoftCompositionContextHelper::InnerBrush(IBrush) noexcept { - return nullptr; -} - -winrt::Microsoft::UI::Composition::ICompositionSurface MicrosoftCompositionContextHelper::InnerSurface( - IDrawingSurfaceBrush) noexcept { - return nullptr; -} - -} // namespace winrt::Microsoft::ReactNative::Composition::Experimental::implementation diff --git a/vnext/Microsoft.ReactNative/Fabric/Composition/CompositionUIService_emptyimpl.cpp b/vnext/Microsoft.ReactNative/Fabric/Composition/CompositionUIService_emptyimpl.cpp deleted file mode 100644 index 828239854b8..00000000000 --- a/vnext/Microsoft.ReactNative/Fabric/Composition/CompositionUIService_emptyimpl.cpp +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -#include "pch.h" - -#include "CompositionUIService.h" - -#include "Composition.CompositionUIService.g.cpp" -#include - -namespace winrt::Microsoft::ReactNative::Composition::implementation { - -void CompositionUIService::SetCompositor( - ReactInstanceSettings const &, - winrt::Microsoft::UI::Composition::Compositor const &) noexcept {} - -winrt::Microsoft::UI::Composition::Compositor CompositionUIService::GetCompositor(const IReactPropertyBag &) noexcept { - return nullptr; -} - -winrt::Microsoft::ReactNative::ComponentView CompositionUIService::ComponentFromReactTag( - const winrt::Microsoft::ReactNative::IReactContext &, - int64_t) noexcept { - return nullptr; -} - -} // namespace winrt::Microsoft::ReactNative::Composition::implementation diff --git a/vnext/Microsoft.ReactNative/Fabric/Composition/Theme_emptyimpl.cpp b/vnext/Microsoft.ReactNative/Fabric/Composition/Theme_emptyimpl.cpp deleted file mode 100644 index 76946c7726e..00000000000 --- a/vnext/Microsoft.ReactNative/Fabric/Composition/Theme_emptyimpl.cpp +++ /dev/null @@ -1,81 +0,0 @@ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -#pragma once - -#include "Theme.h" - -#include "Composition.Theme.g.cpp" -#include "winrt/Microsoft.ReactNative.Composition.h" - -namespace winrt::Microsoft::ReactNative::Composition::implementation { - -Theme::Theme( - const winrt::Microsoft::ReactNative::ReactContext &, - const winrt::Microsoft::ReactNative::Composition::ICustomResourceLoader &) noexcept {} - -void Theme::ClearCacheAndRaiseChangedEvent() noexcept {} - -Theme::Theme() noexcept {} - -bool Theme::TryGetPlatformColor(winrt::hstring, winrt::Windows::UI::Color &) noexcept { - return false; -} - -bool Theme::TryGetPlatformColor(const std::string &, winrt::Windows::UI::Color &) noexcept { - return false; -} - -winrt::Windows::UI::Color Theme::Color(const facebook::react::Color &) noexcept { - return {}; -} - -winrt::Windows::UI::Color Theme::PlatformColor(const std::string &) noexcept { - return {}; -} - -winrt::Microsoft::UI::Composition::CompositionBrush Theme::PlatformBrush(winrt::hstring) noexcept { - return nullptr; -} - -winrt::Microsoft::ReactNative::Composition::Experimental::IBrush Theme::PlatformBrush(const std::string &) noexcept { - return nullptr; -} - -winrt::Microsoft::ReactNative::Composition::Experimental::IBrush Theme::Brush(const facebook::react::Color &) noexcept { - return nullptr; -} - -D2D1::ColorF Theme::D2DColor(const facebook::react::Color &) noexcept { - return D2D1::ColorF::Blue; -} - -D2D1::ColorF Theme::D2DPlatformColor(const std::string &) noexcept { - return D2D1::ColorF::Blue; -} - -bool Theme::IsEmpty() const noexcept { - return false; -} - -winrt::event_token Theme::ThemeChanged( - winrt::Windows::Foundation::EventHandler const &) noexcept { - return {}; -} -void Theme::ThemeChanged(winrt::event_token const &) noexcept {} - -winrt::Microsoft::ReactNative::Composition::Theme Theme::EmptyTheme() noexcept { - return nullptr; -} - -/*static*/ winrt::Microsoft::ReactNative::Composition::Theme Theme::GetDefaultTheme( - const winrt::Microsoft::ReactNative::IReactContext &) noexcept { - return nullptr; -} - -/*static*/ void Theme::SetDefaultResources( - const winrt::Microsoft::ReactNative::ReactInstanceSettings &, - const winrt::Microsoft::ReactNative::Composition::ICustomResourceLoader &) noexcept {} - -} // namespace winrt::Microsoft::ReactNative::Composition::implementation diff --git a/vnext/Microsoft.ReactNative/Fabric/platform/react/renderer/graphics/PlatformColorUtils.cpp b/vnext/Microsoft.ReactNative/Fabric/platform/react/renderer/graphics/PlatformColorUtils.cpp index 6ee8cef788c..d16d0d24c83 100644 --- a/vnext/Microsoft.ReactNative/Fabric/platform/react/renderer/graphics/PlatformColorUtils.cpp +++ b/vnext/Microsoft.ReactNative/Fabric/platform/react/renderer/graphics/PlatformColorUtils.cpp @@ -4,9 +4,6 @@ #include "PlatformColorUtils.h" #include #include -#ifndef CORE_ABI -#include -#endif // CORE_ABI #include #include #include "HostPlatformColor.h" diff --git a/vnext/Microsoft.ReactNative/Microsoft.ReactNative.vcxproj b/vnext/Microsoft.ReactNative/Microsoft.ReactNative.vcxproj index d8edd9f50ac..e767733e54e 100644 --- a/vnext/Microsoft.ReactNative/Microsoft.ReactNative.vcxproj +++ b/vnext/Microsoft.ReactNative/Microsoft.ReactNative.vcxproj @@ -304,8 +304,6 @@ - - @@ -319,74 +317,23 @@ Code - QuirkSettings.idl Code - - XamlUIService.idl - Code - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Create - - - - - - XamlUIService.idl - Code - - - - Designer - diff --git a/vnext/Microsoft.ReactNative/Microsoft.ReactNative.vcxproj.filters b/vnext/Microsoft.ReactNative/Microsoft.ReactNative.vcxproj.filters index 6219079aa75..e308cba30f0 100644 --- a/vnext/Microsoft.ReactNative/Microsoft.ReactNative.vcxproj.filters +++ b/vnext/Microsoft.ReactNative/Microsoft.ReactNative.vcxproj.filters @@ -86,9 +86,6 @@ Modules\Animated - - Modules - Modules @@ -107,9 +104,6 @@ Modules - - Modules - Modules @@ -143,12 +137,6 @@ Utils - - Utils - - - Utils - Utils @@ -157,7 +145,6 @@ - @@ -218,7 +205,6 @@ ReactHost - @@ -377,12 +363,6 @@ Utils - - Utils - - - Utils - Utils @@ -453,8 +433,6 @@ - - Views\cppwinrt diff --git a/vnext/Microsoft.ReactNative/Modules/AlertModule.cpp b/vnext/Microsoft.ReactNative/Modules/AlertModule.cpp index 802459d535f..62b2a08e99a 100644 --- a/vnext/Microsoft.ReactNative/Modules/AlertModule.cpp +++ b/vnext/Microsoft.ReactNative/Modules/AlertModule.cpp @@ -76,7 +76,8 @@ void Alert::ProcessPendingAlertRequestsMessageDialog() noexcept { auto asyncOp = messageDialog.ShowAsync(); asyncOp.Completed( [result, this]( - const winrt::IAsyncOperation &asyncOp, winrt::AsyncStatus status) { + const winrt::Windows::Foundation::IAsyncOperation &asyncOp, + winrt::Windows::Foundation::AsyncStatus status) { auto uicommand = asyncOp.GetResults(); result(m_constants.buttonClicked, winrt::unbox_value(uicommand.Id())); pendingAlerts.pop(); diff --git a/vnext/Microsoft.ReactNative/Modules/AppStateModule.cpp b/vnext/Microsoft.ReactNative/Modules/AppStateModule.cpp index ba712e6b1d1..9ea20b0a6f7 100644 --- a/vnext/Microsoft.ReactNative/Modules/AppStateModule.cpp +++ b/vnext/Microsoft.ReactNative/Modules/AppStateModule.cpp @@ -15,8 +15,6 @@ namespace Microsoft::ReactNative { void AppState::Initialize(winrt::Microsoft::ReactNative::ReactContext const &reactContext) noexcept { m_context = reactContext; - m_deactivated = false; - m_enteredBackground = false; } void AppState::GetCurrentAppState( @@ -39,21 +37,8 @@ ReactNativeSpecs::AppStateSpec_AppStateConstants AppState::GetConstants() noexce return {GetAppState()}; } -void AppState::SetDeactivated(bool deactivated) noexcept { - if (winrt::Microsoft::ReactNative::implementation::QuirkSettings::GetMapWindowDeactivatedToAppStateInactive( - m_context.Properties())) { - m_deactivated = deactivated; - AppStateDidChange({GetAppState()}); - } -} - -void AppState::SetEnteredBackground(bool enteredBackground) noexcept { - m_enteredBackground = enteredBackground; - AppStateDidChange({GetAppState()}); -} - std::string AppState::GetAppState() noexcept { - return m_enteredBackground ? "background" : (m_deactivated ? "inactive" : "active"); + return "active"; } -} // namespace Microsoft::ReactNative \ No newline at end of file +} // namespace Microsoft::ReactNative diff --git a/vnext/Microsoft.ReactNative/Modules/AppStateModule.h b/vnext/Microsoft.ReactNative/Modules/AppStateModule.h index 9c40294d330..9cff01c0b2b 100644 --- a/vnext/Microsoft.ReactNative/Modules/AppStateModule.h +++ b/vnext/Microsoft.ReactNative/Modules/AppStateModule.h @@ -37,13 +37,9 @@ struct AppState : public std::enable_shared_from_this { std::function AppStateDidChange; private: - void SetDeactivated(bool deactivated) noexcept; - void SetEnteredBackground(bool enteredBackground) noexcept; std::string GetAppState() noexcept; std::mutex m_stateMutex; - std::atomic m_deactivated; - std::atomic m_enteredBackground; char const *m_lastState{nullptr}; winrt::Microsoft::ReactNative::ReactContext m_context; }; diff --git a/vnext/Microsoft.ReactNative/Modules/AppThemeModuleUwp.cpp b/vnext/Microsoft.ReactNative/Modules/AppThemeModuleUwp.cpp index d5ba7a1bc88..c3cc3eac72b 100644 --- a/vnext/Microsoft.ReactNative/Modules/AppThemeModuleUwp.cpp +++ b/vnext/Microsoft.ReactNative/Modules/AppThemeModuleUwp.cpp @@ -11,7 +11,6 @@ #include #include #include -#include #include #include #include @@ -21,7 +20,6 @@ #endif namespace winrt { -using namespace xaml; using namespace Windows::UI::ViewManagement; } // namespace winrt diff --git a/vnext/Microsoft.ReactNative/Modules/AppearanceModule.cpp b/vnext/Microsoft.ReactNative/Modules/AppearanceModule.cpp index aaf5ca8a20d..2a630490667 100644 --- a/vnext/Microsoft.ReactNative/Modules/AppearanceModule.cpp +++ b/vnext/Microsoft.ReactNative/Modules/AppearanceModule.cpp @@ -4,17 +4,14 @@ #include "pch.h" #include "AppearanceModule.h" #include -#include #include -using Application = xaml::Application; -using ApplicationTheme = xaml::ApplicationTheme; using UISettings = winrt::Windows::UI::ViewManagement::UISettings; namespace Microsoft::ReactNative { -static const React::ReactPropertyId &AppearanceCurrentThemePropertyId() noexcept { - static const React::ReactPropertyId prop{L"ReactNative.Appearance", L"ApplicationTheme"}; +static const React::ReactPropertyId &AppearanceCurrentThemePropertyId() noexcept { + static const React::ReactPropertyId prop{L"ReactNative.Appearance", L"ApplicationTheme"}; return prop; } @@ -42,13 +39,14 @@ void Appearance::Initialize(winrt::Microsoft::ReactNative::ReactContext const &r }); } -ApplicationTheme CurrentThemeFromUISettings(const winrt::Windows::UI::ViewManagement::UISettings &uiSettings) { +Appearance::ApplicationTheme CurrentThemeFromUISettings( + const winrt::Windows::UI::ViewManagement::UISettings &uiSettings) { return IsColorLight(uiSettings.GetColorValue(winrt::Windows::UI::ViewManagement::UIColorType::Foreground)) - ? ApplicationTheme::Dark - : ApplicationTheme::Light; + ? Appearance::ApplicationTheme::Dark + : Appearance::ApplicationTheme::Light; } -ApplicationTheme Appearance::GetCurrentTheme() noexcept { +Appearance::ApplicationTheme Appearance::GetCurrentTheme() noexcept { assert(m_context.UIDispatcher().HasThreadAccess()); // xaml::Application is only accessible on the UI thread return CurrentThemeFromUISettings(m_uiSettings); } @@ -59,9 +57,9 @@ const char *Appearance::ToString(ApplicationTheme theme) noexcept { void Appearance::RequeryTheme() noexcept { auto theme = GetCurrentTheme(); - auto oldThemeBoxed = - m_context.Properties().Handle().Set(AppearanceCurrentThemePropertyId().Handle(), winrt::box_value(theme)); - auto oldTheme = winrt::unbox_value_or(oldThemeBoxed, ApplicationTheme::Light); + auto oldTheme = m_context.Properties().Get(AppearanceCurrentThemePropertyId()).value_or(false) + ? Appearance::ApplicationTheme::Dark + : Appearance::ApplicationTheme::Light; if (oldTheme != theme) { appearanceChanged({ToString(theme)}); @@ -69,11 +67,11 @@ void Appearance::RequeryTheme() noexcept { } void Appearance::InitOnUIThread(const Mso::React::IReactContext &context) noexcept { - xaml::ApplicationTheme theme = ApplicationTheme::Light; + Appearance::ApplicationTheme theme = Appearance::ApplicationTheme::Light; theme = CurrentThemeFromUISettings(winrt::Windows::UI::ViewManagement::UISettings()); winrt::Microsoft::ReactNative::ReactPropertyBag pb{context.Properties()}; - pb.Set(AppearanceCurrentThemePropertyId(), theme); + pb.Set(AppearanceCurrentThemePropertyId(), theme == Appearance::ApplicationTheme::Dark); } void Appearance::setColorScheme(std::string style) noexcept { @@ -81,7 +79,10 @@ void Appearance::setColorScheme(std::string style) noexcept { } std::optional Appearance::getColorScheme() noexcept { - return ToString(*(m_context.Properties().Get(AppearanceCurrentThemePropertyId()))); + return ToString( + m_context.Properties().Get(AppearanceCurrentThemePropertyId()).value_or(false) + ? Appearance::ApplicationTheme::Dark + : Appearance::ApplicationTheme::Light); } void Appearance::addListener(std::string eventName) noexcept { diff --git a/vnext/Microsoft.ReactNative/Modules/AppearanceModule.h b/vnext/Microsoft.ReactNative/Modules/AppearanceModule.h index 61e09bce701..11856588eea 100644 --- a/vnext/Microsoft.ReactNative/Modules/AppearanceModule.h +++ b/vnext/Microsoft.ReactNative/Modules/AppearanceModule.h @@ -17,10 +17,14 @@ struct AppearanceChangeArgs { REACT_MODULE(Appearance) struct Appearance : std::enable_shared_from_this { - using ApplicationTheme = xaml::ApplicationTheme; using UISettings = winrt::Windows::UI::ViewManagement::UISettings; using ModuleSpec = ReactNativeSpecs::AppearanceSpec; + enum class ApplicationTheme { + Light = 0, + Dark, + }; + REACT_INIT(Initialize) void Initialize(winrt::Microsoft::ReactNative::ReactContext const &reactContext) noexcept; diff --git a/vnext/Microsoft.ReactNative/Modules/DeviceInfoModule.cpp b/vnext/Microsoft.ReactNative/Modules/DeviceInfoModule.cpp index 7ff583346f2..e98f355cfca 100644 --- a/vnext/Microsoft.ReactNative/Modules/DeviceInfoModule.cpp +++ b/vnext/Microsoft.ReactNative/Modules/DeviceInfoModule.cpp @@ -7,7 +7,6 @@ #include #include #include -#include #include #include #include @@ -114,12 +113,8 @@ void DeviceInfoHolder::SetCallback( } void DeviceInfoHolder::updateDeviceInfo() noexcept { - auto hwnd = XamlUIService::GetIslandWindowHandle(m_context->Properties()); - - if (IsFabricEnabled(m_context->Properties())) { - winrt::Microsoft::ReactNative::ReactPropertyBag pb{m_context->Properties()}; - hwnd = winrt::Microsoft::ReactNative::implementation::ReactCoreInjection::GetTopLevelWindowId(pb.Handle()); - } + winrt::Microsoft::ReactNative::ReactPropertyBag pb{m_context->Properties()}; + auto hwnd = winrt::Microsoft::ReactNative::implementation::ReactCoreInjection::GetTopLevelWindowId(pb.Handle()); if (hwnd) { RECT rect{}; diff --git a/vnext/Microsoft.ReactNative/Modules/DeviceInfoModule.h b/vnext/Microsoft.ReactNative/Modules/DeviceInfoModule.h index 0fe517c5260..e0ef2e76656 100644 --- a/vnext/Microsoft.ReactNative/Modules/DeviceInfoModule.h +++ b/vnext/Microsoft.ReactNative/Modules/DeviceInfoModule.h @@ -41,7 +41,6 @@ struct DeviceInfoHolder { uint32_t m_screenWidth{0}; uint32_t m_screenHeight{0}; - winrt::Windows::UI::Core::CoreWindow::SizeChanged_revoker m_sizeChangedRevoker; winrt::Windows::Graphics::Display::DisplayInformation::DpiChanged_revoker m_dpiChangedRevoker{}; Mso::Functor m_notifyCallback; winrt::Microsoft::ReactNative::ReactNotificationSubscription m_wmSubscription{}; diff --git a/vnext/Microsoft.ReactNative/Modules/I18nManagerModule.h b/vnext/Microsoft.ReactNative/Modules/I18nManagerModule.h index 72773c1bc11..eb1d49affc0 100644 --- a/vnext/Microsoft.ReactNative/Modules/I18nManagerModule.h +++ b/vnext/Microsoft.ReactNative/Modules/I18nManagerModule.h @@ -17,11 +17,11 @@ REACT_MODULE(I18nManager) struct I18nManager { using ModuleSpec = ReactNativeSpecs::I18nManagerSpec; - static void InitI18nInfo(const React::ReactPropertyBag &propertyBag) noexcept; - static bool IsRTL(const React::ReactPropertyBag &propertyBag) noexcept; + static void InitI18nInfo(const winrt::Microsoft::ReactNative::ReactPropertyBag &propertyBag) noexcept; + static bool IsRTL(const winrt::Microsoft::ReactNative::ReactPropertyBag &propertyBag) noexcept; REACT_INIT(Initialize) - void Initialize(React::ReactContext const &reactContext) noexcept; + void Initialize(winrt::Microsoft::ReactNative::ReactContext const &reactContext) noexcept; REACT_GET_CONSTANTS(GetConstants) ReactNativeSpecs::I18nManagerSpec_I18nManagerConstants GetConstants() noexcept; @@ -38,7 +38,7 @@ struct I18nManager { private: bool IsRTL() noexcept; - React::ReactContext m_context; + winrt::Microsoft::ReactNative::ReactContext m_context; }; } // namespace Microsoft::ReactNative diff --git a/vnext/Microsoft.ReactNative/QuirkSettings.cpp b/vnext/Microsoft.ReactNative/QuirkSettings.cpp index 1c817aa0f0a..dd44d34bc1d 100644 --- a/vnext/Microsoft.ReactNative/QuirkSettings.cpp +++ b/vnext/Microsoft.ReactNative/QuirkSettings.cpp @@ -13,37 +13,6 @@ namespace winrt::Microsoft::ReactNative::implementation { QuirkSettings::QuirkSettings() noexcept {} -winrt::Microsoft::ReactNative::ReactPropertyId MatchAndroidAndIOSStretchBehaviorProperty() noexcept { - static winrt::Microsoft::ReactNative::ReactPropertyId propId{ - L"ReactNative.QuirkSettings", L"MatchAndroidAndIOSyStretchBehavior"}; - return propId; -} - -/*static*/ void QuirkSettings::SetMatchAndroidAndIOSStretchBehavior( - winrt::Microsoft::ReactNative::ReactPropertyBag properties, - bool value) noexcept { - properties.Set(MatchAndroidAndIOSStretchBehaviorProperty(), value); -} - -winrt::Microsoft::ReactNative::ReactPropertyId UseWebFlexBasisBehaviorProperty() noexcept { - static winrt::Microsoft::ReactNative::ReactPropertyId propId{ - L"ReactNative.QuirkSettings", L"UseWebFlexBasisBehavior"}; - return propId; -} - -/*static*/ void QuirkSettings::SetUseWebFlexBasisBehavior( - winrt::Microsoft::ReactNative::ReactPropertyBag properties, - bool value) noexcept { - properties.Set(UseWebFlexBasisBehaviorProperty(), value); -} - -winrt::Microsoft::ReactNative::ReactPropertyId AcceptSelfSignedCertsProperty() noexcept { - winrt::Microsoft::ReactNative::ReactPropertyId propId{ - L"ReactNative.QuirkSettings", L"Networking.AcceptSelfSigned"}; - - return propId; -} - winrt::Microsoft::ReactNative::ReactPropertyId EnableBackHandlerKindProperty() noexcept { winrt::Microsoft::ReactNative::ReactPropertyId propId{ @@ -51,122 +20,20 @@ EnableBackHandlerKindProperty() noexcept { return propId; } - -winrt::Microsoft::ReactNative::ReactPropertyId MapWindowDeactivatedToAppStateInactiveProperty() noexcept { - static winrt::Microsoft::ReactNative::ReactPropertyId propId{ - L"ReactNative.QuirkSettings", L"MapWindowDeactivatedToAppStateInactiveProperty"}; - return propId; -} - -/*static*/ void QuirkSettings::SetMapWindowDeactivatedToAppStateInactive( - winrt::Microsoft::ReactNative::ReactPropertyBag properties, - bool value) noexcept { - properties.Set(MapWindowDeactivatedToAppStateInactiveProperty(), value); -} - -winrt::Microsoft::ReactNative::ReactPropertyId SuppressWindowFocusOnViewFocusProperty() noexcept { - winrt::Microsoft::ReactNative::ReactPropertyId propId{ - L"ReactNative.QuirkSettings", L"SuppressWindowFocusOnViewFocus"}; - - return propId; -} - -winrt::Microsoft::ReactNative::ReactPropertyId UseRuntimeSchedulerProperty() noexcept { - winrt::Microsoft::ReactNative::ReactPropertyId propId{L"ReactNative.QuirkSettings", L"UseRuntimeScheduler"}; - - return propId; -} - -winrt::Microsoft::ReactNative::ReactPropertyId UseRunOnQueueSyncProperty() noexcept { - winrt::Microsoft::ReactNative::ReactPropertyId propId{L"ReactNative.QuirkSettings", L"UseRunOnQueueSync"}; - - return propId; -} - #pragma region IDL interface -/*static*/ void QuirkSettings::SetMatchAndroidAndIOSStretchBehavior( - winrt::Microsoft::ReactNative::ReactInstanceSettings settings, - bool value) noexcept { - SetMatchAndroidAndIOSStretchBehavior(ReactPropertyBag(settings.Properties()), value); -} - -/*static*/ void QuirkSettings::SetUseWebFlexBasisBehavior( - winrt::Microsoft::ReactNative::ReactInstanceSettings settings, - bool value) noexcept { - SetUseWebFlexBasisBehavior(ReactPropertyBag(settings.Properties()), value); -} - -/*static*/ void QuirkSettings::SetAcceptSelfSigned( - winrt::Microsoft::ReactNative::ReactInstanceSettings settings, - bool value) noexcept { - ReactPropertyBag(settings.Properties()).Set(AcceptSelfSignedCertsProperty(), value); -} - /*static*/ void QuirkSettings::SetBackHandlerKind( winrt::Microsoft::ReactNative::ReactInstanceSettings settings, winrt::Microsoft::ReactNative::BackNavigationHandlerKind kind) noexcept { ReactPropertyBag(settings.Properties()).Set(EnableBackHandlerKindProperty(), kind); } -/*static*/ void QuirkSettings::SetMapWindowDeactivatedToAppStateInactive( - winrt::Microsoft::ReactNative::ReactInstanceSettings settings, - bool value) noexcept { - SetMapWindowDeactivatedToAppStateInactive(ReactPropertyBag(settings.Properties()), value); -} - -/*static*/ void QuirkSettings::SetSuppressWindowFocusOnViewFocus( - winrt::Microsoft::ReactNative::ReactInstanceSettings settings, - bool value) noexcept { - ReactPropertyBag(settings.Properties()).Set(SuppressWindowFocusOnViewFocusProperty(), value); -} - -/*static*/ void QuirkSettings::SetUseRuntimeScheduler( - winrt::Microsoft::ReactNative::ReactInstanceSettings settings, - bool value) noexcept { - ReactPropertyBag(settings.Properties()).Set(UseRuntimeSchedulerProperty(), value); -} - -/*static*/ void QuirkSettings::SetUseRunOnQueueSync( - winrt::Microsoft::ReactNative::ReactInstanceSettings settings, - bool value) noexcept { - ReactPropertyBag(settings.Properties()).Set(UseRunOnQueueSyncProperty(), value); -} - #pragma endregion IDL interface -/*static*/ bool QuirkSettings::GetMatchAndroidAndIOSStretchBehavior(ReactPropertyBag properties) noexcept { - return properties.Get(MatchAndroidAndIOSStretchBehaviorProperty()).value_or(true); -} - -/*static*/ bool QuirkSettings::GetUseWebFlexBasisBehavior(ReactPropertyBag properties) noexcept { - return properties.Get(UseWebFlexBasisBehaviorProperty()).value_or(false); -} - -/*static*/ bool QuirkSettings::GetAcceptSelfSigned(ReactPropertyBag properties) noexcept { - return properties.Get(AcceptSelfSignedCertsProperty()).value_or(false); -} - /*static*/ winrt::Microsoft::ReactNative::BackNavigationHandlerKind QuirkSettings::GetBackHandlerKind( ReactPropertyBag properties) noexcept { return properties.Get(EnableBackHandlerKindProperty()) .value_or(winrt::Microsoft::ReactNative::BackNavigationHandlerKind::JavaScript); } -/*static*/ bool QuirkSettings::GetMapWindowDeactivatedToAppStateInactive(ReactPropertyBag properties) noexcept { - return properties.Get(MapWindowDeactivatedToAppStateInactiveProperty()).value_or(false); -} - -/*static*/ bool QuirkSettings::GetSuppressWindowFocusOnViewFocus(ReactPropertyBag properties) noexcept { - return properties.Get(SuppressWindowFocusOnViewFocusProperty()).value_or(false); -} - -/*static*/ bool QuirkSettings::GetUseRuntimeScheduler(ReactPropertyBag properties) noexcept { - return properties.Get(UseRuntimeSchedulerProperty()).value_or(true); -} - -/*static*/ bool QuirkSettings::GetUseRunOnQueueSync(ReactPropertyBag properties) noexcept { - return properties.Get(UseRunOnQueueSyncProperty()).value_or(false); -} - } // namespace winrt::Microsoft::ReactNative::implementation diff --git a/vnext/Microsoft.ReactNative/QuirkSettings.h b/vnext/Microsoft.ReactNative/QuirkSettings.h index f19691a20c6..df4d065463f 100644 --- a/vnext/Microsoft.ReactNative/QuirkSettings.h +++ b/vnext/Microsoft.ReactNative/QuirkSettings.h @@ -14,60 +14,17 @@ struct QuirkSettings : QuirkSettingsT { public: QuirkSettings() noexcept; - // Internal use - static void SetMatchAndroidAndIOSStretchBehavior( - winrt::Microsoft::ReactNative::ReactPropertyBag properties, - bool value) noexcept; - static bool GetMatchAndroidAndIOSStretchBehavior(winrt::Microsoft::ReactNative::ReactPropertyBag properties) noexcept; - - static void SetUseWebFlexBasisBehavior( - winrt::Microsoft::ReactNative::ReactPropertyBag properties, - bool value) noexcept; - static bool GetUseWebFlexBasisBehavior(winrt::Microsoft::ReactNative::ReactPropertyBag properties) noexcept; - - static bool GetAcceptSelfSigned(winrt::Microsoft::ReactNative::ReactPropertyBag properties) noexcept; static winrt::Microsoft::ReactNative::BackNavigationHandlerKind GetBackHandlerKind( winrt::Microsoft::ReactNative::ReactPropertyBag properties) noexcept; - static bool GetSuppressWindowFocusOnViewFocus(winrt::Microsoft::ReactNative::ReactPropertyBag properties) noexcept; - static bool GetUseRuntimeScheduler(winrt::Microsoft::ReactNative::ReactPropertyBag properties) noexcept; - static bool GetUseRunOnQueueSync(winrt::Microsoft::ReactNative::ReactPropertyBag properties) noexcept; static bool GetEnableFabric(winrt::Microsoft::ReactNative::ReactPropertyBag properties) noexcept; - static void SetMapWindowDeactivatedToAppStateInactive( - winrt::Microsoft::ReactNative::ReactPropertyBag properties, - bool value) noexcept; - static bool GetMapWindowDeactivatedToAppStateInactive( - winrt::Microsoft::ReactNative::ReactPropertyBag properties) noexcept; - #pragma region Public API - part of IDL interface - static void SetMatchAndroidAndIOSStretchBehavior( - winrt::Microsoft::ReactNative::ReactInstanceSettings settings, - bool value) noexcept; - - static void SetUseWebFlexBasisBehavior( - winrt::Microsoft::ReactNative::ReactInstanceSettings settings, - bool value) noexcept; - static void SetAcceptSelfSigned(winrt::Microsoft::ReactNative::ReactInstanceSettings settings, bool value) noexcept; static void SetBackHandlerKind( winrt::Microsoft::ReactNative::ReactInstanceSettings settings, winrt::Microsoft::ReactNative::BackNavigationHandlerKind kind) noexcept; - static void SetMapWindowDeactivatedToAppStateInactive( - winrt::Microsoft::ReactNative::ReactInstanceSettings settings, - bool value) noexcept; - - static void SetSuppressWindowFocusOnViewFocus( - winrt::Microsoft::ReactNative::ReactInstanceSettings settings, - bool value) noexcept; - - static void SetUseRuntimeScheduler( - winrt::Microsoft::ReactNative::ReactInstanceSettings settings, - bool value) noexcept; - - static void SetUseRunOnQueueSync(winrt::Microsoft::ReactNative::ReactInstanceSettings settings, bool value) noexcept; - #pragma endregion Public API - part of IDL interface }; diff --git a/vnext/Microsoft.ReactNative/QuirkSettings.idl b/vnext/Microsoft.ReactNative/QuirkSettings.idl index 0770d5faa3f..5b56977bafe 100644 --- a/vnext/Microsoft.ReactNative/QuirkSettings.idl +++ b/vnext/Microsoft.ReactNative/QuirkSettings.idl @@ -22,53 +22,12 @@ namespace Microsoft.ReactNative "to update their code to not rely on these settings.") static runtimeclass QuirkSettings { - DOC_STRING( - "Older versions of react-native-windows did not use [Yoga](https://github.com/facebook/yoga)'s legacy " - "stretch behavior. This meant that react-native-windows would layout views " - "slightly differently that in iOS and Android.\n" - "Set this setting to false to maintain the behavior from react-native-windows <= 0.62.") - DOC_DEFAULT("true") - static void SetMatchAndroidAndIOSStretchBehavior(ReactInstanceSettings settings, Boolean value); - - DOC_STRING( - "There is a chance that cached flex basis values can cause text truncation in some re-layout scenarios. " - "Enabling [Yoga](https://github.com/facebook/yoga)'s experimental web flex basis behavior fixes this issue, " - "however using it may result in performance regressions due to additional layout passes.") - DOC_DEFAULT("false") - static void SetUseWebFlexBasisBehavior(ReactInstanceSettings settings, Boolean value); - - DOC_STRING("Runtime setting allowing Networking (HTTP, WebSocket) connections to skip certificate validation.") - static void SetAcceptSelfSigned(ReactInstanceSettings settings, Boolean value); - DOC_STRING( "By default `react-native-windows` will handle various back events and forward them to JavaScript. " "Setting this to @BackNavigationHandlerKind.Native prevents `react-native-windows` from handling " "these events, including forwarding to JavaScript. This will allow applications to handle back " "navigation in native code, but will prevent the `BackHandler` native module from receiving events.") static void SetBackHandlerKind(ReactInstanceSettings settings, BackNavigationHandlerKind kind); - - DOC_STRING( - "By default `react-native-windows` will only track `active` and `background` `AppState`. " - "Setting this to true enables `react-native-windows` to also track `inactive` `AppState` which [maps closely to iOS.](https://reactnative.dev/docs/appstate)" - "`inactive` tracks the [Window.Activated Event](https://docs.microsoft.com/uwp/api/windows.ui.core.corewindow.activated) when the window is deactivated.") - DOC_DEFAULT("false") - static void SetMapWindowDeactivatedToAppStateInactive(ReactInstanceSettings settings, Boolean value); - - DOC_STRING( - "When running multiple windows from a single UI thread, focusing a native view causes the parent " - "window of that view to get focus as well. Set this setting to true to prevent focus of a blurred " - "window when a view in that window is programmatically focused.") - static void SetSuppressWindowFocusOnViewFocus(ReactInstanceSettings settings, Boolean value); - - DOC_STRING( - "By default `react-native-windows` will use the new RuntimeScheduler." - "Setting this to false will revert the behavior to previous scheduling logic.") - static void SetUseRuntimeScheduler(ReactInstanceSettings settings, Boolean value); - - DOC_STRING( - "By default `react-native-windows` will not call sync JS call: runOnQueueSync." - "Setting this to true will revert the behavior to previous logic and might result in hang.") - static void SetUseRunOnQueueSync(ReactInstanceSettings settings, Boolean value); } } // namespace Microsoft.ReactNative diff --git a/vnext/Microsoft.ReactNative/ReactHost/CrashManager.cpp b/vnext/Microsoft.ReactNative/ReactHost/CrashManager.cpp index 6604b913743..9b2e6085fe4 100644 --- a/vnext/Microsoft.ReactNative/ReactHost/CrashManager.cpp +++ b/vnext/Microsoft.ReactNative/ReactHost/CrashManager.cpp @@ -47,13 +47,9 @@ void __cdecl on_sigabrt(int signum) { void InternalRegisterCustomHandler() noexcept { // Do this now because by the time we catch the exception we may be in OOM -#ifndef CORE_ABI // win32 vs uwp file permissions wchar_t currentDirectory[MAX_PATH]{}; VerifyElseCrash(!!GetTempPath(MAX_PATH, currentDirectory)); g_logFileName = currentDirectory; -#else - g_logFileName = winrt::Windows::Storage::ApplicationData::Current().LocalFolder().Path() + L"\\"; -#endif g_logFileName += L"ReactNativeCrashDetails_" + std::to_wstring(GetCurrentProcessId()) + L".txt"; diff --git a/vnext/Microsoft.ReactNative/ReactHost/MsoReactContext.cpp b/vnext/Microsoft.ReactNative/ReactHost/MsoReactContext.cpp index 51d67bff53a..db8723e4e49 100644 --- a/vnext/Microsoft.ReactNative/ReactHost/MsoReactContext.cpp +++ b/vnext/Microsoft.ReactNative/ReactHost/MsoReactContext.cpp @@ -178,11 +178,9 @@ void ReactContext::CallJSFunction(std::string &&module, std::string &&method, fo } void ReactContext::DispatchEvent(int64_t viewTag, std::string &&eventName, folly::dynamic &&eventData) const noexcept { -#ifndef CORE_ABI // requires instance if (auto instance = m_reactInstance.GetStrongPtr()) { instance->DispatchEvent(viewTag, std::move(eventName), std::move(eventData)); } -#endif } winrt::Microsoft::ReactNative::JsiRuntime ReactContext::JsiRuntime() const noexcept { diff --git a/vnext/Microsoft.ReactNative/ReactHost/React.h b/vnext/Microsoft.ReactNative/ReactHost/React.h index 643003b6d37..4537d5b5c88 100644 --- a/vnext/Microsoft.ReactNative/ReactHost/React.h +++ b/vnext/Microsoft.ReactNative/ReactHost/React.h @@ -16,11 +16,6 @@ #include -#ifdef CORE_ABI -#include -#undef GetCurrentTime -#endif - #include #include diff --git a/vnext/Microsoft.ReactNative/ReactHost/ReactInstanceWin.cpp b/vnext/Microsoft.ReactNative/ReactHost/ReactInstanceWin.cpp index 1c7fb051fe8..2976094c58a 100644 --- a/vnext/Microsoft.ReactNative/ReactHost/ReactInstanceWin.cpp +++ b/vnext/Microsoft.ReactNative/ReactHost/ReactInstanceWin.cpp @@ -68,20 +68,17 @@ #include #include "Inspector/ReactInspectorThread.h" -#ifndef CORE_ABI -#include -#include #include "Modules/AccessibilityInfoModule.h" #include "Modules/AlertModule.h" #include "Modules/AppStateModule.h" #include "Modules/AppThemeModuleUwp.h" +#include "Modules/AppearanceModule.h" #include "Modules/ClipboardModule.h" #include "Modules/DeviceInfoModule.h" +#include "Modules/ExceptionsManager.h" #include "Modules/I18nManagerModule.h" #include "Modules/LinkingManagerModule.h" #include "Modules/LogBoxModule.h" -#endif -#include "Modules/ExceptionsManager.h" #include "Modules/PlatformConstantsWinModule.h" #include "Modules/ReactRootViewTagGenerator.h" #include "Modules/SourceCode.h" @@ -245,7 +242,6 @@ void ReactInstanceWin::LoadModules( L"FabricUIManagerBinding", winrt::Microsoft::ReactNative::MakeModuleProvider<::Microsoft::ReactNative::FabricUIManager>()); -#ifndef CORE_ABI registerTurboModule( L"AccessibilityInfo", winrt::Microsoft::ReactNative::MakeTurboModuleProvider<::Microsoft::ReactNative::AccessibilityInfo>()); @@ -278,15 +274,6 @@ void ReactInstanceWin::LoadModules( L"NativeAnimatedModule", winrt::Microsoft::ReactNative::MakeModuleProvider<::Microsoft::ReactNative::NativeAnimatedModule>()); -#else - registerTurboModule( - L"ImageLoader", winrt::Microsoft::ReactNative::MakeTurboModuleProvider<::Microsoft::ReactNative::ImageLoader>()); - - registerTurboModule( - L"NativeAnimatedModule", - winrt::Microsoft::ReactNative::MakeModuleProvider<::Microsoft::ReactNative::NativeAnimatedModule>()); -#endif - turboModulesProvider->AddModuleProvider( L"SampleTurboModule", winrt::Microsoft::ReactNative::MakeTurboModuleProvider<::Microsoft::ReactNative::SampleTurboModule>(), @@ -330,14 +317,12 @@ void ReactInstanceWin::LoadModules( registerTurboModule( L"DevSettings", winrt::Microsoft::ReactNative::MakeTurboModuleProvider<::Microsoft::ReactNative::DevSettings>()); -#ifndef CORE_ABI registerTurboModule( L"I18nManager", winrt::Microsoft::ReactNative::MakeTurboModuleProvider<::Microsoft::ReactNative::I18nManager>()); registerTurboModule( L"LinkingManager", winrt::Microsoft::ReactNative::MakeTurboModuleProvider<::Microsoft::ReactNative::LinkingManager>()); -#endif registerTurboModule(L"Timing", winrt::Microsoft::ReactNative::MakeModuleProvider<::Microsoft::ReactNative::Timing>()); @@ -362,13 +347,11 @@ void ReactInstanceWin::InitDevMenu() noexcept { } void ReactInstanceWin::InitUIDependentCalls() noexcept { -#ifndef CORE_ABI Microsoft::ReactNative::AppThemeHolder::InitAppThemeHolder(GetReactContext()); Microsoft::ReactNative::I18nManager::InitI18nInfo( winrt::Microsoft::ReactNative::ReactPropertyBag(Options().Properties)); Microsoft::ReactNative::Appearance::InitOnUIThread(GetReactContext()); Microsoft::ReactNative::DeviceInfoHolder::InitDeviceInfoHolder(GetReactContext()); -#endif // CORE_ABI } std::shared_ptr ReactInstanceWin::CreateDevSettings() noexcept { @@ -400,11 +383,6 @@ std::shared_ptr ReactInstanceWin::CreateDevSetting } }; - bool useRuntimeScheduler = winrt::Microsoft::ReactNative::implementation::QuirkSettings::GetUseRuntimeScheduler( - winrt::Microsoft::ReactNative::ReactPropertyBag(m_reactContext->Properties())); - - devSettings->useRuntimeScheduler = useRuntimeScheduler; - devSettings->inspectorHostTarget = m_options.InspectorHostTarget; return devSettings; @@ -797,14 +775,12 @@ facebook::react::NativeLoggingHook ReactInstanceWin::GetLoggingCallback() noexce std::shared_ptr ReactInstanceWin::GetRedBoxHandler() noexcept { if (m_options.RedBoxHandler) { return m_options.RedBoxHandler; -#ifndef CORE_ABI } else if (UseDeveloperSupport()) { auto localWkReactHost = m_weakReactHost; return CreateDefaultRedBoxHandler( winrt::Microsoft::ReactNative::ReactPropertyBag(m_reactContext->Properties()), std::move(localWkReactHost), *m_uiQueue); -#endif } else { return {}; } diff --git a/vnext/Microsoft.ReactNative/ReactHost/ReactInstanceWin.h b/vnext/Microsoft.ReactNative/ReactHost/ReactInstanceWin.h index d0b789ba02a..0b59ed9fd66 100644 --- a/vnext/Microsoft.ReactNative/ReactHost/ReactInstanceWin.h +++ b/vnext/Microsoft.ReactNative/ReactHost/ReactInstanceWin.h @@ -12,11 +12,6 @@ #include "React_win.h" #include "activeObject/activeObject.h" -#ifndef CORE_ABI -#include -#include -#endif - #include namespace winrt::Microsoft::ReactNative { diff --git a/vnext/Microsoft.ReactNative/ReactHost/React_Win.h b/vnext/Microsoft.ReactNative/ReactHost/React_Win.h index 6cdec6cc453..35ca35dbda0 100644 --- a/vnext/Microsoft.ReactNative/ReactHost/React_Win.h +++ b/vnext/Microsoft.ReactNative/ReactHost/React_Win.h @@ -3,9 +3,7 @@ #pragma once -#ifndef CORE_ABI #include -#endif #include #include diff --git a/vnext/Microsoft.ReactNative/ReactSupport.cpp b/vnext/Microsoft.ReactNative/ReactSupport.cpp deleted file mode 100644 index 91d346e24d5..00000000000 --- a/vnext/Microsoft.ReactNative/ReactSupport.cpp +++ /dev/null @@ -1,221 +0,0 @@ - -#include "pch.h" -#include "ReactSupport.h" -#include "Base/FollyIncludes.h" - -using namespace winrt; -using namespace Windows::Foundation; -using namespace Windows::Foundation::Collections; - -namespace winrt::Microsoft::ReactNative { - -folly::dynamic ConvertToDynamic(IInspectable const &object) { - if (object == nullptr) - return nullptr; - - if (auto const &map = object.try_as>()) { - folly::dynamic obj = folly::dynamic::object; - for (auto const &kvp : map) { - obj[to_string(kvp.Key())] = ConvertToDynamic(kvp.Value()); - } - return obj; - } - - auto propValue = object.try_as(); - if (!propValue) { - auto stringable = object.try_as(); - if (stringable) { - // This handles types such as the Newtonsoft.Json.Linq.JObject and - // the Windows.Data.Json.JsonObject. - auto stringified = to_string(stringable.ToString()); - auto json = folly::parseJson(stringified); - return json; - } else { - throw hresult_invalid_argument(L"Unrecognized argument value type."); - } - } - - auto propType = propValue.Type(); - folly::dynamic value; - - switch (propType) { - case PropertyType::Boolean: - value = propValue.GetBoolean(); - break; - case PropertyType::Char16: - value = propValue.GetChar16(); - break; - case PropertyType::Double: - value = propValue.GetDouble(); - break; - case PropertyType::Int16: - value = propValue.GetInt16(); - break; - case PropertyType::Int32: - value = propValue.GetInt32(); - break; - case PropertyType::Int64: - value = propValue.GetInt64(); - break; - case PropertyType::Single: - value = propValue.GetSingle(); - break; - case PropertyType::String: { - hstring stringValue = propValue.GetString(); - value = to_string(stringValue); - break; - } - case PropertyType::UInt8: - value = propValue.GetUInt8(); - break; - case PropertyType::UInt16: - value = propValue.GetUInt16(); - break; - case PropertyType::UInt32: - value = propValue.GetUInt32(); - break; - case PropertyType::UInt64: - value = propValue.GetUInt64(); - break; - - // ARRAYS - case PropertyType::BooleanArray: { - com_array tmpArray; - propValue.GetBooleanArray(tmpArray); - folly::dynamic d = folly::dynamic::array(); - for (bool b : tmpArray) { - d.push_back(folly::dynamic(b)); - } - value = d; - break; - } - case PropertyType::Char16Array: { - com_array tmpArray; - propValue.GetChar16Array(tmpArray); - folly::dynamic d = folly::dynamic::array(); - for (char16_t b : tmpArray) { - d.push_back(folly::dynamic(b)); - } - value = d; - break; - } - case PropertyType::DoubleArray: { - com_array tmpArray; - propValue.GetDoubleArray(tmpArray); - folly::dynamic d = folly::dynamic::array(); - for (double_t b : tmpArray) { - d.push_back(folly::dynamic(b)); - } - value = d; - break; - } - case PropertyType::InspectableArray: { - com_array tmpArray; - propValue.GetInspectableArray(tmpArray); - folly::dynamic d = folly::dynamic::array; - for (auto inspectable : tmpArray) { - d.push_back(ConvertToDynamic(inspectable)); - } - value = d; - break; - } - case PropertyType::Int16Array: { - com_array tmpArray; - propValue.GetInt16Array(tmpArray); - folly::dynamic d = folly::dynamic::array(); - for (int16_t b : tmpArray) { - d.push_back(folly::dynamic(b)); - } - value = d; - break; - } - case PropertyType::Int32Array: { - com_array tmpArray; - propValue.GetInt32Array(tmpArray); - folly::dynamic d = folly::dynamic::array(); - for (int32_t b : tmpArray) { - d.push_back(folly::dynamic(b)); - } - value = d; - break; - } - case PropertyType::Int64Array: { - com_array tmpArray; - propValue.GetInt64Array(tmpArray); - folly::dynamic d = folly::dynamic::array(); - for (int64_t b : tmpArray) { - d.push_back(folly::dynamic(b)); - } - value = d; - break; - } - case PropertyType::SingleArray: { - com_array tmpArray; - propValue.GetSingleArray(tmpArray); - folly::dynamic d = folly::dynamic::array(); - for (float b : tmpArray) { - d.push_back(folly::dynamic(b)); - } - value = d; - break; - } - case PropertyType::StringArray: { - com_array tmpArray; - propValue.GetStringArray(tmpArray); - folly::dynamic d = folly::dynamic::array; - for (auto strItem : tmpArray) { - d.push_back(to_string(strItem)); - } - value = d; - break; - } - case PropertyType::UInt8Array: { - com_array tmpArray; - propValue.GetUInt8Array(tmpArray); - folly::dynamic d = folly::dynamic::array(); - for (uint8_t b : tmpArray) { - d.push_back(folly::dynamic(b)); - } - value = d; - break; - } - case PropertyType::UInt16Array: { - com_array tmpArray; - propValue.GetUInt16Array(tmpArray); - folly::dynamic d = folly::dynamic::array(); - for (uint16_t b : tmpArray) { - d.push_back(folly::dynamic(b)); - } - value = d; - break; - } - case PropertyType::UInt32Array: { - com_array tmpArray; - propValue.GetUInt32Array(tmpArray); - folly::dynamic d = folly::dynamic::array(); - for (uint32_t b : tmpArray) { - d.push_back(folly::dynamic(b)); - } - value = d; - break; - } - case PropertyType::UInt64Array: { - com_array tmpArray; - propValue.GetUInt64Array(tmpArray); - folly::dynamic d = folly::dynamic::array(); - for (uint64_t b : tmpArray) { - d.push_back(folly::dynamic(b)); - } - value = d; - break; - } - default: - wchar_t buf[512]; - swprintf(buf, ARRAYSIZE(buf), L"Unrecognized argument value type: %d\n", propType); - throw hresult_invalid_argument(buf); - } - - return value; -} - -} // namespace winrt::Microsoft::ReactNative diff --git a/vnext/Microsoft.ReactNative/ReactSupport.h b/vnext/Microsoft.ReactNative/ReactSupport.h deleted file mode 100644 index 5e7b7fe78a6..00000000000 --- a/vnext/Microsoft.ReactNative/ReactSupport.h +++ /dev/null @@ -1,13 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -#pragma once - -#include - -namespace winrt::Microsoft::ReactNative { - -// Convert a WinRT IInspectable into a folly::dynamic object -folly::dynamic ConvertToDynamic(winrt::Windows::Foundation::IInspectable const &object); - -} // namespace winrt::Microsoft::ReactNative diff --git a/vnext/Microsoft.ReactNative/RedBox.cpp b/vnext/Microsoft.ReactNative/RedBox.cpp index d5bf9c752c9..f153631c664 100644 --- a/vnext/Microsoft.ReactNative/RedBox.cpp +++ b/vnext/Microsoft.ReactNative/RedBox.cpp @@ -14,8 +14,6 @@ #include #include -#ifndef CORE_ABI - #include #include #include @@ -27,7 +25,6 @@ #include #include "CppWinRTIncludes.h" #include "Utils/Helpers.h" -#endif // CORE_ABI #include "XamlUtils.h" using namespace winrt::Windows::Foundation; @@ -36,7 +33,6 @@ namespace Mso::React { using IInspectable = winrt::Windows::Foundation::IInspectable; -#ifndef CORE_ABI struct RedBox : public std::enable_shared_from_this { RedBox( winrt::Microsoft::ReactNative::ReactPropertyBag &propBag, @@ -272,7 +268,6 @@ struct DefaultRedBoxHandler final : public std::enable_shared_from_this> m_redBoxes; // Protected by m_lockRedBox const Mso::WeakPtr m_weakReactHost; }; -#endif // CORE_ABI struct RedBoxHandler final : public Mso::React::IRedBoxHandler { RedBoxHandler(winrt::Microsoft::ReactNative::IRedBoxHandler const &redBoxHandler) : m_redBoxHandler(redBoxHandler) {} @@ -316,11 +311,7 @@ std::shared_ptr CreateDefaultRedBoxHandler( const winrt::Microsoft::ReactNative::ReactPropertyBag &propBag, Mso::WeakPtr &&weakReactHost, const Mso::React::IDispatchQueue2 &uiQueue) noexcept { -#ifndef CORE_ABI return std::make_shared(propBag, std::move(weakReactHost), uiQueue); -#else - return nullptr; -#endif } } // namespace Mso::React diff --git a/vnext/Microsoft.ReactNative/RedBoxHandler.cpp b/vnext/Microsoft.ReactNative/RedBoxHandler.cpp index dc8f340d5f5..b48a2870929 100644 --- a/vnext/Microsoft.ReactNative/RedBoxHandler.cpp +++ b/vnext/Microsoft.ReactNative/RedBoxHandler.cpp @@ -61,11 +61,7 @@ struct DefaultRedBoxHandler : winrt::implements(host); -#else - return nullptr; -#endif } } // namespace winrt::Microsoft::ReactNative::implementation diff --git a/vnext/Microsoft.ReactNative/Utils/UwpPreparedScriptStore.cpp b/vnext/Microsoft.ReactNative/Utils/UwpPreparedScriptStore.cpp deleted file mode 100644 index 411edcd1bfb..00000000000 --- a/vnext/Microsoft.ReactNative/Utils/UwpPreparedScriptStore.cpp +++ /dev/null @@ -1,107 +0,0 @@ -#include "pch.h" - -#include -#include -#include -#include -#include -#include "Unicode.h" - -#if _MSC_VER <= 1913 -// VC 19 (2015-2017.6) cannot optimize co_await/cppwinrt usage -#pragma optimize("", off) -#endif - -namespace winrt { -using namespace winrt::Windows::Foundation; -using namespace winrt::Windows::Storage; -}; // namespace winrt - -namespace Microsoft::ReactNative { -UwpPreparedScriptStore::UwpPreparedScriptStore(winrt::hstring uri) { - if (!uri.empty()) { - m_byteCodeFileAsync = winrt::StorageFile::GetFileFromApplicationUriAsync(winrt::Uri(uri)); - } -} - -std::shared_ptr UwpPreparedScriptStore::tryGetPreparedScript( - const facebook::jsi::ScriptSignature &scriptSignature, - const facebook::jsi::JSRuntimeSignature & /*runtimeSignature*/, - const char * /*prepareTag*/ // Optional tag. For e.g. eagerly evaluated vs lazy cache. - ) noexcept { - try { - // check if app bundle version is older than or equal to the prepared script - // version if true then just read the buffer from the prepared script and - // return - auto byteCodeFile = TryGetByteCodeFileSync(scriptSignature); - if (byteCodeFile == nullptr) { - return nullptr; - } - - auto buffer = winrt::FileIO::ReadBufferAsync(byteCodeFile).get(); - auto bytecodeBuffer(std::make_shared(buffer.Length())); - auto dataReader{winrt::Streams::DataReader::FromBuffer(buffer)}; - dataReader.ReadBytes( - winrt::array_view{&bytecodeBuffer->data()[0], &bytecodeBuffer->data()[bytecodeBuffer->size()]}); - dataReader.Close(); - - return bytecodeBuffer; - } catch (...) { - return nullptr; - } -} - -void UwpPreparedScriptStore::persistPreparedScript( - std::shared_ptr preparedScript, - const facebook::jsi::ScriptSignature &scriptMetadata, - const facebook::jsi::JSRuntimeSignature &runtimeMetadata, - const char *prepareTag // Optional tag. For e.g. eagerly evaluated vs lazy cache. - ) noexcept { - persistPreparedScriptAsync(preparedScript, scriptMetadata, runtimeMetadata, prepareTag); -} - -winrt::fire_and_forget UwpPreparedScriptStore::persistPreparedScriptAsync( - std::shared_ptr preparedScript, - const facebook::jsi::ScriptSignature &scriptMetadata, - const facebook::jsi::JSRuntimeSignature &runtimeMetadata, - const char *prepareTag // Optional tag. For e.g. eagerly evaluated vs lazy cache. -) { - try { - co_await winrt::resume_background(); - auto folder = winrt::ApplicationData::Current().LocalCacheFolder(); - auto fileName = winrt::to_hstring(scriptMetadata.url + ".bytecode"); - auto file = co_await folder.CreateFileAsync(fileName, winrt::CreationCollisionOption::ReplaceExisting); - winrt::FileIO::WriteBytesAsync( - file, - winrt::array_view{&preparedScript->data()[0], &preparedScript->data()[preparedScript->size()]}); - } catch (...) { - } -} - -winrt::StorageFile UwpPreparedScriptStore::TryGetByteCodeFileSync( - const facebook::jsi::ScriptSignature &scriptSignature) { - try { - if (m_byteCodeFileAsync != nullptr) { - auto file = m_byteCodeFileAsync.get(); - auto byteCodeVersion = UwpScriptStore::GetFileVersion(file.Path().c_str()); - - if (byteCodeVersion >= scriptSignature.version) { - return file; - } - } - } catch (...) { - // Eat this exception. If we can't get the file from the uri. Still try - // looking in the cache. - } - - // Getting here means one of two things. No bytecode file uri was specified, - // or the file uri was specified but it is outdated. Try looking in LocalCache - // folder for bytecode file and use that. - auto fileName = winrt::to_hstring(scriptSignature.url + ".bytecode"); - auto file = winrt::ApplicationData::Current().LocalCacheFolder().GetFileAsync(fileName).get(); - - auto byteCodeVersion = UwpScriptStore::GetFileVersion(file.Path().c_str()); - - return byteCodeVersion > scriptSignature.version ? file : nullptr; -} -} // namespace Microsoft::ReactNative diff --git a/vnext/Microsoft.ReactNative/Utils/UwpPreparedScriptStore.h b/vnext/Microsoft.ReactNative/Utils/UwpPreparedScriptStore.h deleted file mode 100644 index c2e8ed5eebf..00000000000 --- a/vnext/Microsoft.ReactNative/Utils/UwpPreparedScriptStore.h +++ /dev/null @@ -1,62 +0,0 @@ -#pragma once -#include -#include -#include -#include -#include -#include -#include - -namespace Microsoft::ReactNative { -class UwpPreparedScriptStore : public facebook::jsi::PreparedScriptStore { - public: - UwpPreparedScriptStore(winrt::hstring uri); - std::shared_ptr tryGetPreparedScript( - const facebook::jsi::ScriptSignature &scriptSignature, - const facebook::jsi::JSRuntimeSignature &runtimeSignature, - const char *prepareTag // Optional tag. For e.g. eagerly evaluated vs lazy cache. - ) noexcept override; - - void persistPreparedScript( - std::shared_ptr preparedScript, - const facebook::jsi::ScriptSignature &scriptMetadata, - const facebook::jsi::JSRuntimeSignature &runtimeMetadata, - const char *prepareTag // Optional tag. For e.g. eagerly evaluated vs lazy cache. - ) noexcept override; - - UwpPreparedScriptStore(const UwpPreparedScriptStore &) = delete; - void operator=(const UwpPreparedScriptStore &) = delete; - - private: - winrt::fire_and_forget persistPreparedScriptAsync( - std::shared_ptr preparedScript, - const facebook::jsi::ScriptSignature &scriptMetadata, - const facebook::jsi::JSRuntimeSignature &runtimeMetadata, - const char *prepareTag // Optional tag. For e.g. eagerly evaluated vs lazy cache. - ); - winrt::Windows::Storage::StorageFile TryGetByteCodeFileSync(const facebook::jsi::ScriptSignature &scriptSignature); - winrt::Windows::Foundation::IAsyncOperation m_byteCodeFileAsync; -}; - -class ByteCodeBuffer final : public facebook::jsi::Buffer { - public: - size_t size() const override { - return size_; - } - const uint8_t *data() const { - return byteArray_.get(); - } - - uint8_t *data() { - return byteArray_.get(); - } - - ByteCodeBuffer(int size) : size_(size), byteArray_(std::make_unique(size)) {} - ByteCodeBuffer(const ByteCodeBuffer &) = delete; - void operator=(const ByteCodeBuffer &) = delete; - - private: - int size_; - std::unique_ptr byteArray_; -}; -} // namespace Microsoft::ReactNative diff --git a/vnext/Microsoft.ReactNative/Utils/UwpScriptStore.cpp b/vnext/Microsoft.ReactNative/Utils/UwpScriptStore.cpp deleted file mode 100644 index 59bb0c805db..00000000000 --- a/vnext/Microsoft.ReactNative/Utils/UwpScriptStore.cpp +++ /dev/null @@ -1,56 +0,0 @@ -#include "pch.h" - -#include -#include -#include -#include -#include -#include "Unicode.h" - -namespace winrt { -using namespace winrt::Windows::Foundation; -using namespace winrt::Windows::Storage; -} // namespace winrt - -namespace Microsoft::ReactNative { - -UwpScriptStore::UwpScriptStore() {} - -/* static */ facebook::jsi::ScriptVersion_t UwpScriptStore::GetFileVersion(const std::wstring &filePath) { - // append prefix to allow long file paths. - auto longFilePath = L"\\\\?\\" + filePath; - WIN32_FILE_ATTRIBUTE_DATA fileData; - if (GetFileAttributesEx(longFilePath.c_str(), GetFileExInfoStandard, &fileData)) { - return ((facebook::jsi::ScriptVersion_t)fileData.ftLastWriteTime.dwHighDateTime << 32) | - fileData.ftLastWriteTime.dwLowDateTime; - } - - return 0; -} - -facebook::jsi::VersionedBuffer UwpScriptStore::getVersionedScript(const std::string & /*url*/) noexcept { - facebook::jsi::VersionedBuffer versionedBuffer_; - versionedBuffer_.buffer = nullptr; - versionedBuffer_.version = 0; - - return versionedBuffer_; -} - -// Script version = timestamp of bundle file last created -facebook::jsi::ScriptVersion_t UwpScriptStore::getScriptVersion(const std::string &url) noexcept { - auto version = getScriptVersionAsync(url).get(); - - return version; -} - -std::future UwpScriptStore::getScriptVersionAsync(const std::string &bundleUri) { - co_await winrt::resume_background(); - - const winrt::hstring fileUrl(Microsoft::Common::Unicode::Utf8ToUtf16("ms-appx:///Bundle/" + bundleUri + ".bundle")); - - auto file = co_await winrt::StorageFile::GetFileFromApplicationUriAsync(winrt::Windows::Foundation::Uri{fileUrl}); - - co_return GetFileVersion(file.Path().c_str()); -} - -} // namespace Microsoft::ReactNative diff --git a/vnext/Microsoft.ReactNative/Utils/UwpScriptStore.h b/vnext/Microsoft.ReactNative/Utils/UwpScriptStore.h deleted file mode 100644 index 6b77db3f9e7..00000000000 --- a/vnext/Microsoft.ReactNative/Utils/UwpScriptStore.h +++ /dev/null @@ -1,22 +0,0 @@ -#pragma once -#include -#include - -namespace Microsoft::ReactNative { - -class UwpScriptStore : public facebook::jsi::ScriptStore { - public: - facebook::jsi::VersionedBuffer getVersionedScript(const std::string &url) noexcept override; - facebook::jsi::ScriptVersion_t getScriptVersion(const std::string &url) noexcept override; - UwpScriptStore(); - UwpScriptStore(const UwpScriptStore &) = delete; - void operator=(const UwpScriptStore &) = delete; - - public: - static facebook::jsi::ScriptVersion_t GetFileVersion(const std::wstring &filePath); - - private: - std::future getScriptVersionAsync(const std::string &bundleUri); -}; - -} // namespace Microsoft::ReactNative diff --git a/vnext/Microsoft.ReactNative/Utils/ValueUtils.cpp b/vnext/Microsoft.ReactNative/Utils/ValueUtils.cpp index 497b17bc582..8400d42c7d5 100644 --- a/vnext/Microsoft.ReactNative/Utils/ValueUtils.cpp +++ b/vnext/Microsoft.ReactNative/Utils/ValueUtils.cpp @@ -48,7 +48,7 @@ struct ColorComp { }; winrt::Color ColorFromNumber(DWORD argb) noexcept { - return xaml::FromArgb(GetAFromArgb(argb), GetRFromArgb(argb), GetGFromArgb(argb), GetBFromArgb(argb)); + return winrt::Windows::UI::Color{GetAFromArgb(argb), GetRFromArgb(argb), GetGFromArgb(argb), GetBFromArgb(argb)}; } REACTWINDOWS_API_(winrt::Color) ColorFrom(const folly::dynamic &d) { diff --git a/vnext/Microsoft.ReactNative/XamlUIService.cpp b/vnext/Microsoft.ReactNative/XamlUIService.cpp deleted file mode 100644 index e697522980e..00000000000 --- a/vnext/Microsoft.ReactNative/XamlUIService.cpp +++ /dev/null @@ -1,68 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -#include "pch.h" -#include "XamlUIService.h" -#include "XamlUIService.g.cpp" - -#include "DynamicWriter.h" - -namespace winrt::Microsoft::ReactNative::implementation { - -XamlUIService::XamlUIService(Mso::CntPtr &&context) noexcept : m_context(context) {} - -/*static*/ winrt::Microsoft::ReactNative::XamlUIService XamlUIService::FromContext(IReactContext context) { - return context.Properties() - .Get(XamlUIService::XamlUIServiceProperty().Handle()) - .try_as(); -} - -/*static*/ ReactPropertyId XamlUIService::XamlUIServiceProperty() noexcept { - static ReactPropertyId uiManagerProperty{L"ReactNative.UIManager", L"XamlUIManager"}; - return uiManagerProperty; -} - -ReactPropertyId XamlRootProperty() noexcept { - static ReactPropertyId propId{L"ReactNative.UIManager", L"XamlRoot"}; - return propId; -} - -ReactPropertyId AccessibleRootProperty() noexcept { - static ReactPropertyId propId{L"ReactNative.UIManager", L"AccessibleRoot"}; - return propId; -} - -/*static*/ void XamlUIService::SetXamlRoot( - IReactPropertyBag const &properties, - xaml::XamlRoot const &xamlRoot) noexcept { - winrt::Microsoft::ReactNative::ReactPropertyBag(properties).Set(XamlRootProperty(), xamlRoot); -} - -/*static*/ void XamlUIService::SetAccessibleRoot( - IReactPropertyBag const &properties, - xaml::FrameworkElement const &accessibleRoot) noexcept { - winrt::Microsoft::ReactNative::ReactPropertyBag(properties).Set(AccessibleRootProperty(), accessibleRoot); -} - -/*static*/ xaml::XamlRoot XamlUIService::GetXamlRoot(IReactPropertyBag const &properties) noexcept { - return winrt::Microsoft::ReactNative::ReactPropertyBag(properties).Get(XamlRootProperty()); -} - -/*static*/ xaml::FrameworkElement XamlUIService::GetAccessibleRoot(IReactPropertyBag const &properties) noexcept { - return winrt::Microsoft::ReactNative::ReactPropertyBag(properties).Get(AccessibleRootProperty()); -} - -ReactPropertyId XamlIslandProperty() noexcept { - static ReactPropertyId propId{L"ReactNative.UIManager", L"XamlIsland"}; - return propId; -} - -/*static*/ void XamlUIService::SetIslandWindowHandle(IReactPropertyBag const &properties, uint64_t hwnd) noexcept { - winrt::Microsoft::ReactNative::ReactPropertyBag(properties).Set(XamlIslandProperty(), hwnd); -} -/*static*/ uint64_t XamlUIService::GetIslandWindowHandle(IReactPropertyBag const &properties) noexcept { - auto hwnd = winrt::Microsoft::ReactNative::ReactPropertyBag(properties).Get(XamlIslandProperty()); - return hwnd.value_or(0); -} - -} // namespace winrt::Microsoft::ReactNative::implementation diff --git a/vnext/Microsoft.ReactNative/XamlUIService.h b/vnext/Microsoft.ReactNative/XamlUIService.h deleted file mode 100644 index ebe848481b3..00000000000 --- a/vnext/Microsoft.ReactNative/XamlUIService.h +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -#pragma once - -#include "XamlUIService.g.h" -#include "ReactHost/React.h" -#include "ReactPropertyBag.h" -#include "winrt/Microsoft.ReactNative.h" - -namespace winrt::Microsoft::ReactNative::implementation { -struct XamlUIService : XamlUIServiceT { - public: - XamlUIService(Mso::CntPtr &&context) noexcept; - static ReactPropertyId XamlUIServiceProperty() noexcept; - - static winrt::Microsoft::ReactNative::XamlUIService FromContext(IReactContext context); - - static void SetXamlRoot(IReactPropertyBag const &properties, xaml::XamlRoot const &xamlRoot) noexcept; - static void SetAccessibleRoot( - IReactPropertyBag const &properties, - xaml::FrameworkElement const &accessibleRoot) noexcept; - static xaml::XamlRoot GetXamlRoot(IReactPropertyBag const &properties) noexcept; - static xaml::FrameworkElement GetAccessibleRoot(IReactPropertyBag const &properties) noexcept; - - static void SetIslandWindowHandle(IReactPropertyBag const &properties, uint64_t hwnd) noexcept; - static uint64_t GetIslandWindowHandle(IReactPropertyBag const &properties) noexcept; - - private: - Mso::CntPtr m_context; -}; - -} // namespace winrt::Microsoft::ReactNative::implementation - -namespace winrt::Microsoft::ReactNative::factory_implementation { -struct XamlUIService : XamlUIServiceT {}; -} // namespace winrt::Microsoft::ReactNative::factory_implementation diff --git a/vnext/Microsoft.ReactNative/XamlUIService.idl b/vnext/Microsoft.ReactNative/XamlUIService.idl deleted file mode 100644 index a9a881fc61e..00000000000 --- a/vnext/Microsoft.ReactNative/XamlUIService.idl +++ /dev/null @@ -1,53 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import "IReactContext.idl"; - -#include "NamespaceRedirect.h" -#include "DocString.h" - -namespace Microsoft.ReactNative -{ - [default_interface] - [webhosthidden] - DOC_STRING( - "Provides access to XAML UI-specific functionality. " - "It provides access to APIs to get a XAML element from a react tag, and to dispatch events to JS components.") - runtimeclass XamlUIService - { - DOC_STRING("Use this method to get access to the @XamlUIService associated with the @IReactContext.") - static XamlUIService FromContext(IReactContext context); - - DOC_STRING( - "Sets the @Windows.UI.Xaml.XamlRoot element for the app. " - "This must be manually provided to the @ReactInstanceSettings object when using XAML Islands " - "so that certain APIs work correctly.\n" - "For more information, see [Host WinRT XAML Controls in desktop apps (XAML Islands)]" - "(https://docs.microsoft.com/windows/apps/desktop/modernize/xaml-islands).") - static void SetXamlRoot(IReactPropertyBag properties, XAML_NAMESPACE.XamlRoot xamlRoot); - - DOC_STRING( - "Sets the @Windows.UI.Xaml.FrameworkElement that will act as the default accessible element for the app. " - "The element must be able to create an automation peer " - "(see @Windows.UI.Xaml.Automation.Peers.FrameworkElementAutomationPeer), or have the Landmark type property set " - "(see @Windows.UI.Xaml.Automation.AutomationProperties.LandmarkTypeProperty).\n" - "This must be manually provided to the @ReactInstanceSettings when using XAML Islands " - "to have access to functionality related to accessibility.") - static void SetAccessibleRoot(IReactPropertyBag properties, XAML_NAMESPACE.FrameworkElement accessibleRoot); - - DOC_STRING("Retrieves the default @Windows.UI.Xaml.XamlRoot for the app.") - static XAML_NAMESPACE.XamlRoot GetXamlRoot(IReactPropertyBag properties); - - DOC_STRING("Retrieves the default @Windows.UI.Xaml.FrameworkElement that will be used for the app for accessibility purposes (e.g. to announce).") - static XAML_NAMESPACE.FrameworkElement GetAccessibleRoot(IReactPropertyBag properties); - - DOC_STRING( - "Gets the window handle HWND (as an UInt64) used as the XAML Island window for the current React instance.") - static UInt64 GetIslandWindowHandle(IReactPropertyBag properties); - - DOC_STRING( - "Sets the windowHandle HWND (as an UInt64) to be the XAML Island window for the current React instance.\n" - "Pass the value returned by IDesktopWindowXamlSourceNative get_WindowHandle.") - static void SetIslandWindowHandle(IReactPropertyBag properties, UInt64 windowHandle); - } -} // namespace Microsoft.ReactNative diff --git a/vnext/PropertySheets/ReactNativeArchitecture.props b/vnext/PropertySheets/ReactNativeArchitecture.props index 4353cacfa52..402d082eb44 100644 --- a/vnext/PropertySheets/ReactNativeArchitecture.props +++ b/vnext/PropertySheets/ReactNativeArchitecture.props @@ -7,23 +7,23 @@ --> - false + true - + - + - + - + true true @@ -35,7 +35,7 @@ RNW_NEW_ARCH;$(DefineConstants) - + RNW_NEW_ARCH;%(PreprocessorDefinitions) @@ -44,24 +44,6 @@ - - - - - - - - - - - - false - - - true - false - - true diff --git a/vnext/ReactWindows-Desktop.sln b/vnext/ReactWindows-Desktop.sln index cfddcb84673..5c3bbffcd14 100644 --- a/vnext/ReactWindows-Desktop.sln +++ b/vnext/ReactWindows-Desktop.sln @@ -77,8 +77,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "ReactNative", "ReactNative" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Folly", "Folly", "{41F31595-2F20-4D6B-A6CF-60444415012A}" EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "React.Windows.Desktop.ABITests", "Desktop.ABITests\React.Windows.Desktop.ABITests.vcxproj", "{44DCED9B-9C4C-48FE-8545-0930192BBC16}" -EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Include", "include\Include.vcxitems", "{EF074BA1-2D54-4D49-A28E-5E040B47CD2E}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Common", "Common\Common.vcxproj", "{FCA38F3C-7C73-4C47-BE4E-32F77FA8538D}" @@ -193,18 +191,6 @@ Global {700A84FD-F92A-43F1-8D06-B0E0745DF9B5}.Release|x64.Build.0 = Release|x64 {700A84FD-F92A-43F1-8D06-B0E0745DF9B5}.Release|x86.ActiveCfg = Release|Win32 {700A84FD-F92A-43F1-8D06-B0E0745DF9B5}.Release|x86.Build.0 = Release|Win32 - {44DCED9B-9C4C-48FE-8545-0930192BBC16}.Debug|ARM64.ActiveCfg = Debug|Win32 - {44DCED9B-9C4C-48FE-8545-0930192BBC16}.Debug|ARM64EC.ActiveCfg = Debug|ARM64EC - {44DCED9B-9C4C-48FE-8545-0930192BBC16}.Debug|x64.ActiveCfg = Debug|x64 - {44DCED9B-9C4C-48FE-8545-0930192BBC16}.Debug|x64.Build.0 = Debug|x64 - {44DCED9B-9C4C-48FE-8545-0930192BBC16}.Debug|x86.ActiveCfg = Debug|Win32 - {44DCED9B-9C4C-48FE-8545-0930192BBC16}.Debug|x86.Build.0 = Debug|Win32 - {44DCED9B-9C4C-48FE-8545-0930192BBC16}.Release|ARM64.ActiveCfg = Release|Win32 - {44DCED9B-9C4C-48FE-8545-0930192BBC16}.Release|ARM64EC.ActiveCfg = Release|ARM64EC - {44DCED9B-9C4C-48FE-8545-0930192BBC16}.Release|x64.ActiveCfg = Release|x64 - {44DCED9B-9C4C-48FE-8545-0930192BBC16}.Release|x64.Build.0 = Release|x64 - {44DCED9B-9C4C-48FE-8545-0930192BBC16}.Release|x86.ActiveCfg = Release|Win32 - {44DCED9B-9C4C-48FE-8545-0930192BBC16}.Release|x86.Build.0 = Release|Win32 {FCA38F3C-7C73-4C47-BE4E-32F77FA8538D}.Debug|ARM64.ActiveCfg = Debug|ARM64 {FCA38F3C-7C73-4C47-BE4E-32F77FA8538D}.Debug|ARM64.Build.0 = Debug|ARM64 {FCA38F3C-7C73-4C47-BE4E-32F77FA8538D}.Debug|ARM64EC.ActiveCfg = Debug|ARM64EC @@ -281,8 +267,6 @@ Global GlobalSection(SharedMSBuildProjectFiles) = preSolution Mso\Mso.vcxitems*{1958ceaa-fbe0-44e3-8a99-90ad85531ffe}*SharedItemsImports = 4 Shared\Shared.vcxitems*{2049dbe9-8d13-42c9-ae4b-413ae38fffd0}*SharedItemsImports = 9 - Microsoft.ReactNative.Cxx\Microsoft.ReactNative.Cxx.vcxitems*{44dced9b-9c4c-48fe-8545-0930192bbc16}*SharedItemsImports = 4 - Mso\Mso.vcxitems*{44dced9b-9c4c-48fe-8545-0930192bbc16}*SharedItemsImports = 4 Mso\Mso.vcxitems*{84e05bfa-cbaf-4f0d-bfb6-4ce85742a57e}*SharedItemsImports = 9 Microsoft.ReactNative.Cxx\Microsoft.ReactNative.Cxx.vcxitems*{95048601-c3dc-475f-adf8-7c0c764c10d5}*SharedItemsImports = 4 Mso\Mso.vcxitems*{95048601-c3dc-475f-adf8-7c0c764c10d5}*SharedItemsImports = 4 diff --git a/vnext/Shared/DevSettings.h b/vnext/Shared/DevSettings.h index 3687f686698..b06a775f164 100644 --- a/vnext/Shared/DevSettings.h +++ b/vnext/Shared/DevSettings.h @@ -86,9 +86,6 @@ struct DevSettings { bool enableDefaultCrashHandler{false}; - // Enable concurrent mode by installing runtimeScheduler - bool useRuntimeScheduler{false}; - // The HostTarget instance for Fusebox facebook::react::jsinspector_modern::HostTarget *inspectorHostTarget; }; diff --git a/vnext/Shared/Shared.vcxitems b/vnext/Shared/Shared.vcxitems index 7f3f4dbebec..14afc5a6b13 100644 --- a/vnext/Shared/Shared.vcxitems +++ b/vnext/Shared/Shared.vcxitems @@ -29,11 +29,6 @@ $(ReactNativeWindowsDir)Microsoft.ReactNative\CompositionContext.idl Code - - true - $(ReactNativeWindowsDir)Microsoft.ReactNative\CompositionContext.idl - Code - $(ReactNativeWindowsDir)Microsoft.ReactNative\IReactCompositionViewComponentBuilder.idl $(ReactNativeWindowsDir)Microsoft.ReactNative\IReactViewComponentBuilder.idl @@ -63,11 +58,6 @@ $(ReactNativeWindowsDir)Microsoft.ReactNative\CompositionUIService.idl Code - - true - $(ReactNativeWindowsDir)Microsoft.ReactNative\CompositionUIService.idl - Code - $(ReactNativeWindowsDir)Microsoft.ReactNative\FocusManager.idl Code @@ -100,11 +90,6 @@ $(ReactNativeWindowsDir)Microsoft.ReactNative\Theme.idl - - true - $(ReactNativeWindowsDir)Microsoft.ReactNative\Theme.idl - Code - @@ -231,6 +216,8 @@ $(MSBuildThisFileDirectory)..\Microsoft.ReactNative\JsiApi.idl + + $(MSBuildThisFileDirectory)..\Microsoft.ReactNative\ReactNativeAppBuilder.idl @@ -370,13 +357,46 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - + + + + + + + @@ -568,6 +588,7 @@ + @@ -587,25 +608,25 @@ - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + diff --git a/vnext/Shared/Shared.vcxitems.filters b/vnext/Shared/Shared.vcxitems.filters index 4a0d1ee7ddb..32c1cd327ec 100644 --- a/vnext/Shared/Shared.vcxitems.filters +++ b/vnext/Shared/Shared.vcxitems.filters @@ -163,6 +163,41 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -297,6 +332,24 @@ + + + + + + + + + + + + + + + + + + diff --git a/vnext/Shared/Utils.cpp b/vnext/Shared/Utils.cpp index 93ea7224ede..fe19435e485 100644 --- a/vnext/Shared/Utils.cpp +++ b/vnext/Shared/Utils.cpp @@ -4,14 +4,6 @@ #include "Utils.h" #include -#include -#include -#include -#include -#include -#include - -#include #include using std::string; @@ -44,86 +36,6 @@ std::string FormatString(const char *format, ...) { return result; } -namespace { -IAsyncOperation getPackagedApplicationDataPath(const wchar_t *childFolder) { - auto localFolder = winrt::Windows::Storage::ApplicationData::Current().LocalFolder(); - if (!childFolder) { - co_return localFolder.Path(); - } else { - auto subfolder = co_await localFolder.CreateFolderAsync( - childFolder, winrt::Windows::Storage::CreationCollisionOption::OpenIfExists); - co_return subfolder.Path(); - } -} - -IAsyncOperation getUnPackagedApplicationDataPath(const wchar_t *childFolder) { - wchar_t *pwzAppDataPath = NULL; - if (CALL_INDIRECT( - L"shell32.dll", - SHGetKnownFolderPath, - FOLDERID_AppDataProgramData, - KF_FLAG_CREATE, - static_cast(NULL), - &pwzAppDataPath) != S_OK) - std::abort(); - - winrt::hstring appDataPath(pwzAppDataPath); - CoTaskMemFree(pwzAppDataPath); - - if (!childFolder) { - co_return appDataPath; - } else { - std::wostringstream os; - os << appDataPath.c_str() << "\\" << childFolder; - auto childFolderPath = os.str(); - if (!CreateDirectoryW(childFolderPath.c_str(), NULL) && GetLastError() != ERROR_ALREADY_EXISTS) - std::abort(); - co_return winrt::hstring(childFolderPath); - } -} -} // namespace - -IAsyncOperation getApplicationDataPath(const wchar_t *childFolder) { - if (Microsoft::ReactNative::HasPackageIdentity()) { - co_return co_await getPackagedApplicationDataPath(childFolder); - } else { - co_return co_await getUnPackagedApplicationDataPath(childFolder); - } -} - -Url::Url(string &&source) { - // ( 1 ) ( 2 ) ( 3 (4) ) ( 5 ) ( 6 (7) ) - std::regex expression("(http|https|ws|wss)://([^:/\\?]+)(:(\\d+))?(/[^\\?]*)?(\\?(.*))?$"); - // scheme host port path query - constexpr int schemeIdx = 1; - constexpr int hostIdx = 2; - constexpr int portIdx = 4; - constexpr int pathIdx = 5; - constexpr int queryIdx = 7; - - std::cmatch match; - if (std::regex_match(source.c_str(), match, expression)) { - this->scheme = string(match[schemeIdx].first, match[schemeIdx].second); - this->host = string(match[hostIdx].first, match[hostIdx].second); - this->port = string(match[portIdx].first, match[portIdx].second); - this->path = string(match[pathIdx].first, match[pathIdx].second); - - if (1 > path.length() || '/' != path.at(0)) - path.insert(0, "/"); - - this->queryString = string(match[queryIdx].first, match[queryIdx].second); - } else { - throw std::exception("Could not parse URL."); - } -} - -string Url::Target() { - if (1 > queryString.length()) - return path; - else - return path.append("?").append(queryString); -} - } // namespace Microsoft::React // Folly/folly/SafeAssert.cpp brings in a bunch of file APIs that we otherwise diff --git a/vnext/Shared/Utils.h b/vnext/Shared/Utils.h index 81e4e1d5576..837c587d310 100644 --- a/vnext/Shared/Utils.h +++ b/vnext/Shared/Utils.h @@ -8,20 +8,6 @@ namespace Microsoft::React { -struct Url { - std::string scheme; - std::string host; - std::string port; - std::string path; - std::string queryString; - - Url(std::string &&urlString); - - std::string Target(); -}; - -winrt::Windows::Foundation::IAsyncOperation getApplicationDataPath(const wchar_t *childfolder); - // string formatting std::string FormatString(_Printf_format_string_ const char *format, ...);