diff --git a/.gitignore b/.gitignore index 558aadae5a..863bfdce8f 100644 --- a/.gitignore +++ b/.gitignore @@ -210,6 +210,8 @@ PublishScripts/ # NuGet v3's project.json files produces more ignorable files *.nuget.props *.nuget.targets +# except our intentionally checked in local repository +!tools/nuget/*.nupkg # Microsoft Azure Build Output csx/ diff --git a/DevCheck.ps1 b/DevCheck.ps1 index 635d5ac0e0..e3dedb48ca 100644 --- a/DevCheck.ps1 +++ b/DevCheck.ps1 @@ -322,7 +322,7 @@ function Get-VSWhere { $global:vswhere = Get-VSWhereOnline } - } + } if ([string]::IsNullOrEmpty($global:vswhere)) { Write-Host "ERROR: vswhere.exe not found" -ForegroundColor Red -BackgroundColor Black @@ -1010,8 +1010,8 @@ function Test-PackagesConfig else { Write-Host "ERROR: Unknown version $name=$version in $filename" -ForegroundColor Red -BackgroundColor Black - $global:issues++ - } + $global:issues++ + } } if (-not($package.HasAttribute("targetFramework"))) diff --git a/HybridCRT.props b/HybridCRT.props index 0260ccbdc4..3b898d1a7f 100644 --- a/HybridCRT.props +++ b/HybridCRT.props @@ -2,7 +2,11 @@ - + + $(Configuration) + + + MultiThreadedDebug @@ -16,7 +20,7 @@ %(AdditionalOptions) /defaultlib:ucrtd.lib - + MultiThreaded diff --git a/NuGet.config b/NuGet.config index 77870f80f1..53cf0cce2a 100644 --- a/NuGet.config +++ b/NuGet.config @@ -7,8 +7,23 @@ + + + + diff --git a/WindowsAppRuntime.sln b/WindowsAppRuntime.sln index 775f444ce2..81ac78588e 100644 --- a/WindowsAppRuntime.sln +++ b/WindowsAppRuntime.sln @@ -475,6 +475,7 @@ EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "KozaniManager", "dev\Kozani\KozaniManager\KozaniManager.vcxproj", "{829CDB09-EEFE-4188-A045-3FC6BE7BD96B}" ProjectSection(ProjectDependencies) = postProject {22747850-42DE-489B-BD0D-F59DB3DE25AD} = {22747850-42DE-489B-BD0D-F59DB3DE25AD} + {3F28C3ED-2548-4530-8B6C-832FAE0E993D} = {3F28C3ED-2548-4530-8B6C-832FAE0E993D} {5C0E77FA-B6F4-4B3F-AAE5-AB85CF97816F} = {5C0E77FA-B6F4-4B3F-AAE5-AB85CF97816F} {B73AD907-6164-4294-88FB-F3C9C10DA1F1} = {B73AD907-6164-4294-88FB-F3C9C10DA1F1} {CFC67AC3-3DC3-4981-A9BB-BC5ED06542D4} = {CFC67AC3-3DC3-4981-A9BB-BC5ED06542D4} @@ -485,6 +486,7 @@ EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "KozaniRemoteManager", "dev\Kozani\KozaniRemoteManager\KozaniRemoteManager.vcxproj", "{A11C6664-F26A-4E71-B440-2E4E1BA09A93}" ProjectSection(ProjectDependencies) = postProject {133BFD48-FD50-4B35-9E0C-C6B362E13027} = {133BFD48-FD50-4B35-9E0C-C6B362E13027} + {3F28C3ED-2548-4530-8B6C-832FAE0E993D} = {3F28C3ED-2548-4530-8B6C-832FAE0E993D} {B73AD907-6164-4294-88FB-F3C9C10DA1F1} = {B73AD907-6164-4294-88FB-F3C9C10DA1F1} {B9933E40-5A7C-482E-9FF3-FC06C1A7B37E} = {B9933E40-5A7C-482E-9FF3-FC06C1A7B37E} {EAFEF760-EB96-436D-BDD0-C00B3C8BC8E7} = {EAFEF760-EB96-436D-BDD0-C00B3C8BC8E7} @@ -617,6 +619,10 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "data", "data", "{9CE0ED94-0 EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "KozaniManager.Msix", "test\Kozani\data\KozaniManager.Msix\KozaniManager.Msix.vcxproj", "{D4D29026-C15C-49A3-BEC5-4D477028962C}" EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "KozaniProtocol", "KozaniProtocol", "{82197F64-3A88-4C48-AEF9-7E62E71D75BB}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "KozaniProtocol", "dev\Kozani\KozaniProtocol\KozaniProtocol.vcxproj", "{3F28C3ED-2548-4530-8B6C-832FAE0E993D}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -2180,6 +2186,22 @@ Global {D4D29026-C15C-49A3-BEC5-4D477028962C}.Release|x64.Build.0 = Release|x64 {D4D29026-C15C-49A3-BEC5-4D477028962C}.Release|x86.ActiveCfg = Release|Win32 {D4D29026-C15C-49A3-BEC5-4D477028962C}.Release|x86.Build.0 = Release|Win32 + {3F28C3ED-2548-4530-8B6C-832FAE0E993D}.Debug|Any CPU.ActiveCfg = Debug|x64 + {3F28C3ED-2548-4530-8B6C-832FAE0E993D}.Debug|Any CPU.Build.0 = Debug|x64 + {3F28C3ED-2548-4530-8B6C-832FAE0E993D}.Debug|ARM64.ActiveCfg = Debug|ARM64 + {3F28C3ED-2548-4530-8B6C-832FAE0E993D}.Debug|ARM64.Build.0 = Debug|ARM64 + {3F28C3ED-2548-4530-8B6C-832FAE0E993D}.Debug|x64.ActiveCfg = Debug|x64 + {3F28C3ED-2548-4530-8B6C-832FAE0E993D}.Debug|x64.Build.0 = Debug|x64 + {3F28C3ED-2548-4530-8B6C-832FAE0E993D}.Debug|x86.ActiveCfg = Debug|Win32 + {3F28C3ED-2548-4530-8B6C-832FAE0E993D}.Debug|x86.Build.0 = Debug|Win32 + {3F28C3ED-2548-4530-8B6C-832FAE0E993D}.Release|Any CPU.ActiveCfg = Release|x64 + {3F28C3ED-2548-4530-8B6C-832FAE0E993D}.Release|Any CPU.Build.0 = Release|x64 + {3F28C3ED-2548-4530-8B6C-832FAE0E993D}.Release|ARM64.ActiveCfg = Release|ARM64 + {3F28C3ED-2548-4530-8B6C-832FAE0E993D}.Release|ARM64.Build.0 = Release|ARM64 + {3F28C3ED-2548-4530-8B6C-832FAE0E993D}.Release|x64.ActiveCfg = Release|x64 + {3F28C3ED-2548-4530-8B6C-832FAE0E993D}.Release|x64.Build.0 = Release|x64 + {3F28C3ED-2548-4530-8B6C-832FAE0E993D}.Release|x86.ActiveCfg = Release|Win32 + {3F28C3ED-2548-4530-8B6C-832FAE0E993D}.Release|x86.Build.0 = Release|Win32 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -2366,6 +2388,8 @@ Global {400ED5EC-4530-4ADB-8DCE-9D1E6708A1F5} = {49CF5AB7-304F-4C78-A098-A77B2931F64E} {9CE0ED94-078A-405F-8599-BFC2D8D6E537} = {9164C50F-E9CA-41BD-BCA9-5F30845FA257} {D4D29026-C15C-49A3-BEC5-4D477028962C} = {9CE0ED94-078A-405F-8599-BFC2D8D6E537} + {82197F64-3A88-4C48-AEF9-7E62E71D75BB} = {84F66485-4391-41C7-89CB-D5006EDF1383} + {3F28C3ED-2548-4530-8B6C-832FAE0E993D} = {82197F64-3A88-4C48-AEF9-7E62E71D75BB} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {4B3D7591-CFEC-4762-9A07-ABE99938FB77} diff --git a/dev/Kozani/KozaniManager/KozaniManager.vcxproj b/dev/Kozani/KozaniManager/KozaniManager.vcxproj index 1fd2e6ecab..558d07b64f 100644 --- a/dev/Kozani/KozaniManager/KozaniManager.vcxproj +++ b/dev/Kozani/KozaniManager/KozaniManager.vcxproj @@ -5,6 +5,7 @@ + Debug @@ -47,6 +48,8 @@ true + + Release false @@ -88,14 +91,15 @@ - (MSBuildThisFileDirectory);$(OutDir)..\KozaniManagerProxyStub;$(OutDir)\..\WindowsAppRuntime_DLL;$(RepoRoot)\dev\WindowsAppRuntime_Insights;$(RepoRoot)\dev\common;$(IntDir);%(AdditionalIncludeDirectories) + (MSBuildThisFileDirectory);$(OutDir)..\KozaniProtocol;$(OutDir)..\KozaniManagerProxyStub;$(OutDir)\..\WindowsAppRuntime_DLL;$(RepoRoot)\dev\WindowsAppRuntime_Insights;$(RepoRoot)\dev\common;$(IntDir);%(AdditionalIncludeDirectories) Use pch.h _WINDOWS;_USRDLL;%(PreprocessorDefinitions) Windows - onecore.lib;onecoreuap.lib;%(AdditionalDependencies) + KozaniProtocol.lib;onecore.lib;onecoreuap.lib;%(AdditionalDependencies) + $(OutDir)..\KozaniProtocol;%(AdditionalLibraryDirectories) Microsoft.WindowsAppRuntime.dll;%(DelayLoadDLLs) @@ -109,7 +113,8 @@ - _DEBUG;%(PreprocessorDefinitions) + + @@ -136,8 +141,12 @@ + + + + @@ -149,6 +158,7 @@ Create + @@ -175,6 +185,7 @@ + @@ -189,5 +200,7 @@ + + - \ No newline at end of file + diff --git a/dev/Kozani/KozaniManager/KozaniManager.vcxproj.filters b/dev/Kozani/KozaniManager/KozaniManager.vcxproj.filters index 8b12b793c9..b390746283 100644 --- a/dev/Kozani/KozaniManager/KozaniManager.vcxproj.filters +++ b/dev/Kozani/KozaniManager/KozaniManager.vcxproj.filters @@ -21,6 +21,9 @@ Source Files + + Source Files + Source Files @@ -32,19 +35,41 @@ Header Files + + Header Files + + + Header Files + + + Header Files + - Source Files + Header Files - Source Files + Header Files + + + Header Files +<<<<<<< HEAD + + + +======= +>>>>>>> develop Resource Files - \ No newline at end of file +<<<<<<< HEAD + +======= + +>>>>>>> develop diff --git a/dev/Kozani/KozaniManager/KozaniProtobufMessages.h b/dev/Kozani/KozaniManager/KozaniProtobufMessages.h new file mode 100644 index 0000000000..dff1b4a5c8 --- /dev/null +++ b/dev/Kozani/KozaniManager/KozaniProtobufMessages.h @@ -0,0 +1,14 @@ +// Copyright (c) Microsoft Corporation and Contributors. +// Licensed under the MIT License. + +#include "pch.h" + +// Include all protobuf files here so we can disable any warnings they contain +#pragma warning(push) +#pragma warning(disable : 4244) // 'conversion' conversion from 'type1' to 'type2', possible loss of data +#pragma warning(disable : 4127) // conditional expression is constant +#pragma warning(disable : 5054) // operator '*': deprecated between enumerations of different types + +#include + +#pragma warning(pop) diff --git a/dev/Kozani/KozaniManager/Microsoft.Kozani.Activation.cpp b/dev/Kozani/KozaniManager/Microsoft.Kozani.Activation.cpp new file mode 100644 index 0000000000..bd44ed3f68 --- /dev/null +++ b/dev/Kozani/KozaniManager/Microsoft.Kozani.Activation.cpp @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation and Contributors. +// Licensed under the MIT License. + +#include "pch.h" + +#include "Microsoft.Kozani.Activation.h" + +std::string Microsoft::Kozani::Activation::ActivateApp( + std::int64_t cookie, + PCWSTR appUserModelId, + ::IInspectable* activatedEventArgs) +{ + winrt::com_ptr<::IInspectable> inspectable(activatedEventArgs, winrt::take_ownership_from_abi); + auto args{ inspectable.as() }; + return ActivateApp(cookie, appUserModelId, args); +} + +std::string Microsoft::Kozani::Activation::ActivateApp( + std::int64_t cookie, + PCWSTR appUserModelId, + winrt::Windows::ApplicationModel::Activation::IActivatedEventArgs& args) +{ + const auto activationKind{ args.Kind() }; + if (activationKind == winrt::Windows::ApplicationModel::Activation::ActivationKind::Launch) + { + auto specificArgs{ args.as() }; + return ActivateApp(cookie, appUserModelId, specificArgs); + } + + THROW_HR_MSG(HRESULT_FROM_WIN32(ERROR_NOT_SUPPORTED), "ActivationKind:%d", activationKind); +} + +std::string Microsoft::Kozani::Activation::ActivateApp( + std::int64_t cookie, + PCWSTR appUserModelId, + winrt::Windows::ApplicationModel::Activation::LaunchActivatedEventArgs& args) +{ + const auto arguments{ args.Arguments() }; + return ActivateApp_Launch(cookie, appUserModelId, arguments.c_str()); +} + +std::string Microsoft::Kozani::Activation::ActivateApp_Launch( + std::int64_t cookie, + PCWSTR appUserModelId, + PCWSTR arguments) +{ + const std::string appUserModelIdUtf8{ ::Microsoft::Utf8::ToUtf8(appUserModelId) }; + const std::string argumentsUtf8{ arguments ? ::Microsoft::Utf8::ToUtf8(arguments) : "" }; + return ActivateApp_Launch(cookie, appUserModelIdUtf8, argumentsUtf8); +} + +std::string Microsoft::Kozani::Activation::ActivateApp_Launch( + std::int64_t cookie, + const std::string& appUserModelId, + const std::string& arguments) +{ + ::Microsoft::Kozani::Activation::ActivateAppRequest message; + message.set_cookie(cookie); + message.set_activation_kind(::Microsoft::Kozani::Activation::ActivationKind::Launch); + message.set_app_user_model_id(appUserModelId); + message.set_arguments(arguments); + + std::string bytes; + message.SerializeToString(&bytes); + return bytes; +} diff --git a/dev/Kozani/KozaniManager/Microsoft.Kozani.Activation.h b/dev/Kozani/KozaniManager/Microsoft.Kozani.Activation.h new file mode 100644 index 0000000000..17160f15be --- /dev/null +++ b/dev/Kozani/KozaniManager/Microsoft.Kozani.Activation.h @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation and Contributors. +// Licensed under the MIT License. + +#pragma once + +#include "KozaniProtobufMessages.h" + +namespace Microsoft::Kozani::Activation +{ +std::string ActivateApp( + std::int64_t cookie, + PCWSTR appUserModelId, + ::IInspectable* args); + +std::string ActivateApp( + std::int64_t cookie, + PCWSTR appUserModelId, + winrt::Windows::ApplicationModel::Activation::IActivatedEventArgs& args); + +std::string ActivateApp( + std::int64_t cookie, + PCWSTR appUserModelId, + winrt::Windows::ApplicationModel::Activation::LaunchActivatedEventArgs& args); + +std::string ActivateApp_Launch( + std::int64_t cookie, + PCWSTR appUserModelId, + PCWSTR arguments); + +std::string ActivateApp_Launch( + std::int64_t cookie, + const std::string& appUserModelId, + const std::string& arguments); +} diff --git a/dev/Kozani/KozaniManager/main.cpp b/dev/Kozani/KozaniManager/main.cpp index 6f3797055b..ca1270d0e4 100644 --- a/dev/Kozani/KozaniManager/main.cpp +++ b/dev/Kozani/KozaniManager/main.cpp @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Corporation and Contributors. +// Copyright (c) Microsoft Corporation and Contributors. // Licensed under the MIT License. #include "pch.h" @@ -7,6 +7,8 @@ #include +#include "Microsoft.Kozani.Activation.h" + // Including this file once per binary will automatically opt WIL error handling macros into calling RoOriginateError when they // begin logging a new error. This greatly improves the debuggability of errors that propagate before a failfast. #include @@ -31,16 +33,20 @@ struct __declspec(uuid(PR_KOZANIMANAGER_CLSID_STRING)) KozaniManagerImpl WrlFina PCWSTR additionalSettingsFilePath, ::IInspectable* activatedEventArgs, IKozaniStatusCallback* statusCallback, - DWORD associatedLocalProcessId) + DWORD associatedLocalProcessId) try { - // TODO: https://task.ms/42882034 temporary code to enable initial testing of the in-proc WinRT API and OOP COM API. Will be replaced with real impl later. + // Serialize the message + const std::int64_t cookie{}; + std::string messageBytes{ ::Microsoft::Kozani::Activation::ActivateApp(cookie, appUserModelId, activatedEventArgs) }; + + // TODO: https://task.ms/42882034 temporary code to enable initial testing of the in-proc WinRT API and OOP COM API. Will be replaced with real impl later. if (statusCallback != nullptr) { RETURN_IF_FAILED(statusCallback->OnActivated(associatedLocalProcessId)); } return S_OK; - } + } CATCH_RETURN(); }; CoCreatableClass(KozaniManagerImpl); @@ -53,6 +59,10 @@ void EndOfTheLine() int WINAPI WinMain(HINSTANCE /*hInstance*/, HINSTANCE /*hPrevInstance*/, PSTR /*lpCmdLine*/, int /*nCmdShow*/) { + // Verify that the version of the library that we linked against is + // compatible with the version of the headers we compiled against. + GOOGLE_PROTOBUF_VERIFY_VERSION; + RETURN_IF_FAILED(::CoInitializeEx(nullptr, COINITBASE_MULTITHREADED)); wil::unique_event endOfTheLine(::CreateEventW(nullptr, TRUE, FALSE, nullptr)); @@ -69,6 +79,8 @@ int WINAPI WinMain(HINSTANCE /*hInstance*/, HINSTANCE /*hPrevInstance*/, PSTR /* ::CoUninitialize(); + google::protobuf::ShutdownProtobufLibrary(); + return 0; } diff --git a/dev/Kozani/KozaniManager/packages.config b/dev/Kozani/KozaniManager/packages.config index 14efb7baf5..ba003992c7 100644 --- a/dev/Kozani/KozaniManager/packages.config +++ b/dev/Kozani/KozaniManager/packages.config @@ -5,4 +5,5 @@ + diff --git a/dev/Kozani/KozaniManager/pch.h b/dev/Kozani/KozaniManager/pch.h index 41a32db1d5..3942856447 100644 --- a/dev/Kozani/KozaniManager/pch.h +++ b/dev/Kozani/KozaniManager/pch.h @@ -24,6 +24,12 @@ #include #include +#include + #include #include + +#include + +#include "KozaniProtobufMessages.h" diff --git a/dev/Kozani/KozaniProtocol/Kozani.Activation.proto b/dev/Kozani/KozaniProtocol/Kozani.Activation.proto new file mode 100644 index 0000000000..4e0199270a --- /dev/null +++ b/dev/Kozani/KozaniProtocol/Kozani.Activation.proto @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation and Contributors. +// Licensed under the MIT License. + +syntax = "proto3"; + +package Microsoft.Kozani.Activation; + +enum ActivationKind +{ + // NOTE: Values must match Windows.ApplicationModel.Activation.ActivationKind + Launch = 0; + File = 3; + Protocol = 4; +} + +message ActivateAppRequest +{ + int64 cookie = 1; + ActivationKind activation_kind = 2; + string app_user_model_id = 3; + optional string arguments = 4; +} + +message ActivateAppResult +{ + int64 cookie = 1; + int32 hresult = 2; +} diff --git a/dev/Kozani/KozaniProtocol/KozaniProtocol.vcxproj b/dev/Kozani/KozaniProtocol/KozaniProtocol.vcxproj new file mode 100644 index 0000000000..47822963f4 --- /dev/null +++ b/dev/Kozani/KozaniProtocol/KozaniProtocol.vcxproj @@ -0,0 +1,159 @@ + + + + + + + + + + Debug + Win32 + + + Release + Win32 + + + Debug + x64 + + + Release + x64 + + + Debug + ARM64 + + + Release + ARM64 + + + + 16.0 + StaticLibrary + {3f28c3ed-2548-4530-8b6c-832fae0e993d} + KozaniProtocol + 10.0 + + + KozaniProtocol + StaticLibrary + v143 + Unicode + + + x64 + + + false + + + true + + Release + + + false + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + false + true + 4125;4127;4244;4267 + true + + + Console + false + false + + + + + + + + + + + NDEBUG;%(PreprocessorDefinitions) + + + + + WIN32;%(PreprocessorDefinitions) + + + + + + + + + + + + + + + + + + + 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}. + + + + + + + + + + + + + + + + + + diff --git a/dev/Kozani/KozaniProtocol/KozaniProtocol.vcxproj.filters b/dev/Kozani/KozaniProtocol/KozaniProtocol.vcxproj.filters new file mode 100644 index 0000000000..b7987c7415 --- /dev/null +++ b/dev/Kozani/KozaniProtocol/KozaniProtocol.vcxproj.filters @@ -0,0 +1,21 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms + + + + + + + \ No newline at end of file diff --git a/dev/Kozani/KozaniProtocol/packages.config b/dev/Kozani/KozaniProtocol/packages.config new file mode 100644 index 0000000000..47b86d753f --- /dev/null +++ b/dev/Kozani/KozaniProtocol/packages.config @@ -0,0 +1,7 @@ + + + + + + + diff --git a/dev/Kozani/KozaniRemoteManager/KozaniRemoteManager.vcxproj b/dev/Kozani/KozaniRemoteManager/KozaniRemoteManager.vcxproj index 4e423e0a19..3bedea7379 100644 --- a/dev/Kozani/KozaniRemoteManager/KozaniRemoteManager.vcxproj +++ b/dev/Kozani/KozaniRemoteManager/KozaniRemoteManager.vcxproj @@ -5,6 +5,7 @@ + Debug @@ -47,6 +48,8 @@ true + + Release false @@ -88,14 +91,15 @@ - (MSBuildThisFileDirectory);$(OutDir)..\KozaniRemoteManagerProxyStub;$(OutDir)\..\WindowsAppRuntime_DLL;$(RepoRoot)\dev\WindowsAppRuntime_Insights;$(RepoRoot)\dev\common;$(IntDir);%(AdditionalIncludeDirectories) + (MSBuildThisFileDirectory);$(OutDir)..\KozaniProtocol;$(OutDir)..\KozaniRemoteManagerProxyStub;$(OutDir)\..\WindowsAppRuntime_DLL;$(RepoRoot)\dev\WindowsAppRuntime_Insights;$(RepoRoot)\dev\common;$(IntDir);%(AdditionalIncludeDirectories) Use pch.h _WINDOWS;_USRDLL;%(PreprocessorDefinitions) Windows - onecore.lib;onecoreuap.lib;%(AdditionalDependencies) + KozaniProtocol.lib;onecore.lib;onecoreuap.lib;%(AdditionalDependencies) + $(OutDir)..\KozaniProtocol;%(AdditionalLibraryDirectories) Microsoft.WindowsAppRuntime.dll;%(DelayLoadDLLs) @@ -109,7 +113,8 @@ - _DEBUG;%(PreprocessorDefinitions) + + @@ -136,6 +141,8 @@ + + @@ -172,6 +179,7 @@ + @@ -186,5 +194,7 @@ + + diff --git a/dev/Kozani/KozaniRemoteManager/KozaniRemoteManager.vcxproj.filters b/dev/Kozani/KozaniRemoteManager/KozaniRemoteManager.vcxproj.filters index 76173509dd..68c8e984e3 100644 --- a/dev/Kozani/KozaniRemoteManager/KozaniRemoteManager.vcxproj.filters +++ b/dev/Kozani/KozaniRemoteManager/KozaniRemoteManager.vcxproj.filters @@ -32,14 +32,17 @@ Header Files - + + Header Files + + Header Files - Source Files + Header Files - Source Files + Header Files diff --git a/dev/Kozani/KozaniRemoteManager/packages.config b/dev/Kozani/KozaniRemoteManager/packages.config index 14efb7baf5..ba003992c7 100644 --- a/dev/Kozani/KozaniRemoteManager/packages.config +++ b/dev/Kozani/KozaniRemoteManager/packages.config @@ -5,4 +5,5 @@ + diff --git a/eng/Version.Dependencies.props b/eng/Version.Dependencies.props index fa2059a3a1..ab7541e542 100644 --- a/eng/Version.Dependencies.props +++ b/eng/Version.Dependencies.props @@ -21,6 +21,7 @@ $([System.Text.RegularExpressions.Regex]::Match($(VersionDependenciesXml), 'Name="Microsoft.SourceLink.GitHub"\s+Version="(.*?)"').Groups[1].Value) $([System.Text.RegularExpressions.Regex]::Match($(VersionDependenciesXml), 'Name="Microsoft.Taef"\s+Version="(.*?)"').Groups[1].Value) $([System.Text.RegularExpressions.Regex]::Match($(VersionDependenciesXml), 'Name="Microsoft.Telemetry.Inbox.Native"\s+Version="(.*?)"').Groups[1].Value) + $([System.Text.RegularExpressions.Regex]::Match($(VersionDependenciesXml), 'Name="Microsoft.WindowsAppSDK.Protobuf"\s+Version="(.*?)"').Groups[1].Value) $([System.Text.RegularExpressions.Regex]::Match($(VersionDependenciesXml), 'Name="Microsoft.Windows.CppWinRT"\s+Version="(.*?)"').Groups[1].Value) $([System.Text.RegularExpressions.Regex]::Match($(VersionDependenciesXml), 'Name="Microsoft.Windows.ImplementationLibrary"\s+Version="(.*?)"').Groups[1].Value) diff --git a/eng/Version.Dependencies.xml b/eng/Version.Dependencies.xml index 9f34fc82d9..1918283612 100644 --- a/eng/Version.Dependencies.xml +++ b/eng/Version.Dependencies.xml @@ -33,4 +33,5 @@ + diff --git a/tools/ProjectTemplates/dev.cpp.exe+dll.com-oopserver/PurojekutoTenpuret/PurojekutoTenpuret.vcxproj b/tools/ProjectTemplates/dev.cpp.exe+dll.com-oopserver/PurojekutoTenpuret/PurojekutoTenpuret.vcxproj index e3d3b7b228..8f097d10a9 100644 --- a/tools/ProjectTemplates/dev.cpp.exe+dll.com-oopserver/PurojekutoTenpuret/PurojekutoTenpuret.vcxproj +++ b/tools/ProjectTemplates/dev.cpp.exe+dll.com-oopserver/PurojekutoTenpuret/PurojekutoTenpuret.vcxproj @@ -136,6 +136,8 @@ + + diff --git a/tools/ProjectTemplates/dev.cpp.exe+dll.com-oopserver/PurojekutoTenpuret/PurojekutoTenpuret.vcxproj.filters b/tools/ProjectTemplates/dev.cpp.exe+dll.com-oopserver/PurojekutoTenpuret/PurojekutoTenpuret.vcxproj.filters index ae002426e3..9b16095fa4 100644 --- a/tools/ProjectTemplates/dev.cpp.exe+dll.com-oopserver/PurojekutoTenpuret/PurojekutoTenpuret.vcxproj.filters +++ b/tools/ProjectTemplates/dev.cpp.exe+dll.com-oopserver/PurojekutoTenpuret/PurojekutoTenpuret.vcxproj.filters @@ -35,11 +35,14 @@ Header Files + + Header Files + - Source Files + Header Files - Source Files + Header Files diff --git a/tools/ProjectTemplates/dev.cpp.exe.com-oopserver-main/PurojekutoTenpuret.vcxproj b/tools/ProjectTemplates/dev.cpp.exe.com-oopserver-main/PurojekutoTenpuret.vcxproj index 885d364cf2..4638c2b496 100644 --- a/tools/ProjectTemplates/dev.cpp.exe.com-oopserver-main/PurojekutoTenpuret.vcxproj +++ b/tools/ProjectTemplates/dev.cpp.exe.com-oopserver-main/PurojekutoTenpuret.vcxproj @@ -136,6 +136,8 @@ + + diff --git a/tools/ProjectTemplates/dev.cpp.exe.com-oopserver-main/PurojekutoTenpuret.vcxproj.filters b/tools/ProjectTemplates/dev.cpp.exe.com-oopserver-main/PurojekutoTenpuret.vcxproj.filters index ae002426e3..9b16095fa4 100644 --- a/tools/ProjectTemplates/dev.cpp.exe.com-oopserver-main/PurojekutoTenpuret.vcxproj.filters +++ b/tools/ProjectTemplates/dev.cpp.exe.com-oopserver-main/PurojekutoTenpuret.vcxproj.filters @@ -35,11 +35,14 @@ Header Files + + Header Files + - Source Files + Header Files - Source Files + Header Files diff --git a/tools/ProjectTemplates/dev.cpp.lib.cpp-protobuf/PurojekutoTenpuret.Metadeta b/tools/ProjectTemplates/dev.cpp.lib.cpp-protobuf/PurojekutoTenpuret.Metadeta new file mode 100644 index 0000000000..0b8d199ac8 --- /dev/null +++ b/tools/ProjectTemplates/dev.cpp.lib.cpp-protobuf/PurojekutoTenpuret.Metadeta @@ -0,0 +1,7 @@ +{ + "Description" : "ProtocolBuffers static lib", + "Libraries": "ProtocolBuffers", + "Name": { + "AllowedRegex": "^[A-Za-z][A-Za-z0-9_]*$" + } +} diff --git a/tools/ProjectTemplates/dev.cpp.lib.cpp-protobuf/PurojekutoTenpuret.proto b/tools/ProjectTemplates/dev.cpp.lib.cpp-protobuf/PurojekutoTenpuret.proto new file mode 100644 index 0000000000..e5e85d78e9 --- /dev/null +++ b/tools/ProjectTemplates/dev.cpp.lib.cpp-protobuf/PurojekutoTenpuret.proto @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation and Contributors. +// Licensed under the MIT License. + +syntax = "proto3"; + +package Microsoft.Kozani.Activation; + +enum ActivationKind +{ + // NOTE: Values must match Windows.ApplicationModel.Activation.ActivationKind + Launch = 0; + File = 3; + Protocol = 4; +} + +message ActivateAppRequest +{ + int64 cookie = 1; + ActivationKind activation_kind = 2; + string app_user_model_id = 3; + optional string arguments = 4; +} + +message ActivateAppResult +{ + int64 cookie = 1; + int32 hresult = 2; +} diff --git a/tools/ProjectTemplates/dev.cpp.lib.cpp-protobuf/PurojekutoTenpuret.vcxproj b/tools/ProjectTemplates/dev.cpp.lib.cpp-protobuf/PurojekutoTenpuret.vcxproj new file mode 100644 index 0000000000..e31177ca62 --- /dev/null +++ b/tools/ProjectTemplates/dev.cpp.lib.cpp-protobuf/PurojekutoTenpuret.vcxproj @@ -0,0 +1,171 @@ + + + + + + + + + + Debug + Win32 + + + Release + Win32 + + + Debug + x64 + + + Release + x64 + + + Debug + ARM64 + + + Release + ARM64 + + + + 16.0 + StaticLibrary + {00000000-0000-0000-0000-000000000000} + PurojekutoTenpuret + 10.0 + + + PurojekutoTenpuret + StaticLibrary + v143 + Unicode + + + $(protoc_windows64) + + + + $(BuildGenerateSourcesTargets); + BuildProtoCpp; + + + + x64 + + + false + + + true + + + false + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + false + true + 4125;4127;4244;4267 + true + + + Console + false + false + + + + + _DEBUG;%(PreprocessorDefinitions) + + + + + NDEBUG;%(PreprocessorDefinitions) + + + + + WIN32;%(PreprocessorDefinitions) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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}. + + + + + + + + + + diff --git a/tools/ProjectTemplates/dev.cpp.lib.cpp-protobuf/PurojekutoTenpuret.vcxproj.filters b/tools/ProjectTemplates/dev.cpp.lib.cpp-protobuf/PurojekutoTenpuret.vcxproj.filters new file mode 100644 index 0000000000..b1b7edd2b2 --- /dev/null +++ b/tools/ProjectTemplates/dev.cpp.lib.cpp-protobuf/PurojekutoTenpuret.vcxproj.filters @@ -0,0 +1,21 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms + + + + + + + diff --git a/tools/ProjectTemplates/dev.cpp.lib.cpp-protobuf/packages.config b/tools/ProjectTemplates/dev.cpp.lib.cpp-protobuf/packages.config new file mode 100644 index 0000000000..d9db55a1b3 --- /dev/null +++ b/tools/ProjectTemplates/dev.cpp.lib.cpp-protobuf/packages.config @@ -0,0 +1,6 @@ + + + + + + diff --git a/tools/nuget/Microsoft.WindowsAppSDK.Protobuf.3.21.12.nupkg b/tools/nuget/Microsoft.WindowsAppSDK.Protobuf.3.21.12.nupkg new file mode 100644 index 0000000000..0d0dc9a4b9 Binary files /dev/null and b/tools/nuget/Microsoft.WindowsAppSDK.Protobuf.3.21.12.nupkg differ diff --git a/tools/nuget/protobuf/Microsoft.WindowsAppSDK.Protobuf.nuspec b/tools/nuget/protobuf/Microsoft.WindowsAppSDK.Protobuf.nuspec new file mode 100644 index 0000000000..6355284942 --- /dev/null +++ b/tools/nuget/protobuf/Microsoft.WindowsAppSDK.Protobuf.nuspec @@ -0,0 +1,20 @@ + + + + Microsoft.WindowsAppSDK.Protobuf + $version$ + Microsoft.WindowsAppSDK.Protobuf + Microsoft + Windows App SDK packaging of Google's Protobuf. See https://github.com/microsoft/WindowsAppSDK/tree/main/tools/nuget/README.md for more details. + LICENSE + false + https://aka.ms/windowsappsdk + © Microsoft Corporation. All rights reserved. + Microsoft WindowsAppSDK Google Protobuf + + + + + + + diff --git a/tools/nuget/protobuf/Microsoft.WindowsAppSDK.Protobuf.props b/tools/nuget/protobuf/Microsoft.WindowsAppSDK.Protobuf.props new file mode 100644 index 0000000000..918dc5e7bd --- /dev/null +++ b/tools/nuget/protobuf/Microsoft.WindowsAppSDK.Protobuf.props @@ -0,0 +1,16 @@ + + + + $([System.IO.Path]::GetFullPath('$(MSBuildThisFileDirectory)/../../tools/')) + $([System.IO.Path]::GetFullPath('$(protoc_tools)/arm64/protoc.exe')) + $([System.IO.Path]::GetFullPath('$(protoc_tools)/x64/protoc.exe')) + $([System.IO.Path]::GetFullPath('$(protoc_tools)/x86/protoc.exe')) + $(protoc_windows_x64) + + + + $(MSBuildThisFileDirectory)/../../include + libprotobuf.lib + $(MSBuildThisFileDirectory)/../../lib/win10-$(PlatformTarget) + + diff --git a/tools/nuget/protobuf/Microsoft.WindowsAppSDK.Protobuf.targets b/tools/nuget/protobuf/Microsoft.WindowsAppSDK.Protobuf.targets new file mode 100644 index 0000000000..3bcf25f20d --- /dev/null +++ b/tools/nuget/protobuf/Microsoft.WindowsAppSDK.Protobuf.targets @@ -0,0 +1,39 @@ + + + + + + + $(BuildGenerateSourcesTargets); + BuildProtoCpp; + + + + + + %(AdditionalIncludeDirectories);$(ProtoIncludes) + + + %(AdditionalDependencies);$(ProtoLibs) + %(AdditionalLibraryDirectories);$(ProtoLibDirs) + + + + + + + + + + + + + + + + + + + + + diff --git a/tools/nuget/protobuf/README.md b/tools/nuget/protobuf/README.md new file mode 100644 index 0000000000..89f79bc9f2 --- /dev/null +++ b/tools/nuget/protobuf/README.md @@ -0,0 +1,56 @@ +# Microsoft.WindowsAppSDK.Protobuf Nuget Package + +## Problem: Where's the Nuget Package? + +Google's Protocol Buffers (aka protobuf) is available as nuget packages on https://nuget.org for +most languages (C#, Python, ...) but for C++ developers there's only google.protobuf.tools +providing a precompiled message compiler (protoc.exe). That reads *.proto files and generates C++ +source and header files but doesn't provide protobuf's headers and lib(s) required to compile your +generated code. + +The documented solution is to use VCPKG to download and compile protobuf's sources but VCPKG +doesn't provide as clean an isolation model as nuget packages, plus the VCPKG built solution +doesn't quite align with our needs (e.g. debug CRT). VCPKG can export to a nuget package but +that's rather sizable (115M for x86+x64+arm64 support, unsurprisingly as it contains Release and +Debug builds) and GitHub rejects any push'd commit if it contains a file >100M. + +## Solution: Roll up our sleeves... + +VCPKG does the heavy lifting for us, driving the protobuf build process to produce the desired +artifacts. We then finish the job to create a nuget to suit our needs: + +1. Use VCPKG to download and build protobuf +2. Define our own .props/.targets to integrate protobuf into VS/MSBuild +3. Define our own script to create a nuget from the VCPKG build + +The resulting nuget package is named Microsoft.WindowsAppSDK.Protobuf. + +NOTE: Only the developer creating the nuget (or creating a new version) has to wade through this +process. Everyone else in the project is blissfully aware and can just consume the nuget package +like any others. + +## Where's the Nuget? + +A new directory is created as an in-repo-repository of nuget package: `tools\nuget` + +`\nuget.config` is updated to find Microsoft.WindowsAppSDK.Protobuf nuget packages in this local repository. + +## HOWTO: Build the nuget + +Run `tools\nuget\protobuf\protobuf-makenuget.cmd` (no parameters) for help. + +The steps to build the protobuf nuget (assumed windowsappsdk is located at c:\source\repos\windowsappsdk): + +``` +cd /d c:\source\repos +git clone https://github.com/microsoft/vcpkg +cd vcpkg +.\bootstrap-vcpkg.bat +.\vcpkg install protobuf:x86-windows-static protobuf:x64-windows-static protobuf:arm64-windows-static +cd /d c:\source\repos\windowsappsdk\tools\nuget +protobuf\protobuf-makenuget.cmd c:\source\repos\vcpkg . 3.21.12 +``` + +NOTE: Replace the `3.21.12` parameter with the version you're creating. + +This will produce the nuget e.g. `tools\nuget\Microsoft.WindowsAppSDK.Protobuf.3.21.12.nupkg`. diff --git a/tools/nuget/protobuf/protobuf-makenuget.cmd b/tools/nuget/protobuf/protobuf-makenuget.cmd new file mode 100644 index 0000000000..a65d843afe --- /dev/null +++ b/tools/nuget/protobuf/protobuf-makenuget.cmd @@ -0,0 +1,91 @@ +@ECHO OFF +SETLOCAL + +IF %1x == x GOTO Help +IF %1x == --helpx GOTO Help +IF %1x == -?x GOTO Help +IF %1x == /?x GOTO Help +IF %2x == x GOTO Help +IF %3x == x GOTO Help +SET _KEEP=0 +IF %4x == KEEPx SET _KEEP=1 +IF %4x == keepx SET _KEEP=1 + +SET _VCPKGDIR=%1 +SET _FROM=%_VCPKGDIR%\installed + +SET _WORKDIR=%2 +SET _TO=%_WORKDIR%\temp + +SET _VERSION=%3 + +:GetNuget +ECHO Getting nuget.exe... +curl --get --location --progress-bar --output %_WORKDIR%\nuget.exe https://dist.nuget.org/win-x86-commandline/v6.4.0/nuget.exe +SET _NUGET=%_WORKDIR%\nuget.exe + +:CopyFiles +IF EXIST %_TO% rd /s/q %_TO% +md %_TO% + +ECHO Building nuget's \build... +md %_TO%\build\native >NUL +copy %~dp0\*.props %_TO%\build\native\* >NUL +copy %~dp0\*.targets %_TO%\build\native\* >NUL + +ECHO Building nuget's \include... +REM Include files are the same regardless of architecture +md %_TO%\include >NUL +XCOPY %_FROM%\x64-windows-static\include\* %_TO%\include\* /S >NUL + +ECHO Building nuget's \lib... +md %_TO%\lib >NUL +md %_TO%\lib\win10-arm64 >NUL +XCOPY %_FROM%\arm64-windows-static\lib\libprotobuf.lib %_TO%\lib\win10-arm64\* >NUL +md %_TO%\lib\win10-x64 >NUL +XCOPY %_FROM%\x64-windows-static\lib\libprotobuf.lib %_TO%\lib\win10-x64\* >NUL +md %_TO%\lib\win10-x86 >NUL +XCOPY %_FROM%\x86-windows-static\lib\libprotobuf.lib %_TO%\lib\win10-x86\* >NUL + +ECHO Building nuget's share\... +REM Share files are the same regardless of architecture +md %_TO%\share >NUL +XCOPY %_FROM%\x64-windows-static\share\protobuf\copyright %_TO%\share\* >NUL +XCOPY %_FROM%\x64-windows-static\share\protobuf\vcpkg.spdx.json %_TO%\share\* >NUL +XCOPY %_FROM%\x64-windows-static\share\protobuf\vcpkg_abi_info.txt %_TO%\share\* >NUL + +ECHO Building nuget's tools\... +md %_TO%\tools >NUL +md %_TO%\tools\arm64 >NUL +XCOPY %_FROM%\arm64-windows-static\tools\protobuf\* %_TO%\tools\arm64\* >NUL +md %_TO%\tools\x64 >NUL +XCOPY %_FROM%\x64-windows-static\tools\protobuf\* %_TO%\tools\x64\* >NUL +md %_TO%\tools\x86 >NUL +XCOPY %_FROM%\x86-windows-static\tools\protobuf\* %_TO%\tools\x86\* >NUL + +copy %_FROM%\x64-windows-static\share\protobuf\copyright %_TO%\LICENSE >NUL +SET _NUGETARGS=%~dp0\Microsoft.WindowsAppSDK.Protobuf.nuspec -Version %_VERSION% -BasePath %_TO% +ECHO %_NUGET% pack %_NUGETARGS% +%_NUGET% pack %_NUGETARGS% + +GOTO Cleanup + +:Cleanup +IF %_KEEP% == 1 GOTO PostCleanup +ECHO Cleaning up... +del /q %_NUGET% +rd /s/q %_TO% +:PostCleanup +GOTO TheEnd + +:Help +ECHO Protobuf-Nuget vcpkgpath version outdir [KEEP] +ECHO where +ECHO vcpkgpath = Path to VCPKG repository +ECHO outdir = Output directory +ECHO version = Version of the nuget package +ECHO KEEP = Keep intermediary artifacts (optional) +GOTO TheEnd + +:TheEnd +ENDLOCAL