Skip to content

Commit 61677f2

Browse files
RebeccaAnnejonwisalmedina-ms
authored
Merge Jonwis' object model conversion into UWP (#6322)
* Merge u/jonwis/winui3 from fork * Copy object model changes from winappsdk to uwp * Delete winappsdk directory * Rename WinUI3 to Uwp - everything builds * Testing, bug fixes, and cleanup * Fix propert_opt setter * Version and package changes * Remove nuget source from nuget config * version changes * Update package pushing readme Co-authored-by: Jon Wiswall <jonwis@microsoft.com> Co-authored-by: almedina-ms <35784165+almedina-ms@users.noreply.github.com>
1 parent 13943f4 commit 61677f2

File tree

162 files changed

+4018
-12058
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

162 files changed

+4018
-12058
lines changed

source/shared/cpp/ObjectModel/EnumMagic.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,19 +7,19 @@ namespace AdaptiveCards
77
{
88
struct CaseInsensitiveEqualTo
99
{
10-
bool operator()(const std::string& lhs, const std::string& rhs) const noexcept
10+
template<typename T> bool operator()(T const& lhs, T const& rhs) const noexcept
1111
{
12-
return std::equal(lhs.begin(), lhs.end(), rhs.begin(), rhs.end(), [](unsigned char a, unsigned char b) {
12+
return std::equal(std::begin(lhs), std::end(lhs), std::begin(rhs), std::end(rhs), [](auto a, auto b) {
1313
return std::toupper(a) == std::toupper(b);
1414
});
1515
}
1616
};
1717

1818
struct CaseInsensitiveHash
1919
{
20-
size_t operator()(const std::string& keyval) const noexcept
20+
template<typename T> size_t operator()(T const& keyval) const noexcept
2121
{
22-
return std::accumulate(keyval.cbegin(), keyval.cend(), size_t{0}, [](size_t acc, unsigned char c) {
22+
return std::accumulate(std::cbegin(keyval), std::cend(keyval), size_t{0}, [](size_t acc, auto c) {
2323
return acc + std::toupper(c);
2424
});
2525
}

source/uwp/AdaptiveCardsObjectModel/AdaptiveCardsObjectModel.vcxproj

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3-
<Import Project="..\packages\Microsoft.Windows.CppWinRT.2.0.200630.5\build\native\Microsoft.Windows.CppWinRT.props" Condition="Exists('..\packages\Microsoft.Windows.CppWinRT.2.0.200630.5\build\native\Microsoft.Windows.CppWinRT.props')" />
3+
<Import Project="..\packages\Microsoft.Windows.CppWinRT.2.0.210913.7\build\native\Microsoft.Windows.CppWinRT.props" Condition="Exists('..\packages\Microsoft.Windows.CppWinRT.2.0.210913.7\build\native\Microsoft.Windows.CppWinRT.props')" />
44
<ItemGroup Label="ProjectConfigurations">
55
<ProjectConfiguration Include="Debug|ARM">
66
<Configuration>Debug</Configuration>
@@ -50,6 +50,8 @@
5050
<GenerateManifest>false</GenerateManifest>
5151
<ConfigurationType>DynamicLibrary</ConfigurationType>
5252
<PlatformToolset>v142</PlatformToolset>
53+
<CppWinRTFastAbi>true</CppWinRTFastAbi>
54+
<CppWinRTOptimized>true</CppWinRTOptimized>
5355
</PropertyGroup>
5456
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
5557
<PropertyGroup Condition="'$(Configuration)'=='Debug'" Label="Configuration">
@@ -210,10 +212,8 @@
210212
<ClInclude Include="lib\AdaptiveShowCardAction.h" />
211213
<ClInclude Include="lib\AdaptiveSubmitAction.h" />
212214
<ClInclude Include="lib\AdaptiveTextBlock.h" />
213-
<ClInclude Include="lib\ErrorHandling.h" />
214215
<ClInclude Include="lib\pch.h" />
215216
<ClInclude Include="lib\ObjectModelUtil.h" />
216-
<ClInclude Include="lib\Vector.h" />
217217
<ClCompile Include="lib\AdaptiveBackgroundImage.cpp" />
218218
<ClCompile Include="lib\AdaptiveMedia.cpp">
219219
<PreprocessToFile Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">false</PreprocessToFile>
@@ -230,7 +230,6 @@
230230
<ClCompile Include="lib\AdaptiveOpenUrlActionParser.cpp" />
231231
<ClCompile Include="lib\AdaptiveRichTextBlock.cpp" />
232232
<ClCompile Include="lib\AdaptiveRichTextBlockParser.cpp" />
233-
<ClCompile Include="lib\AdaptiveTextElement.cpp" />
234233
<ClCompile Include="lib\AdaptiveTextRun.cpp" />
235234
<ClCompile Include="lib\AdaptiveToggleVisibilityActionParser.cpp" />
236235
<ClCompile Include="lib\AdaptiveToggleVisibilityTarget.cpp" />
@@ -309,13 +308,14 @@
309308
</ItemGroup>
310309
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
311310
<ImportGroup Label="ExtensionTargets">
312-
<Import Project="..\packages\Microsoft.Windows.CppWinRT.2.0.200630.5\build\native\Microsoft.Windows.CppWinRT.targets" Condition="Exists('..\packages\Microsoft.Windows.CppWinRT.2.0.200630.5\build\native\Microsoft.Windows.CppWinRT.targets')" />
311+
<Import Project="..\packages\Microsoft.Windows.ImplementationLibrary.1.0.210803.1\build\native\Microsoft.Windows.ImplementationLibrary.targets" Condition="Exists('..\packages\Microsoft.Windows.ImplementationLibrary.1.0.210803.1\build\native\Microsoft.Windows.ImplementationLibrary.targets')" />
312+
<Import Project="..\packages\Microsoft.Windows.CppWinRT.2.0.210913.7\build\native\Microsoft.Windows.CppWinRT.targets" Condition="Exists('..\packages\Microsoft.Windows.CppWinRT.2.0.210913.7\build\native\Microsoft.Windows.CppWinRT.targets')" />
313313
</ImportGroup>
314314
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
315315
<PropertyGroup>
316316
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
317317
</PropertyGroup>
318-
<Error Condition="!Exists('..\packages\Microsoft.Windows.CppWinRT.2.0.200630.5\build\native\Microsoft.Windows.CppWinRT.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Microsoft.Windows.CppWinRT.2.0.200630.5\build\native\Microsoft.Windows.CppWinRT.props'))" />
319-
<Error Condition="!Exists('..\packages\Microsoft.Windows.CppWinRT.2.0.200630.5\build\native\Microsoft.Windows.CppWinRT.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Microsoft.Windows.CppWinRT.2.0.200630.5\build\native\Microsoft.Windows.CppWinRT.targets'))" />
318+
<Error Condition="!Exists('..\packages\Microsoft.Windows.CppWinRT.2.0.210913.7\build\native\Microsoft.Windows.CppWinRT.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Microsoft.Windows.CppWinRT.2.0.210913.7\build\native\Microsoft.Windows.CppWinRT.props'))" />
319+
<Error Condition="!Exists('..\packages\Microsoft.Windows.CppWinRT.2.0.210913.7\build\native\Microsoft.Windows.CppWinRT.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Microsoft.Windows.CppWinRT.2.0.210913.7\build\native\Microsoft.Windows.CppWinRT.targets'))" />
320320
</Target>
321321
</Project>

source/uwp/AdaptiveCardsObjectModel/AdaptiveCardsObjectModel.vcxproj.filters

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,6 @@
6363
<ClCompile Include="lib\AdaptiveRichTextBlock.cpp" />
6464
<ClCompile Include="lib\AdaptiveRichTextBlockParser.cpp" />
6565
<ClCompile Include="lib\AdaptiveTextRun.cpp" />
66-
<ClCompile Include="lib\AdaptiveTextElement.cpp" />
6766
<ClCompile Include="lib\AdaptiveRequirement.cpp" />
6867
<ClCompile Include="lib\AdaptiveExecuteAction.cpp" />
6968
<ClCompile Include="lib\AdaptiveExecuteActionParser.cpp" />
@@ -85,10 +84,8 @@
8584
<ClInclude Include="lib\AdaptiveContainer.h" />
8685
<ClInclude Include="lib\AdaptiveImage.h" />
8786
<ClInclude Include="lib\AdaptiveTextBlock.h" />
88-
<ClInclude Include="lib\ErrorHandling.h" />
8987
<ClInclude Include="lib\pch.h" />
9088
<ClInclude Include="lib\ObjectModelUtil.h" />
91-
<ClInclude Include="lib\Vector.h" />
9289
<ClInclude Include="lib\AdaptiveFactSet.h" />
9390
<ClInclude Include="lib\AdaptiveFact.h" />
9491
<ClInclude Include="lib\AdaptiveImageSet.h" />

source/uwp/AdaptiveCardsObjectModel/dll/dll.cpp

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,13 @@
55
#include <windows.h>
66
#include <wrl.h>
77
#include <wrl\wrappers\corewrappers.h>
8+
#include <module.g.cpp>
89

910
using namespace Microsoft::WRL;
1011

1112
STDAPI DllGetActivationFactory(_In_ HSTRING activatableClassId, _COM_Outptr_ IActivationFactory** factory)
1213
{
13-
return Module<ModuleType::InProc>::GetModule().GetActivationFactory(activatableClassId, factory);
14+
return WINRT_GetActivationFactory(activatableClassId, reinterpret_cast<void**>(factory));
1415
}
1516

1617
STDAPI DllGetClassObject(_In_ REFCLSID rclsid, _In_ REFIID riid, _COM_Outptr_ void** ppv)
@@ -20,13 +21,7 @@ STDAPI DllGetClassObject(_In_ REFCLSID rclsid, _In_ REFIID riid, _COM_Outptr_ vo
2021

2122
STDAPI DllCanUnloadNow()
2223
{
23-
HRESULT hr = S_FALSE;
24-
if (Module<ModuleType::InProc>::GetModule().GetObjectCount() == 0)
25-
{
26-
Module<ModuleType::InProc>::GetModule().Terminate();
27-
hr = S_OK;
28-
}
29-
return hr;
24+
return WINRT_CanUnloadNow();
3025
}
3126

3227
STDAPI_(BOOL) DllMain(_In_ HINSTANCE hInstance, _In_ DWORD dwReason, _In_ void* /*lpReserved*/)

0 commit comments

Comments
 (0)