@@ -244,10 +244,10 @@ void add_sdist_to_build(build_plan& plan, | |||
} | |||
} | |||
void add_deps_to_build(build_plan& plan, | |||
usage_requirement_map& ureqs, | |||
const build_params& params, | |||
build_env_ref env) { | |||
void add_deps_to_build(build_plan& plan, | |||
usage_requirement_map& ureqs, | |||
const build_params& params, | |||
build_env_ref env) { | |||
auto sd_idx = params.dep_sdists // | |||
| ranges::views::transform([](const auto& sd) { | |||
return std::pair(sd.manifest.pkg_id.name, std::cref(sd)); |
@@ -14,4 +14,4 @@ struct temporary_sdist { | |||
temporary_sdist get_package_sdist(const package_info&); | |||
} // namespace dds | |||
} // namespace dds |
@@ -13,7 +13,7 @@ void dds::generate_compdb(const build_plan& plan, build_env_ref env) { | |||
for (const compile_file_plan& cf : iter_compilations(plan)) { | |||
auto cmd_info = cf.generate_compile_command(env); | |||
auto entry = nlohmann::json::object({ | |||
auto entry = nlohmann::json::object({ | |||
{"directory", env.output_root.string()}, | |||
{"arguments", cmd_info.command}, | |||
{"file", cf.source_path().string()}, |
@@ -9,8 +9,8 @@ | |||
#include <range/v3/range/conversion.hpp> | |||
#include <range/v3/view/transform.hpp> | |||
#include <spdlog/spdlog.h> | |||
#include <spdlog/fmt/ostr.h> | |||
#include <spdlog/spdlog.h> | |||
#include <cctype> | |||
#include <map> |
@@ -1,8 +1,8 @@ | |||
#ifdef _WIN32 | |||
#include "./proc.hpp" | |||
#include <wil/resource.h> | |||
#include <spdlog/spdlog.h> | |||
#include <wil/resource.h> | |||
#include <windows.h> | |||
@@ -111,26 +111,25 @@ const sdist* repository::find(const package_id& pkg) const noexcept { | |||
} | |||
std::vector<package_id> repository::solve(const std::vector<dependency>& deps, | |||
const catalog& ctlg) const { | |||
return dds::solve(deps, | |||
[&](std::string_view name) -> std::vector<package_id> { | |||
auto mine = ranges::views::all(_sdists) // | |||
| ranges::views::filter([&](const sdist& sd) { | |||
return sd.manifest.pkg_id.name == name; | |||
}) | |||
| ranges::views::transform( | |||
[](const sdist& sd) { return sd.manifest.pkg_id; }); | |||
auto avail = ctlg.by_name(name); | |||
auto all = ranges::views::concat(mine, avail) | ranges::to_vector; | |||
ranges::sort(all, std::less<>{}); | |||
ranges::unique(all, std::less<>{}); | |||
return all; | |||
}, | |||
[&](const package_id& pkg_id) { | |||
auto found = find(pkg_id); | |||
if (found) { | |||
return found->manifest.dependencies; | |||
} | |||
return ctlg.dependencies_of(pkg_id); | |||
}); | |||
const catalog& ctlg) const { | |||
return dds::solve( | |||
deps, | |||
[&](std::string_view name) -> std::vector<package_id> { | |||
auto mine = ranges::views::all(_sdists) // | |||
| ranges::views::filter( | |||
[&](const sdist& sd) { return sd.manifest.pkg_id.name == name; }) | |||
| ranges::views::transform([](const sdist& sd) { return sd.manifest.pkg_id; }); | |||
auto avail = ctlg.by_name(name); | |||
auto all = ranges::views::concat(mine, avail) | ranges::to_vector; | |||
ranges::sort(all, std::less<>{}); | |||
ranges::unique(all, std::less<>{}); | |||
return all; | |||
}, | |||
[&](const package_id& pkg_id) { | |||
auto found = find(pkg_id); | |||
if (found) { | |||
return found->manifest.dependencies; | |||
} | |||
return ctlg.dependencies_of(pkg_id); | |||
}); | |||
} |
@@ -1,8 +1,8 @@ | |||
#pragma once | |||
#include <dds/catalog/catalog.hpp> | |||
#include <dds/sdist.hpp> | |||
#include <dds/util/flock.hpp> | |||
#include <dds/catalog/catalog.hpp> | |||
#include <dds/util/fs.hpp> | |||
#include <functional> |
@@ -44,12 +44,13 @@ void check_tc_compile(std::string_view tc_content, | |||
} | |||
TEST_CASE("Generating toolchain commands") { | |||
check_tc_compile("Compiler-ID: GNU", | |||
"g++ -fPIC -fdiagnostics-color -pthread -MD -MF foo.o.d -MT foo.o -c foo.cpp -ofoo.o", | |||
"g++ -fPIC -fdiagnostics-color -pthread -Wall -Wextra -Wpedantic -Wconversion " | |||
"-MD -MF foo.o.d -MT foo.o -c foo.cpp -ofoo.o", | |||
"ar rcs stuff.a foo.o bar.o", | |||
"g++ -fPIC -fdiagnostics-color foo.o bar.a -pthread -lstdc++fs -omeow.exe"); | |||
check_tc_compile( | |||
"Compiler-ID: GNU", | |||
"g++ -fPIC -fdiagnostics-color -pthread -MD -MF foo.o.d -MT foo.o -c foo.cpp -ofoo.o", | |||
"g++ -fPIC -fdiagnostics-color -pthread -Wall -Wextra -Wpedantic -Wconversion " | |||
"-MD -MF foo.o.d -MT foo.o -c foo.cpp -ofoo.o", | |||
"ar rcs stuff.a foo.o bar.o", | |||
"g++ -fPIC -fdiagnostics-color foo.o bar.a -pthread -lstdc++fs -omeow.exe"); | |||
check_tc_compile( | |||
"Compiler-ID: GNU\nDebug: True", |
@@ -45,8 +45,8 @@ vector<string> toolchain::definition_args(std::string_view s) const noexcept { | |||
return replace(_def_template, "<DEF>", s); | |||
} | |||
compile_command_info toolchain::create_compile_command(const compile_file_spec& spec) const | |||
noexcept { | |||
compile_command_info | |||
toolchain::create_compile_command(const compile_file_spec& spec) const noexcept { | |||
vector<string> flags; | |||
using namespace std::literals; |
@@ -1,9 +1,9 @@ | |||
#pragma once | |||
#include <algorithm> | |||
#include <functional> | |||
#include <initializer_list> | |||
#include <vector> | |||
#include <functional> | |||
namespace dds { | |||