Skip to content

Commit

Permalink
[vcpkg] Fix regression in --debug. Remove old features featurefla…
Browse files Browse the repository at this point in the history
…g. (#6507)
  • Loading branch information
ras0219-msft authored May 19, 2019
1 parent 469543f commit 77af264
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 51 deletions.
2 changes: 0 additions & 2 deletions toolsrc/include/vcpkg/globalstate.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@ namespace vcpkg
static Util::LockGuarded<Chrono::ElapsedTimer> timer;
static Util::LockGuarded<std::string> g_surveydate;

static std::atomic<bool> debugging;
static std::atomic<bool> feature_packages;
static std::atomic<bool> g_binary_caching;

static std::atomic<int> g_init_console_cp;
Expand Down
9 changes: 4 additions & 5 deletions toolsrc/src/vcpkg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -294,11 +294,11 @@ int main(const int argc, const char* const* const argv)
Checks::register_global_shutdown_handler([]() {
const auto elapsed_us_inner = GlobalState::timer.lock()->microseconds();

bool debugging = GlobalState::debugging;
bool debugging = Debug::g_debugging;

auto metrics = Metrics::g_metrics.lock();
metrics->track_metric("elapsed_us", elapsed_us_inner);
GlobalState::debugging = false;
Debug::g_debugging = false;
metrics->flush();

#if defined(_WIN32)
Expand Down Expand Up @@ -337,14 +337,13 @@ int main(const int argc, const char* const* const argv)

const VcpkgCmdArguments args = VcpkgCmdArguments::create_from_command_line(argc, argv);

if (const auto p = args.featurepackages.get()) GlobalState::feature_packages = *p;
if (const auto p = args.binarycaching.get()) GlobalState::g_binary_caching = *p;

if (const auto p = args.printmetrics.get()) Metrics::g_metrics.lock()->set_print_metrics(*p);
if (const auto p = args.sendmetrics.get()) Metrics::g_metrics.lock()->set_send_metrics(*p);
if (const auto p = args.debug.get()) GlobalState::debugging = *p;
if (const auto p = args.debug.get()) Debug::g_debugging = *p;

if (GlobalState::debugging)
if (Debug::g_debugging)
{
inner(args);
Checks::exit_fail(VCPKG_LINE_INFO);
Expand Down
12 changes: 4 additions & 8 deletions toolsrc/src/vcpkg/build.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#include <vcpkg/base/stringliteral.h>
#include <vcpkg/base/system.print.h>
#include <vcpkg/base/system.process.h>
#include <vcpkg/base/system.debug.h>

#include <vcpkg/build.h>
#include <vcpkg/commands.h>
Expand Down Expand Up @@ -129,11 +130,6 @@ namespace vcpkg::Build::Command
const FullPackageSpec spec = Input::check_and_get_full_package_spec(
std::move(first_arg), default_triplet, COMMAND_STRUCTURE.example_text);
Input::check_triplet(spec.package_spec.triplet(), paths);
if (!spec.features.empty() && !GlobalState::feature_packages)
{
Checks::exit_with_message(
VCPKG_LINE_INFO, "Feature packages are experimentally available under the --featurepackages flag.");
}
perform_and_exit_ex(spec, paths.port_dir(spec.package_spec), options, paths);
}
}
Expand Down Expand Up @@ -237,7 +233,7 @@ namespace vcpkg::Build
if (!pre_build_info.cmake_system_name.empty() && pre_build_info.cmake_system_name != "WindowsStore") return "";

const char* tonull = " >nul";
if (GlobalState::debugging)
if (Debug::g_debugging)
{
tonull = "";
}
Expand Down Expand Up @@ -511,7 +507,7 @@ namespace vcpkg::Build
// which will give a stable ordering and better names in the key entry.
// this is not available in the filesystem TS so instead number the files for the key.
std::string key = Strings::format("file_%03d", counter++);
if (GlobalState::debugging)
if (Debug::g_debugging)
{
System::print2("[DEBUG] mapping ", key, " from ", port_file.u8string(), "\n");
}
Expand All @@ -536,7 +532,7 @@ namespace vcpkg::Build
const std::string full_abi_info =
Strings::join("", abi_tag_entries, [](const AbiEntry& p) { return p.key + " " + p.value + "\n"; });

if (GlobalState::debugging)
if (Debug::g_debugging)
{
System::print2("[DEBUG] <abientries>\n");
for (auto&& entry : abi_tag_entries)
Expand Down
2 changes: 0 additions & 2 deletions toolsrc/src/vcpkg/globalstate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ namespace vcpkg
Util::LockGuarded<Chrono::ElapsedTimer> GlobalState::timer;
Util::LockGuarded<std::string> GlobalState::g_surveydate;

std::atomic<bool> GlobalState::debugging(false);
std::atomic<bool> GlobalState::feature_packages(true);
std::atomic<bool> GlobalState::g_binary_caching(false);

std::atomic<int> GlobalState::g_init_console_cp(0);
Expand Down
22 changes: 1 addition & 21 deletions toolsrc/src/vcpkg/install.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -302,8 +302,7 @@ namespace vcpkg::Install
{
const InstallPlanType& plan_type = action.plan_type;
const std::string display_name = action.spec.to_string();
const std::string display_name_with_features =
GlobalState::feature_packages ? action.displayname() : display_name;
const std::string display_name_with_features = action.displayname();

const bool is_user_requested = action.request_type == RequestType::USER_REQUESTED;
const bool use_head_version = Util::Enum::to_bool(action.build_options.use_head_version);
Expand Down Expand Up @@ -615,11 +614,6 @@ namespace vcpkg::Install
for (auto&& spec : specs)
{
Input::check_triplet(spec.package_spec.triplet(), paths);
if (!spec.features.empty() && !GlobalState::feature_packages)
{
Checks::exit_with_message(
VCPKG_LINE_INFO, "Feature packages are experimentally available under the --featurepackages flag.");
}
}

const bool dry_run = Util::Sets::contains(options.switches, OPTION_DRY_RUN);
Expand Down Expand Up @@ -655,20 +649,6 @@ namespace vcpkg::Install
std::vector<AnyAction> action_plan =
create_feature_install_plan(provider, FullPackageSpec::to_feature_specs(specs), status_db);

if (!GlobalState::feature_packages)
{
for (auto&& action : action_plan)
{
if (action.remove_action.has_value())
{
Checks::exit_with_message(
VCPKG_LINE_INFO,
"The installation plan requires feature packages support. Please re-run the "
"command with --featurepackages.");
}
}
}

for (auto&& action : action_plan)
{
if (auto p_install = action.install_action.get())
Expand Down
16 changes: 3 additions & 13 deletions toolsrc/src/vcpkg/paragraphs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#include <vcpkg/base/files.h>
#include <vcpkg/base/system.print.h>
#include <vcpkg/base/util.h>
#include <vcpkg/globalstate.h>
#include <vcpkg/base/system.debug.h>
#include <vcpkg/paragraphparseresult.h>
#include <vcpkg/paragraphs.h>

Expand Down Expand Up @@ -211,17 +211,7 @@ namespace vcpkg::Paragraphs
Expected<std::vector<std::unordered_map<std::string, std::string>>> pghs = get_paragraphs(fs, path / "CONTROL");
if (auto vector_pghs = pghs.get())
{
auto csf = SourceControlFile::parse_control_file(std::move(*vector_pghs));
if (!GlobalState::feature_packages)
{
if (auto ptr = csf.get())
{
Checks::check_exit(VCPKG_LINE_INFO, ptr->get() != nullptr);
ptr->get()->core_paragraph->default_features.clear();
ptr->get()->feature_paragraphs.clear();
}
}
return csf;
return SourceControlFile::parse_control_file(std::move(*vector_pghs));
}
auto error_info = std::make_unique<ParseControlErrorInfo>();
error_info->name = path.filename().generic_u8string();
Expand Down Expand Up @@ -279,7 +269,7 @@ namespace vcpkg::Paragraphs
auto results = try_load_all_ports(fs, ports_dir);
if (!results.errors.empty())
{
if (GlobalState::debugging)
if (Debug::g_debugging)
{
print_error_message(results.errors);
}
Expand Down

0 comments on commit 77af264

Please sign in to comment.