diff --git a/include/Frate/Reflection.hpp b/include/Frate/Reflection.hpp deleted file mode 100644 index 9bdeb02..0000000 --- a/include/Frate/Reflection.hpp +++ /dev/null @@ -1,16 +0,0 @@ -#pragma once -#include -#include - -namespace Frate::Reflection { - using nlohmann::json; - using Command::Project; - //Project related reflection - // void to_json(const Project &p, json &j); - // void to_json(const Command::Package &p, json &j); - // void to_json(const Command::Mode &m, json &j); - - // void from_json(const json &j, Command::Package& package); - // void from_json(const json &j, Command::Mode& mode); - // void from_json(const json &j, Project &pro); -} diff --git a/include/Frate/System.hpp b/include/Frate/System.hpp new file mode 100644 index 0000000..497e12f --- /dev/null +++ b/include/Frate/System.hpp @@ -0,0 +1,34 @@ +#include +#include +#include + + +namespace Frate::System { + + class Capabilities { + public: + bool cmake_installed; + std::string cmake_version; + + bool git_installed; + std::string git_version; + + bool zip_installed; + std::string zip_version; + + bool unzip_installed; + std::string unzip_version; + + bool tar_installed; + std::string tar_version; + + // compilers and installed versions + std::unordered_map> compilers; + + + //Gets the capabilities of the system + Capabilities(); + + }; + +} diff --git a/src/Command/Actions/Build.cpp b/src/Command/Actions/Build.cpp index 628f2b0..515e007 100644 --- a/src/Command/Actions/Build.cpp +++ b/src/Command/Actions/Build.cpp @@ -1,5 +1,6 @@ #include "Frate/Utils/General.hpp" #include +#include namespace Frate::Command::Build { bool options(std::shared_ptr inter){ @@ -27,42 +28,40 @@ namespace Frate::Command::Build { jobs = inter->args->operator[]("jobs").as(); } - Utils::Info info; + inter->loadProjectJson(); + Generators::Project::refresh(inter->pro); + Utils::info << "Building project with: " << std::endl; Utils::info << "Target: " << target << std::endl; Utils::info << "Mode: " << mode << std::endl; Utils::info << "Jobs: " << jobs << std::endl; //TODO: Handle different targets - + + Utils::info << "Build command: " << inter->pro->build_command << std::endl; for(Mode &m : inter->pro->modes){ if(m.name == mode){ std::string workdir_cmd = "cd " + inter->pro->path.string(); - std::string build_cmd = "cmake -DCMAKE_BUILD_TYPE=" + m.name + " ."; - std::string make_cmd = "make"; - if(Utils::hSystem(workdir_cmd + ";" + build_cmd) != 0){ - std::cout << "Build failed" << std::endl; + Utils::replaceKey(inter->pro->build_command, "\n", ";"); + std::string full_build_cmd = inter->pro->build_command; + if(Utils::hSystem(workdir_cmd + ";" + full_build_cmd) != 0){ + Utils::error << "Build failed" << std::endl; return false; }else{ - std::cout << "Build success" << std::endl; + Utils::info << "Build success" << std::endl; return true; } } } - + std::string workdir_cmd = "cd " + inter->pro->path.string(); - std::string build_cmd = "cmake -DCMAKE_BUILD_TYPE=" + inter->pro->default_mode + " ."; - std::string make_cmd = "make -j" + std::to_string(jobs); - if(Utils::hSystem(workdir_cmd + ";" + build_cmd) != 0){ - std::cout << "Build failed" << std::endl; + Utils::replaceKey(inter->pro->build_command, "\n", ";"); + std::string full_build_cmd = workdir_cmd + ";" + inter->pro->build_command; + + if(Utils::hSystem(full_build_cmd) != 0){ + Utils::error << "Build failed" << std::endl; return false; - }else{ - if(Utils::hSystem(workdir_cmd + ";" + make_cmd) != 0){ - std::cout << "Build failed" << std::endl; - return false; - } - std::cout << "Build success" << std::endl; - return true; } + Utils::info << "Build success" << std::endl; return true; } } diff --git a/src/Command/Actions/Set.cpp b/src/Command/Actions/Set.cpp index 155ed98..66b7064 100644 --- a/src/Command/Actions/Set.cpp +++ b/src/Command/Actions/Set.cpp @@ -68,7 +68,6 @@ namespace Frate::Command::Set { } inter->loadProjectJson(); - Generators::Project::refresh(inter->pro); return runCommand(inter,subcommand, setHandlers); } } diff --git a/src/Command/Helpers/Interface.cpp b/src/Command/Helpers/Interface.cpp index 9361e05..06c24a2 100644 --- a/src/Command/Helpers/Interface.cpp +++ b/src/Command/Helpers/Interface.cpp @@ -66,7 +66,7 @@ namespace Frate::Command { this->pro = std::make_shared(); #ifdef DEBUG #ifndef TEST - verbose_mode = true; + Utils::verbose_mode = true; #endif std::cout << "DEBUG MODE ENABLED\n"; pro->path = std::filesystem::current_path() / "build"; diff --git a/src/Command/Keywords/AddKeywords.cpp b/src/Command/Keywords/AddKeywords.cpp index 2f617e7..db41e31 100644 --- a/src/Command/Keywords/AddKeywords.cpp +++ b/src/Command/Keywords/AddKeywords.cpp @@ -20,9 +20,6 @@ namespace Frate::Command::Keywords{ } inter->pro->keywords.push_back(keyword); } - if(!inter->pro->save()){ - return false; - } return true; } } diff --git a/src/Lua/API.cpp b/src/Lua/API.cpp index f87e6bc..617d7c0 100644 --- a/src/Lua/API.cpp +++ b/src/Lua/API.cpp @@ -7,7 +7,6 @@ #include #include #include -#include namespace Frate::LuaAPI { using Command::Project; using std::filesystem::path; diff --git a/src/Lua/Format.cpp b/src/Lua/Format.cpp index 06432c4..6b44c9b 100644 --- a/src/Lua/Format.cpp +++ b/src/Lua/Format.cpp @@ -53,7 +53,6 @@ namespace Frate::LuaAPI { std::string FrateApi::format(const std::string &str, sol::table in_table, sol::this_state s) { - Utils::warning << str << std::endl; std::string result = ""; sol::state_view lua(s);