Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Split BinaryProvider into read vs write #998

Merged
merged 12 commits into from
May 10, 2023
70 changes: 69 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,73 @@
"source.organizeImports": true
},
"eslint.format.enable": true,
"files.eol": "\n"
"files.eol": "\n",
"files.associations": {
"any": "cpp",
ras0219-msft marked this conversation as resolved.
Show resolved Hide resolved
"array": "cpp",
"atomic": "cpp",
"bit": "cpp",
"*.tcc": "cpp",
"bitset": "cpp",
"cctype": "cpp",
"chrono": "cpp",
"clocale": "cpp",
"cmath": "cpp",
"codecvt": "cpp",
"complex": "cpp",
"condition_variable": "cpp",
"cstdarg": "cpp",
"cstddef": "cpp",
"cstdint": "cpp",
"cstdio": "cpp",
"cstdlib": "cpp",
"cstring": "cpp",
"ctime": "cpp",
"cwchar": "cpp",
"cwctype": "cpp",
"deque": "cpp",
"list": "cpp",
"map": "cpp",
"set": "cpp",
"unordered_map": "cpp",
"unordered_set": "cpp",
"vector": "cpp",
"exception": "cpp",
"algorithm": "cpp",
"functional": "cpp",
"iterator": "cpp",
"memory": "cpp",
"memory_resource": "cpp",
"numeric": "cpp",
"optional": "cpp",
"random": "cpp",
"ratio": "cpp",
"regex": "cpp",
"string": "cpp",
"string_view": "cpp",
"system_error": "cpp",
"tuple": "cpp",
"type_traits": "cpp",
"utility": "cpp",
"fstream": "cpp",
"future": "cpp",
"initializer_list": "cpp",
"iomanip": "cpp",
"iosfwd": "cpp",
"iostream": "cpp",
"istream": "cpp",
"limits": "cpp",
"mutex": "cpp",
"new": "cpp",
"ostream": "cpp",
"shared_mutex": "cpp",
"sstream": "cpp",
"stdexcept": "cpp",
"streambuf": "cpp",
"thread": "cpp",
"cinttypes": "cpp",
"typeindex": "cpp",
"typeinfo": "cpp",
"variant": "cpp"
}
}
29 changes: 21 additions & 8 deletions include/vcpkg/archives.h
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
#pragma once

#include <vcpkg/base/fwd/expected.h>
#include <vcpkg/base/fwd/files.h>
#include <vcpkg/base/fwd/message_sinks.h>
#include <vcpkg/base/fwd/span.h>
#include <vcpkg/base/fwd/system.process.h>

#include <vcpkg/fwd/tools.h>
#include <vcpkg/fwd/vcpkgpaths.h>

#include <vcpkg/tools.h>
#include <vcpkg/base/path.h>

namespace vcpkg
{
Expand All @@ -27,14 +30,24 @@ namespace vcpkg
Filesystem& fs, const ToolCache& tools, MessageSink& status_sink, const Path& archive, const Path& to_path);
#endif

// Compress the source directory into the destination file.
ExpectedL<Unit> compress_directory_to_zip(
Filesystem& fs, const ToolCache& tools, MessageSink& status_sink, const Path& source, const Path& destination);
struct ZipTool
{
static ExpectedL<ZipTool> make(Filesystem& fs, const ToolCache& tools, MessageSink& status_sink);

Command decompress_zip_archive_cmd(const ToolCache& tools,
MessageSink& status_sink,
const Path& dst,
const Path& archive_path);
private:
ZipTool() = default;

Filesystem* fs = nullptr;
#if defined _WIN32
Path seven_zip;
#endif

public:
// Compress the source directory into the destination file.
ExpectedL<Unit> compress_directory_to_zip(const Path& source, const Path& destination) const;

Command decompress_zip_archive_cmd(const Path& dst, const Path& archive_path) const;
};

std::vector<ExpectedL<Unit>> decompress_in_parallel(View<Command> jobs);
}
40 changes: 33 additions & 7 deletions include/vcpkg/base/message-data.inc.h
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,7 @@ DECLARE_MESSAGE(BaselineMissingDefault,
"",
"The baseline.json from commit `\"{commit_sha}\"` in the repo {url} was invalid (did not "
"contain a \"default\" field).")
DECLARE_MESSAGE(BinaryCacheVendorHTTP, (), "", "HTTP servers")
DECLARE_MESSAGE(BinarySourcesArg, (), "", "Add sources for binary caching. See 'vcpkg help binarycaching'.")
DECLARE_MESSAGE(BinaryWithInvalidArchitecture,
(msg::path, msg::expected, msg::actual),
Expand Down Expand Up @@ -2230,12 +2231,34 @@ DECLARE_MESSAGE(ResponseFileCode,
"Explains to the user that they can use response files on the command line, 'response_file' must "
"have no spaces and be a legal file name.",
"@response_file")
DECLARE_MESSAGE(RestoredPackage, (msg::path), "", "Restored package from \"{path}\"")
DECLARE_MESSAGE(
RestoredPackagesFromVendor,
(msg::count, msg::elapsed, msg::value),
"{value} may be either a 'vendor' like 'Azure' or 'NuGet', or a file path like C:\\example or /usr/example",
"Restored {count} package(s) from {value} in {elapsed}. Use --debug to see more details.")
DECLARE_MESSAGE(RestoredPackagesFromAWS,
(msg::count, msg::elapsed),
"",
"Restored {count} package(s) from AWS in {elapsed}. Use --debug to see more details.")
DECLARE_MESSAGE(RestoredPackagesFromCOS,
(msg::count, msg::elapsed),
"",
"Restored {count} package(s) from COS in {elapsed}. Use --debug to see more details.")
DECLARE_MESSAGE(RestoredPackagesFromFiles,
(msg::count, msg::elapsed, msg::path),
"",
"Restored {count} package(s) from {path} in {elapsed}. Use --debug to see more details.")
DECLARE_MESSAGE(RestoredPackagesFromGCS,
(msg::count, msg::elapsed),
"",
"Restored {count} package(s) from GCS in {elapsed}. Use --debug to see more details.")
DECLARE_MESSAGE(RestoredPackagesFromGHA,
(msg::count, msg::elapsed),
"",
"Restored {count} package(s) from GitHub Actions Cache in {elapsed}. Use --debug to see more details.")
DECLARE_MESSAGE(RestoredPackagesFromHTTP,
(msg::count, msg::elapsed),
"",
"Restored {count} package(s) from HTTP servers in {elapsed}. Use --debug to see more details.")
DECLARE_MESSAGE(RestoredPackagesFromNuGet,
(msg::count, msg::elapsed),
"",
"Restored {count} package(s) from NuGet in {elapsed}. Use --debug to see more details.")
DECLARE_MESSAGE(ResultsHeader, (), "Displayed before a list of installation results.", "RESULTS")
DECLARE_MESSAGE(ScriptAssetCacheRequiresScript,
(),
Expand Down Expand Up @@ -2298,7 +2321,10 @@ DECLARE_MESSAGE(SpecifyTargetArch,
"Specify the target architecture triplet. See 'vcpkg help triplet'.\n(default: '{env_var}')")
DECLARE_MESSAGE(StartCodeUnitInContinue, (), "", "found start code unit in continue position")
DECLARE_MESSAGE(StoredBinaryCache, (msg::path), "", "Stored binary cache: \"{path}\"")
DECLARE_MESSAGE(StoredBinariesToDestinations, (msg::count), "", "Stored binaries in {count} destinations.")
DECLARE_MESSAGE(StoredBinariesToDestinations,
(msg::count, msg::elapsed),
"",
"Stored binaries in {count} destinations in {elapsed}.")
DECLARE_MESSAGE(StoreOptionMissingSha, (), "", "--store option is invalid without a sha512")
DECLARE_MESSAGE(SuccessfulyExported, (msg::package_name, msg::path), "", "Exported {package_name} to {path}")
DECLARE_MESSAGE(SuggestGitPull, (), "", "The result may be outdated. Run `git pull` to get the latest results.")
Expand Down
Loading
Loading