optimize imports with "include-what-you-use"

This commit is contained in:
Jörg Thalheim 2023-12-11 22:05:02 +01:00
parent 843dc25cfe
commit 1f4bbded61
8 changed files with 137 additions and 28 deletions

View file

@ -1,7 +1,11 @@
#include "buffered-io.hh"
#include <string.h>
#include <unistd.h>
#include <nix/signals.hh>
#include <errno.h>
#include <stdlib.h>
#include <error.hh>
#include "buffered-io.hh"
[[nodiscard]] int tryWriteLine(int fd, std::string s) {
s += "\n";

View file

@ -1,10 +1,27 @@
#include "drv.hh"
#include <nix/config.h>
#include <nix/config.h> // IWYU pragma: keep
#include <nix/path-with-outputs.hh>
#include <nix/store-api.hh>
#include <nix/local-fs-store.hh>
#include <nix/value-to-json.hh>
#include <nix/derivations.hh>
#include <stdint.h>
#include <nix/derived-path-map.hh>
#include <nix/eval.hh>
#include <nix/get-drvs.hh>
#include <nix/nixexpr.hh>
#include <nlohmann/detail/json_ref.hpp>
#include <nix/path.hh>
#include <nix/ref.hh>
#include <nix/value/context.hh>
#include <exception>
#include <memory>
#include <sstream>
#include <utility>
#include <vector>
#include "drv.hh"
#include "eval-args.hh"
static bool queryIsCached(nix::Store &store,
std::map<std::string, std::string> &outputs) {

View file

@ -1,16 +1,22 @@
#include <nix/get-drvs.hh>
#include <nix/eval.hh>
#include <nlohmann/json.hpp>
#include <nlohmann/json_fwd.hpp>
#include <string>
#include <map>
#include <set>
#include <string>
#include <optional>
#include <nix/get-drvs.hh>
#include <nix/eval.hh>
#include <nlohmann/json.hpp>
#include "eval-args.hh"
class MyArgs;
namespace nix {
class EvalState;
struct DrvInfo;
} // namespace nix
/* The fields of a derivation that are printed in json form */
struct Drv {
std::string name;

View file

@ -1,3 +1,15 @@
#include <stdio.h>
#include <stdlib.h>
#include <nix/args.hh>
#include <nix/file-system.hh>
#include <nix/flake/flake.hh>
#include <nix/flake/lockfile.hh>
#include <functional>
#include <map>
#include <memory>
#include <set>
#include <utility>
#include "eval-args.hh"
MyArgs::MyArgs() : MixCommonArgs("nix-eval-jobs") {

View file

@ -1,9 +1,14 @@
#pragma once
#include <string>
#include <nix/flake/flake.hh>
#include <nix/args/root.hh>
#include <nix/common-eval-args.hh>
#include <stddef.h>
#include <nix/common-args.hh>
#include <nix/flake/flakeref.hh>
#include <nix/types.hh>
#include <string>
#include <optional>
class MyArgs : virtual public nix::MixEvalArgs,
virtual public nix::MixCommonArgs,

View file

@ -1,30 +1,49 @@
#include <map>
#include <sys/signal.h>
#include <thread>
#include <condition_variable>
#include <filesystem>
#include <nix/config.h> // IWYU pragma: keep
#include <nix/config.h>
#include <nix/eval-settings.hh>
#include <nix/common-eval-args.hh>
#include <nix/args/root.hh>
#include <nix/shared.hh>
#include <nix/sync.hh>
#include <nix/eval.hh>
#include <nix/get-drvs.hh>
#include <nix/value-to-json.hh>
#include <nix/local-fs-store.hh>
#include <nix/signals.hh>
#include <nix/terminal.hh>
#include <sys/wait.h>
#include <nlohmann/json.hpp>
#include <errno.h>
#include <signal.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <nix/attr-set.hh>
#include <nix/config.hh>
#include <nix/error.hh>
#include <nix/file-descriptor.hh>
#include <nix/globals.hh>
#include <nix/logging.hh>
#include <nlohmann/detail/iterators/iter_impl.hpp>
#include <nlohmann/detail/json_ref.hpp>
#include <nlohmann/json_fwd.hpp>
#include <nix/processes.hh>
#include <nix/ref.hh>
#include <nix/store-api.hh>
#include <map>
#include <thread>
#include <condition_variable>
#include <filesystem>
#include <exception>
#include <functional>
#include <iostream>
#include <memory>
#include <optional>
#include <set>
#include <string>
#include <string_view>
#include <utility>
#include <vector>
#include "eval-args.hh"
#include "drv.hh"
#include "buffered-io.hh"
#include "worker.hh"
#include <nlohmann/json.hpp>
using namespace nix;
using namespace nlohmann;

View file

@ -1,14 +1,52 @@
#include "worker.hh"
#include "drv.hh"
#include "buffered-io.hh"
#include <nix/config.h> // IWYU pragma: keep
// doesn't exist on macOS
// IWYU pragma: no_include <bits/types/struct_rusage.h>
#include <nix/terminal.hh>
#include <nix/attr-path.hh>
#include <nix/local-fs-store.hh>
#include <nix/installable-flake.hh>
#include <sys/resource.h>
#include <nlohmann/json.hpp>
#include <stdio.h>
#include <stdlib.h>
#include <nix/attr-set.hh>
#include <nix/canon-path.hh>
#include <nix/common-eval-args.hh>
#include <nix/error.hh>
#include <nix/eval-inline.hh>
#include <nix/eval.hh>
#include <nix/file-descriptor.hh>
#include <nix/file-system.hh>
#include <nix/flake/flakeref.hh>
#include <nix/get-drvs.hh>
#include <nix/input-accessor.hh>
#include <nix/logging.hh>
#include <nix/nixexpr.hh>
#include <nlohmann/detail/json_ref.hpp>
#include <nlohmann/json_fwd.hpp>
#include <nix/ref.hh>
#include <nix/store-api.hh>
#include <nix/symbol-table.hh>
#include <nix/types.hh>
#include <nix/util.hh>
#include <nix/value.hh>
#include <exception>
#include <map>
#include <memory>
#include <numeric>
#include <optional>
#include <sstream>
#include <string>
#include <string_view>
#include <utility>
#include <vector>
#include "worker.hh"
#include "drv.hh"
#include "buffered-io.hh"
#include "eval-args.hh"
static nix::Value *releaseExprTopLevelValue(nix::EvalState &state,
nix::Bindings &autoArgs,

View file

@ -1,9 +1,17 @@
#pragma once
#include <nix/config.h>
#include <nix/shared.hh>
#include <nix/eval.hh>
#include "eval-args.hh"
class MyArgs;
namespace nix {
class AutoCloseFD;
class Bindings;
class EvalState;
template <typename T> class ref;
} // namespace nix
void worker(nix::ref<nix::EvalState> state, nix::Bindings &autoArgs,
nix::AutoCloseFD &to, nix::AutoCloseFD &from, MyArgs &args);