| "depends": {} | "depends": {} | ||||
| } | } | ||||
| }, | }, | ||||
| "neo-buffer": { | |||||
| "0.1.0": { | |||||
| "neo-sqlite3": { | |||||
| "0.2.2": { | |||||
| "git": { | "git": { | ||||
| "url": "https://github.com/vector-of-bool/neo-buffer.git", | |||||
| "ref": "develop" | |||||
| "url": "https://github.com/vector-of-bool/neo-sqlite3.git", | |||||
| "ref": "0.2.2" | |||||
| }, | }, | ||||
| "depends": {} | "depends": {} | ||||
| } | } | ||||
| }, | }, | ||||
| "neo-sqlite3": { | |||||
| "0.2.2": { | |||||
| "neo-fun": { | |||||
| "0.1.0": { | |||||
| "git": { | "git": { | ||||
| "url": "https://github.com/vector-of-bool/neo-sqlite3.git", | |||||
| "ref": "0.2.2" | |||||
| "url": "https://github.com/vector-of-bool/neo-fun.git", | |||||
| "ref": "0.1.0" | |||||
| }, | }, | ||||
| "depends": {} | "depends": {} | ||||
| } | } |
| Uses: Microsoft/wil | Uses: Microsoft/wil | ||||
| Uses: Niebler/range-v3 | Uses: Niebler/range-v3 | ||||
| Uses: nlohmann/json | Uses: nlohmann/json | ||||
| Uses: neo/buffer | |||||
| Uses: neo/sqlite3 | Uses: neo/sqlite3 | ||||
| Uses: neo/fun | |||||
| Uses: semver/semver | Uses: semver/semver | ||||
| Uses: pubgrub/pubgrub | Uses: pubgrub/pubgrub |
| Name: dds | Name: dds | ||||
| Version: 0.1.0 | Version: 0.1.0 | ||||
| Depends: neo-buffer 0.1.0 | |||||
| Depends: spdlog 1.4.2 | Depends: spdlog 1.4.2 | ||||
| Depends: ms-wil 2019.11.10 | Depends: ms-wil 2019.11.10 | ||||
| Depends: range-v3 0.10.0 | Depends: range-v3 0.10.0 | ||||
| Depends: nlohmann-json 3.7.1 | Depends: nlohmann-json 3.7.1 | ||||
| Depends: neo-sqlite3 0.2.2 | Depends: neo-sqlite3 0.2.2 | ||||
| Depends: neo-fun 0.1.0 | |||||
| Depends: semver 0.2.1 | Depends: semver 0.2.1 | ||||
| Depends: pubgrub 0.1.2 | Depends: pubgrub 0.1.2 | ||||
| return {deps, cleaned_output}; | return {deps, cleaned_output}; | ||||
| } | } | ||||
| void dds::update_deps_info(database& db, const file_deps_info& deps) { | |||||
| void dds::update_deps_info(neo::output<database> db_, const file_deps_info& deps) { | |||||
| database& db = db_; | |||||
| db.store_file_command(deps.output, {deps.command, deps.command_output}); | db.store_file_command(deps.output, {deps.command, deps.command_output}); | ||||
| db.forget_inputs_of(deps.output); | db.forget_inputs_of(deps.output); | ||||
| for (auto&& inp : deps.inputs) { | for (auto&& inp : deps.inputs) { | ||||
| } | } | ||||
| deps_rebuild_info dds::get_rebuild_info(const database& db, path_ref output_path) { | deps_rebuild_info dds::get_rebuild_info(const database& db, path_ref output_path) { | ||||
| std::unique_lock lk{db.mutex()}; | |||||
| auto cmd_ = db.command_of(output_path); | |||||
| auto cmd_ = db.command_of(output_path); | |||||
| if (!cmd_) { | if (!cmd_) { | ||||
| return {}; | return {}; | ||||
| } | } |
| #include <dds/util/fs.hpp> | #include <dds/util/fs.hpp> | ||||
| #include <neo/out.hpp> | |||||
| #include <string> | #include <string> | ||||
| #include <string_view> | #include <string_view> | ||||
| #include <vector> | #include <vector> | ||||
| * @param db The database to update | * @param db The database to update | ||||
| * @param info The dependency information to store | * @param info The dependency information to store | ||||
| */ | */ | ||||
| void update_deps_info(database& db, const file_deps_info& info); | |||||
| void update_deps_info(neo::output<database> db, const file_deps_info& info); | |||||
| /** | /** | ||||
| * The information that is pertinent to the rebuild of a file. This will contain a list of inputs | * The information that is pertinent to the rebuild of a file. This will contain a list of inputs |
| // Update compile dependency information | // Update compile dependency information | ||||
| auto tr = env.db.transaction(); | auto tr = env.db.transaction(); | ||||
| for (auto& info : all_new_deps) { | for (auto& info : all_new_deps) { | ||||
| update_deps_info(env.db, info); | |||||
| update_deps_info(neo::into(env.db), info); | |||||
| } | } | ||||
| // Return whether or not there were any failures. | // Return whether or not there were any failures. |
| class database { | class database { | ||||
| neo::sqlite3::database _db; | neo::sqlite3::database _db; | ||||
| mutable neo::sqlite3::statement_cache _stmt_cache{_db}; | mutable neo::sqlite3::statement_cache _stmt_cache{_db}; | ||||
| mutable std::shared_mutex _mutex; | |||||
| explicit database(neo::sqlite3::database db); | explicit database(neo::sqlite3::database db); | ||||
| database(const database&) = delete; | database(const database&) = delete; | ||||
| static database open(const std::string& db_path); | static database open(const std::string& db_path); | ||||
| static database open(path_ref db_path) { return open(db_path.string()); } | static database open(path_ref db_path) { return open(db_path.string()); } | ||||
| auto& mutex() const noexcept { return _mutex; } | |||||
| neo::sqlite3::transaction_guard transaction() noexcept { | neo::sqlite3::transaction_guard transaction() noexcept { | ||||
| return neo::sqlite3::transaction_guard(_db); | return neo::sqlite3::transaction_guard(_db); | ||||
| } | } |
| #include <dds/util/flock.hpp> | #include <dds/util/flock.hpp> | ||||
| #include <dds/util/fs.hpp> | #include <dds/util/fs.hpp> | ||||
| #include <neo/fwd.hpp> | |||||
| #include <functional> | #include <functional> | ||||
| #include <optional> | #include <optional> | ||||
| #include <set> | #include <set> | ||||
| } | } | ||||
| auto repo = _open_for_directory(writeable, dirpath); | auto repo = _open_for_directory(writeable, dirpath); | ||||
| return std::invoke((Func &&) fn, std::move(repo)); | |||||
| return std::invoke(NEO_FWD(fn), std::move(repo)); | |||||
| } | } | ||||
| static fs::path default_local_path() noexcept; | static fs::path default_local_path() noexcept; |
| return inserted->second; | return inserted->second; | ||||
| } | } | ||||
| void usage_requirement_map::apply(shared_compile_file_rules rules, | |||||
| std::string ns, | |||||
| std::string name) const { | |||||
| auto reqs = get(ns, name); | |||||
| if (!reqs) { | |||||
| throw std::runtime_error( | |||||
| fmt::format("Unable to resolve usage requirements for '{}/{}'", ns, name)); | |||||
| } | |||||
| for (auto&& use : reqs->uses) { | |||||
| apply(rules, use.namespace_, use.name); | |||||
| } | |||||
| extend(rules.include_dirs(), reqs->include_paths); | |||||
| extend(rules.defs(), reqs->preproc_defs); | |||||
| } | |||||
| usage_requirement_map usage_requirement_map::from_lm_index(const lm::index& idx) noexcept { | usage_requirement_map usage_requirement_map::from_lm_index(const lm::index& idx) noexcept { | ||||
| usage_requirement_map ret; | usage_requirement_map ret; | ||||
| for (const auto& pkg : idx.packages) { | for (const auto& pkg : idx.packages) { |
| #include <libman/index.hpp> | #include <libman/index.hpp> | ||||
| #include <libman/library.hpp> | #include <libman/library.hpp> | ||||
| #include <neo/out.hpp> | |||||
| #include <map> | #include <map> | ||||
| #include <string> | #include <string> | ||||
| lm::library& add(std::string ns, std::string name); | lm::library& add(std::string ns, std::string name); | ||||
| void add(std::string ns, std::string name, lm::library lib) { add(ns, name) = lib; } | void add(std::string ns, std::string name, lm::library lib) { add(ns, name) = lib; } | ||||
| void apply(shared_compile_file_rules, std::string ns, std::string name) const; | |||||
| std::vector<fs::path> link_paths(const lm::usage&) const; | std::vector<fs::path> link_paths(const lm::usage&) const; | ||||
| std::vector<fs::path> include_paths(const lm::usage& req) const; | std::vector<fs::path> include_paths(const lm::usage& req) const; | ||||
| #pragma once | #pragma once | ||||
| #include <neo/fwd.hpp> | |||||
| #include <chrono> | #include <chrono> | ||||
| #include <utility> | #include <utility> | ||||
| }; | }; | ||||
| template <typename Duration = stopwatch::duration, typename Func> | template <typename Duration = stopwatch::duration, typename Func> | ||||
| auto timed(Func&& fn) noexcept(noexcept(((Func &&)(fn))())) { | |||||
| auto timed(Func&& fn) noexcept(noexcept(NEO_FWD(fn)())) { | |||||
| stopwatch sw; | stopwatch sw; | ||||
| using result_type = decltype(((Func &&)(fn))()); | |||||
| using result_type = decltype(NEO_FWD(fn)()); | |||||
| if constexpr (std::is_void_v<result_type>) { | if constexpr (std::is_void_v<result_type>) { | ||||
| ((Func &&)(fn))(); | |||||
| NEO_FWD(fn)(); | |||||
| auto elapsed = sw.elapsed_as<Duration>(); | auto elapsed = sw.elapsed_as<Duration>(); | ||||
| return std::pair(elapsed, nullptr); | return std::pair(elapsed, nullptr); | ||||
| } else { | } else { | ||||
| decltype(auto) value = ((Func &&)(fn))(); | |||||
| decltype(auto) value = NEO_FWD(fn)(); | |||||
| auto elapsed = sw.elapsed_as<Duration>(); | auto elapsed = sw.elapsed_as<Duration>(); | ||||
| return std::pair<Duration, decltype(value)>(elapsed, ((decltype(value)&&)value)); | return std::pair<Duration, decltype(value)>(elapsed, ((decltype(value)&&)value)); | ||||
| } | } |
| #pragma once | |||||
| #include <spdlog/fmt/fmt.h> |
| #include "./index.hpp" | #include "./index.hpp" | ||||
| #include <libman/fmt.hpp> | |||||
| #include <libman/parse.hpp> | #include <libman/parse.hpp> | ||||
| #include <spdlog/fmt/fmt.h> | |||||
| using namespace lm; | using namespace lm; | ||||
| lm::index index::from_file(path_ref fpath) { | lm::index index::from_file(path_ref fpath) { |
| #include "./package.hpp" | #include "./package.hpp" | ||||
| #include <libman/fmt.hpp> | |||||
| #include <libman/parse.hpp> | #include <libman/parse.hpp> | ||||
| #include <spdlog/fmt/fmt.h> | |||||
| using namespace lm; | using namespace lm; | ||||
| package package::from_file(path_ref fpath) { | package package::from_file(path_ref fpath) { |