Skip to content

Commit

Permalink
Make zip install an experimental feature (#2351)
Browse files Browse the repository at this point in the history
  • Loading branch information
ryfu-msft authored Jul 20, 2022
1 parent 34f22ce commit c62be2f
Show file tree
Hide file tree
Showing 9 changed files with 41 additions and 2 deletions.
5 changes: 5 additions & 0 deletions schemas/JSON/settings/settings.schema.0.2.json
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,11 @@
"description": "Enable use of MSI APIs rather than msiexec for MSI installs",
"type": "boolean",
"default": false
},
"zipInstall": {
"description": "Enable support for installing zip packages.",
"type": "boolean",
"default": false
}
}
}
Expand Down
13 changes: 13 additions & 0 deletions src/AppInstallerCLICore/Workflows/InstallFlow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,18 @@ namespace AppInstaller::CLI::Workflow
}
}

// TODO: Remove check once feature becomes stable
void EnsureFeatureEnabledForArchiveInstall(Execution::Context& context)
{
auto installer = context.Get<Execution::Data::Installer>().value();

if (IsArchiveType(installer.InstallerType))
{
context <<
Workflow::EnsureFeatureEnabled(Settings::ExperimentalFeature::Feature::ZipInstall);
}
}

Execution::Args::Type GetUnsupportedArgumentType(UnsupportedArgumentEnum unsupportedArgument)
{
Execution::Args::Type execArg;
Expand Down Expand Up @@ -541,6 +553,7 @@ namespace AppInstaller::CLI::Workflow
void EnsureSupportForInstall(Execution::Context& context)
{
context <<
Workflow::EnsureFeatureEnabledForArchiveInstall <<
Workflow::EnsureSupportForPortableInstall <<
Workflow::EnsureNonPortableTypeForArchiveInstall <<
Workflow::EnsureValidNestedInstallerMetadataForArchiveInstall;
Expand Down
1 change: 1 addition & 0 deletions src/AppInstallerCLIE2ETests/BaseCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ public void InitializeAllFeatures(bool status)
ConfigureFeature("experimentalCmd", status);
ConfigureFeature("dependencies", status);
ConfigureFeature("directMSI", status);
ConfigureFeature("zipInstall", status);
}
}
}
6 changes: 6 additions & 0 deletions src/AppInstallerCLIE2ETests/InstallCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,12 @@ public class InstallCommand : BaseCommand
private const string InstallTestMsiProductId = @"{A5D36CF1-1993-4F63-BFB4-3ACD910D36A1}";
private const string InstallTestMsixName = @"6c6338fe-41b7-46ca-8ba6-b5ad5312bb0e";

[OneTimeSetUp]
public void OneTimeSetup()
{
ConfigureFeature("zipInstall", true);
}

[Test]
public void InstallAppDoesNotExist()
{
Expand Down
10 changes: 8 additions & 2 deletions src/AppInstallerCLITests/WorkFlow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -988,6 +988,8 @@ TEST_CASE("InstallFlowWithNonApplicableArchitecture", "[InstallFlow][workflow]")
TEST_CASE("InstallFlow_ZipWithExe", "[InstallFlow][workflow]")
{
TestCommon::TempFile installResultPath("TestExeInstalled.txt");
TestCommon::TestUserSettings testSettings;
testSettings.Set<Setting::EFZipInstall>(true);

std::ostringstream installOutput;
TestContext context{ installOutput, std::cin };
Expand All @@ -1014,6 +1016,8 @@ TEST_CASE("InstallFlow_ZipWithExe", "[InstallFlow][workflow]")
TEST_CASE("InstallFlow_Zip_BadRelativePath", "[InstallFlow][workflow]")
{
TestCommon::TempFile installResultPath("TestExeInstalled.txt");
TestCommon::TestUserSettings testSettings;
testSettings.Set<Setting::EFZipInstall>(true);

std::ostringstream installOutput;
TestContext context{ installOutput, std::cin };
Expand All @@ -1036,6 +1040,8 @@ TEST_CASE("InstallFlow_Zip_BadRelativePath", "[InstallFlow][workflow]")
TEST_CASE("InstallFlow_Zip_MissingNestedInstaller", "[InstallFlow][workflow]")
{
TestCommon::TempFile installResultPath("TestExeInstalled.txt");
TestCommon::TestUserSettings testSettings;
testSettings.Set<Setting::EFZipInstall>(true);

std::ostringstream installOutput;
TestContext context{ installOutput, std::cin };
Expand All @@ -1056,6 +1062,8 @@ TEST_CASE("InstallFlow_Zip_MissingNestedInstaller", "[InstallFlow][workflow]")
TEST_CASE("InstallFlow_Zip_MultipleNonPortableNestedInstallers", "[InstallFlow][workflow]")
{
TestCommon::TempFile installResultPath("TestExeInstalled.txt");
TestCommon::TestUserSettings testSettings;
testSettings.Set<Setting::EFZipInstall>(true);

std::ostringstream installOutput;
TestContext context{ installOutput, std::cin };
Expand Down Expand Up @@ -1195,8 +1203,6 @@ TEST_CASE("PortableInstallFlow", "[InstallFlow][workflow]")
TestCommon::TempDirectory tempDirectory("TestPortableInstallRoot", false);
TestCommon::TempFile portableInstallResultPath("TestPortableInstalled.txt");

TestCommon::TestUserSettings testSettings;

std::ostringstream installOutput;
TestContext context{ installOutput, std::cin };
auto previousThreadGlobals = context.SetForCurrentThread();
Expand Down
4 changes: 4 additions & 0 deletions src/AppInstallerCommonCore/ExperimentalFeature.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ namespace AppInstaller::Settings
return userSettings.Get<Setting::EFDependencies>();
case ExperimentalFeature::Feature::DirectMSI:
return userSettings.Get<Setting::EFDirectMSI>();
case ExperimentalFeature::Feature::ZipInstall:
return userSettings.Get<Setting::EFZipInstall>();
default:
THROW_HR(E_UNEXPECTED);
}
Expand Down Expand Up @@ -73,6 +75,8 @@ namespace AppInstaller::Settings
return ExperimentalFeature{ "Show Dependencies Information", "dependencies", "https://aka.ms/winget-settings", Feature::Dependencies };
case Feature::DirectMSI:
return ExperimentalFeature{ "Direct MSI Installation", "directMSI", "https://aka.ms/winget-settings", Feature::DirectMSI };
case Feature::ZipInstall:
return ExperimentalFeature{ "Zip Installation", "zipInstall", "https://aka.ms/winget-settings", Feature::ZipInstall };
default:
THROW_HR(E_UNEXPECTED);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ namespace AppInstaller::Settings
Dependencies = 0x1,
// Before making DirectMSI non-experimental, it should be part of manifest validation.
DirectMSI = 0x2,
ZipInstall = 0x4,
Max, // This MUST always be after all experimental features

// Features listed after Max will not be shown with the features command
Expand Down
2 changes: 2 additions & 0 deletions src/AppInstallerCommonCore/Public/winget/UserSettings.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ namespace AppInstaller::Settings
EFExperimentalCmd,
EFExperimentalArg,
EFDependencies,
EFZipInstall,
TelemetryDisable,
InstallScopePreference,
InstallScopeRequirement,
Expand Down Expand Up @@ -128,6 +129,7 @@ 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::EFDependencies, bool, bool, false, ".experimentalFeatures.dependencies"sv);
SETTINGMAPPING_SPECIALIZATION(Setting::EFZipInstall, bool, bool, false, ".experimentalFeatures.zipInstall"sv);
SETTINGMAPPING_SPECIALIZATION(Setting::TelemetryDisable, bool, bool, false, ".telemetry.disable"sv);
SETTINGMAPPING_SPECIALIZATION(Setting::InstallArchitecturePreference, std::vector<std::string>, std::vector<Utility::Architecture>, {}, ".installBehavior.preferences.architectures"sv);
SETTINGMAPPING_SPECIALIZATION(Setting::InstallArchitectureRequirement, std::vector<std::string>, std::vector<Utility::Architecture>, {}, ".installBehavior.requirements.architectures"sv);
Expand Down
1 change: 1 addition & 0 deletions src/AppInstallerCommonCore/UserSettings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,7 @@ namespace AppInstaller::Settings
WINGET_VALIDATE_PASS_THROUGH(EFExperimentalCmd)
WINGET_VALIDATE_PASS_THROUGH(EFExperimentalArg)
WINGET_VALIDATE_PASS_THROUGH(EFDependencies)
WINGET_VALIDATE_PASS_THROUGH(EFZipInstall)
WINGET_VALIDATE_PASS_THROUGH(TelemetryDisable)
WINGET_VALIDATE_PASS_THROUGH(EFDirectMSI)
WINGET_VALIDATE_PASS_THROUGH(EnableSelfInitiatedMinidump)
Expand Down

0 comments on commit c62be2f

Please sign in to comment.