Skip to content

Commit fe8ac77

Browse files
fzanolloJohnMcPMS
andauthored
Show dependencies feature microsoft#1012 (microsoft#1165)
* first tests for show depenencies feature * show dependencies feature for show, install, need to change message * showflow output changed * install commands shows dependencies as in specs * tests for informing dependencies on commands: show, install, upgrade, import * refactor install flow * change import command from install flow (install multiple) * import shows all dependencies together * show dependencies for validate and uninstall * tests for validate and uninstall * create show dependencies exp feature * test for validate command * put functionality under experimental feature check * enable show dep experimental feature on unit test cases * change experimental feature name * remove info stream characters on testcase * move check for exp feature inside report function, create new DependenciesFlow * DependenciesFlow header and cpp inside Workflow * �change representation of Dependency, create DependencyType and DependencyList; add Dependency to context data * dependencies context data is of type DependencyList (not optional) * fix spelling errors * ApplyTo function, can receibe a lambda function to apply on specific DpeendencyType * localize user strings, code style changes, validate report dependencies task divided, creates ValidateFlow * change uninstall flow (gets dependencies from package version), make DependencyList.dependencies private, code style * add missing report dep on upgrade * Update src/AppInstallerCLIPackage/Shared/Strings/en-us/winget.resw Co-authored-by: JohnMcPMS <johnmcp@microsoft.com> * compare id with ICU case insensitive * move dependencies related functions to DependenciesFlow, ReportDependencies is now a WorkflowTask receiving resource string id * TODO to get dependencies on uninstall context, remove testcase for now, move dependency related function to DependenciesFlow * wfIds not temporary * DependencyList Add function checks for existence and updates min version if needed * root dependencies are used when installer are not present, otherwise installer are preferred * merge commits from master * style and details * fix merge conflicts * spellcheck exception * detail when adding dep * divide identity report and installation disclaimer from actual installation Co-authored-by: JohnMcPMS <johnmcp@microsoft.com>
1 parent 145c64c commit fe8ac77

40 files changed

Lines changed: 941 additions & 71 deletions

.github/actions/spelling/expect.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,7 @@ IHelp
138138
IHost
139139
IID
140140
IInstalled
141+
IISOn
141142
img
142143
IName
143144
inet
@@ -202,6 +203,7 @@ msftrubengu
202203
MSIHASH
203204
MSIXHASH
204205
msstore
206+
Multideclaration
205207
multimap
206208
mx
207209
mycustom

doc/Settings.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,3 +146,12 @@ Support in WinGet for packaged callers is currently implemented as an experiment
146146
"packagedAPI": true
147147
},
148148
```
149+
### Dependencies
150+
151+
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.
152+
153+
```json
154+
"experimentalFeatures": {
155+
"dependencies": true
156+
},
157+
```

src/AppInstallerCLICore/AppInstallerCLICore.vcxproj

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -249,6 +249,7 @@
249249
<ClInclude Include="Commands\ValidateCommand.h" />
250250
<ClInclude Include="Commands\SettingsCommand.h" />
251251
<ClInclude Include="CompletionData.h" />
252+
<ClInclude Include="Workflows\DependenciesFlow.h" />
252253
<ClInclude Include="ExecutionArgs.h" />
253254
<ClInclude Include="ExecutionContextData.h" />
254255
<ClInclude Include="ExecutionContext.h" />
@@ -278,6 +279,7 @@
278279
<ClCompile Include="COMContext.cpp" />
279280
<ClCompile Include="Commands\COMInstallCommand.cpp" />
280281
<ClCompile Include="Commands\ImportCommand.cpp" />
282+
<ClCompile Include="Workflows\DependenciesFlow.cpp" />
281283
<ClCompile Include="PackageCollection.cpp" />
282284
<ClCompile Include="Argument.cpp" />
283285
<ClCompile Include="ChannelStreams.cpp" />

src/AppInstallerCLICore/AppInstallerCLICore.vcxproj.filters

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,8 @@
155155
<ClInclude Include="COMContext.h">
156156
<Filter>Public</Filter>
157157
</ClInclude>
158+
<ClInclude Include="Workflows\DependenciesFlow.h">
159+
<Filter>Workflows</Filter>
158160
<ClInclude Include="Commands\COMInstallCommand.h">
159161
<Filter>Commands</Filter>
160162
</ClInclude>
@@ -280,6 +282,8 @@
280282
<ClCompile Include="COMContext.cpp">
281283
<Filter>Source Files</Filter>
282284
</ClCompile>
285+
<ClCompile Include="Workflows\DependenciesFlow.cpp">
286+
<Filter>Source Files</Filter>
283287
<ClCompile Include="Commands\COMInstallCommand.cpp">
284288
<Filter>Commands</Filter>
285289
</ClCompile>

src/AppInstallerCLICore/Commands/UninstallCommand.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
#include "Workflows/InstallFlow.h"
77
#include "Workflows/CompletionFlow.h"
88
#include "Workflows/WorkflowBase.h"
9+
#include "Workflows/DependenciesFlow.h"
910
#include "Resources.h"
1011

1112
using AppInstaller::CLI::Execution::Args;
@@ -128,6 +129,8 @@ namespace AppInstaller::CLI
128129
context <<
129130
Workflow::GetInstalledPackageVersion <<
130131
Workflow::GetUninstallInfo <<
132+
Workflow::GetDependenciesInfoForUninstall <<
133+
Workflow::ReportDependencies(Resource::String::UninstallCommandReportDependencies) <<
131134
Workflow::ReportExecutionStage(ExecutionStage::Execution) <<
132135
Workflow::ExecuteUninstaller <<
133136
Workflow::ReportExecutionStage(ExecutionStage::PostExecution);

src/AppInstallerCLICore/Commands/UpgradeCommand.cpp

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
#include "Workflows/InstallFlow.h"
77
#include "Workflows/UpdateFlow.h"
88
#include "Workflows/WorkflowBase.h"
9+
#include "Workflows/DependenciesFlow.h"
910
#include "Resources.h"
1011

1112
using namespace AppInstaller::CLI::Execution;
@@ -148,7 +149,10 @@ namespace AppInstaller::CLI
148149
GetInstalledPackageVersion <<
149150
EnsureUpdateVersionApplicable <<
150151
SelectInstaller <<
151-
EnsureApplicableInstaller <<
152+
EnsureApplicableInstaller <<
153+
ReportIdentityAndInstallationDisclaimer <<
154+
GetDependenciesFromInstaller <<
155+
ReportDependencies(Resource::String::InstallAndUpgradeCommandsReportDependencies) <<
152156
InstallPackageInstaller;
153157
}
154158
else
@@ -175,7 +179,11 @@ namespace AppInstaller::CLI
175179
context << SelectLatestApplicableUpdate(true);
176180
}
177181

178-
context << InstallPackageInstaller;
182+
context <<
183+
ReportIdentityAndInstallationDisclaimer <<
184+
GetDependenciesFromInstaller <<
185+
ReportDependencies(Resource::String::InstallAndUpgradeCommandsReportDependencies) <<
186+
InstallPackageInstaller;
179187
}
180188
}
181189
}

src/AppInstallerCLICore/Commands/ValidateCommand.cpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
#include "pch.h"
44
#include "ValidateCommand.h"
55
#include "Workflows/WorkflowBase.h"
6+
#include "Workflows/DependenciesFlow.h"
67
#include "Resources.h"
78

89
namespace AppInstaller::CLI
@@ -41,7 +42,13 @@ namespace AppInstaller::CLI
4142

4243
try
4344
{
44-
(void)Manifest::YamlParser::CreateFromPath(inputFile, true, true);
45+
auto manifest = Manifest::YamlParser::CreateFromPath(inputFile, true, true);
46+
47+
context.Add<Execution::Data::Manifest>(manifest);
48+
context <<
49+
Workflow::GetInstallersDependenciesFromManifest <<
50+
Workflow::ReportDependencies(Resource::String::ValidateCommandReportDependencies);
51+
4552
context.Reporter.Info() << Resource::String::ManifestValidationSuccess << std::endl;
4653
}
4754
catch (const Manifest::ManifestException& e)

src/AppInstallerCLICore/ExecutionContextData.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ namespace AppInstaller::CLI::Execution
4747
// On import: Sources for the imported packages
4848
Sources,
4949
ARPSnapshot,
50+
Dependencies,
5051
Max
5152
};
5253

@@ -184,5 +185,11 @@ namespace AppInstaller::CLI::Execution
184185
// Contains the { Id, Version, Channel }
185186
using value_t = std::vector<std::tuple<Utility::LocIndString, Utility::LocIndString, Utility::LocIndString>>;
186187
};
188+
189+
template <>
190+
struct DataMapping<Data::Dependencies>
191+
{
192+
using value_t = Manifest::DependencyList;
193+
};
187194
}
188195
}

src/AppInstallerCLICore/ExecutionReporter.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ namespace AppInstaller::CLI::Execution
1111

1212
const Sequence& HelpCommandEmphasis = TextFormat::Foreground::Bright;
1313
const Sequence& HelpArgumentEmphasis = TextFormat::Foreground::Bright;
14+
const Sequence& ManifestInfoEmphasis = TextFormat::Foreground::Bright;
1415
const Sequence& NameEmphasis = TextFormat::Foreground::BrightCyan;
1516
const Sequence& IdEmphasis = TextFormat::Foreground::BrightCyan;
1617
const Sequence& UrlEmphasis = TextFormat::Foreground::BrightBlue;

src/AppInstallerCLICore/ExecutionReporter.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,7 @@ namespace AppInstaller::CLI::Execution
142142
// Indirection to enable change without tracking down every place
143143
extern const VirtualTerminal::Sequence& HelpCommandEmphasis;
144144
extern const VirtualTerminal::Sequence& HelpArgumentEmphasis;
145+
extern const VirtualTerminal::Sequence& ManifestInfoEmphasis;
145146
extern const VirtualTerminal::Sequence& NameEmphasis;
146147
extern const VirtualTerminal::Sequence& IdEmphasis;
147148
extern const VirtualTerminal::Sequence& UrlEmphasis;

0 commit comments

Comments
 (0)