From 1350d6381de4c2b2c56a69f0dc20ce54fab7be8b Mon Sep 17 00:00:00 2001 From: Amlal El Mahrouss Date: Wed, 29 Oct 2025 12:05:32 +0100 Subject: feat: new NeBuild JSON API. Signed-off-by: Amlal El Mahrouss --- dev/src/JSONManifestBuilder.cc | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) (limited to 'dev/src') diff --git a/dev/src/JSONManifestBuilder.cc b/dev/src/JSONManifestBuilder.cc index 5ea96a7..e045f6c 100644 --- a/dev/src/JSONManifestBuilder.cc +++ b/dev/src/JSONManifestBuilder.cc @@ -49,8 +49,8 @@ bool JSONManifestBuilder::BuildTarget(const std::string& argv_val, const bool dr std::string compiler = json_obj["compiler_path"].get(); if (compiler != "g++" || !compiler.starts_with("clang")) { - NeBuild::Logger::info() << "nebuild: error: compiler '" << compiler << "' is not a valid C/C++ compiler!" - << std::endl; + NeBuild::Logger::info() << "nebuild: error: compiler '" << compiler + << "' is not a valid C/C++ compiler!" << std::endl; return false; } @@ -62,8 +62,8 @@ bool JSONManifestBuilder::BuildTarget(const std::string& argv_val, const bool dr command += "-I" + headers.get() + " "; } - JSON headers_path = json_obj["headers_path"]; - JSON sources_files = json_obj["sources_path"]; + JSON headers_path = json_obj["headers_path"]; + JSON sources_files = json_obj["sources_path"]; for (auto& sources : sources_files) { command += sources.get() + " "; @@ -126,8 +126,6 @@ bool JSONManifestBuilder::BuildTarget(const std::string& argv_val, const bool dr } #endif - return false; - } else { return false; } @@ -137,12 +135,12 @@ bool JSONManifestBuilder::BuildTarget(const std::string& argv_val, const bool dr std::system(("./" + target).c_str()); #endif } - } catch (...) { - return true; + } catch (std::runtime_error& err) { + NeBuild::Logger::info() << "error: " << err.what() << std::endl; + return false; } } catch (std::runtime_error& err) { NeBuild::Logger::info() << "error: " << err.what() << std::endl; - return false; } -- cgit v1.2.3