-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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 scope support to more commands and add provisioning support for msix and msstore types #2766
Conversation
@@ -121,16 +133,29 @@ namespace AppInstaller::Repository::Microsoft | |||
SQLiteIndex index = SQLiteIndex::CreateNew(SQLITE_MEMORY_DB_CONNECTION_TARGET, Schema::Version::Latest()); | |||
|
|||
// Put installed packages into the index | |||
if (filter == PredefinedInstalledSourceFactory::Filter::None || filter == PredefinedInstalledSourceFactory::Filter::ARP) | |||
if (filter == PredefinedInstalledSourceFactory::Filter::None || filter == PredefinedInstalledSourceFactory::Filter::ARP || | |||
filter == PredefinedInstalledSourceFactory::Filter::User || filter == PredefinedInstalledSourceFactory::Filter::Machine) | |||
{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this done on purpose for readability? Could be simplified to:
if (filter != PredefinedInstalledSourceFactory::Filter::Msix)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it'd be better to check expected values instead of "!=" so future additions of the enum will not accidentally change previous behavior
if (filter == PredefinedInstalledSourceFactory::Filter::None || | ||
filter == PredefinedInstalledSourceFactory::Filter::MSIX || | ||
filter == PredefinedInstalledSourceFactory::Filter::User) | ||
{ | ||
PopulateIndexFromMSIX(index); | ||
PopulateIndexFromMSIX(index, Manifest::ScopeEnum::User); | ||
} | ||
else if (filter == PredefinedInstalledSourceFactory::Filter::Machine) | ||
{ | ||
PopulateIndexFromMSIX(index, Manifest::ScopeEnum::Machine); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if (filter != PredefinedInstalledSourceFactory::Filter::Arp)
{
if (filter == PredefinedInstalledSourceFactory::Filter::Machine)
{
PopulateIndexFromMSIX(index, Manifest::ScopeEnum::Machine);
}
else
{
PopulateIndexFromMSIX(index, Manifest::ScopeEnum::User);
}
}
::AppInstaller::Repository::Source installedSource = ::AppInstaller::Repository::Source{ ::AppInstaller::Repository::PredefinedSource::Installed }; | ||
::AppInstaller::Repository::Source installedSource; | ||
auto manifestInstalledScope = GetManifestScope(m_compositePackageCatalogOptions.InstalledScope()); | ||
if (manifestInstalledScope.first == ::AppInstaller::Manifest::ScopeEnum::User) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
NIT: seems like you can just assign manifestInstalledScope.first directly to the local variable.
if (installerType == InstallerTypeEnum::Portable || | ||
installerType == InstallerTypeEnum::MSStore || | ||
installerType == InstallerTypeEnum::Msix) | ||
{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use semantic check like IsAdminRequiredForMachineScopeInstall(installerType)
@@ -133,6 +134,11 @@ namespace AppInstaller::CLI::Workflow | |||
installOptions.CompletedInstallToastNotificationMode(AppInstallationToastNotificationMode::NoToast); | |||
} | |||
|
|||
if (Manifest::ConvertToScopeEnum(context.Args.GetArg(Execution::Args::Type::InstallScope)) == Manifest::ScopeEnum::Machine) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If arg does not exist, the GetArg returns empty, no exception is thrown. I copied this snippet from existing usage in other places.
Scope parameter in list, upgrade and uninstall commands works slightly differently from install and show commands.
Show, install commands: scope parameter is to filter the installer selection
List, upgrade and uninstall: scope parameter is to filter the installed package selection, for upgrade, that means the package to upgrade is also filtered to the scope due to the InstalledScopeFilter in ManifestComparator
Microsoft Reviewers: Open in CodeFlow