diff options
Diffstat (limited to 'Userland/DevTools')
-rw-r--r-- | Userland/DevTools/HackStudio/ProjectBuilder.cpp | 11 | ||||
-rw-r--r-- | Userland/DevTools/HackStudio/ProjectBuilder.h | 1 |
2 files changed, 12 insertions, 0 deletions
diff --git a/Userland/DevTools/HackStudio/ProjectBuilder.cpp b/Userland/DevTools/HackStudio/ProjectBuilder.cpp index 1052fd3ed2..39a156398e 100644 --- a/Userland/DevTools/HackStudio/ProjectBuilder.cpp +++ b/Userland/DevTools/HackStudio/ProjectBuilder.cpp @@ -40,6 +40,7 @@ ErrorOr<void> ProjectBuilder::build(StringView active_file) } if (m_is_serenity == IsSerenityRepo::No) { + TRY(verify_make_is_installed()); TRY(m_terminal->run_command("make")); return {}; } @@ -65,6 +66,7 @@ ErrorOr<void> ProjectBuilder::run(StringView active_file) } if (m_is_serenity == IsSerenityRepo::No) { + TRY(verify_make_is_installed()); TRY(m_terminal->run_command("make run")); return {}; } @@ -102,6 +104,7 @@ ErrorOr<void> ProjectBuilder::update_active_file(StringView active_file) ErrorOr<void> ProjectBuilder::build_serenity_component() { + TRY(verify_make_is_installed()); TRY(m_terminal->run_command(String::formatted("make {}", m_serenity_component_name), build_directory(), TerminalWrapper::WaitForExit::Yes, "Make failed"sv)); return {}; } @@ -255,6 +258,14 @@ ErrorOr<void> ProjectBuilder::verify_cmake_is_installed() return Error::from_string_literal("CMake port is not installed"sv); } +ErrorOr<void> ProjectBuilder::verify_make_is_installed() +{ + auto res = Core::command("make --version", {}); + if (!res.is_error() && res.value().exit_code == 0) + return {}; + return Error::from_string_literal("Make port is not installed"sv); +} + String ProjectBuilder::build_directory() const { return LexicalPath::join(m_project_root, "Build"sv).string(); diff --git a/Userland/DevTools/HackStudio/ProjectBuilder.h b/Userland/DevTools/HackStudio/ProjectBuilder.h index 22766788e4..bb2d97da21 100644 --- a/Userland/DevTools/HackStudio/ProjectBuilder.h +++ b/Userland/DevTools/HackStudio/ProjectBuilder.h @@ -47,6 +47,7 @@ private: static void for_each_library_dependencies(Function<void(String, Vector<StringView>)>); static ErrorOr<String> component_name(StringView cmake_file_path); static ErrorOr<void> verify_cmake_is_installed(); + static ErrorOr<void> verify_make_is_installed(); String m_project_root; Project const& m_project; |