1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 13:57:35 +00:00

DevTools/HackStudio: Add verify_make_is_installed()

This commit is contained in:
ferhatgec 2022-06-15 04:09:16 +03:00 committed by Sam Atkins
parent 31fc1990fa
commit 00075afb07
2 changed files with 12 additions and 0 deletions

View file

@ -40,6 +40,7 @@ ErrorOr<void> ProjectBuilder::build(StringView active_file)
} }
if (m_is_serenity == IsSerenityRepo::No) { if (m_is_serenity == IsSerenityRepo::No) {
TRY(verify_make_is_installed());
TRY(m_terminal->run_command("make")); TRY(m_terminal->run_command("make"));
return {}; return {};
} }
@ -65,6 +66,7 @@ ErrorOr<void> ProjectBuilder::run(StringView active_file)
} }
if (m_is_serenity == IsSerenityRepo::No) { if (m_is_serenity == IsSerenityRepo::No) {
TRY(verify_make_is_installed());
TRY(m_terminal->run_command("make run")); TRY(m_terminal->run_command("make run"));
return {}; return {};
} }
@ -102,6 +104,7 @@ ErrorOr<void> ProjectBuilder::update_active_file(StringView active_file)
ErrorOr<void> ProjectBuilder::build_serenity_component() 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)); TRY(m_terminal->run_command(String::formatted("make {}", m_serenity_component_name), build_directory(), TerminalWrapper::WaitForExit::Yes, "Make failed"sv));
return {}; return {};
} }
@ -255,6 +258,14 @@ ErrorOr<void> ProjectBuilder::verify_cmake_is_installed()
return Error::from_string_literal("CMake port is not installed"sv); 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 String ProjectBuilder::build_directory() const
{ {
return LexicalPath::join(m_project_root, "Build"sv).string(); return LexicalPath::join(m_project_root, "Build"sv).string();

View file

@ -47,6 +47,7 @@ private:
static void for_each_library_dependencies(Function<void(String, Vector<StringView>)>); static void for_each_library_dependencies(Function<void(String, Vector<StringView>)>);
static ErrorOr<String> component_name(StringView cmake_file_path); static ErrorOr<String> component_name(StringView cmake_file_path);
static ErrorOr<void> verify_cmake_is_installed(); static ErrorOr<void> verify_cmake_is_installed();
static ErrorOr<void> verify_make_is_installed();
String m_project_root; String m_project_root;
Project const& m_project; Project const& m_project;