diff options
author | Tobias Hunger <tobias.hunger@qt.io> | 2016-09-09 08:01:46 (GMT) |
---|---|---|
committer | Tobias Hunger <tobias.hunger@qt.io> | 2016-09-29 20:34:10 (GMT) |
commit | 4e34f042504f1c62f36a0f16e137e137a7bf1e72 (patch) | |
tree | 6a9079a16e93dd82dce7d04c36d4bb8805546f25 /Source/cmServerProtocol.cxx | |
parent | 262500028cb5e6c278cbc0f0a2694b50833dc3ec (diff) | |
download | CMake-4e34f042504f1c62f36a0f16e137e137a7bf1e72.zip CMake-4e34f042504f1c62f36a0f16e137e137a7bf1e72.tar.gz CMake-4e34f042504f1c62f36a0f16e137e137a7bf1e72.tar.bz2 |
server-mode: Watch CMakeLists.txt files
Watch CMakeLists.txt files (and similar) from the Server
Diffstat (limited to 'Source/cmServerProtocol.cxx')
-rw-r--r-- | Source/cmServerProtocol.cxx | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/Source/cmServerProtocol.cxx b/Source/cmServerProtocol.cxx index 626bff0..a2bdf49 100644 --- a/Source/cmServerProtocol.cxx +++ b/Source/cmServerProtocol.cxx @@ -371,6 +371,30 @@ bool cmServerProtocol1_0::DoActivate(const cmServerRequest& request, return true; } +void cmServerProtocol1_0::HandleCMakeFileChanges(const std::string& path, + int event, int status) +{ + assert(status == 0); + static_cast<void>(status); + + if (!m_isDirty) { + m_isDirty = true; + SendSignal(kDIRTY_SIGNAL, Json::objectValue); + } + Json::Value obj = Json::objectValue; + obj[kPATH_KEY] = path; + Json::Value properties = Json::arrayValue; + if (event & UV_RENAME) { + properties.append(kRENAME_PROPERTY_VALUE); + } + if (event & UV_CHANGE) { + properties.append(kCHANGE_PROPERTY_VALUE); + } + + obj[kPROPERTIES_KEY] = properties; + SendSignal(kFILE_CHANGE_SIGNAL, obj); +} + const cmServerResponse cmServerProtocol1_0::Process( const cmServerRequest& request) { @@ -949,7 +973,17 @@ cmServerResponse cmServerProtocol1_0::ProcessConfigure( if (ret < 0) { return request.ReportError("Configuration failed."); } + + std::vector<std::string> toWatchList; + getCMakeInputs(gg, std::string(), buildDir, nullptr, &toWatchList, nullptr); + + FileMonitor()->MonitorPaths(toWatchList, + [this](const std::string& p, int e, int s) { + this->HandleCMakeFileChanges(p, e, s); + }); + m_State = STATE_CONFIGURED; + m_isDirty = false; return request.Reply(Json::Value()); } |