forked from qt-creator/qt-creator
Nim: Do not crash on empty nimprojects
Create a Nim Application using the wizard, remove main.nim, open. Without this patch creator crashes. Change-Id: Ia1628c67525e2fe9bb8dd9c76f62d7074844ccc4 Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
This commit is contained in:
committed by
Tim Jenssen
parent
7480f58cf1
commit
6cd68d5401
@@ -108,7 +108,9 @@ BuildConfiguration *NimBuildConfigurationFactory::create(Target *parent, const B
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
nimCompilerBuildStep->setDefaultCompilerOptions(defaultOption);
|
nimCompilerBuildStep->setDefaultCompilerOptions(defaultOption);
|
||||||
nimCompilerBuildStep->setTargetNimFile(project->nimFiles().first());
|
Utils::FileNameList nimFiles = project->nimFiles();
|
||||||
|
if (!nimFiles.isEmpty())
|
||||||
|
nimCompilerBuildStep->setTargetNimFile(nimFiles.first());
|
||||||
buildSteps->appendStep(nimCompilerBuildStep);
|
buildSteps->appendStep(nimCompilerBuildStep);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -26,6 +26,7 @@
|
|||||||
#include "nimcompilerbuildstep.h"
|
#include "nimcompilerbuildstep.h"
|
||||||
#include "nimbuildconfiguration.h"
|
#include "nimbuildconfiguration.h"
|
||||||
#include "nimcompilerbuildstepconfigwidget.h"
|
#include "nimcompilerbuildstepconfigwidget.h"
|
||||||
|
#include "nimproject.h"
|
||||||
|
|
||||||
#include "../nimconstants.h"
|
#include "../nimconstants.h"
|
||||||
|
|
||||||
@@ -50,6 +51,8 @@ NimCompilerBuildStep::NimCompilerBuildStep(BuildStepList *parentList)
|
|||||||
this, &NimCompilerBuildStep::updateProcessParameters);
|
this, &NimCompilerBuildStep::updateProcessParameters);
|
||||||
connect(this, &NimCompilerBuildStep::outFilePathChanged,
|
connect(this, &NimCompilerBuildStep::outFilePathChanged,
|
||||||
bc, &NimBuildConfiguration::outFilePathChanged);
|
bc, &NimBuildConfiguration::outFilePathChanged);
|
||||||
|
connect(bc->target()->project(), &ProjectExplorer::Project::fileListChanged,
|
||||||
|
this, &NimCompilerBuildStep::updateTargetNimFile);
|
||||||
updateProcessParameters();
|
updateProcessParameters();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -202,5 +205,13 @@ void NimCompilerBuildStep::updateEnvironment()
|
|||||||
processParameters()->setEnvironment(bc->environment());
|
processParameters()->setEnvironment(bc->environment());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void NimCompilerBuildStep::updateTargetNimFile()
|
||||||
|
{
|
||||||
|
if (!m_targetNimFile.isEmpty())
|
||||||
|
return;
|
||||||
|
const Utils::FileNameList nimFiles = static_cast<NimProject *>(project())->nimFiles();
|
||||||
|
if (!nimFiles.isEmpty())
|
||||||
|
setTargetNimFile(nimFiles.at(0));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} // namespace Nim
|
||||||
|
|||||||
@@ -74,6 +74,8 @@ private:
|
|||||||
void updateArguments();
|
void updateArguments();
|
||||||
void updateEnvironment();
|
void updateEnvironment();
|
||||||
|
|
||||||
|
void updateTargetNimFile();
|
||||||
|
|
||||||
DefaultBuildOptions m_defaultOptions;
|
DefaultBuildOptions m_defaultOptions;
|
||||||
QStringList m_userCompilerOptions;
|
QStringList m_userCompilerOptions;
|
||||||
Utils::FileName m_targetNimFile;
|
Utils::FileName m_targetNimFile;
|
||||||
|
|||||||
Reference in New Issue
Block a user