Skip to content

Commit

Permalink
hyprpm: don't update headers if they are up-to-date, only recompile
Browse files Browse the repository at this point in the history
will not update headers if plugins are compiled for different ones, and instead only compile.

ref #4284
  • Loading branch information
vaxerski committed Jan 29, 2024
1 parent 4b4bd90 commit 91e8c42
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
9 changes: 2 additions & 7 deletions hyprpm/src/core/PluginManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -310,9 +310,7 @@ eHeadersErrors CPluginManager::headersValid() {
hash = hash.substr(hash.find_first_of('"') + 1);
hash = hash.substr(0, hash.find_first_of('"'));

auto GLOBALSTATE = DataState::getGlobalState();

if (hash != HLVER.hash || hash != GLOBALSTATE.headersHashCompiled)
if (hash != HLVER.hash)
return HEADERS_MISMATCHED;

return HEADERS_OK;
Expand All @@ -328,10 +326,7 @@ bool CPluginManager::updateHeaders(bool force) {
}

if (!force && headersValid() == HEADERS_OK) {
std::cout << "\n" << std::string{Colors::GREEN} + "" + Colors::RESET + " Your headers are already up-to-date.\n";
auto GLOBALSTATE = DataState::getGlobalState();
GLOBALSTATE.headersHashCompiled = HLVER.hash;
DataState::updateGlobalState(GLOBALSTATE);
std::cout << "\n" << std::string{Colors::GREEN} + "" + Colors::RESET + " Headers up to date.\n";
return true;
}

Expand Down
7 changes: 6 additions & 1 deletion hyprpm/src/main.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#include "progress/CProgressBar.hpp"
#include "helpers/Colors.hpp"
#include "core/PluginManager.hpp"
#include "core/DataState.hpp"

#include <iostream>
#include <vector>
Expand Down Expand Up @@ -88,7 +89,11 @@ int main(int argc, char** argv, char** envp) {
bool headersValid = g_pPluginManager->headersValid() == HEADERS_OK;
bool headers = g_pPluginManager->updateHeaders(force);
if (headers) {
bool ret1 = g_pPluginManager->updatePlugins(!headersValid || force);
const auto HLVER = g_pPluginManager->getHyprlandVersion();
auto GLOBALSTATE = DataState::getGlobalState();
const auto COMPILEDOUTDATED = HLVER.hash != GLOBALSTATE.headersHashCompiled;

bool ret1 = g_pPluginManager->updatePlugins(!headersValid || force || COMPILEDOUTDATED);

if (!ret1)
return 1;
Expand Down

0 comments on commit 91e8c42

Please sign in to comment.