cemu-vcpkg/toolsrc/include/vcpkg/base/system.process.h
ras0219 91e798afd8
[vcpkg] Implementation of --x-binarysource=nuget (and friends) (#12058)
* [vcpkg] Initial implementation of --x-binarysource=nuget

* [vcpkg] Remove double-double quoting of CMake arguments

* [vcpkg] Update nuget.exe to 5.5.1 to support Azure DevOps Artifacts

* [vcpkg] Enable batching of NuGet server calls with prefetch(). Add `interactive` binarysource.

* [vcpkg] Add `nugetconfig` binary source

* [vcpkg] Short circuit querying remote NuGet servers once all refs are found

* [vcpkg] Add experimental help for binary caching

* [vcpkg] Improved NuGet cache package descriptions and version formatting

* [vcpkg] Rename `CmdLineBuilder::build()` to extract()

* [vcpkg-help] Ascii-betize help topics

* [vcpkg] Add tests for cmdlinebuilder. Improve handling of quotes and slashes.

* [vcpkg] Addressing code review comments

* [vcpkg] Add tests for vcpkg::reformat_version()

* [vcpkg] Added test for vcpkg::generate_nuspec()

* [vcpkg] Add tests for vcpkg::XmlSerializer

* [vcpkg] Addressed code review comment

* [vcpkg] Add test for vcpkg::Strings::find_first_of

* [vcpkg] Fix machine-specific paths in test for vcpkg::generate_nuspec()

Co-authored-by: Robert Schumacher <roschuma@microsoft.com>
2020-06-26 12:16:02 -07:00

82 lines
2.5 KiB
C++

#pragma once
#include <vcpkg/base/files.h>
#include <vcpkg/base/zstringview.h>
#include <functional>
#include <string>
#include <unordered_map>
#include <vector>
namespace vcpkg::System
{
struct CMakeVariable
{
CMakeVariable(const StringView varname, const char* varvalue);
CMakeVariable(const StringView varname, const std::string& varvalue);
CMakeVariable(const StringView varname, const fs::path& path);
std::string s;
};
std::string make_basic_cmake_cmd(const fs::path& cmake_tool_path,
const fs::path& cmake_script,
const std::vector<CMakeVariable>& pass_variables);
struct CmdLineBuilder
{
CmdLineBuilder& path_arg(const fs::path& p) { return string_arg(p.u8string()); }
CmdLineBuilder& string_arg(StringView s);
std::string extract() noexcept { return std::move(buf); }
operator ZStringView() const { return buf; }
private:
std::string buf;
};
fs::path get_exe_path_of_current_process();
struct ExitCodeAndOutput
{
int exit_code;
std::string output;
};
struct Environment
{
#if defined(_WIN32)
std::wstring m_env_data;
#endif
};
const Environment& get_clean_environment();
Environment get_modified_clean_environment(const std::unordered_map<std::string, std::string>& extra_env,
const std::string& prepend_to_path = {});
int cmd_execute(const ZStringView cmd_line, const Environment& env = {});
int cmd_execute_clean(const ZStringView cmd_line);
#if defined(_WIN32)
Environment cmd_execute_modify_env(const ZStringView cmd_line, const Environment& env = {});
void cmd_execute_no_wait(const StringView cmd_line);
#endif
ExitCodeAndOutput cmd_execute_and_capture_output(const ZStringView cmd_line, const Environment& env = {});
int cmd_execute_and_stream_lines(const ZStringView cmd_line,
std::function<void(const std::string&)> per_line_cb,
const Environment& env = {});
int cmd_execute_and_stream_data(const ZStringView cmd_line,
std::function<void(StringView)> data_cb,
const Environment& env = {});
void register_console_ctrl_handler();
#if defined(_WIN32)
void initialize_global_job_object();
void enter_interactive_subprocess();
void exit_interactive_subprocess();
#endif
}