From ec64b17b2719dabdcb070ffd6ff824cb213d53fa Mon Sep 17 00:00:00 2001 From: Jorijn van der Graaf Date: Mon, 3 Nov 2025 15:52:04 +0100 Subject: [PATCH] update --- implementations/Crafter.Build-Project.cpp | 18 +++++++++++------- implementations/main.cpp | 3 ++- project.json | 2 +- tests/{ShouldCompile => }/ShouldCompile.cpp | 0 4 files changed, 14 insertions(+), 9 deletions(-) rename tests/{ShouldCompile => }/ShouldCompile.cpp (100%) diff --git a/implementations/Crafter.Build-Project.cpp b/implementations/Crafter.Build-Project.cpp index 0979b68..854e25f 100644 --- a/implementations/Crafter.Build-Project.cpp +++ b/implementations/Crafter.Build-Project.cpp @@ -182,17 +182,16 @@ clang++ -std=c++26 -Wno-reserved-identifier -Wno-reserved-module-identifier --pr name.replace_extension(); if(!fs::exists(buildDir/name)) { if(!config.dependencies[i].branch.empty()) { - RunCommandIgnore(std::format("cd {} && git clone {} && cd {} && git switch {}", buildDir.string(), config.dependencies[i].path, (buildDir/name).string(), config.dependencies[i].branch)); + system(std::format("cd {} && git clone {} && cd {} && git switch {}", buildDir.string(), config.dependencies[i].path, (buildDir/name).string(), config.dependencies[i].branch).c_str()); } else if(!config.dependencies[i].commit.empty()){ - std::cout << std::format("cd {} && git clone {} && cd {} && git checkout {}", buildDir.string(), config.dependencies[i].path, (buildDir/name).string(), config.dependencies[i].commit) << std::endl; - RunCommandIgnore(std::format("cd {} && git clone {} && cd {} && git checkout {}", buildDir.string(), config.dependencies[i].path, (buildDir/name).string(), config.dependencies[i].commit)); + system(std::format("cd {} && git clone {} && cd {} && git checkout {}", buildDir.string(), config.dependencies[i].path, (buildDir/name).string(), config.dependencies[i].commit).c_str()); } else { - RunCommandIgnore(std::format("cd {} && git clone {}", buildDir.string(), config.dependencies[i].path)); + system(std::format("cd {} && git clone {}", buildDir.string(), config.dependencies[i].path).c_str()); } } else if(config.dependencies[i].commit.empty()) { - RunCommandIgnore(std::format("cd {} && git pull", (buildDir/name).string())); + system(std::format("cd {} && git pull", (buildDir/name).string()).c_str()); } - config.dependencies[i].path = fs::path(config.dependencies[i].path).filename().replace_extension()/"project.json"; + config.dependencies[i].path = buildDir/name/"project.json"; } if(fs::path(config.dependencies[i].path).is_relative()) { config.dependencies[i].path = this->path/config.dependencies[i].path; @@ -372,7 +371,12 @@ clang++ -std=c++26 -Wno-reserved-identifier -Wno-reserved-module-identifier --pr dlclose(handle); throw std::runtime_error(std::format("Cannot load symbol 'RunTest': {}", msg)); } - std::string* testResult = loadedTest(); + std::string* testResult; + try { + testResult = loadedTest(); + } catch(std::exception& e) { + return {test.config.name, std::string(e.what())}; + } if(testResult != nullptr) { TestResult result = {test.config.name, *testResult}; delete testResult; diff --git a/implementations/main.cpp b/implementations/main.cpp index 425b363..1ea7dac 100644 --- a/implementations/main.cpp +++ b/implementations/main.cpp @@ -70,7 +70,8 @@ int main(int argc, char* argv[]) { binDir = std::format("{}/{}", project.binDir.string(), config.name); } if(config.debug) { - system(std::format("cd {} && lldb -o run {}", (fs::path(projectPath).parent_path()/binDir).string(), project.name).c_str()); + system(std::format("cd {} && ./{}", (fs::path(projectPath).parent_path()/binDir).string(), project.name).c_str()); + //system(std::format("cd {} && lldb -o run {}", (fs::path(projectPath).parent_path()/binDir).string(), project.name).c_str()); } else { system(std::format("cd {} && ./{}", (fs::path(projectPath).parent_path()/binDir).string(), project.name).c_str()); } diff --git a/project.json b/project.json index 2650e3e..1afdc27 100644 --- a/project.json +++ b/project.json @@ -37,7 +37,7 @@ "tests": [ { "name": "should-compile", - "implementations": ["tests/ShouldCompile/ShouldCompile"], + "implementations": ["tests/ShouldCompile"], "dependencies": [ { "path":"./project.json", diff --git a/tests/ShouldCompile/ShouldCompile.cpp b/tests/ShouldCompile.cpp similarity index 100% rename from tests/ShouldCompile/ShouldCompile.cpp rename to tests/ShouldCompile.cpp