Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions toolsrc/src/vcpkg/binarycaching.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#include <vcpkg/binarycaching.private.h>
#include <vcpkg/build.h>
#include <vcpkg/dependencies.h>
#include <vcpkg/metrics.h>
#include <vcpkg/tools.h>

using namespace vcpkg;
Expand Down Expand Up @@ -667,6 +668,7 @@ namespace
auto maybe_cachepath = System::get_environment_variable("VCPKG_DEFAULT_BINARY_CACHE");
if (auto p_str = maybe_cachepath.get())
{
Metrics::g_metrics.lock()->track_property("VCPKG_DEFAULT_BINARY_CACHE", "defined");
const auto path = fs::u8path(*p_str);
const auto status = fs::stdfs::status(path);
if (!fs::stdfs::exists(status))
Expand Down Expand Up @@ -915,6 +917,12 @@ namespace
ExpectedS<std::unique_ptr<IBinaryProvider>> vcpkg::create_binary_provider_from_configs_pure(
const std::string& env_string, View<std::string> args)
{
{
auto metrics = Metrics::g_metrics.lock();
if (!env_string.empty()) metrics->track_property("VCPKG_BINARY_SOURCES", "defined");
if (args.size() != 0) metrics->track_property("binarycaching-source", "defined");
}

State s;

BinaryConfigParser default_parser("default,readwrite", "<defaults>", &s);
Expand All @@ -930,17 +938,22 @@ ExpectedS<std::unique_ptr<IBinaryProvider>> vcpkg::create_binary_provider_from_c
if (auto err = arg_parser.get_error()) return err->format();
}

if (s.m_cleared) Metrics::g_metrics.lock()->track_property("binarycaching-clear", "defined");

std::vector<std::unique_ptr<IBinaryProvider>> providers;
if (!s.archives_to_read.empty() || !s.archives_to_write.empty())
providers.push_back(
std::make_unique<ArchivesBinaryProvider>(std::move(s.archives_to_read), std::move(s.archives_to_write)));
if (!s.sources_to_read.empty() || !s.sources_to_write.empty() || !s.configs_to_read.empty() ||
!s.configs_to_write.empty())
{
Metrics::g_metrics.lock()->track_property("binarycaching-nuget", "defined");
providers.push_back(std::make_unique<NugetBinaryProvider>(std::move(s.sources_to_read),
std::move(s.sources_to_write),
std::move(s.configs_to_read),
std::move(s.configs_to_write),
s.interactive));
}

return {std::make_unique<MergeBinaryProviders>(std::move(providers))};
}
Expand Down Expand Up @@ -978,13 +991,16 @@ details::NuGetRepoInfo details::get_nuget_repo_info_from_env()
auto vcpkg_nuget_repository = System::get_environment_variable("VCPKG_NUGET_REPOSITORY");
if (auto p = vcpkg_nuget_repository.get())
{
Metrics::g_metrics.lock()->track_property("VCPKG_NUGET_REPOSITORY", "defined");
return {std::move(*p)};
}
auto gh_repo = System::get_environment_variable("GITHUB_REPOSITORY").value_or("");
if (gh_repo.empty()) return {};
auto gh_server = System::get_environment_variable("GITHUB_SERVER_URL").value_or("");
if (gh_server.empty()) return {};

Metrics::g_metrics.lock()->track_property("GITHUB_REPOSITORY", "defined");

return {Strings::concat(gh_server, '/', gh_repo, ".git"),
System::get_environment_variable("GITHUB_REF").value_or(""),
System::get_environment_variable("GITHUB_SHA").value_or("")};
Expand Down
2 changes: 2 additions & 0 deletions toolsrc/src/vcpkg/commands.setinstalled.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#include <vcpkg/help.h>
#include <vcpkg/input.h>
#include <vcpkg/install.h>
#include <vcpkg/metrics.h>
#include <vcpkg/portfileprovider.h>
#include <vcpkg/remove.h>
#include <vcpkg/vcpkgcmdarguments.h>
Expand Down Expand Up @@ -141,6 +142,7 @@ namespace vcpkg::Commands::SetInstalled
auto it_pkgsconfig = options.settings.find(OPTION_WRITE_PACKAGES_CONFIG);
if (it_pkgsconfig != options.settings.end())
{
Metrics::g_metrics.lock()->track_property("x-write-nuget-packages-config", "defined");
pkgsconfig = it_pkgsconfig->second;
}

Expand Down
2 changes: 2 additions & 0 deletions toolsrc/src/vcpkg/install.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -786,6 +786,7 @@ namespace vcpkg::Install
auto it_pkgsconfig = options.settings.find(OPTION_WRITE_PACKAGES_CONFIG);
if (it_pkgsconfig != options.settings.end())
{
Metrics::g_metrics.lock()->track_property("x-write-nuget-packages-config", "defined");
pkgsconfig = fs::u8path(it_pkgsconfig->second);
}
auto manifest_path = paths.get_manifest_path().value_or_exit(VCPKG_LINE_INFO);
Expand Down Expand Up @@ -924,6 +925,7 @@ namespace vcpkg::Install
auto it_pkgsconfig = options.settings.find(OPTION_WRITE_PACKAGES_CONFIG);
if (it_pkgsconfig != options.settings.end())
{
Metrics::g_metrics.lock()->track_property("x-write-nuget-packages-config", "defined");
Build::compute_all_abis(paths, action_plan, var_provider, status_db);

auto pkgsconfig_path = Files::combine(paths.original_cwd, fs::u8path(it_pkgsconfig->second));
Expand Down