Skip to content

Instantly share code, notes, and snippets.

@Plagman
Created January 24, 2018 02:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Plagman/cf43d9f55099e98184b3e35333768805 to your computer and use it in GitHub Desktop.
Save Plagman/cf43d9f55099e98184b3e35333768805 to your computer and use it in GitHub Desktop.
Description: <short summary of the patch>
TODO: Put a short summary on the line above and replace this paragraph
with a longer explanation of this change. Complete the meta-information
with other relevant fields (see below for details). To make it easier, the
information below has been extracted from the changelog. Adjust it or drop
it.
.
kdevelop (4:5.1.2-1ubuntu1) artful; urgency=medium
.
* Sync with debian changes. Remaining changes:
- Keep autotests
- Revert the versioned clang dep - We don't have the mesa/llvm-default
mismatch in ubuntu that caused debian bug #846410, so this only
causes potential problems for us (LP: #1677140)
Author: Rik Mills <rikmills@kubuntu.org>
Bug-Ubuntu: https://bugs.launchpad.net/bugs/1677140
---
The information above should follow the Patch Tagging Guidelines, please
checkout http://dep.debian.net/deps/dep3/ to learn about the format. Here
are templates for supplementary fields that you might want to add:
Origin: <vendor|upstream|other>, <url of original patch>
Bug: <url in upstream bugtracker>
Bug-Debian: https://bugs.debian.org/<bugnumber>
Bug-Ubuntu: https://launchpad.net/bugs/<bugnumber>
Forwarded: <no|not-needed|url proving that it has been forwarded>
Reviewed-By: <name and email of someone who approved the patch>
Last-Update: 2018-01-24
--- kdevelop-5.1.2.orig/projectmanagers/cmake/cmakeimportjsonjob.cpp
+++ kdevelop-5.1.2/projectmanagers/cmake/cmakeimportjsonjob.cpp
@@ -69,6 +69,7 @@ CMakeJsonData importCommands(const Path&
MakeFileResolver resolver;
static const QString KEY_COMMAND = QStringLiteral("command");
+ static const QString KEY_ARGUMENTS = QStringLiteral("arguments");
static const QString KEY_DIRECTORY = QStringLiteral("directory");
static const QString KEY_FILE = QStringLiteral("file");
foreach(const QJsonValue& value, document.array()) {
@@ -77,12 +78,23 @@ CMakeJsonData importCommands(const Path&
continue;
}
const QJsonObject entry = value.toObject();
- if (!entry.contains(KEY_FILE) || !entry.contains(KEY_COMMAND) || !entry.contains(KEY_DIRECTORY)) {
+ if (!entry.contains(KEY_FILE)
+ || !(entry.contains(KEY_COMMAND) || entry.contains(KEY_ARGUMENTS))
+ || !entry.contains(KEY_DIRECTORY)) {
qCWarning(CMAKE) << "JSON command file entry does not contain required keys:" << entry;
continue;
}
+ QString commandString;
+ if (entry.contains(KEY_COMMAND)) {
+ commandString = entry[KEY_COMMAND].toString();
+ } else {
+ auto args = entry[KEY_ARGUMENTS].toArray();
+ for (QJsonValue arg: args) {
+ commandString += QStringLiteral(" ") + arg.toString();
+ }
+ }
- PathResolutionResult result = resolver.processOutput(entry[KEY_COMMAND].toString(), entry[KEY_DIRECTORY].toString());
+ PathResolutionResult result = resolver.processOutput(commandString, entry[KEY_DIRECTORY].toString());
CMakeFile ret;
ret.includes = result.paths;
@@ -90,7 +102,8 @@ CMakeJsonData importCommands(const Path&
ret.defines = result.defines;
// NOTE: we use the canonical file path to prevent issues with symlinks in the path
// leading to lookup failures
- const auto path = Path(QFileInfo(entry[KEY_FILE].toString()).canonicalFilePath());
+ const auto path = Path(QFileInfo(entry[KEY_DIRECTORY].toString()+"/"+entry[KEY_FILE].toString()).canonicalFilePath());
+ qCWarning(CMAKE) << "JSON command file:" << path << ret.defines;
data.files[path] = ret;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment