@@ -615,12 +615,11 @@ struct cli_build_deps { | |||
dds::builder bd; | |||
dds::sdist_build_params sdist_params; | |||
auto all_file_deps | |||
= deps_files.Get() // | |||
auto all_file_deps = deps_files.Get() // | |||
| ranges::views::transform([&](auto dep_fpath) { | |||
spdlog::info("Reading deps from {}", dep_fpath.string()); | |||
return dds::package_manifest::load_from_file(dep_fpath).dependencies; | |||
}) | |||
spdlog::info("Reading deps from {}", dep_fpath.string()); | |||
return dds::dependency_manifest::from_file(dep_fpath).dependencies; | |||
}) | |||
| ranges::actions::join; | |||
auto cmd_deps = ranges::views::transform(deps.Get(), [&](auto dep_str) { | |||
@@ -650,6 +649,7 @@ struct cli_build_deps { | |||
assert(sdist_ptr); | |||
dds::sdist_build_params deps_params; | |||
deps_params.subdir = sdist_ptr->manifest.pkg_id.to_string(); | |||
spdlog::info("Dependency: {}", sdist_ptr->manifest.pkg_id.to_string()); | |||
bd.add(*sdist_ptr, deps_params); | |||
} | |||
}); |
@@ -40,3 +40,20 @@ dependency dependency::parse_depends_string(std::string_view str) { | |||
str)); | |||
} | |||
} | |||
dependency_manifest dependency_manifest::from_file(path_ref fpath) { | |||
auto kvs = lm::parse_file(fpath); | |||
dependency_manifest ret; | |||
lm::read( | |||
fmt::format("Reading dependencies from '{}'", fpath.string()), | |||
kvs, | |||
[&](auto, auto key, auto val) { | |||
if (key == "Depends") { | |||
ret.dependencies.push_back(dependency::parse_depends_string(val)); | |||
return true; | |||
} | |||
return false; | |||
}, | |||
lm::reject_unknown()); | |||
return ret; | |||
} |
@@ -1,6 +1,6 @@ | |||
#pragma once | |||
#include <dds/build/plan/full.hpp> | |||
#include <dds/util/fs.hpp> | |||
#include <pubgrub/interval.hpp> | |||
#include <semver/range.hpp> | |||
@@ -19,4 +19,13 @@ struct dependency { | |||
static dependency parse_depends_string(std::string_view str); | |||
}; | |||
/** | |||
* Represents a dependency listing file, which is a subset of a package manifest | |||
*/ | |||
struct dependency_manifest { | |||
std::vector<dependency> dependencies; | |||
static dependency_manifest from_file(path_ref where); | |||
}; | |||
} // namespace dds |
@@ -1,5 +1,6 @@ | |||
#include "./dist.hpp" | |||
#include <dds/library/library.hpp> | |||
#include <dds/temp.hpp> | |||
#include <dds/util/fs.hpp> | |||
@@ -74,6 +74,7 @@ class DDS: | |||
return self.run([ | |||
'build-deps', | |||
f'--toolchain={toolchain or self.default_builtin_toolchain}', | |||
f'--catalog={self.catalog_path}', | |||
f'--repo-dir={self.repo_dir}', | |||
f'--out={self.deps_build_dir}', | |||
f'--lmi-path={self.lmi_path}', |
@@ -0,0 +1,21 @@ | |||
{ | |||
"version": 1, | |||
"packages": { | |||
"neo-sqlite3": { | |||
"0.1.0": { | |||
"git": { | |||
"url": "https://github.com/vector-of-bool/neo-sqlite3.git", | |||
"ref": "0.1.0" | |||
}, | |||
"depends": {} | |||
}, | |||
"0.2.2": { | |||
"git": { | |||
"url": "https://github.com/vector-of-bool/neo-sqlite3.git", | |||
"ref": "0.2.2" | |||
}, | |||
"depends": {} | |||
} | |||
} | |||
} | |||
} |
@@ -1,4 +1,2 @@ | |||
Name: dummy | |||
Version: 0.0.0 | |||
Depends: neo-sqlite3 +0.0.0 |
@@ -1,7 +1,22 @@ | |||
from tests import dds, DDS | |||
def test_build_deps(dds: DDS): | |||
def test_build_deps_from_file(dds: DDS): | |||
assert not dds.deps_build_dir.is_dir() | |||
dds.catalog_import(dds.source_root / 'catalog.json') | |||
dds.build_deps(['-d', 'deps.dds']) | |||
assert dds.deps_build_dir.is_dir() | |||
assert (dds.deps_build_dir / 'neo-sqlite3@0.1.0').is_dir() | |||
def test_build_deps_from_cmd(dds: DDS): | |||
assert not dds.deps_build_dir.is_dir() | |||
dds.catalog_import(dds.source_root / 'catalog.json') | |||
dds.build_deps(['neo-sqlite3 =0.1.0']) | |||
assert (dds.deps_build_dir / 'neo-sqlite3@0.1.0').is_dir() | |||
def test_multiple_deps(dds: DDS): | |||
assert not dds.deps_build_dir.is_dir() | |||
dds.catalog_import(dds.source_root / 'catalog.json') | |||
dds.build_deps(['neo-sqlite3 ^0.1.0', 'neo-sqlite3 ~0.2.0']) | |||
assert (dds.deps_build_dir / 'neo-sqlite3@0.2.2').is_dir() |