libutil: remove *-json.hh headers

we can inline them into their parents now.

fixes #598

Change-Id: I7bc9371885cc0adde11da1e2c67bf0a4cf833a98
This commit is contained in:
eldritch horrors
2025-03-25 10:44:50 +01:00
parent 4181796ed2
commit e5b9c86e59
13 changed files with 51 additions and 92 deletions
-1
View File
@@ -9,7 +9,6 @@
#include "lix/libstore/common-protocol.hh"
#include "lix/libstore/common-protocol-impl.hh" // IWYU pragma: keep
#include "lix/libstore/local-store.hh" // TODO remove, along with remaining downcasts
#include "lix/libutil/logging-json.hh"
#include "lix/libstore/build/substitution-goal.hh"
#include "lix/libstore/build/drv-output-substitution-goal.hh"
#include "lix/libutil/result.hh"
-2
View File
@@ -2,8 +2,6 @@
///@file
#include "lix/libutil/config.hh"
// Required for instances of to_json and from_json for ExperimentalFeature
#include "lix/libutil/experimental-features-json.hh"
#include "lix/libutil/json.hh"
namespace nix {
-1
View File
@@ -5,7 +5,6 @@
#include "lix/libutil/json.hh" // IWYU pragma: keep (instances)
#include "lix/libutil/environment-variables.hh"
#include "lix/libutil/experimental-features-json.hh" // IWYU pragma: keep (instances)
#include "lix/libutil/logging.hh"
#include <glob.h>
-23
View File
@@ -1,23 +0,0 @@
#pragma once
///@file
#include "lix/libutil/deprecated-features.hh"
#include "lix/libutil/json-fwd.hh"
namespace nix {
/**
* Compute the documentation of all deprecated features.
*
* See `doc/manual` for how this information is used.
*/
JSON documentDeprecatedFeatures();
/**
* Semi-magic conversion to and from json.
* See the nlohmann/json readme for more details.
*/
void to_json(JSON &, const DeprecatedFeature &);
void from_json(const JSON &, DeprecatedFeature &);
};
-2
View File
@@ -1,6 +1,4 @@
#include "lix/libutil/deprecated-features.hh"
// Required for instances of to_json and from_json for DeprecatedFeature
#include "lix/libutil/deprecated-features-json.hh"
#include "lix/libutil/json.hh"
#include "lix/libutil/strings.hh"
+15
View File
@@ -2,6 +2,7 @@
///@file
#include "lix/libutil/error.hh"
#include "lix/libutil/json-fwd.hh"
#include "lix/libutil/types.hh"
namespace nix {
@@ -63,6 +64,20 @@ std::ostream & operator<<(
*/
DeprecatedFeatures parseDeprecatedFeatures(const std::set<std::string> &);
/**
* Compute the documentation of all deprecated features.
*
* See `doc/manual` for how this information is used.
*/
JSON documentDeprecatedFeatures();
/**
* Semi-magic conversion to and from json.
* See the nlohmann/json readme for more details.
*/
void to_json(JSON &, const DeprecatedFeature &);
void from_json(const JSON &, DeprecatedFeature &);
/**
* A deprecated feature used for some
* operation, but was not enabled.
-23
View File
@@ -1,23 +0,0 @@
#pragma once
///@file
#include "lix/libutil/experimental-features.hh"
#include "lix/libutil/json-fwd.hh"
namespace nix {
/**
* Compute the documentation of all experimental features.
*
* See `doc/manual` for how this information is used.
*/
JSON documentExperimentalFeatures();
/**
* Semi-magic conversion to and from json.
* See the nlohmann/json readme for more details.
*/
void to_json(JSON &, const ExperimentalFeature &);
void from_json(const JSON &, ExperimentalFeature &);
};
-2
View File
@@ -1,6 +1,4 @@
#include "lix/libutil/experimental-features.hh"
// Required for instances of to_json and from_json for ExperimentalFeature
#include "lix/libutil/experimental-features-json.hh"
#include "lix/libutil/json.hh"
#include "lix/libutil/strings.hh"
+15
View File
@@ -2,6 +2,7 @@
///@file
#include "lix/libutil/error.hh"
#include "lix/libutil/json-fwd.hh"
#include "lix/libutil/types.hh"
namespace nix {
@@ -60,6 +61,20 @@ std::ostream & operator<<(
*/
ExperimentalFeatures parseFeatures(const std::set<std::string> &);
/**
* Compute the documentation of all experimental features.
*
* See `doc/manual` for how this information is used.
*/
JSON documentExperimentalFeatures();
/**
* Semi-magic conversion to and from json.
* See the nlohmann/json readme for more details.
*/
void to_json(JSON &, const ExperimentalFeature &);
void from_json(const JSON &, ExperimentalFeature &);
/**
* An experimental feature was required for some (experimental)
* operation, but was not enabled.
-33
View File
@@ -1,33 +0,0 @@
#pragma once
///@file logging-json.hh
///
///@brief Logging functions for json specifically, split due to the cost of
///including nlohmann.
#include "lix/libutil/json-fwd.hh"
#include "lix/libutil/logging.hh"
namespace nix {
/**
* @param source A noun phrase describing the source of the message, e.g. "the builder".
*/
std::optional<JSON> parseJSONMessage(const std::string & msg, std::string_view source);
/**
* @param source A noun phrase describing the source of the message, e.g. "the builder".
*/
bool handleJSONLogMessage(JSON & json,
const Activity & act, std::map<ActivityId, Activity> & activities,
std::string_view source,
bool trusted);
/**
* @param source A noun phrase describing the source of the message, e.g. "the builder".
*/
bool handleJSONLogMessage(const std::string & msg,
const Activity & act, std::map<ActivityId, Activity> & activities,
std::string_view source,
bool trusted);
};
+21
View File
@@ -307,4 +307,25 @@ void writeLogsToStderr(std::string_view s);
* The purpose of this function is making failures with redirected stderr louder. */
void logFatal(std::string const & s);
/**
* @param source A noun phrase describing the source of the message, e.g. "the builder".
*/
std::optional<JSON> parseJSONMessage(const std::string & msg, std::string_view source);
/**
* @param source A noun phrase describing the source of the message, e.g. "the builder".
*/
bool handleJSONLogMessage(JSON & json,
const Activity & act, std::map<ActivityId, Activity> & activities,
std::string_view source,
bool trusted);
/**
* @param source A noun phrase describing the source of the message, e.g. "the builder".
*/
bool handleJSONLogMessage(const std::string & msg,
const Activity & act, std::map<ActivityId, Activity> & activities,
std::string_view source,
bool trusted);
}
-3
View File
@@ -77,7 +77,6 @@ libutil_headers = files(
'config-impl.hh',
'config.hh',
'current-process.hh',
'deprecated-features-json.hh',
'deprecated-features.hh',
'english.hh',
'environment-variables.hh',
@@ -85,7 +84,6 @@ libutil_headers = files(
'escape-char.hh',
'escape-string.hh',
'exit.hh',
'experimental-features-json.hh',
'experimental-features.hh',
'file-descriptor.hh',
'file-system.hh',
@@ -98,7 +96,6 @@ libutil_headers = files(
'input-accessor.hh',
'json-fwd.hh',
'json.hh',
'logging-json.hh',
'logging.hh',
'lru-cache.hh',
'manually-drop.hh',
-2
View File
@@ -14,8 +14,6 @@
#include "lix/libutil/json.hh"
#include "lix/libmain/loggers.hh"
#include "lix/libcmd/markdown.hh"
#include "lix/libutil/experimental-features-json.hh"
#include "lix/libutil/deprecated-features-json.hh"
#include "add-to-store.hh"
#include "build-remote.hh"
#include "build.hh"