summaryrefslogtreecommitdiff
path: root/tools/minicargo/repository.h
diff options
context:
space:
mode:
Diffstat (limited to 'tools/minicargo/repository.h')
-rw-r--r--tools/minicargo/repository.h29
1 files changed, 29 insertions, 0 deletions
diff --git a/tools/minicargo/repository.h b/tools/minicargo/repository.h
new file mode 100644
index 00000000..0b186077
--- /dev/null
+++ b/tools/minicargo/repository.h
@@ -0,0 +1,29 @@
+#pragma once
+
+#include <string>
+#include <map>
+#include "helpers.h"
+#include "manifest.h"
+
+class Repository
+{
+ struct Entry
+ {
+ /// Path to the Cargo.toml file in the package root
+ ::std::string manifest_path;
+ /// Package version
+ PackageVersion version;
+ /// (Cached) loaded manifest
+ ::std::shared_ptr<PackageManifest> loaded_manifest;
+ };
+
+ ::std::multimap<::std::string, Entry> m_cache;
+ // path => manifest
+ ::std::map<::std::string, ::std::shared_ptr<PackageManifest>> m_path_cache;
+public:
+ void load_cache(const ::helpers::path& path);
+ void load_vendored(const ::helpers::path& path);
+
+ ::std::shared_ptr<PackageManifest> from_path(::helpers::path path);
+ ::std::shared_ptr<PackageManifest> find(const ::std::string& name, const PackageVersionSpec& version);
+};