Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for in-proc Com state separation #2068

Merged
merged 9 commits into from
Apr 8, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Take InstallOptions for applicability check
yao-msft committed Apr 8, 2022
commit 4d82734184ddbb4ea5609ff6719a764dd51a0daf
9 changes: 9 additions & 0 deletions src/Microsoft.Management.Deployment/PackageManager.h
Original file line number Diff line number Diff line change
@@ -4,6 +4,14 @@
#include "PackageManager.g.h"
#include "Public/ComClsids.h"

#if !defined(INCLUDE_ONLY_INTERFACE_METHODS)
// Forward declaration
namespace AppInstaller::CLI::Execution
{
struct Context;
}
#endif

namespace winrt::Microsoft::Management::Deployment::implementation
{
[uuid(WINGET_OUTOFPROC_COM_CLSID_PackageManager)]
@@ -32,6 +40,7 @@ namespace winrt::Microsoft::Management::Deployment::implementation

#if !defined(INCLUDE_ONLY_INTERFACE_METHODS)
void SetComCallerName(std::string name);
void PopulateContextFromInstallOptions(AppInstaller::CLI::Execution::Context* context, winrt::Microsoft::Management::Deployment::InstallOptions options);
#endif
}

2 changes: 1 addition & 1 deletion src/Microsoft.Management.Deployment/PackageManager.idl
Original file line number Diff line number Diff line change
@@ -269,7 +269,7 @@ namespace Microsoft.Management.Deployment
[contract(Microsoft.Management.Deployment.WindowsPackageManagerContract, 4)]
{
/// Checks if this package version has at least one applicable installer.
Boolean HasApplicableInstaller { get; };
Boolean HasApplicableInstaller(InstallOptions options);
}

/// DESIGN NOTE:
Original file line number Diff line number Diff line change
@@ -14,6 +14,11 @@
#include "winget/RepositorySearch.h"
#include "AppInstallerVersions.h"
#include "Converters.h"
#pragma warning( push )
#pragma warning ( disable : 4467 )
// 4467 Allow use of uuid attribute for com object creation.
#include "PackageManager.h"
#pragma warning( pop )
#include <wil\cppwinrt_wrl.h>

namespace winrt::Microsoft::Management::Deployment::implementation
@@ -115,9 +120,10 @@ namespace winrt::Microsoft::Management::Deployment::implementation
return CompareResult::Equal;
}
}
bool PackageVersionInfo::HasApplicableInstaller()
bool PackageVersionInfo::HasApplicableInstaller(InstallOptions options)
{
AppInstaller::CLI::Execution::COMContext context;
PopulateContextFromInstallOptions(&context, options);
AppInstaller::Repository::IPackageVersion::Metadata installationMetadata;
AppInstaller::CLI::Workflow::ManifestComparator manifestComparator{ context, installationMetadata };
AppInstaller::Manifest::Manifest manifest = m_packageVersion->GetManifest();
2 changes: 1 addition & 1 deletion src/Microsoft.Management.Deployment/PackageVersionInfo.h
Original file line number Diff line number Diff line change
@@ -24,7 +24,7 @@ namespace winrt::Microsoft::Management::Deployment::implementation
winrt::Microsoft::Management::Deployment::PackageCatalog PackageCatalog();
winrt::Microsoft::Management::Deployment::CompareResult CompareToVersion(hstring versionString);
// Contract version 4
bool HasApplicableInstaller();
bool HasApplicableInstaller(InstallOptions options);

#if !defined(INCLUDE_ONLY_INTERFACE_METHODS)
private: