diff options
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/clangCompleteAt.sh | 2 | ||||
-rwxr-xr-x | scripts/ninjawrapper.py | 31 | ||||
-rwxr-xr-x | scripts/perltest2tasks.pl | 83 |
3 files changed, 115 insertions, 1 deletions
diff --git a/scripts/clangCompleteAt.sh b/scripts/clangCompleteAt.sh index e80fbd623a4..18f225a9207 100755 --- a/scripts/clangCompleteAt.sh +++ b/scripts/clangCompleteAt.sh @@ -94,7 +94,7 @@ runCodeCompletion() if [ -n "${CINDEXTEST_EXEC}" ]; then command="${CINDEXTEST_EXEC} -code-completion-at=${FILE}:${LINE}:${COLUMN} ${FILE}" else - command="${CLANG_EXEC} -cc1 -code-completion-at ${FILE}:${LINE}:${COLUMN} ${FILE}" + command="${CLANG_EXEC} -fsyntax-only -Xclang -code-completion-at -Xclang ${FILE}:${LINE}:${COLUMN} ${FILE}" fi echo "Command: $command" eval $command diff --git a/scripts/ninjawrapper.py b/scripts/ninjawrapper.py new file mode 100755 index 00000000000..9259d52bc9b --- /dev/null +++ b/scripts/ninjawrapper.py @@ -0,0 +1,31 @@ +#!/usr/bin/python + +'''A simple wrapper around ninja that enables Qt Creator to parse compile errors + + This wrapper splits up ninja output in such a way that Qt Creator will be able + to extract compile errors from the output of this script. + + Make sure that ninja is found in PATH and then override the make build step in + Qt Creator with this script to use it. +''' + +import os, subprocess, sys + +def main(): + stdout = os.fdopen(sys.stdout.fileno(), 'wb') + stderr = os.fdopen(sys.stderr.fileno(), 'wb') + + proc = subprocess.Popen(['ninja'] + sys.argv[1:], stdout=subprocess.PIPE, bufsize=256) + + for line in iter(proc.stdout.readline, b''): + if (line.startswith(b'[') or line.startswith(b'ninja: no work to do')) : + stdout.write(line) + stdout.flush() + else: + stderr.write(line) + stderr.flush() + + return proc.returncode + +if __name__ == '__main__': + sys.exit(main()) diff --git a/scripts/perltest2tasks.pl b/scripts/perltest2tasks.pl new file mode 100755 index 00000000000..39748b73813 --- /dev/null +++ b/scripts/perltest2tasks.pl @@ -0,0 +1,83 @@ +#!/usr/bin/perl -w + +############################################################################ +# +# Copyright (C) 2017 The Qt Company Ltd. +# Contact: https://www.qt.io/licensing/ +# +# This file is part of Qt Creator. +# +# Commercial License Usage +# Licensees holding valid commercial Qt licenses may use this file in +# accordance with the commercial license agreement provided with the +# Software or, alternatively, in accordance with the terms contained in +# a written agreement between you and The Qt Company. For licensing terms +# and conditions see https://www.qt.io/terms-conditions. For further +# information use the contact form at https://www.qt.io/contact-us. +# +# GNU General Public License Usage +# Alternatively, this file may be used under the terms of the GNU +# General Public License version 3 as published by the Free Software +# Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +# included in the packaging of this file. Please review the following +# information to ensure the GNU General Public License requirements will +# be met: https://www.gnu.org/licenses/gpl-3.0.html. +# +############################################################################ + +=head1 NAME + +perltest2tasks.pl - Convert messages of the Perl module Test::More into Qt Creator task files. + +=head1 SYNOPSIS + + perltest2tasks.pl < logfile > taskfile + +=cut + +use strict; + +my $lineNumber = 1; +my $type = 'err'; +my $slash = index($^O, 'MSWin') < 0 ? '/' : "\\"; + +my $text; + +# The format is: +# "ok <number> - message" +# "not ok <number> - message" +# "# message line 2" (Continuation line) +# The message is free format, the script tries to find a file name in it by +# checking for a slash. + +sub printPendingMessage +{ + return unless defined $text; + # Try to extract the file name from the message with some heuristics + my $fileName; + for my $word (split(/\s+/, $text)) { + if (index($word, $slash) >= 0) { + $fileName = $word; + last; + } + } + print $fileName, "\t", $lineNumber, "\t", $type, "\t", $text,"\n" if defined $fileName; + $text = undef; +} + +while (my $line = <STDIN> ) { + chomp($line); + if (index($line, '#') == 0) { # Continuation line + $line =~ s/^#\s+//; + $text .= ' ' . $line if defined($text); + } elsif ($line =~ /^ok\s/) { # Passed test, flush message + printPendingMessage(); + } elsif ($line =~ /^not ok\s+\d+\s-\s+(.*)$/) { # Failed test, flush message and start over + printPendingMessage(); + $text = $1; + } +} + +printPendingMessage(); + + |