Skip to content

Commit

Permalink
Remove PrintUsage from BuildPackageOptions. (#1527)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
BillyONeal authored Nov 1, 2024
1 parent ef392c3 commit cfbdd3a
Show file tree
Hide file tree
Showing 8 changed files with 20 additions and 23 deletions.
1 change: 0 additions & 1 deletion include/vcpkg/commands.build.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@ namespace vcpkg
CleanDownloads clean_downloads;
DownloadTool download_tool;
BackcompatFeatures backcompat_features;
PrintUsage print_usage;
KeepGoing keep_going;
};

Expand Down
1 change: 1 addition & 0 deletions include/vcpkg/commands.set-installed.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ namespace vcpkg
const CMakeVars::CMakeVarProvider& cmake_vars,
ActionPlan action_plan,
DryRun dry_run,
PrintUsage print_usage,
const Optional<Path>& maybe_pkgconfig,
bool include_manifest_in_github_issue);
void command_set_installed_and_exit(const VcpkgCmdArguments& args,
Expand Down
1 change: 0 additions & 1 deletion src/vcpkg/commands.build-external.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ namespace vcpkg
CleanDownloads::No,
DownloadTool::Builtin,
BackcompatFeatures::Allow,
PrintUsage::Yes,
};

const FullPackageSpec spec =
Expand Down
1 change: 0 additions & 1 deletion src/vcpkg/commands.build.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,6 @@ namespace vcpkg
CleanDownloads::No,
DownloadTool::Builtin,
BackcompatFeatures::Allow,
PrintUsage::Yes,
};

const FullPackageSpec spec =
Expand Down
1 change: 0 additions & 1 deletion src/vcpkg/commands.ci.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,6 @@ namespace vcpkg
CleanDownloads::No,
DownloadTool::Builtin,
BackcompatFeatures::Prohibit,
PrintUsage::Yes,
KeepGoing::Yes,
};

Expand Down
9 changes: 5 additions & 4 deletions src/vcpkg/commands.install.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1055,8 +1055,7 @@ namespace vcpkg
const auto unsupported_port_action = Util::Sets::contains(options.switches, SwitchAllowUnsupported)
? UnsupportedPortAction::Warn
: UnsupportedPortAction::Error;
const PrintUsage print_cmake_usage =
Util::Sets::contains(options.switches, SwitchNoPrintUsage) ? PrintUsage::No : PrintUsage::Yes;
const bool print_cmake_usage = !Util::Sets::contains(options.switches, SwitchNoPrintUsage);

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

Expand Down Expand Up @@ -1125,7 +1124,6 @@ namespace vcpkg
Util::Enum::to_enum<CleanDownloads>(clean_after_build || clean_downloads_after_build),
download_tool,
prohibit_backcompat_features ? BackcompatFeatures::Prohibit : BackcompatFeatures::Allow,
print_cmake_usage,
keep_going,
};

Expand Down Expand Up @@ -1273,6 +1271,7 @@ namespace vcpkg
var_provider,
std::move(install_plan),
dry_run ? DryRun::Yes : DryRun::No,
print_cmake_usage ? PrintUsage::Yes : PrintUsage::No,
pkgsconfig,
true);
}
Expand Down Expand Up @@ -1373,6 +1372,8 @@ namespace vcpkg
binary_cache,
null_build_logs_recorder());

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

if (build_package_options.print_usage == PrintUsage::Yes)
if (print_cmake_usage)
{
std::set<std::string> printed_usages;
for (auto&& result : summary.results)
Expand Down
28 changes: 14 additions & 14 deletions src/vcpkg/commands.set-installed.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,7 @@ namespace vcpkg
const CMakeVars::CMakeVarProvider& cmake_vars,
ActionPlan action_plan,
DryRun dry_run,
PrintUsage print_usage,
const Optional<Path>& maybe_pkgconfig,
bool include_manifest_in_github_issue)
{
Expand Down Expand Up @@ -257,7 +258,7 @@ namespace vcpkg
}
}

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

const bool dry_run = Util::Sets::contains(options.switches, SwitchDryRun);
const auto only_downloads =
Util::Sets::contains(options.switches, SwitchOnlyDownloads) ? OnlyDownloads::Yes : OnlyDownloads::No;
const auto keep_going =
Util::Sets::contains(options.switches, SwitchKeepGoing) || only_downloads == OnlyDownloads::Yes
? KeepGoing::Yes
: KeepGoing::No;
const auto print_usage =
Util::Sets::contains(options.switches, SwitchNoPrintUsage) ? PrintUsage::No : PrintUsage::Yes;
const auto unsupported_port_action = Util::Sets::contains(options.switches, SwitchAllowUnsupported)
? UnsupportedPortAction::Warn
: UnsupportedPortAction::Error;
Expand All @@ -312,7 +310,6 @@ namespace vcpkg
CleanDownloads::No,
DownloadTool::Builtin,
prohibit_backcompat_features,
print_usage,
keep_going,
};

Expand All @@ -339,14 +336,17 @@ namespace vcpkg
specs,
{},
{nullptr, host_triplet, paths.packages(), unsupported_port_action, UseHeadVersion::No, Editable::No});
command_set_installed_and_exit_ex(args,
paths,
host_triplet,
build_options,
*cmake_vars,
std::move(action_plan),
dry_run ? DryRun::Yes : DryRun::No,
pkgsconfig,
false);

command_set_installed_and_exit_ex(
args,
paths,
host_triplet,
build_options,
*cmake_vars,
std::move(action_plan),
Util::Sets::contains(options.switches, SwitchDryRun) ? DryRun::Yes : DryRun::No,
Util::Sets::contains(options.switches, SwitchNoPrintUsage) ? PrintUsage::No : PrintUsage::Yes,
pkgsconfig,
false);
}
} // namespace vcpkg
1 change: 0 additions & 1 deletion src/vcpkg/commands.upgrade.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@ namespace vcpkg
CleanDownloads::No,
DownloadTool::Builtin,
BackcompatFeatures::Allow,
PrintUsage::Yes,
keep_going,
};

Expand Down

0 comments on commit cfbdd3a

Please sign in to comment.