forked from qt-creator/qt-creator
CMake: Put cmake server-mode socket into a temporary directory
Do not put the cmake server-mode socket into the build directory, but put it into a temporary directory instead. This makes sure it will not stick around and also avoids polluting the build directory with Qt Creator specific files. Task-number: QTCREATORBUG-17320 Change-Id: Id849b1a80d7cba07c026cc2ecd7030435c401884 Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
This commit is contained in:
committed by
Tim Jenssen
parent
c6f90e575e
commit
01e80b264b
@@ -25,11 +25,13 @@
|
|||||||
|
|
||||||
#include "servermode.h"
|
#include "servermode.h"
|
||||||
|
|
||||||
|
#include <coreplugin/icore.h>
|
||||||
#include <coreplugin/reaper.h>
|
#include <coreplugin/reaper.h>
|
||||||
|
|
||||||
#include <utils/algorithm.h>
|
#include <utils/algorithm.h>
|
||||||
#include <utils/qtcassert.h>
|
#include <utils/qtcassert.h>
|
||||||
#include <utils/qtcprocess.h>
|
#include <utils/qtcprocess.h>
|
||||||
|
#include <utils/temporarydirectory.h>
|
||||||
|
|
||||||
#include <QByteArray>
|
#include <QByteArray>
|
||||||
#include <QCryptographicHash>
|
#include <QCryptographicHash>
|
||||||
@@ -61,13 +63,12 @@ Q_LOGGING_CATEGORY(cmakeServerMode, "qtc.cmake.serverMode");
|
|||||||
// Helpers:
|
// Helpers:
|
||||||
// ----------------------------------------------------------------------
|
// ----------------------------------------------------------------------
|
||||||
|
|
||||||
QString socketName(const Utils::FileName &buildDirectory)
|
QString socketName()
|
||||||
{
|
{
|
||||||
if (HostOsInfo::isWindowsHost()) {
|
|
||||||
QUuid uuid = QUuid::createUuid();
|
QUuid uuid = QUuid::createUuid();
|
||||||
|
if (HostOsInfo::isWindowsHost())
|
||||||
return "\\\\.\\pipe\\" + uuid.toString();
|
return "\\\\.\\pipe\\" + uuid.toString();
|
||||||
}
|
return Utils::TemporaryDirectory::masterDirectoryPath() + "/cmake-socket-" + uuid.toString();
|
||||||
return buildDirectory.toString() + "/socket";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool isValid(const QVariant &v)
|
bool isValid(const QVariant &v)
|
||||||
@@ -108,7 +109,7 @@ ServerMode::ServerMode(const Environment &env,
|
|||||||
|
|
||||||
m_cmakeProcess->setEnvironment(env);
|
m_cmakeProcess->setEnvironment(env);
|
||||||
m_cmakeProcess->setWorkingDirectory(buildDirectory.toString());
|
m_cmakeProcess->setWorkingDirectory(buildDirectory.toString());
|
||||||
m_socketName = socketName(buildDirectory);
|
m_socketName = socketName();
|
||||||
const QStringList args = QStringList({ "-E", "server", "--pipe=" + m_socketName });
|
const QStringList args = QStringList({ "-E", "server", "--pipe=" + m_socketName });
|
||||||
|
|
||||||
connect(m_cmakeProcess.get(), &QtcProcess::started, this, [this]() { m_connectionTimer.start(); });
|
connect(m_cmakeProcess.get(), &QtcProcess::started, this, [this]() { m_connectionTimer.start(); });
|
||||||
|
|||||||
@@ -62,15 +62,6 @@ const char SOURCES_KEY[] = "sources";
|
|||||||
|
|
||||||
const int MAX_PROGRESS = 1400;
|
const int MAX_PROGRESS = 1400;
|
||||||
|
|
||||||
// ----------------------------------------------------------------------
|
|
||||||
// Helpers:
|
|
||||||
// ----------------------------------------------------------------------
|
|
||||||
|
|
||||||
QString socketName(const BuildDirReader::Parameters &p)
|
|
||||||
{
|
|
||||||
return p.buildDirectory.toString() + "/socket";
|
|
||||||
}
|
|
||||||
|
|
||||||
// --------------------------------------------------------------------
|
// --------------------------------------------------------------------
|
||||||
// ServerModeReader:
|
// ServerModeReader:
|
||||||
// --------------------------------------------------------------------
|
// --------------------------------------------------------------------
|
||||||
|
|||||||
Reference in New Issue
Block a user