mirror of
https://github.com/NixOS/nix
synced 2025-07-06 21:41:48 +02:00
experimental-features.hh: Don't include json-utils.hh
This caused nlohmann/json.hpp to leak into a lot of compilation units, which is slow (when not using precompiled headers). Cuts build time from 46m24s to 42m5s (real time with -j24: 2m42s to 2m24s).
This commit is contained in:
parent
4e8a9e0ed4
commit
15e5684884
11 changed files with 25 additions and 12 deletions
|
@ -1,5 +1,7 @@
|
|||
#include "config-global.hh"
|
||||
|
||||
#include <nlohmann/json.hpp>
|
||||
|
||||
namespace nix {
|
||||
|
||||
bool GlobalConfig::set(const std::string & name, const std::string & value)
|
||||
|
|
|
@ -2,9 +2,10 @@
|
|||
///@file
|
||||
|
||||
#include "error.hh"
|
||||
#include "json-utils.hh"
|
||||
#include "types.hh"
|
||||
|
||||
#include <nlohmann/json_fwd.hpp>
|
||||
|
||||
namespace nix {
|
||||
|
||||
/**
|
||||
|
@ -98,10 +99,4 @@ public:
|
|||
void to_json(nlohmann::json &, const ExperimentalFeature &);
|
||||
void from_json(const nlohmann::json &, ExperimentalFeature &);
|
||||
|
||||
/**
|
||||
* It is always rendered as a string
|
||||
*/
|
||||
template<>
|
||||
struct json_avoids_null<ExperimentalFeature> : std::true_type {};
|
||||
|
||||
}
|
||||
|
|
|
@ -3,12 +3,13 @@
|
|||
|
||||
#include <nlohmann/json.hpp>
|
||||
#include <list>
|
||||
#include <nlohmann/json_fwd.hpp>
|
||||
|
||||
#include "types.hh"
|
||||
|
||||
namespace nix {
|
||||
|
||||
enum struct ExperimentalFeature;
|
||||
|
||||
const nlohmann::json * get(const nlohmann::json & map, const std::string & key);
|
||||
|
||||
nlohmann::json * get(nlohmann::json & map, const std::string & key);
|
||||
|
@ -71,6 +72,12 @@ struct json_avoids_null<std::list<T>> : std::true_type {};
|
|||
template<typename K, typename V>
|
||||
struct json_avoids_null<std::map<K, V>> : std::true_type {};
|
||||
|
||||
/**
|
||||
* `ExperimentalFeature` is always rendered as a string.
|
||||
*/
|
||||
template<>
|
||||
struct json_avoids_null<ExperimentalFeature> : std::true_type {};
|
||||
|
||||
}
|
||||
|
||||
namespace nlohmann {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue