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

Make dependencies, windows feature, and download experimental features stable #3545

Merged
merged 5 commits into from
Aug 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
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
32 changes: 0 additions & 32 deletions doc/Settings.md
Original file line number Diff line number Diff line change
Expand Up @@ -251,16 +251,6 @@ You can enable the feature as shown below.
},
```

### dependencies

Experimental feature with the aim of managing dependencies, as of now it only shows package dependency information. You can enable the feature as shown below.

```json
"experimentalFeatures": {
"dependencies": true
},
```

### configuration

This feature enables the configuration commands. These commands allow configuring the system into a desired state.
Expand All @@ -270,26 +260,4 @@ You can enable the feature as shown below.
"experimentalFeatures": {
"configuration": true
},
```

### 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
},
```

### download

This feature enables the download command. This command allows users to download the installers of a specified package.
You can enable the feature as shown below.

```json
"experimentalFeatures": {
"download": true
},
```
10 changes: 0 additions & 10 deletions schemas/JSON/settings/settings.schema.0.2.json
Original file line number Diff line number Diff line change
Expand Up @@ -210,11 +210,6 @@
"type": "boolean",
"default": false
},
"dependencies": {
"description": "Support for package dependencies",
"type": "boolean",
"default": false
},
"directMSI": {
"description": "Enable use of MSI APIs rather than msiexec for MSI installs",
"type": "boolean",
Expand All @@ -224,11 +219,6 @@
"description": "Enable support for configuration",
"type": "boolean",
"default": false
},
"download": {
"description": "Enable support for the download command",
"type": "boolean",
"default": false
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/AppInstallerCLICore/Commands/DownloadCommand.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ namespace AppInstaller::CLI
{
struct DownloadCommand final : public Command
{
DownloadCommand(std::string_view parent) : Command("download", {} /* aliases */, parent, Settings::ExperimentalFeature::Feature::Download) {}
DownloadCommand(std::string_view parent) : Command("download", {} /* aliases */, parent) {}

std::vector<Argument> GetArguments() const override;

Expand Down
50 changes: 14 additions & 36 deletions src/AppInstallerCLICore/Workflows/DependenciesFlow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,6 @@ namespace AppInstaller::CLI::Workflow

void ReportDependencies::operator()(Execution::Context& context) const
{
if (!Settings::ExperimentalFeature::IsEnabled(Settings::ExperimentalFeature::Feature::Dependencies))
{
return;
}
auto info = context.Reporter.Info();

const auto& dependencies = context.Get<Execution::Data::Dependencies>();
Expand Down Expand Up @@ -81,40 +77,32 @@ namespace AppInstaller::CLI::Workflow
}
}

void GetInstallersDependenciesFromManifest(Execution::Context& context) {
if (Settings::ExperimentalFeature::IsEnabled(Settings::ExperimentalFeature::Feature::Dependencies))
{
const auto& manifest = context.Get<Execution::Data::Manifest>();
DependencyList allDependencies;

for (const auto& installer : manifest.Installers)
{
allDependencies.Add(installer.Dependencies);
}
void GetInstallersDependenciesFromManifest(Execution::Context& context)
{
const auto& manifest = context.Get<Execution::Data::Manifest>();
DependencyList allDependencies;

context.Add<Execution::Data::Dependencies>(std::move(allDependencies));
for (const auto& installer : manifest.Installers)
{
allDependencies.Add(installer.Dependencies);
}

context.Add<Execution::Data::Dependencies>(std::move(allDependencies));
}

void GetDependenciesFromInstaller(Execution::Context& context)
{
if (Settings::ExperimentalFeature::IsEnabled(Settings::ExperimentalFeature::Feature::Dependencies))
const auto& installer = context.Get<Execution::Data::Installer>();
if (installer)
{
const auto& installer = context.Get<Execution::Data::Installer>();
if (installer)
{
context.Add<Execution::Data::Dependencies>(installer->Dependencies);
}
context.Add<Execution::Data::Dependencies>(installer->Dependencies);
}
}

void GetDependenciesInfoForUninstall(Execution::Context& context)
{
if (Settings::ExperimentalFeature::IsEnabled(Settings::ExperimentalFeature::Feature::Dependencies))
{
// TODO make best effort to get the correct installer information, it may be better to have a record of installations and save the correct installers
context.Add<Execution::Data::Dependencies>(DependencyList()); // sending empty list of dependencies for now
}
// TODO make best effort to get the correct installer information, it may be better to have a record of installations and save the correct installers
context.Add<Execution::Data::Dependencies>(DependencyList()); // sending empty list of dependencies for now
}

void OpenDependencySource(Execution::Context& context)
Expand All @@ -141,11 +129,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())
Expand Down Expand Up @@ -239,11 +222,6 @@ namespace AppInstaller::CLI::Workflow

void CreateDependencySubContexts::operator()(Execution::Context& context) const
{
if (!Settings::ExperimentalFeature::IsEnabled(Settings::ExperimentalFeature::Feature::Dependencies))
{
return;
}

auto info = context.Reporter.Info();
auto error = context.Reporter.Error();
const auto& rootManifest = context.Get<Execution::Data::Manifest>();
Expand Down
33 changes: 15 additions & 18 deletions src/AppInstallerCLICore/Workflows/InstallFlow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -618,32 +618,29 @@ namespace AppInstaller::CLI::Workflow
bool downloadInstallerOnly = WI_IsFlagSet(context.GetFlags(), Execution::ContextFlag::InstallerDownloadOnly);

// Report dependencies
if (Settings::ExperimentalFeature::IsEnabled(Settings::ExperimentalFeature::Feature::Dependencies))
auto& packageSubContexts = context.Get<Execution::Data::PackageSubContexts>();
if (!packageSubContexts.empty())
{
auto& packageSubContexts = context.Get<Execution::Data::PackageSubContexts>();
if (!packageSubContexts.empty())
if (downloadInstallerOnly)
{
if (downloadInstallerOnly)
{
context.Reporter.Info() << Resource::String::DependenciesFlowDownload << std::endl;
}
else
{
context.Reporter.Info() << Resource::String::DependenciesFlowInstall << std::endl;
}
context.Reporter.Info() << Resource::String::DependenciesFlowDownload << std::endl;
}

DependencyList allDependencies;

for (auto& packageContext : packageSubContexts)
else
{
allDependencies.Add(packageContext->Get<Execution::Data::Installer>().value().Dependencies);
context.Reporter.Info() << Resource::String::DependenciesFlowInstall << std::endl;
}
}

context.Add<Execution::Data::Dependencies>(allDependencies);
context << Workflow::ReportDependencies(m_dependenciesReportMessage);
DependencyList allDependencies;

for (auto& packageContext : packageSubContexts)
{
allDependencies.Add(packageContext->Get<Execution::Data::Installer>().value().Dependencies);
}

context.Add<Execution::Data::Dependencies>(allDependencies);
context << Workflow::ReportDependencies(m_dependenciesReportMessage);

bool allSucceeded = true;
size_t packagesCount = context.Get<Execution::Data::PackageSubContexts>().size();
size_t packagesProgress = 0;
Expand Down
61 changes: 29 additions & 32 deletions src/AppInstallerCLICore/Workflows/ShowFlow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -169,45 +169,42 @@ namespace AppInstaller::CLI::Workflow
ShowSingleLineField(info, Resource::String::ShowLabelInstallerProductId, installer->ProductId, true);
ShowSingleLineField(info, Resource::String::ShowLabelInstallerReleaseDate, installer->ReleaseDate, true);

if (Settings::ExperimentalFeature::IsEnabled(Settings::ExperimentalFeature::Feature::Dependencies))
const auto& dependencies = installer->Dependencies;

if (dependencies.HasAny())
{
const auto& dependencies = installer->Dependencies;
info << Execution::ManifestInfoEmphasis << " "_liv << Resource::String::ShowLabelDependencies << ' ' << std::endl;

if (dependencies.HasAny())
if (dependencies.HasAnyOf(Manifest::DependencyType::WindowsFeature))
{
info << Execution::ManifestInfoEmphasis << " "_liv << Resource::String::ShowLabelDependencies << ' ' << std::endl;

if (dependencies.HasAnyOf(Manifest::DependencyType::WindowsFeature))
{
info << " - "_liv << Resource::String::ShowLabelWindowsFeaturesDependencies << ' ' << std::endl;
dependencies.ApplyToType(Manifest::DependencyType::WindowsFeature, [&info](Manifest::Dependency dependency) {info << " "_liv << dependency.Id() << std::endl; });
}
info << " - "_liv << Resource::String::ShowLabelWindowsFeaturesDependencies << ' ' << std::endl;
dependencies.ApplyToType(Manifest::DependencyType::WindowsFeature, [&info](Manifest::Dependency dependency) {info << " "_liv << dependency.Id() << std::endl; });
}

if (dependencies.HasAnyOf(Manifest::DependencyType::WindowsLibrary))
{
info << " - "_liv << Resource::String::ShowLabelWindowsLibrariesDependencies << ' ' << std::endl;
dependencies.ApplyToType(Manifest::DependencyType::WindowsLibrary, [&info](Manifest::Dependency dependency) {info << " "_liv << dependency.Id() << std::endl; });
}
if (dependencies.HasAnyOf(Manifest::DependencyType::WindowsLibrary))
{
info << " - "_liv << Resource::String::ShowLabelWindowsLibrariesDependencies << ' ' << std::endl;
dependencies.ApplyToType(Manifest::DependencyType::WindowsLibrary, [&info](Manifest::Dependency dependency) {info << " "_liv << dependency.Id() << std::endl; });
}

if (dependencies.HasAnyOf(Manifest::DependencyType::Package))
{
info << " - "_liv << Resource::String::ShowLabelPackageDependencies << ' ' << std::endl;
dependencies.ApplyToType(Manifest::DependencyType::Package, [&info](Manifest::Dependency dependency)
if (dependencies.HasAnyOf(Manifest::DependencyType::Package))
{
info << " - "_liv << Resource::String::ShowLabelPackageDependencies << ' ' << std::endl;
dependencies.ApplyToType(Manifest::DependencyType::Package, [&info](Manifest::Dependency dependency)
{
info << " "_liv << dependency.Id();
if (dependency.MinVersion)
{
info << " "_liv << dependency.Id();
if (dependency.MinVersion)
{
info << " [>= " << dependency.MinVersion.value().ToString() << "]";
}
info << std::endl;
});
}
info << " [>= " << dependency.MinVersion.value().ToString() << "]";
}
info << std::endl;
});
}

if (dependencies.HasAnyOf(Manifest::DependencyType::External))
{
info << " - "_liv << Resource::String::ShowLabelExternalDependencies << ' ' << std::endl;
dependencies.ApplyToType(Manifest::DependencyType::External, [&info](Manifest::Dependency dependency) {info << " "_liv << dependency.Id() << std::endl; });
}
if (dependencies.HasAnyOf(Manifest::DependencyType::External))
{
info << " - "_liv << Resource::String::ShowLabelExternalDependencies << ' ' << std::endl;
dependencies.ApplyToType(Manifest::DependencyType::External, [&info](Manifest::Dependency dependency) {info << " "_liv << dependency.Id() << std::endl; });
}
}
}
Expand Down
10 changes: 0 additions & 10 deletions src/AppInstallerCLIE2ETests/DownloadCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,6 @@ namespace AppInstallerCLIE2ETests
/// </summary>
public class DownloadCommand : BaseCommand
{
/// <summary>
/// One time setup.
/// </summary>
[OneTimeSetUp]
public void OneTimeSetup()
{
WinGetSettingsHelper.ConfigureFeature("download", true);
WinGetSettingsHelper.ConfigureFeature("dependencies", true);
}

/// <summary>
/// Downloads the test installer and its package dependencies.
/// </summary>
Expand Down
3 changes: 0 additions & 3 deletions src/AppInstallerCLIE2ETests/FeaturesCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,6 @@ public void EnableExperimentalFeatures()
WinGetSettingsHelper.ConfigureFeature("experimentalArg", true);
WinGetSettingsHelper.ConfigureFeature("experimentalCmd", true);
WinGetSettingsHelper.ConfigureFeature("directMSI", true);
WinGetSettingsHelper.ConfigureFeature("windowsFeature", true);
WinGetSettingsHelper.ConfigureFeature("download", true);
WinGetSettingsHelper.ConfigureFeature("dependencies", true);
var result = TestCommon.RunAICLICommand("features", string.Empty);
Assert.True(result.StdOut.Contains("Enabled"));
}
Expand Down
5 changes: 0 additions & 5 deletions src/AppInstallerCLIE2ETests/Helpers/WinGetSettingsHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,7 @@ public static void InitializeWingetSettings()
{
{ "experimentalArg", false },
{ "experimentalCmd", false },
{ "dependencies", false },
{ "directMSI", false },
{ "download", false },
}
},
{
Expand Down Expand Up @@ -189,12 +187,9 @@ public static void InitializeAllFeatures(bool status)
{
ConfigureFeature("experimentalArg", status);
ConfigureFeature("experimentalCmd", status);
ConfigureFeature("dependencies", status);
ConfigureFeature("directMSI", status);
ConfigureFeature("pinning", status);
ConfigureFeature("configuration", status);
ConfigureFeature("windowsFeature", status);
ConfigureFeature("download", status);
}
}
}
10 changes: 0 additions & 10 deletions src/AppInstallerCLIE2ETests/InstallCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,6 @@ namespace AppInstallerCLIE2ETests
/// </summary>
public class InstallCommand : BaseCommand
{
/// <summary>
/// One time setup.
/// </summary>
[OneTimeSetUp]
public void OneTimeSetup()
{
WinGetSettingsHelper.ConfigureFeature("dependencies", true);
WinGetSettingsHelper.ConfigureFeature("windowsFeature", true);
}

/// <summary>
/// Set up.
/// </summary>
Expand Down
5 changes: 0 additions & 5 deletions src/AppInstallerCLIE2ETests/Interop/InteropSetUpFixture.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,6 @@ public class InteropSetUpFixture
public void Setup()
{
TestCommon.SetupTestSource();

// For the COM E2E tests, once the settings file is initialized, it persists throughout the entirety of the tests.
// Any experimental features needed must be declared prior to running the COM E2E tests.
WinGetSettingsHelper.ConfigureFeature("dependencies", true);
WinGetSettingsHelper.ConfigureFeature("download", true);
}

/// <summary>
Expand Down
3 changes: 0 additions & 3 deletions src/AppInstallerCLITests/ImportFlow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -238,9 +238,6 @@ TEST_CASE("ImportFlow_Dependencies", "[ImportFlow][workflow][dependencies]")
OverrideForShellExecute(context);
context.Args.AddArg(Execution::Args::Type::ImportFile, TestDataFile("ImportFile-Good-Dependencies.json").GetPath().string());

TestUserSettings settings;
settings.Set<AppInstaller::Settings::Setting::EFDependencies>({ true });

ImportCommand importCommand({});
importCommand.Execute(context);
INFO(importOutput.str());
Expand Down
Loading