// SPDX-License-Identifier: LGPL-3.0-only // SPDX-FileCopyrightText: Copyright (C) 2026 Catcrafts® module; #include "Crafter.Build-Api.h" export module Crafter.Build:Interface; import std; namespace fs = std::filesystem; namespace Crafter { export class Module; export class ModulePartition { public: std::vector moduleDependencies; std::vector partitionDependencies; std::vector> externalModuleDependencies; // Names from `import X;` that matched neither a module in this // Configuration nor one reachable through its dependencies at the time // the source was scanned. Retried by ResolvePendingImports (see // Crafter.Build:Clang) so a dependency wired up after // GetInterfacesAndImplementations still produces a staleness edge. // Names that never resolve (`std`, module-mapped externals) stay here. std::vector pendingImports; std::atomic compiled; bool needsRecompiling; bool checked = false; std::string name; fs::path path; CRAFTER_API ModulePartition(std::string&& name, fs::path&& path); CRAFTER_API bool Check(const fs::path& pcmDir, fs::file_time_type sourceFloor = fs::file_time_type::min()); CRAFTER_API void Compile(const std::string_view clang, const fs::path& pcmDir, const fs::path& buildDir, std::atomic& buildCancelled, std::string& buildError); }; export class Module { public: std::atomic compiled; bool needsRecompiling; bool checked = false; std::vector> partitions; std::string name; fs::path path; CRAFTER_API Module(std::string&& name, fs::path&& path); CRAFTER_API bool Check(const fs::path& pcmDir, fs::file_time_type sourceFloor = fs::file_time_type::min()); CRAFTER_API void Compile(const std::string_view clang, const fs::path& pcmDir, const fs::path& buildDir, std::atomic& buildCancelled, std::string& buildError); }; }