diff --git a/project.cpp b/project.cpp index 6515374..8403d20 100644 --- a/project.cpp +++ b/project.cpp @@ -29,8 +29,11 @@ extern "C" Configuration CrafterBuildProject(std::span a // The rule test compiles the module as its own interface and links // crafter-build to run the linter in-process: from git by default, or // the sibling checkout with `crafter-build test --local`. Host only, - // like the rules themselves. - if (cfg.target == "x86_64-pc-linux-gnu") { + // like the rules themselves, and only when this is the project being + // built: crafter-build itself loads this file as a dependency, and the + // test's GitProject would then load crafter-build's project file again + // and recurse into the cycle guard. + if (IsTopLevelProject() && cfg.target == "x86_64-pc-linux-gnu") { Configuration* build = useLocal ? LocalProject({ .projectFile = "../Crafter.Build/project.cpp", .args = depArgs }) : GitProject({ .source = { .url = "https://forgejo.catcrafts.net/Catcrafts/Crafter.Build.git" }, .args = depArgs });