|
| 1 | +/** |
| 2 | + * |
| 3 | + * @file BuildGraphExecutor.hpp |
| 4 | + * @author Gaspard Kirira |
| 5 | + * |
| 6 | + * Copyright 2026, Gaspard Kirira. All rights reserved. |
| 7 | + * https://github.com/vixcpp/vix |
| 8 | + * Use of this source code is governed by a MIT license |
| 9 | + * that can be found in the License file. |
| 10 | + * |
| 11 | + * Vix.cpp |
| 12 | + * |
| 13 | + * Target-aware build graph executor |
| 14 | + * |
| 15 | + */ |
| 16 | + |
| 17 | +#ifndef VIX_CLI_BUILD_BUILD_GRAPH_EXECUTOR_HPP |
| 18 | +#define VIX_CLI_BUILD_BUILD_GRAPH_EXECUTOR_HPP |
| 19 | + |
| 20 | +#include <filesystem> |
| 21 | +#include <string> |
| 22 | +#include <vector> |
| 23 | + |
| 24 | +#include <vix/cli/build/BuildGraph.hpp> |
| 25 | +#include <vix/cli/build/BuildScheduler.hpp> |
| 26 | + |
| 27 | +namespace vix::cli::build |
| 28 | +{ |
| 29 | + namespace fs = std::filesystem; |
| 30 | + |
| 31 | + struct BuildGraphExecutorOptions |
| 32 | + { |
| 33 | + fs::path buildDir; |
| 34 | + std::string target; |
| 35 | + |
| 36 | + int jobs{0}; |
| 37 | + bool quiet{false}; |
| 38 | + bool verbose{false}; |
| 39 | + }; |
| 40 | + |
| 41 | + struct BuildGraphExecutorResult |
| 42 | + { |
| 43 | + bool ok{false}; |
| 44 | + |
| 45 | + std::string target; |
| 46 | + std::size_t selectedTasks{0}; |
| 47 | + std::size_t selectedCompileTasks{0}; |
| 48 | + std::size_t dirtyCompileTasks{0}; |
| 49 | + std::size_t executedCompileTasks{0}; |
| 50 | + std::size_t skippedCompileTasks{0}; |
| 51 | + |
| 52 | + int exitCode{0}; |
| 53 | + std::string output; |
| 54 | + }; |
| 55 | + |
| 56 | + class BuildGraphExecutor |
| 57 | + { |
| 58 | + public: |
| 59 | + explicit BuildGraphExecutor(BuildGraphExecutorOptions options); |
| 60 | + |
| 61 | + const BuildGraphExecutorOptions &options() const; |
| 62 | + |
| 63 | + BuildGraphExecutorResult run_target(BuildGraph &graph) const; |
| 64 | + |
| 65 | + private: |
| 66 | + BuildGraphExecutorOptions options_; |
| 67 | + }; |
| 68 | + |
| 69 | +} // namespace vix::cli::build |
| 70 | + |
| 71 | +#endif |
0 commit comments