summaryrefslogtreecommitdiff
path: root/tools/minicargo/repository.cpp
diff options
context:
space:
mode:
authorJohn Hodge <tpg@mutabah.net>2019-11-03 15:49:54 +0800
committerJohn Hodge <tpg@mutabah.net>2019-11-03 15:49:54 +0800
commit0b2d92ce3e79f47ddf28be080245eca574828433 (patch)
treed14781233678425afd1c14ad228a458fa08d64df /tools/minicargo/repository.cpp
parent9ebc54d62808d6e6fb8387f245344bcafc870293 (diff)
downloadmrust-0b2d92ce3e79f47ddf28be080245eca574828433.tar.gz
minicargo - Hack in workspace support (for `[patch]`)
Diffstat (limited to 'tools/minicargo/repository.cpp')
-rw-r--r--tools/minicargo/repository.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/tools/minicargo/repository.cpp b/tools/minicargo/repository.cpp
index 060c5207..f6def399 100644
--- a/tools/minicargo/repository.cpp
+++ b/tools/minicargo/repository.cpp
@@ -115,6 +115,19 @@ void Repository::load_vendored(const ::helpers::path& path)
return it->second;
}
}
+void Repository::add_patch_path(const std::string& package_name, ::helpers::path path)
+{
+ auto manifest_path = path / "Cargo.toml";
+
+ auto loaded_manifest = ::std::shared_ptr<PackageManifest>( new PackageManifest(PackageManifest::load_from_toml(manifest_path)) );
+
+ Entry cache_ent;
+ cache_ent.manifest_path = manifest_path;
+ cache_ent.version = loaded_manifest->version();
+ cache_ent.loaded_manifest = ::std::move(loaded_manifest);
+ m_cache.insert(::std::make_pair( package_name, ::std::move(cache_ent) ));
+ // TODO: If there's other packages with the same name, check for compatability (or otherwise ensure that this is the chosen version)
+}
::std::shared_ptr<PackageManifest> Repository::find(const ::std::string& name, const PackageVersionSpec& version)
{
DEBUG("FIND " << name << " matching " << version);