import std; import Crafter.Build; namespace fs = std::filesystem; using namespace Crafter; // Smoke test for the local Crafter.Build library: construct a Configuration // for the fixture/ subdir, call Build() in-process, and assert the binary // was produced. The build engine being exercised here is whatever this // test exe was statically linked against — which, via the parent // project.cpp's .Dependencies({ crafterBuildLib.get() }), is the local // checkout's library form. Edits to implementations/*.cpp show up here on // the next test run with no install step required. int main() { Configuration cfg; cfg.path = fs::current_path() / "tests" / "HelloWorld" / "fixture"; cfg.name = "hello"; cfg.outputName = "hello"; cfg.target = HostTarget(); cfg.type = ConfigurationType::Executable; std::array ifaces = {}; std::array impls = { "main" }; cfg.GetInterfacesAndImplementations(ifaces, impls); std::unordered_map> depResults; std::mutex depMutex; BuildResult r = Build(cfg, depResults, depMutex); if (!r.result.empty()) { std::println(std::cerr, "build failed: {}", r.result); return 1; } fs::path bin = cfg.BinDir() / "hello"; if (!fs::exists(bin)) { std::println(std::cerr, "binary not produced at {}", bin.string()); return 1; } return 0; }