Changeset View
Changeset View
Standalone View
Standalone View
plugins/custommake/makefileresolver/makefileresolver.cpp
Show First 20 Lines • Show All 86 Lines • ▼ Show 20 Line(s) | 79 | } | |||
---|---|---|---|---|---|
87 | class SourcePathInformation | 87 | class SourcePathInformation | ||
88 | { | 88 | { | ||
89 | public: | 89 | public: | ||
90 | explicit SourcePathInformation(const QString& path) | 90 | explicit SourcePathInformation(const QString& path) | ||
91 | : m_path(path) | 91 | : m_path(path) | ||
92 | { | 92 | { | ||
93 | } | 93 | } | ||
94 | 94 | | |||
95 | QString getCommand(const QString& absoluteFile, const QString& workingDirectory, const QString& makeParameters) const | 95 | QString createCommand(const QString& absoluteFile, const QString& workingDirectory, const QString& makeParameters) const | ||
96 | { | 96 | { | ||
97 | QString relativeFile = Path(workingDirectory).relativePath(Path(absoluteFile)); | 97 | QString relativeFile = Path(workingDirectory).relativePath(Path(absoluteFile)); | ||
98 | return "make -k --no-print-directory -W \'" + absoluteFile + "\' -W \'" + relativeFile + "\' -n " + makeParameters; | 98 | return "make -k --no-print-directory -W \'" + absoluteFile + "\' -W \'" + relativeFile + "\' -n " + makeParameters; | ||
99 | } | 99 | } | ||
100 | 100 | | |||
101 | bool hasMakefile() const | 101 | bool hasMakefile() const | ||
102 | { | 102 | { | ||
103 | QFileInfo makeFile(m_path, QStringLiteral("Makefile")); | 103 | QFileInfo makeFile(m_path, QStringLiteral("Makefile")); | ||
▲ Show 20 Lines • Show All 317 Lines • ▼ Show 20 Line(s) | 420 | PathResolutionResult MakeFileResolver::resolveIncludePathInternal(const QString& file, const QString& workingDirectory, | |||
421 | const QString& makeParameters, const SourcePathInformation& source, | 421 | const QString& makeParameters, const SourcePathInformation& source, | ||
422 | int maxDepth) | 422 | int maxDepth) | ||
423 | { | 423 | { | ||
424 | --maxDepth; | 424 | --maxDepth; | ||
425 | if (maxDepth < 0) | 425 | if (maxDepth < 0) | ||
426 | return PathResolutionResult(false); | 426 | return PathResolutionResult(false); | ||
427 | 427 | | |||
428 | QString fullOutput; | 428 | QString fullOutput; | ||
429 | executeCommand(source.getCommand(file, workingDirectory, makeParameters), workingDirectory, fullOutput); | 429 | executeCommand(source.createCommand(file, workingDirectory, makeParameters), workingDirectory, fullOutput); | ||
430 | 430 | | |||
431 | { | 431 | { | ||
432 | QRegExp newLineRx("\\\\\\n"); | 432 | QRegExp newLineRx("\\\\\\n"); | ||
433 | fullOutput.remove(newLineRx); | 433 | fullOutput.remove(newLineRx); | ||
434 | } | 434 | } | ||
435 | ///@todo collect multiple outputs at the same time for performance-reasons | 435 | ///@todo collect multiple outputs at the same time for performance-reasons | ||
436 | QString firstLine = fullOutput; | 436 | QString firstLine = fullOutput; | ||
437 | int lineEnd; | 437 | int lineEnd; | ||
▲ Show 20 Lines • Show All 74 Lines • ▼ Show 20 Line(s) | |||||
512 | } | 512 | } | ||
513 | 513 | | |||
514 | ///STEP 2: Search the output for include-paths | 514 | ///STEP 2: Search the output for include-paths | ||
515 | 515 | | |||
516 | PathResolutionResult ret = processOutput(fullOutput, workingDirectory); | 516 | PathResolutionResult ret = processOutput(fullOutput, workingDirectory); | ||
517 | if (ret.paths.isEmpty() && ret.frameworkDirectories.isEmpty()) | 517 | if (ret.paths.isEmpty() && ret.frameworkDirectories.isEmpty()) | ||
518 | return PathResolutionResult(false, i18n("Could not extract include paths from make output"), | 518 | return PathResolutionResult(false, i18n("Could not extract include paths from make output"), | ||
519 | i18n("Folder: \"%1\" Command: \"%2\" Output: \"%3\"", workingDirectory, | 519 | i18n("Folder: \"%1\" Command: \"%2\" Output: \"%3\"", workingDirectory, | ||
520 | source.getCommand(file, workingDirectory, makeParameters), fullOutput)); | 520 | source.createCommand(file, workingDirectory, makeParameters), fullOutput)); | ||
521 | return ret; | 521 | return ret; | ||
522 | } | 522 | } | ||
523 | 523 | | |||
524 | QRegularExpression MakeFileResolver::defineRegularExpression() | 524 | QRegularExpression MakeFileResolver::defineRegularExpression() | ||
525 | { | 525 | { | ||
526 | static const QRegularExpression pattern( | 526 | static const QRegularExpression pattern( | ||
527 | QStringLiteral("-D([^\\s=]+)(?:=(?:\"(.*?)(?<!\\\\)\"|([^\\s]*)))?") | 527 | QStringLiteral("-D([^\\s=]+)(?:=(?:\"(.*?)(?<!\\\\)\"|([^\\s]*)))?") | ||
528 | ); | 528 | ); | ||
▲ Show 20 Lines • Show All 106 Lines • Show Last 20 Lines |