Skip to content

Commit 7641d0e

Browse files
committed
Only download during COM download
1 parent c534f15 commit 7641d0e

File tree

3 files changed

+37
-5
lines changed

3 files changed

+37
-5
lines changed

src/AppInstallerCLICore/Workflows/InstallFlow.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -609,7 +609,7 @@ namespace AppInstaller::CLI::Workflow
609609
Workflow::GetDependenciesFromInstaller <<
610610
Workflow::ReportDependencies(Resource::String::PackageRequiresDependencies) <<
611611
Workflow::CreateDependencySubContexts(Resource::String::PackageRequiresDependencies) <<
612-
Workflow::ProcessMultiplePackages(Resource::String::PackageRequiresDependencies, APPINSTALLER_CLI_ERROR_DOWNLOAD_DEPENDENCIES, {}, true, true, true, false);
612+
Workflow::ProcessMultiplePackages(Resource::String::PackageRequiresDependencies, APPINSTALLER_CLI_ERROR_DOWNLOAD_DEPENDENCIES, {}, true, true, true, false, true);
613613
}
614614

615615
void InstallSinglePackage(Execution::Context& context)
@@ -682,7 +682,7 @@ namespace AppInstaller::CLI::Workflow
682682
return;
683683
}
684684

685-
bool downloadInstallerOnly = WI_IsFlagSet(context.GetFlags(), Execution::ContextFlag::InstallerDownloadOnly);
685+
bool downloadInstallerOnly = m_downloadOnly ? true : WI_IsFlagSet(context.GetFlags(), Execution::ContextFlag::InstallerDownloadOnly);
686686

687687
// Show all prompts needed for every package before installing anything
688688
context << Workflow::ShowPromptsForMultiplePackages(m_ensurePackageAgreements, downloadInstallerOnly);

src/AppInstallerCLICore/Workflows/InstallFlow.h

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -174,15 +174,17 @@ namespace AppInstaller::CLI::Workflow
174174
bool ensurePackageAgreements = true,
175175
bool ignoreDependencies = false,
176176
bool stopOnFailure = false,
177-
bool refreshPathVariable = false):
177+
bool refreshPathVariable = false,
178+
bool downloadOnly = false):
178179
WorkflowTask("ProcessMultiplePackages"),
179180
m_dependenciesReportMessage(dependenciesReportMessage),
180181
m_resultOnFailure(resultOnFailure),
181182
m_ignorableInstallResults(std::move(ignorableInstallResults)),
182183
m_ignorePackageDependencies(ignoreDependencies),
183184
m_ensurePackageAgreements(ensurePackageAgreements),
184185
m_stopOnFailure(stopOnFailure),
185-
m_refreshPathVariable(refreshPathVariable){}
186+
m_refreshPathVariable(refreshPathVariable),
187+
m_downloadOnly(downloadOnly){}
186188

187189
void operator()(Execution::Context& context) const override;
188190

@@ -194,6 +196,7 @@ namespace AppInstaller::CLI::Workflow
194196
bool m_ensurePackageAgreements;
195197
bool m_stopOnFailure;
196198
bool m_refreshPathVariable;
199+
bool m_downloadOnly;
197200
};
198201

199202
// Stores the existing set of packages in ARP.

src/AppInstallerCLITests/InstallDependenciesFlow.cpp

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,10 @@
44
#include "WorkflowCommon.h"
55
#include "DependenciesTestSource.h"
66
#include <Commands/InstallCommand.h>
7+
#include <Commands/COMCommand.h>
78
#include <Workflows/DependenciesFlow.h>
89
#include <Workflows/InstallFlow.h>
10+
#include <Workflows/ShellExecuteInstallerHandler.h>
911

1012
using namespace TestCommon;
1113
using namespace AppInstaller::CLI;
@@ -38,6 +40,14 @@ void OverrideForProcessMultiplePackages(TestContext& context)
3840
} });
3941
}
4042

43+
void OverrideShellExecute(TestContext& context)
44+
{
45+
context.Override({ ShellExecuteInstallImpl, [](TestContext& c)
46+
{
47+
c.Add< Execution::Data::OperationReturnCode>(0);
48+
} });
49+
}
50+
4151
TEST_CASE("DependencyGraph_SkipInstalled", "[InstallFlow][workflow][dependencyGraph][dependencies]")
4252
{
4353
TestCommon::TempFile installResultPath("TestExeInstalled.txt");
@@ -264,7 +274,26 @@ TEST_CASE("InstallFlow_Dependencies", "[InstallFlow][workflow][dependencies]")
264274
REQUIRE(installOutput.str().find("PreviewIIS") != std::string::npos);
265275
}
266276

277+
TEST_CASE("InstallFlow_Dependencies_COM", "[InstallFlow][workflow][dependencies]")
278+
{
279+
std::ostringstream installOutput;
280+
TestContext context{ installOutput, std::cin };
281+
auto previousThreadGlobals = context.SetForCurrentThread();
282+
OverrideForShellExecute(context);
283+
OverrideShellExecute(context);
284+
OverrideOpenDependencySource(context);
285+
OverrideEnableWindowsFeaturesDependencies(context);
286+
287+
context.Add<Execution::Data::Manifest>(YamlParser::CreateFromPath(TestDataFile("InstallFlowTest_MultipleDependencies.yaml")));
288+
289+
COMDownloadCommand download({});
290+
download.Execute(context);
291+
292+
COMInstallCommand install({});
293+
REQUIRE_NOTHROW(install.Execute(context));
294+
}
295+
267296
// TODO:
268297
// add dependencies for installer tests to DependenciesTestSource (or a new one)
269298
// add tests for min version dependency solving
270-
// add tests that check for correct installation of dependencies (not only the order)
299+
// add tests that check for correct installation of dependencies (not only the order)

0 commit comments

Comments
 (0)