diff --git a/.gitmodules b/.gitmodules index 832bf1ed5..e1229a7ac 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,4 +1,4 @@ [submodule "Submodules/enigma-dev"] path = Submodules/enigma-dev - url = https://github.com/enigma-dev/enigma-dev.git - branch = gmxProtoButt + url = ../enigma-dev.git + branch = master diff --git a/Plugins/ServerPlugin.cpp b/Plugins/ServerPlugin.cpp index 3f79ec5e2..57a9d4452 100644 --- a/Plugins/ServerPlugin.cpp +++ b/Plugins/ServerPlugin.cpp @@ -218,6 +218,14 @@ void CompilerClient::SyntaxCheck() { callData->start(); } +void CompilerClient::TearDown() { + auto* callData = ScheduleTask>(); + + auto worker = dynamic_cast*>(callData); + worker->stream = stub->PrepareAsyncTeardown(&worker->context, ::buffers::Empty(), &cq); + callData->start(); +} + template T* CompilerClient::ScheduleTask() { auto callData = new T(); @@ -243,7 +251,7 @@ void CompilerClient::UpdateLoop(void* got_tag, bool ok) { ServerPlugin::ServerPlugin(MainWindow& mainWindow) : RGMPlugin(mainWindow) { // create a new child process for us to launch an emake server process = new QProcess(this); - + connect(process, &QProcess::errorOccurred, [&](QProcess::ProcessError error) { qDebug() << "QProcess error: " << error << endl; }); @@ -253,7 +261,7 @@ ServerPlugin::ServerPlugin(MainWindow& mainWindow) : RGMPlugin(mainWindow) { connect(process, &QProcess::readyReadStandardError, [&]() { emit LogOutput(process->readAllStandardError()); }); - + #ifdef _WIN32 //TODO: Make all this stuff configurable in IDE QProcessEnvironment env = QProcessEnvironment::systemEnvironment(); @@ -271,11 +279,11 @@ ServerPlugin::ServerPlugin(MainWindow& mainWindow) : RGMPlugin(mainWindow) { // look for an executable file that looks like emake in some common directories #ifndef RGM_DEBUG - QString emakeName = "emake"; + QString emakeName = "emake"; #else - QString emakeName = "emake-debug"; + QString emakeName = "emake-debug"; #endif - + QFileInfo emakeFileInfo; foreach (auto path, MainWindow::EnigmaSearchPaths) { const QDir dir(path); @@ -286,12 +294,12 @@ ServerPlugin::ServerPlugin(MainWindow& mainWindow) : RGMPlugin(mainWindow) { break; } } - + if (emakeFileInfo.filePath().isEmpty()) { qDebug() << "Error: Failed to locate emake. Compiling and syntax check will not work.\n" << "Search Paths:\n" << MainWindow::EnigmaSearchPaths; return; } - + if (MainWindow::EnigmaRoot.filePath().isEmpty()) { qDebug() << "Error: Failed to locate ENIGMA sources. Compiling and syntax check will not work.\n" << "Search Paths:\n" << MainWindow::EnigmaSearchPaths; return; @@ -308,9 +316,9 @@ ServerPlugin::ServerPlugin(MainWindow& mainWindow) : RGMPlugin(mainWindow) { << "Paths" << "-r" << "--quiet" - << "--enigma-root" + << "--enigma-root" << MainWindow::EnigmaRoot.absolutePath(); - + qDebug() << "Running: " << program << " " << arguments; process->start(program, arguments); @@ -330,11 +338,14 @@ ServerPlugin::ServerPlugin(MainWindow& mainWindow) : RGMPlugin(mainWindow) { compilerClient->GetSystems(); } -ServerPlugin::~ServerPlugin() { process->close(); } +ServerPlugin::~ServerPlugin() { + compilerClient->TearDown(); + process->waitForFinished(); +} -void ServerPlugin::Run() { compilerClient->CompileBuffer(mainWindow.Game(), CompileRequest::RUN); }; +void ServerPlugin::Run() { compilerClient->CompileBuffer(mainWindow.Game(), CompileRequest::RUN); } -void ServerPlugin::Debug() { compilerClient->CompileBuffer(mainWindow.Game(), CompileRequest::DEBUG); }; +void ServerPlugin::Debug() { compilerClient->CompileBuffer(mainWindow.Game(), CompileRequest::DEBUG); } void ServerPlugin::CreateExecutable() { const QString& fileName = diff --git a/Plugins/ServerPlugin.h b/Plugins/ServerPlugin.h index 78ca77fed..1f7fdd85f 100644 --- a/Plugins/ServerPlugin.h +++ b/Plugins/ServerPlugin.h @@ -60,6 +60,7 @@ class CompilerClient : public QObject { void SetDefinitions(std::string code, std::string yaml); void SetCurrentConfig(const resources::Settings& settings); void SyntaxCheck(); + void TearDown(); signals: void CompileStatusChanged(bool finished = false); diff --git a/Submodules/enigma-dev b/Submodules/enigma-dev index 02265f0c0..bde40133d 160000 --- a/Submodules/enigma-dev +++ b/Submodules/enigma-dev @@ -1 +1 @@ -Subproject commit 02265f0c0208abe05bf07b6de0a80247df6687ad +Subproject commit bde40133d77c2a2ae5791216c0febd2bdbaabc36