Skip to content

Commit 8ba94b6

Browse files
authored
fix submodule url && emake server shutdown (#210)
1 parent 0aaf068 commit 8ba94b6

File tree

4 files changed

+27
-15
lines changed

4 files changed

+27
-15
lines changed

.gitmodules

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
[submodule "Submodules/enigma-dev"]
22
path = Submodules/enigma-dev
3-
url = https://github.com/enigma-dev/enigma-dev.git
4-
branch = gmxProtoButt
3+
url = ../enigma-dev.git
4+
branch = master

Plugins/ServerPlugin.cpp

+23-12
Original file line numberDiff line numberDiff line change
@@ -218,6 +218,14 @@ void CompilerClient::SyntaxCheck() {
218218
callData->start();
219219
}
220220

221+
void CompilerClient::TearDown() {
222+
auto* callData = ScheduleTask<AsyncResponseReadWorker<Empty>>();
223+
224+
auto worker = dynamic_cast<AsyncResponseReadWorker<Empty>*>(callData);
225+
worker->stream = stub->PrepareAsyncTeardown(&worker->context, ::buffers::Empty(), &cq);
226+
callData->start();
227+
}
228+
221229
template <typename T>
222230
T* CompilerClient::ScheduleTask() {
223231
auto callData = new T();
@@ -243,7 +251,7 @@ void CompilerClient::UpdateLoop(void* got_tag, bool ok) {
243251
ServerPlugin::ServerPlugin(MainWindow& mainWindow) : RGMPlugin(mainWindow) {
244252
// create a new child process for us to launch an emake server
245253
process = new QProcess(this);
246-
254+
247255
connect(process, &QProcess::errorOccurred, [&](QProcess::ProcessError error) {
248256
qDebug() << "QProcess error: " << error << endl;
249257
});
@@ -253,7 +261,7 @@ ServerPlugin::ServerPlugin(MainWindow& mainWindow) : RGMPlugin(mainWindow) {
253261
connect(process, &QProcess::readyReadStandardError, [&]() {
254262
emit LogOutput(process->readAllStandardError());
255263
});
256-
264+
257265
#ifdef _WIN32
258266
//TODO: Make all this stuff configurable in IDE
259267
QProcessEnvironment env = QProcessEnvironment::systemEnvironment();
@@ -271,11 +279,11 @@ ServerPlugin::ServerPlugin(MainWindow& mainWindow) : RGMPlugin(mainWindow) {
271279

272280
// look for an executable file that looks like emake in some common directories
273281
#ifndef RGM_DEBUG
274-
QString emakeName = "emake";
282+
QString emakeName = "emake";
275283
#else
276-
QString emakeName = "emake-debug";
284+
QString emakeName = "emake-debug";
277285
#endif
278-
286+
279287
QFileInfo emakeFileInfo;
280288
foreach (auto path, MainWindow::EnigmaSearchPaths) {
281289
const QDir dir(path);
@@ -286,12 +294,12 @@ ServerPlugin::ServerPlugin(MainWindow& mainWindow) : RGMPlugin(mainWindow) {
286294
break;
287295
}
288296
}
289-
297+
290298
if (emakeFileInfo.filePath().isEmpty()) {
291299
qDebug() << "Error: Failed to locate emake. Compiling and syntax check will not work.\n" << "Search Paths:\n" << MainWindow::EnigmaSearchPaths;
292300
return;
293301
}
294-
302+
295303
if (MainWindow::EnigmaRoot.filePath().isEmpty()) {
296304
qDebug() << "Error: Failed to locate ENIGMA sources. Compiling and syntax check will not work.\n" << "Search Paths:\n" << MainWindow::EnigmaSearchPaths;
297305
return;
@@ -308,9 +316,9 @@ ServerPlugin::ServerPlugin(MainWindow& mainWindow) : RGMPlugin(mainWindow) {
308316
<< "Paths"
309317
<< "-r"
310318
<< "--quiet"
311-
<< "--enigma-root"
319+
<< "--enigma-root"
312320
<< MainWindow::EnigmaRoot.absolutePath();
313-
321+
314322
qDebug() << "Running: " << program << " " << arguments;
315323

316324
process->start(program, arguments);
@@ -330,11 +338,14 @@ ServerPlugin::ServerPlugin(MainWindow& mainWindow) : RGMPlugin(mainWindow) {
330338
compilerClient->GetSystems();
331339
}
332340

333-
ServerPlugin::~ServerPlugin() { process->close(); }
341+
ServerPlugin::~ServerPlugin() {
342+
compilerClient->TearDown();
343+
process->waitForFinished();
344+
}
334345

335-
void ServerPlugin::Run() { compilerClient->CompileBuffer(mainWindow.Game(), CompileRequest::RUN); };
346+
void ServerPlugin::Run() { compilerClient->CompileBuffer(mainWindow.Game(), CompileRequest::RUN); }
336347

337-
void ServerPlugin::Debug() { compilerClient->CompileBuffer(mainWindow.Game(), CompileRequest::DEBUG); };
348+
void ServerPlugin::Debug() { compilerClient->CompileBuffer(mainWindow.Game(), CompileRequest::DEBUG); }
338349

339350
void ServerPlugin::CreateExecutable() {
340351
const QString& fileName =

Plugins/ServerPlugin.h

+1
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ class CompilerClient : public QObject {
6060
void SetDefinitions(std::string code, std::string yaml);
6161
void SetCurrentConfig(const resources::Settings& settings);
6262
void SyntaxCheck();
63+
void TearDown();
6364

6465
signals:
6566
void CompileStatusChanged(bool finished = false);

0 commit comments

Comments
 (0)