forked from qt-creator/qt-creator
Nim: Fix compile
Change-Id: I19753d929dc2ed9594f4d5f0e4daba18b12b868f Reviewed-by: David Schulz <david.schulz@qt.io> Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
@@ -164,12 +164,12 @@ QString NimbleBuildStep::defaultArguments() const
|
||||
QTC_ASSERT(buildConfiguration(), return {}; );
|
||||
switch (buildConfiguration()->buildType()) {
|
||||
case ProjectExplorer::BuildConfiguration::Debug:
|
||||
return "--debugger:native";
|
||||
return {"--debugger:native"};
|
||||
case ProjectExplorer::BuildConfiguration::Unknown:
|
||||
case ProjectExplorer::BuildConfiguration::Profile:
|
||||
case ProjectExplorer::BuildConfiguration::Release:
|
||||
default:
|
||||
return "";
|
||||
return {};
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -105,6 +105,19 @@ NimbleMetadata parseMetadata(const QString &nimblePath, const QString &workingDi
|
||||
NimbleBuildSystem::NimbleBuildSystem(Project *project)
|
||||
: NimBuildSystem(project)
|
||||
{
|
||||
// Not called in parseProject due to nimble behavior to create temporary
|
||||
// files in project directory. This creation in turn stimulate the fs watcher
|
||||
// that in turn causes project parsing (thus a loop if invoke in parseProject).
|
||||
// For this reason we call this function manually during project creation
|
||||
// See https://github.com/nim-lang/nimble/issues/720
|
||||
m_directoryWatcher.addFile(this->project()->projectFilePath().toString(),
|
||||
FileSystemWatcher::WatchModifiedDate);
|
||||
connect(&m_directoryWatcher, &FileSystemWatcher::fileChanged, this, [this](const QString &path) {
|
||||
if (path == this->project()->projectFilePath().toString()) {
|
||||
updateProject();
|
||||
}
|
||||
});
|
||||
updateProject();
|
||||
}
|
||||
|
||||
void NimbleBuildSystem::parseProject(BuildSystem::ParsingContext &&ctx)
|
||||
@@ -118,22 +131,6 @@ void NimbleBuildSystem::updateProject()
|
||||
updateProjectTasks();
|
||||
}
|
||||
|
||||
void NimbleBuildSystem::init()
|
||||
{
|
||||
// Not called in parseProject due to nimble behavior to create temporary
|
||||
// files in project directory. This creation in turn stimulate the fs watcher
|
||||
// that in turn causes project parsing (thus a loop if invoke in parseProject).
|
||||
// For this reason we call this function manually during project creation
|
||||
// See https://github.com/nim-lang/nimble/issues/720
|
||||
m_directoryWatcher.addFile(project()->projectFilePath().toString(), FileSystemWatcher::WatchModifiedDate);
|
||||
connect(&m_directoryWatcher, &FileSystemWatcher::fileChanged, this, [this](const QString &path) {
|
||||
if (path == project()->projectFilePath().toString()) {
|
||||
updateProject();
|
||||
}
|
||||
});
|
||||
updateProject();
|
||||
}
|
||||
|
||||
void NimbleBuildSystem::updateProjectTasks()
|
||||
{
|
||||
auto prj = dynamic_cast<NimbleProject*>(project());
|
||||
|
||||
@@ -36,8 +36,6 @@ class NimbleBuildSystem : public NimBuildSystem
|
||||
public:
|
||||
NimbleBuildSystem(ProjectExplorer::Project *project);
|
||||
|
||||
void init();
|
||||
|
||||
protected:
|
||||
void parseProject(ParsingContext &&ctx) override;
|
||||
|
||||
|
||||
@@ -41,9 +41,7 @@ NimbleProject::NimbleProject(const Utils::FilePath &fileName)
|
||||
setDisplayName(fileName.toFileInfo().completeBaseName());
|
||||
// ensure debugging is enabled (Nim plugin translates nim code to C code)
|
||||
setProjectLanguages(Core::Context(ProjectExplorer::Constants::CXX_LANGUAGE_ID));
|
||||
auto bs = std::make_unique<NimbleBuildSystem>(this);
|
||||
bs->init();
|
||||
setBuildSystem(std::move(bs));
|
||||
setBuildSystemCreator([] (Project *p) { return new NimbleBuildSystem(p); });
|
||||
}
|
||||
|
||||
std::vector<NimbleTask> NimbleProject::tasks() const
|
||||
@@ -103,10 +101,10 @@ QStringList NimbleProject::toStringList(const std::vector<NimbleTask> &tasks)
|
||||
std::tuple<Project::RestoreResult, std::vector<NimbleTask>> NimbleProject::fromStringList(const QStringList &list)
|
||||
{
|
||||
if (list.size() % 2 != 0)
|
||||
return {Project::RestoreResult::Error, {}};
|
||||
return std::make_tuple(Project::RestoreResult::Error, std::vector<NimbleTask>());
|
||||
|
||||
std::vector<NimbleTask> result;
|
||||
for (int i = 0; i < list.size(); i += 2)
|
||||
result.push_back({list[i], list[i + 1]});
|
||||
return {Project::RestoreResult::Ok, std::move(result)};
|
||||
return std::make_tuple(Project::RestoreResult::Ok, result);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user