winget-cli

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

commit 058ba279d895873bc4279b8a5b126c0949064083
parent e57721835861ad9662c9de17a68d5838e69706c6
Author: Ryan <69221034+ryfu-msft@users.noreply.github.com>
Date:   Mon,  5 Feb 2024 10:05:41 -0800

Make windows feature and reboot features stable (#4137)


Diffstat:
Mdoc/Settings.md | 22----------------------
Mschemas/JSON/settings/settings.schema.0.2.json | 10----------
Msrc/AppInstallerCLICore/Argument.cpp | 2+-
Msrc/AppInstallerCLICore/Command.cpp | 3+--
Msrc/AppInstallerCLICore/Workflows/DependenciesFlow.cpp | 5-----
Msrc/AppInstallerCLICore/Workflows/ResumeFlow.cpp | 3+--
Msrc/AppInstallerCLIE2ETests/FeaturesCommand.cs | 1-
Msrc/AppInstallerCLIE2ETests/InstallCommand.cs | 9---------
Msrc/AppInstallerCLITests/InstallFlow.cpp | 1-
Msrc/AppInstallerCLITests/ResumeFlow.cpp | 2--
Msrc/AppInstallerCLITests/UpdateFlow.cpp | 1-
Msrc/AppInstallerCLITests/WindowsFeature.cpp | 10----------
Msrc/AppInstallerCommonCore/ExperimentalFeature.cpp | 8--------
Msrc/AppInstallerCommonCore/Public/winget/ExperimentalFeature.h | 6++----
Msrc/AppInstallerCommonCore/Public/winget/UserSettings.h | 4----
Msrc/AppInstallerCommonCore/UserSettings.cpp | 2--
16 files changed, 5 insertions(+), 84 deletions(-)

diff --git a/doc/Settings.md b/doc/Settings.md @@ -291,17 +291,6 @@ You can enable the feature as shown below. }, ``` -### windowsFeature - -This feature enables the ability to enable Windows Feature dependencies during installation. -You can enable the feature as shown below. - -```json - "experimentalFeatures": { - "windowsFeature": true - }, -``` - ### resume This feature enables support for some commands to resume. @@ -313,17 +302,6 @@ You can enable the feature as shown below. }, ``` -### reboot - -This feature enables support for initiating a reboot. -You can enable the feature as shown below. - -```json - "experimentalFeatures": { - "reboot": true - }, -``` - ### configuration03 This feature enables the configuration schema 0.3. diff --git a/schemas/JSON/settings/settings.schema.0.2.json b/schemas/JSON/settings/settings.schema.0.2.json @@ -270,16 +270,6 @@ "description": "Enable support for configuration", "type": "boolean", "default": false - }, - "windowsFeature": { - "description": "Enable support for enabling Windows Feature(s)", - "type": "boolean", - "default": false - }, - "reboot": { - "description": "Enable support for initiating a reboot", - "type": "boolean", - "default": false } } } diff --git a/src/AppInstallerCLICore/Argument.cpp b/src/AppInstallerCLICore/Argument.cpp @@ -376,7 +376,7 @@ namespace AppInstaller::CLI case Args::Type::ResumeId: return Argument{ type, Resource::String::ResumeIdArgumentDescription, ArgumentType::Standard, true }; case Args::Type::AllowReboot: - return Argument{ type, Resource::String::AllowRebootArgumentDescription, ArgumentType::Flag, ExperimentalFeature::Feature::Reboot }; + return Argument{ type, Resource::String::AllowRebootArgumentDescription, ArgumentType::Flag }; case Args::Type::IgnoreResumeLimit: return Argument{ type, Resource::String::IgnoreResumeLimitArgumentDescription, ArgumentType::Flag, ExperimentalFeature::Feature::Resume }; default: diff --git a/src/AppInstallerCLICore/Command.cpp b/src/AppInstallerCLICore/Command.cpp @@ -882,8 +882,7 @@ namespace AppInstaller::CLI } // NOTE: Reboot logic will still run even if the context is terminated (not including unhandled exceptions). - if (Settings::ExperimentalFeature::IsEnabled(Settings::ExperimentalFeature::Feature::Reboot) && - context.Args.Contains(Execution::Args::Type::AllowReboot) && + if (context.Args.Contains(Execution::Args::Type::AllowReboot) && WI_IsFlagSet(context.GetFlags(), Execution::ContextFlag::RebootRequired)) { context.Reporter.Warn() << Resource::String::InitiatingReboot << std::endl; diff --git a/src/AppInstallerCLICore/Workflows/DependenciesFlow.cpp b/src/AppInstallerCLICore/Workflows/DependenciesFlow.cpp @@ -128,11 +128,6 @@ namespace AppInstaller::CLI::Workflow void EnableWindowsFeaturesDependencies(Execution::Context& context) { - if (!Settings::ExperimentalFeature::IsEnabled(Settings::ExperimentalFeature::Feature::WindowsFeature)) - { - return; - } - const auto& rootDependencies = context.Get<Execution::Data::Installer>()->Dependencies; if (rootDependencies.Empty() || !rootDependencies.HasAnyOf(DependencyType::WindowsFeature)) diff --git a/src/AppInstallerCLICore/Workflows/ResumeFlow.cpp b/src/AppInstallerCLICore/Workflows/ResumeFlow.cpp @@ -19,8 +19,7 @@ namespace AppInstaller::CLI::Workflow void RegisterStartupAfterReboot::operator()(Execution::Context& context) const { - if (!Settings::ExperimentalFeature::IsEnabled(Settings::ExperimentalFeature::Feature::Resume) || - !Settings::ExperimentalFeature::IsEnabled(Settings::ExperimentalFeature::Feature::Reboot)) + if (!Settings::ExperimentalFeature::IsEnabled(Settings::ExperimentalFeature::Feature::Resume)) { return; } diff --git a/src/AppInstallerCLIE2ETests/FeaturesCommand.cs b/src/AppInstallerCLIE2ETests/FeaturesCommand.cs @@ -53,7 +53,6 @@ namespace AppInstallerCLIE2ETests WinGetSettingsHelper.ConfigureFeature("experimentalArg", true); WinGetSettingsHelper.ConfigureFeature("experimentalCmd", true); WinGetSettingsHelper.ConfigureFeature("directMSI", true); - WinGetSettingsHelper.ConfigureFeature("windowsFeature", true); WinGetSettingsHelper.ConfigureFeature("resume", true); var result = TestCommon.RunAICLICommand("features", string.Empty); Assert.True(result.StdOut.Contains("Enabled")); diff --git a/src/AppInstallerCLIE2ETests/InstallCommand.cs b/src/AppInstallerCLIE2ETests/InstallCommand.cs @@ -17,15 +17,6 @@ namespace AppInstallerCLIE2ETests public class InstallCommand : BaseCommand { /// <summary> - /// One time setup. - /// </summary> - [OneTimeSetUp] - public void OneTimeSetup() - { - WinGetSettingsHelper.ConfigureFeature("windowsFeature", true); - } - - /// <summary> /// Set up. /// </summary> [SetUp] diff --git a/src/AppInstallerCLITests/InstallFlow.cpp b/src/AppInstallerCLITests/InstallFlow.cpp @@ -1213,7 +1213,6 @@ TEST_CASE("InstallFlow_InstallWithReboot", "[InstallFlow][workflow][reboot]") { TestCommon::TempFile installResultPath("TestExeInstalled.txt"); TestCommon::TestUserSettings testSettings; - testSettings.Set<Setting::EFReboot>(true); std::ostringstream installOutput; TestContext context{ installOutput, std::cin }; diff --git a/src/AppInstallerCLITests/ResumeFlow.cpp b/src/AppInstallerCLITests/ResumeFlow.cpp @@ -203,8 +203,6 @@ TEST_CASE("ResumeFlow_WriteToRunOnceRegistry", "[Reboot][Resume][windowsFeature] TestCommon::TestUserSettings testSettings; testSettings.Set<Setting::EFResume>(true); - testSettings.Set<Setting::EFReboot>(true); - testSettings.Set<Setting::EFWindowsFeature>(true); std::ostringstream installOutput; TestContext context{ installOutput, std::cin }; diff --git a/src/AppInstallerCLITests/UpdateFlow.cpp b/src/AppInstallerCLITests/UpdateFlow.cpp @@ -1014,7 +1014,6 @@ TEST_CASE("UpdateFlow_UpdateMultiple_NotAllFound", "[UpdateFlow][workflow][Multi TEST_CASE("UpdateFlow_UpdateWithReboot", "[UpdateFlow][workflow][reboot]") { TestCommon::TestUserSettings testSettings; - testSettings.Set<Setting::EFReboot>(true); std::ostringstream updateOutput; TestContext context{ updateOutput, std::cin }; diff --git a/src/AppInstallerCLITests/WindowsFeature.cpp b/src/AppInstallerCLITests/WindowsFeature.cpp @@ -21,9 +21,7 @@ TEST_CASE("InstallFlow_WindowsFeatureDoesNotExist", "[windowsFeature]") } TestCommon::TempFile installResultPath("TestExeInstalled.txt"); - TestCommon::TestUserSettings testSettings; - testSettings.Set<Setting::EFWindowsFeature>(true); std::ostringstream installOutput; TestContext context{ installOutput, std::cin }; @@ -54,9 +52,7 @@ TEST_CASE("InstallFlow_FailedToEnableWindowsFeature", "[windowsFeature]") } TestCommon::TempFile installResultPath("TestExeInstalled.txt"); - TestCommon::TestUserSettings testSettings; - testSettings.Set<Setting::EFWindowsFeature>(true); std::ostringstream installOutput; TestContext context{ installOutput, std::cin }; @@ -86,9 +82,7 @@ TEST_CASE("InstallFlow_FailedToEnableWindowsFeature_Force", "[windowsFeature]") } TestCommon::TempFile installResultPath("TestExeInstalled.txt"); - TestCommon::TestUserSettings testSettings; - testSettings.Set<Setting::EFWindowsFeature>(true); auto doesFeatureExistOverride = TestHook::SetDoesWindowsFeatureExistResult_Override(ERROR_SUCCESS); auto expectedErrorCode = 0xc0040001; // DISMAPI_E_DISMAPI_NOT_INITIALIZED @@ -130,9 +124,7 @@ TEST_CASE("InstallFlow_RebootRequired", "[windowsFeature]") } TestCommon::TempFile installResultPath("TestExeInstalled.txt"); - TestCommon::TestUserSettings testSettings; - testSettings.Set<Setting::EFWindowsFeature>(true); // Override with reboot required HRESULT. auto doesFeatureExistOverride = TestHook::SetDoesWindowsFeatureExistResult_Override(ERROR_SUCCESS); @@ -163,9 +155,7 @@ TEST_CASE("InstallFlow_RebootRequired_Force", "[windowsFeature]") } TestCommon::TempFile installResultPath("TestExeInstalled.txt"); - TestCommon::TestUserSettings testSettings; - testSettings.Set<Setting::EFWindowsFeature>(true); // Override with reboot required HRESULT. auto doesFeatureExistOverride = TestHook::SetDoesWindowsFeatureExistResult_Override(ERROR_SUCCESS); diff --git a/src/AppInstallerCommonCore/ExperimentalFeature.cpp b/src/AppInstallerCommonCore/ExperimentalFeature.cpp @@ -40,14 +40,10 @@ namespace AppInstaller::Settings return userSettings.Get<Setting::EFExperimentalArg>(); case ExperimentalFeature::Feature::DirectMSI: return userSettings.Get<Setting::EFDirectMSI>(); - case ExperimentalFeature::Feature::WindowsFeature: - return userSettings.Get<Setting::EFWindowsFeature>(); case ExperimentalFeature::Feature::Resume: return userSettings.Get<Setting::EFResume>(); case ExperimentalFeature::Feature::Configuration03: return userSettings.Get<Setting::EFConfiguration03>(); - case ExperimentalFeature::Feature::Reboot: - return userSettings.Get<Setting::EFReboot>(); default: THROW_HR(E_UNEXPECTED); } @@ -77,14 +73,10 @@ namespace AppInstaller::Settings return ExperimentalFeature{ "Argument Sample", "experimentalArg", "https://aka.ms/winget-settings", Feature::ExperimentalArg }; case Feature::DirectMSI: return ExperimentalFeature{ "Direct MSI Installation", "directMSI", "https://aka.ms/winget-settings", Feature::DirectMSI }; - case Feature::WindowsFeature: - return ExperimentalFeature{ "Windows Feature Dependencies", "windowsFeature", "https://aka.ms/winget-settings", Feature::WindowsFeature }; case Feature::Resume: return ExperimentalFeature{ "Resume", "resume", "https://aka.ms/winget-settings", Feature::Resume }; case Feature::Configuration03: return ExperimentalFeature{ "Configuration Schema 0.3", "configuration03", "https://aka.ms/winget-settings", Feature::Configuration03 }; - case Feature::Reboot: - return ExperimentalFeature{ "Reboot", "reboot", "https://aka.ms/winget-settings", Feature::Reboot }; default: THROW_HR(E_UNEXPECTED); } diff --git a/src/AppInstallerCommonCore/Public/winget/ExperimentalFeature.h b/src/AppInstallerCommonCore/Public/winget/ExperimentalFeature.h @@ -23,10 +23,8 @@ namespace AppInstaller::Settings None = 0x0, // Before making DirectMSI non-experimental, it should be part of manifest validation. DirectMSI = 0x1, - WindowsFeature = 0x2, - Resume = 0x4, - Configuration03 = 0x8, - Reboot = 0x10, + Resume = 0x2, + Configuration03 = 0x4, Max, // This MUST always be after all experimental features // Features listed after Max will not be shown with the features command diff --git a/src/AppInstallerCommonCore/Public/winget/UserSettings.h b/src/AppInstallerCommonCore/Public/winget/UserSettings.h @@ -70,10 +70,8 @@ namespace AppInstaller::Settings EFExperimentalCmd, EFExperimentalArg, EFDirectMSI, - EFWindowsFeature, EFResume, EFConfiguration03, - EFReboot, // Telemetry TelemetryDisable, // Install behavior @@ -151,10 +149,8 @@ namespace AppInstaller::Settings SETTINGMAPPING_SPECIALIZATION(Setting::EFExperimentalCmd, bool, bool, false, ".experimentalFeatures.experimentalCmd"sv); SETTINGMAPPING_SPECIALIZATION(Setting::EFExperimentalArg, bool, bool, false, ".experimentalFeatures.experimentalArg"sv); SETTINGMAPPING_SPECIALIZATION(Setting::EFDirectMSI, bool, bool, false, ".experimentalFeatures.directMSI"sv); - SETTINGMAPPING_SPECIALIZATION(Setting::EFWindowsFeature, bool, bool, false, ".experimentalFeatures.windowsFeature"sv); SETTINGMAPPING_SPECIALIZATION(Setting::EFResume, bool, bool, false, ".experimentalFeatures.resume"sv); SETTINGMAPPING_SPECIALIZATION(Setting::EFConfiguration03, bool, bool, false, ".experimentalFeatures.configuration03"sv); - SETTINGMAPPING_SPECIALIZATION(Setting::EFReboot, bool, bool, false, ".experimentalFeatures.reboot"sv); // Telemetry SETTINGMAPPING_SPECIALIZATION(Setting::TelemetryDisable, bool, bool, false, ".telemetry.disable"sv); // Install behavior diff --git a/src/AppInstallerCommonCore/UserSettings.cpp b/src/AppInstallerCommonCore/UserSettings.cpp @@ -259,10 +259,8 @@ namespace AppInstaller::Settings WINGET_VALIDATE_PASS_THROUGH(EFExperimentalCmd) WINGET_VALIDATE_PASS_THROUGH(EFExperimentalArg) WINGET_VALIDATE_PASS_THROUGH(EFDirectMSI) - WINGET_VALIDATE_PASS_THROUGH(EFWindowsFeature) WINGET_VALIDATE_PASS_THROUGH(EFResume) WINGET_VALIDATE_PASS_THROUGH(EFConfiguration03) - WINGET_VALIDATE_PASS_THROUGH(EFReboot) WINGET_VALIDATE_PASS_THROUGH(AnonymizePathForDisplay) WINGET_VALIDATE_PASS_THROUGH(TelemetryDisable) WINGET_VALIDATE_PASS_THROUGH(InteractivityDisable)