error messages

This commit is contained in:
Jorijn van der Graaf 2025-09-09 23:04:05 +02:00
commit 23fa8b98b0
9 changed files with 199 additions and 90 deletions

View file

@ -20,6 +20,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
#include <cstdint>
#include <print>
#include <tuple>
#include <iostream>
#include "json.hpp"
import Crafter.Build;
using namespace Crafter::Build;
@ -58,11 +60,22 @@ int main(int argc, char* argv[]) {
projectPath = filepath;
}
std::vector<ClangError> errors;
Project project = Project::LoadFromJSON(projectPath);
if(outputDir.empty()){
project.Build(configuration);
errors = std::get<1>(project.Build(configuration));
} else{
project.Build(configuration, fs::path(outputDir));
errors = std::get<1>(project.Build(configuration, fs::path(outputDir)));
}
if(errors.size() > 0){
for (const ClangError& error : errors) {
std::cout << "Filename: " << error.filename << std::endl;
std::cout << "Line: " << error.line_number << std::endl;
std::cout << "Error Message: " << error.error_message << std::endl;
std::cout << "Code: " << error.code << std::endl << std::endl;
}
return 0;
}
if(run){