Skip to content

Commit

Permalink
Make windows feature and reboot features stable (#4137)
Browse files Browse the repository at this point in the history
  • Loading branch information
ryfu-msft committed Feb 5, 2024
1 parent e577218 commit 058ba27
Show file tree
Hide file tree
Showing 16 changed files with 5 additions and 84 deletions.
22 changes: 0 additions & 22 deletions doc/Settings.md
Expand Up @@ -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.
Expand All @@ -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.
Expand Down
10 changes: 0 additions & 10 deletions schemas/JSON/settings/settings.schema.0.2.json
Expand Up @@ -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
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/AppInstallerCLICore/Argument.cpp
Expand Up @@ -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:
Expand Down
3 changes: 1 addition & 2 deletions src/AppInstallerCLICore/Command.cpp
Expand Up @@ -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;
Expand Down
5 changes: 0 additions & 5 deletions src/AppInstallerCLICore/Workflows/DependenciesFlow.cpp
Expand Up @@ -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))
Expand Down
3 changes: 1 addition & 2 deletions src/AppInstallerCLICore/Workflows/ResumeFlow.cpp
Expand Up @@ -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;
}
Expand Down
1 change: 0 additions & 1 deletion src/AppInstallerCLIE2ETests/FeaturesCommand.cs
Expand Up @@ -53,7 +53,6 @@ public void EnableExperimentalFeatures()
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"));
Expand Down
9 changes: 0 additions & 9 deletions src/AppInstallerCLIE2ETests/InstallCommand.cs
Expand Up @@ -16,15 +16,6 @@ namespace AppInstallerCLIE2ETests
/// </summary>
public class InstallCommand : BaseCommand
{
/// <summary>
/// One time setup.
/// </summary>
[OneTimeSetUp]
public void OneTimeSetup()
{
WinGetSettingsHelper.ConfigureFeature("windowsFeature", true);
}

/// <summary>
/// Set up.
/// </summary>
Expand Down
1 change: 0 additions & 1 deletion src/AppInstallerCLITests/InstallFlow.cpp
Expand Up @@ -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 };
Expand Down
2 changes: 0 additions & 2 deletions src/AppInstallerCLITests/ResumeFlow.cpp
Expand Up @@ -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 };
Expand Down
1 change: 0 additions & 1 deletion src/AppInstallerCLITests/UpdateFlow.cpp
Expand Up @@ -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 };
Expand Down
10 changes: 0 additions & 10 deletions src/AppInstallerCLITests/WindowsFeature.cpp
Expand Up @@ -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 };
Expand Down Expand Up @@ -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 };
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down
8 changes: 0 additions & 8 deletions src/AppInstallerCommonCore/ExperimentalFeature.cpp
Expand Up @@ -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);
}
Expand Down Expand Up @@ -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);
}
Expand Down
Expand Up @@ -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
Expand Down
4 changes: 0 additions & 4 deletions src/AppInstallerCommonCore/Public/winget/UserSettings.h
Expand Up @@ -70,10 +70,8 @@ namespace AppInstaller::Settings
EFExperimentalCmd,
EFExperimentalArg,
EFDirectMSI,
EFWindowsFeature,
EFResume,
EFConfiguration03,
EFReboot,
// Telemetry
TelemetryDisable,
// Install behavior
Expand Down Expand Up @@ -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
Expand Down
2 changes: 0 additions & 2 deletions src/AppInstallerCommonCore/UserSettings.cpp
Expand Up @@ -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)
Expand Down

0 comments on commit 058ba27

Please sign in to comment.