Browse Source

Pull in neo-fun, small refactors, and delete some unused code

default_compile_flags
vector-of-bool 5 years ago
parent
commit
408edfe065
14 changed files with 32 additions and 46 deletions
  1. +8
    -8
      catalog.json
  2. +1
    -1
      library.dds
  3. +1
    -1
      package.dds
  4. +3
    -3
      src/dds/build/file_deps.cpp
  5. +3
    -1
      src/dds/build/file_deps.hpp
  6. +1
    -1
      src/dds/build/plan/compile_exec.cpp
  7. +0
    -3
      src/dds/db/database.hpp
  8. +3
    -1
      src/dds/repo/repo.hpp
  9. +0
    -17
      src/dds/usage_reqs.cpp
  10. +2
    -1
      src/dds/usage_reqs.hpp
  11. +6
    -4
      src/dds/util/time.hpp
  12. +0
    -3
      src/libman/fmt.hpp
  13. +2
    -1
      src/libman/index.cpp
  14. +2
    -1
      src/libman/package.cpp

+ 8
- 8
catalog.json View File

@@ -39,20 +39,20 @@
"depends": {}
}
},
"neo-buffer": {
"0.1.0": {
"neo-sqlite3": {
"0.2.2": {
"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": {}
}
},
"neo-sqlite3": {
"0.2.2": {
"neo-fun": {
"0.1.0": {
"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": {}
}

+ 1
- 1
library.dds View File

@@ -4,7 +4,7 @@ Uses: spdlog/spdlog
Uses: Microsoft/wil
Uses: Niebler/range-v3
Uses: nlohmann/json
Uses: neo/buffer
Uses: neo/sqlite3
Uses: neo/fun
Uses: semver/semver
Uses: pubgrub/pubgrub

+ 1
- 1
package.dds View File

@@ -1,12 +1,12 @@
Name: dds
Version: 0.1.0

Depends: neo-buffer 0.1.0
Depends: spdlog 1.4.2
Depends: ms-wil 2019.11.10
Depends: range-v3 0.10.0
Depends: nlohmann-json 3.7.1
Depends: neo-sqlite3 0.2.2
Depends: neo-fun 0.1.0
Depends: semver 0.2.1
Depends: pubgrub 0.1.2


+ 3
- 3
src/dds/build/file_deps.cpp View File

@@ -65,7 +65,8 @@ msvc_deps_info dds::parse_msvc_output_for_deps(std::string_view output, std::str
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.forget_inputs_of(deps.output);
for (auto&& inp : deps.inputs) {
@@ -75,8 +76,7 @@ void dds::update_deps_info(database& db, const file_deps_info& deps) {
}

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_) {
return {};
}

+ 3
- 1
src/dds/build/file_deps.hpp View File

@@ -29,6 +29,8 @@

#include <dds/util/fs.hpp>

#include <neo/out.hpp>

#include <string>
#include <string_view>
#include <vector>
@@ -120,7 +122,7 @@ msvc_deps_info parse_msvc_output_for_deps(std::string_view output, std::string_v
* @param db The database to update
* @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

+ 1
- 1
src/dds/build/plan/compile_exec.cpp View File

@@ -264,7 +264,7 @@ bool dds::detail::compile_all(const ref_vector<const compile_file_plan>& compile
// Update compile dependency information
auto tr = env.db.transaction();
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.

+ 0
- 3
src/dds/db/database.hpp View File

@@ -28,7 +28,6 @@ struct input_file_info {
class database {
neo::sqlite3::database _db;
mutable neo::sqlite3::statement_cache _stmt_cache{_db};
mutable std::shared_mutex _mutex;

explicit database(neo::sqlite3::database db);
database(const database&) = delete;
@@ -39,8 +38,6 @@ public:
static database open(const std::string& db_path);
static database open(path_ref db_path) { return open(db_path.string()); }

auto& mutex() const noexcept { return _mutex; }

neo::sqlite3::transaction_guard transaction() noexcept {
return neo::sqlite3::transaction_guard(_db);
}

+ 3
- 1
src/dds/repo/repo.hpp View File

@@ -5,6 +5,8 @@
#include <dds/util/flock.hpp>
#include <dds/util/fs.hpp>

#include <neo/fwd.hpp>

#include <functional>
#include <optional>
#include <set>
@@ -74,7 +76,7 @@ public:
}

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;

+ 0
- 17
src/dds/usage_reqs.cpp View File

@@ -27,23 +27,6 @@ lm::library& usage_requirement_map::add(std::string ns, std::string name) {
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 ret;
for (const auto& pkg : idx.packages) {

+ 2
- 1
src/dds/usage_reqs.hpp View File

@@ -4,6 +4,8 @@
#include <libman/index.hpp>
#include <libman/library.hpp>

#include <neo/out.hpp>

#include <map>
#include <string>

@@ -40,7 +42,6 @@ public:
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 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> include_paths(const lm::usage& req) const;


+ 6
- 4
src/dds/util/time.hpp View File

@@ -1,5 +1,7 @@
#pragma once

#include <neo/fwd.hpp>

#include <chrono>
#include <utility>

@@ -28,15 +30,15 @@ public:
};

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;
using result_type = decltype(((Func &&)(fn))());
using result_type = decltype(NEO_FWD(fn)());
if constexpr (std::is_void_v<result_type>) {
((Func &&)(fn))();
NEO_FWD(fn)();
auto elapsed = sw.elapsed_as<Duration>();
return std::pair(elapsed, nullptr);
} else {
decltype(auto) value = ((Func &&)(fn))();
decltype(auto) value = NEO_FWD(fn)();
auto elapsed = sw.elapsed_as<Duration>();
return std::pair<Duration, decltype(value)>(elapsed, ((decltype(value)&&)value));
}

+ 0
- 3
src/libman/fmt.hpp View File

@@ -1,3 +0,0 @@
#pragma once

#include <spdlog/fmt/fmt.h>

+ 2
- 1
src/libman/index.cpp View File

@@ -1,8 +1,9 @@
#include "./index.hpp"

#include <libman/fmt.hpp>
#include <libman/parse.hpp>

#include <spdlog/fmt/fmt.h>

using namespace lm;

lm::index index::from_file(path_ref fpath) {

+ 2
- 1
src/libman/package.cpp View File

@@ -1,8 +1,9 @@
#include "./package.hpp"

#include <libman/fmt.hpp>
#include <libman/parse.hpp>

#include <spdlog/fmt/fmt.h>

using namespace lm;

package package::from_file(path_ref fpath) {

Loading…
Cancel
Save