Commit Graph

10 Commits

Author SHA1 Message Date
Simon Hausmann 41f0925dc8 Fix parsing of JS imports from JS files
If a .js file had an import of another .js file itself, like so:

    .import "otherFile.js" as Blah

then the import scanner would keep the quotes and store

    "\"otherFile.js\""

in the JSON as opposed to

    "otherFile.js"

This is fixed by making use of the same code for extracting the .import
statements from JS files that is also used by the engine itself.

Additionally this fixes the use of comments in .import lines (and other
whitespace characters not producing tokens).

Change-Id: I4dd4a5217308f6fc93b6b148cd8e13392f97d2a6
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
2014-04-24 15:36:42 +02:00
Morten Johan Sørvig f7a8a41e48 Add support for scanning javascript files.
Javascript may contain ".import" pragmas/statements,
which should be treated in a similar way as qml file
imports.

Add findQmlImportsInJavascriptFile() which extracts and
parses the .import lines. Refactor findQmlImportsInFile()
to handle both .qml and .js and call out to the correct
parsing function.

Add "-jsFiles" for specifying javascript
files on the command line similar to "-qmlFiles".

Task-number: QTBUG-35349

Change-Id: I6b8e0cc254c1edcf16940bec5cfda7c2637f115e
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
2014-02-25 17:08:02 +01:00
Morten Johan Sørvig 2dc69a99f0 Improve qmlimportscanner.
Fix several qmlimportscanner defects:

- Expand qml file search to include subdirectories.
This applies to search paths specified with "-rootPath"

- Add "-qmlFiles" for specifying the file list directly

- Parse files with UTF8 BOMs correctly

- Don't set properties where the value is the empty string

Change-Id: I81a538d73487b49fb635c18ef4fe479748ba0bfc
Reviewed-by: Morten Johan Sørvig <morten.sorvig@digia.com>
2013-11-12 13:12:54 +01:00
Morten Johan Sørvig de3c837dfa Fix the QML import search.
Match the algorithm used by QML, look for the most
specific version of an import first.

Change-Id: Ibf1370af227c8154f657cc2d8a1c1d1ae28d2f39
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@digia.com>
2013-10-14 12:30:35 +02:00
Morten Johan Sørvig 9ca4c75da3 Make qmlimportscanner report plugin classnames.
Change-Id: Ifbe72e6dcc569c8cb311d46e4f265da348b353ea
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@digia.com>
2013-10-14 12:30:28 +02:00
Friedemann Kleint c0b4884301 qmlimportscanner: Fix braces.
Change-Id: I1361bc1f10b04d0001a1d02b45033ca2c82f8105
Reviewed-by: Morten Johan Sørvig <morten.sorvig@digia.com>
2013-09-28 18:50:11 +02:00
Friedemann Kleint f52b793fc2 qmlimportscanner: Use iostream for output consistently.
host-built tools should not use <QDebug>.

Change-Id: I2c69c79c138689d22f4979e268313fb461a8053a
Reviewed-by: Morten Johan Sørvig <morten.sorvig@digia.com>
2013-09-28 18:50:07 +02:00
Friedemann Kleint 9ecedb8766 qmlimportcanner: Compile with QT_NO_CAST_TO_ASCII QT_NO_CAST_FROM_ASCII.
Clean up single character string constants and string usage.

Change-Id: I242110d57beeb100155757bda170ade479fcb242
Reviewed-by: Morten Johan Sørvig <morten.sorvig@digia.com>
2013-09-28 18:49:56 +02:00
Friedemann Kleint 36ab6e0160 qmlimportscanner: Print usage when no arguments are passed.
Change-Id: I2ba5e18fff635705b1f5e8e19c104ba078c8e3a1
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
2013-09-25 22:55:37 +02:00
Morten Johan Sørvig 68c75745f8 Add qmlimportscanner.
qmlimportscanner scans for import statements in qml
files and returns a JSON-formatted list of imports.
This is done recursively in order to get all dependencies.

Usage: "qmlimportscanner path/to/app/qml/"
		-importPath path/to/qtbase/qml

Change-Id: I0e99caaf4216058c52a4706f7fdbeaf1eba0bbc1
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
2013-09-23 06:49:44 +02:00