forked from microsoft/vcpkg
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[vcpkg] Initial Registries: Part 2 MVP (microsoft#14153)
* [vcpkg wip] start implementation of registries pt. 2 * Remove the `ports` field of `VcpkgPaths` This is an implementation detail, and so we want to make sure that it's obvious that this is an internal detail; thus, we add a new function `builtin_ports_directory()`, which returns the directory where the builtin ports backing store is. * continue WIP * wip * It works! * format * fix some issues * switch from function static to DelayedInit * fix lexically_normal for experimental::filesystem * format * fix missing include * add STL notice * whee error handling * moar error handling! * ignore extra files in registries * formatting * Billy CRs * Update toolsrc/include/vcpkg/versiont.h * fix add_filename test * fix tests * remove unused function add_filename
- Loading branch information
1 parent
b5e7a72
commit 3d2c4d8
Showing
29 changed files
with
771 additions
and
127 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#pragma once | ||
|
||
#include <vcpkg/base/optional.h> | ||
|
||
#include <memory> | ||
#include <mutex> | ||
|
||
namespace vcpkg | ||
{ | ||
// implements the equivalent of function static initialization for an object | ||
template<class T> | ||
struct DelayedInit | ||
{ | ||
template<class F> | ||
const T& get(F&& f) const | ||
{ | ||
std::call_once(underlying_->flag_, [&f, this]() { underlying_->storage_ = std::forward<F>(f)(); }); | ||
return *underlying_->storage_.get(); | ||
} | ||
|
||
private: | ||
struct Storage | ||
{ | ||
std::once_flag flag_; | ||
Optional<T> storage_; | ||
}; | ||
std::unique_ptr<Storage> underlying_ = std::make_unique<Storage>(); | ||
}; | ||
} |
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
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
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
Oops, something went wrong.