-
Notifications
You must be signed in to change notification settings - Fork 6.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[vcpkg] Merge the vcpkg metadata uploader into the vcpkg binary (#13421)
- Loading branch information
1 parent
0896bb8
commit 6b97dbf
Showing
21 changed files
with
512 additions
and
1,392 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
#pragma once | ||
|
||
#if !VCPKG_DISABLE_METRICS && defined(_WIN32) | ||
#define VCPKG_ENABLE_X_UPLOAD_METRICS_COMMAND 1 | ||
#else | ||
#define VCPKG_ENABLE_X_UPLOAD_METRICS_COMMAND 0 | ||
#endif // !VCPKG_DISABLE_METRICS && defined(_WIN32) | ||
|
||
#if VCPKG_ENABLE_X_UPLOAD_METRICS_COMMAND | ||
|
||
#include <vcpkg/commands.interface.h> | ||
|
||
namespace vcpkg::Commands::UploadMetrics | ||
{ | ||
extern const CommandStructure COMMAND_STRUCTURE; | ||
struct UploadMetricsCommand : BasicCommand | ||
{ | ||
virtual void perform_and_exit(const VcpkgCmdArguments& args, Files::Filesystem& fs) const override; | ||
}; | ||
} | ||
|
||
#endif // VCPKG_ENABLE_X_UPLOAD_METRICS_COMMAND |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#include <vcpkg/commands.upload-metrics.h> | ||
|
||
#if VCPKG_ENABLE_X_UPLOAD_METRICS_COMMAND | ||
#include <vcpkg/base/checks.h> | ||
#include <vcpkg/base/files.h> | ||
|
||
#include <vcpkg/metrics.h> | ||
#include <vcpkg/vcpkgcmdarguments.h> | ||
|
||
using namespace vcpkg; | ||
|
||
namespace vcpkg::Commands::UploadMetrics | ||
{ | ||
const CommandStructure COMMAND_STRUCTURE = { | ||
create_example_string("x-upload-metrics metrics.txt"), | ||
1, | ||
1, | ||
}; | ||
|
||
void UploadMetricsCommand::perform_and_exit(const VcpkgCmdArguments& args, Files::Filesystem& fs) const | ||
{ | ||
(void)args.parse_arguments(COMMAND_STRUCTURE); | ||
const auto& payload_path = args.command_arguments[0]; | ||
auto payload = fs.read_contents(payload_path).value_or_exit(VCPKG_LINE_INFO); | ||
Metrics::g_metrics.lock()->upload(payload); | ||
Checks::exit_success(VCPKG_LINE_INFO); | ||
} | ||
} | ||
#endif // VCPKG_ENABLE_X_UPLOAD_METRICS_COMMAND |
Oops, something went wrong.