Skip to content

Commit cfbdd3a

Browse files
authored
Remove PrintUsage from BuildPackageOptions. (#1527)
* Remove PrintUsage from BuildPackageOptions. Extracted from #1514 build_package never prints usage so the setting should not be there. * Fix flipped print usage order in commands.install.cpp
1 parent ef392c3 commit cfbdd3a

File tree

8 files changed

+20
-23
lines changed

8 files changed

+20
-23
lines changed

include/vcpkg/commands.build.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,6 @@ namespace vcpkg
7272
CleanDownloads clean_downloads;
7373
DownloadTool download_tool;
7474
BackcompatFeatures backcompat_features;
75-
PrintUsage print_usage;
7675
KeepGoing keep_going;
7776
};
7877

include/vcpkg/commands.set-installed.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ namespace vcpkg
4040
const CMakeVars::CMakeVarProvider& cmake_vars,
4141
ActionPlan action_plan,
4242
DryRun dry_run,
43+
PrintUsage print_usage,
4344
const Optional<Path>& maybe_pkgconfig,
4445
bool include_manifest_in_github_issue);
4546
void command_set_installed_and_exit(const VcpkgCmdArguments& args,

src/vcpkg/commands.build-external.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ namespace vcpkg
3636
CleanDownloads::No,
3737
DownloadTool::Builtin,
3838
BackcompatFeatures::Allow,
39-
PrintUsage::Yes,
4039
};
4140

4241
const FullPackageSpec spec =

src/vcpkg/commands.build.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,6 @@ namespace vcpkg
9898
CleanDownloads::No,
9999
DownloadTool::Builtin,
100100
BackcompatFeatures::Allow,
101-
PrintUsage::Yes,
102101
};
103102

104103
const FullPackageSpec spec =

src/vcpkg/commands.ci.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -327,7 +327,6 @@ namespace vcpkg
327327
CleanDownloads::No,
328328
DownloadTool::Builtin,
329329
BackcompatFeatures::Prohibit,
330-
PrintUsage::Yes,
331330
KeepGoing::Yes,
332331
};
333332

src/vcpkg/commands.install.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1055,8 +1055,7 @@ namespace vcpkg
10551055
const auto unsupported_port_action = Util::Sets::contains(options.switches, SwitchAllowUnsupported)
10561056
? UnsupportedPortAction::Warn
10571057
: UnsupportedPortAction::Error;
1058-
const PrintUsage print_cmake_usage =
1059-
Util::Sets::contains(options.switches, SwitchNoPrintUsage) ? PrintUsage::No : PrintUsage::Yes;
1058+
const bool print_cmake_usage = !Util::Sets::contains(options.switches, SwitchNoPrintUsage);
10601059

10611060
get_global_metrics_collector().track_bool(BoolMetric::InstallManifestMode, paths.manifest_mode_enabled());
10621061

@@ -1125,7 +1124,6 @@ namespace vcpkg
11251124
Util::Enum::to_enum<CleanDownloads>(clean_after_build || clean_downloads_after_build),
11261125
download_tool,
11271126
prohibit_backcompat_features ? BackcompatFeatures::Prohibit : BackcompatFeatures::Allow,
1128-
print_cmake_usage,
11291127
keep_going,
11301128
};
11311129

@@ -1273,6 +1271,7 @@ namespace vcpkg
12731271
var_provider,
12741272
std::move(install_plan),
12751273
dry_run ? DryRun::Yes : DryRun::No,
1274+
print_cmake_usage ? PrintUsage::Yes : PrintUsage::No,
12761275
pkgsconfig,
12771276
true);
12781277
}
@@ -1373,6 +1372,8 @@ namespace vcpkg
13731372
binary_cache,
13741373
null_build_logs_recorder());
13751374

1375+
// Skip printing the summary without --keep-going because the status without it is 'obvious': everything was a
1376+
// success.
13761377
if (keep_going == KeepGoing::Yes)
13771378
{
13781379
msg::print(summary.format());
@@ -1396,7 +1397,7 @@ namespace vcpkg
13961397
fs.write_contents(it_xunit->second, xwriter.build_xml(default_triplet), VCPKG_LINE_INFO);
13971398
}
13981399

1399-
if (build_package_options.print_usage == PrintUsage::Yes)
1400+
if (print_cmake_usage)
14001401
{
14011402
std::set<std::string> printed_usages;
14021403
for (auto&& result : summary.results)

src/vcpkg/commands.set-installed.cpp

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,7 @@ namespace vcpkg
172172
const CMakeVars::CMakeVarProvider& cmake_vars,
173173
ActionPlan action_plan,
174174
DryRun dry_run,
175+
PrintUsage print_usage,
175176
const Optional<Path>& maybe_pkgconfig,
176177
bool include_manifest_in_github_issue)
177178
{
@@ -257,7 +258,7 @@ namespace vcpkg
257258
}
258259
}
259260

260-
if (build_options.print_usage == PrintUsage::Yes)
261+
if (print_usage == PrintUsage::Yes)
261262
{
262263
// Note that this differs from the behavior of `vcpkg install` in that it will print usage information for
263264
// packages named but not installed here
@@ -287,15 +288,12 @@ namespace vcpkg
287288
.value_or_exit(VCPKG_LINE_INFO);
288289
});
289290

290-
const bool dry_run = Util::Sets::contains(options.switches, SwitchDryRun);
291291
const auto only_downloads =
292292
Util::Sets::contains(options.switches, SwitchOnlyDownloads) ? OnlyDownloads::Yes : OnlyDownloads::No;
293293
const auto keep_going =
294294
Util::Sets::contains(options.switches, SwitchKeepGoing) || only_downloads == OnlyDownloads::Yes
295295
? KeepGoing::Yes
296296
: KeepGoing::No;
297-
const auto print_usage =
298-
Util::Sets::contains(options.switches, SwitchNoPrintUsage) ? PrintUsage::No : PrintUsage::Yes;
299297
const auto unsupported_port_action = Util::Sets::contains(options.switches, SwitchAllowUnsupported)
300298
? UnsupportedPortAction::Warn
301299
: UnsupportedPortAction::Error;
@@ -312,7 +310,6 @@ namespace vcpkg
312310
CleanDownloads::No,
313311
DownloadTool::Builtin,
314312
prohibit_backcompat_features,
315-
print_usage,
316313
keep_going,
317314
};
318315

@@ -339,14 +336,17 @@ namespace vcpkg
339336
specs,
340337
{},
341338
{nullptr, host_triplet, paths.packages(), unsupported_port_action, UseHeadVersion::No, Editable::No});
342-
command_set_installed_and_exit_ex(args,
343-
paths,
344-
host_triplet,
345-
build_options,
346-
*cmake_vars,
347-
std::move(action_plan),
348-
dry_run ? DryRun::Yes : DryRun::No,
349-
pkgsconfig,
350-
false);
339+
340+
command_set_installed_and_exit_ex(
341+
args,
342+
paths,
343+
host_triplet,
344+
build_options,
345+
*cmake_vars,
346+
std::move(action_plan),
347+
Util::Sets::contains(options.switches, SwitchDryRun) ? DryRun::Yes : DryRun::No,
348+
Util::Sets::contains(options.switches, SwitchNoPrintUsage) ? PrintUsage::No : PrintUsage::Yes,
349+
pkgsconfig,
350+
false);
351351
}
352352
} // namespace vcpkg

src/vcpkg/commands.upgrade.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,6 @@ namespace vcpkg
6969
CleanDownloads::No,
7070
DownloadTool::Builtin,
7171
BackcompatFeatures::Allow,
72-
PrintUsage::Yes,
7372
keep_going,
7473
};
7574

0 commit comments

Comments
 (0)