Say hello to QtQmlDevTools library
authorKent Hansen <kent.hansen@nokia.com>
Fri, 23 Sep 2011 08:08:30 +0000 (10:08 +0200)
committerQt by Nokia <qt-info@nokia.com>
Fri, 7 Oct 2011 06:32:51 +0000 (08:32 +0200)
QtQmlDevTools is a private helper library. It provides QML/JS
file parsing for tools that live outside of the qtdeclarative
repository, such as lupdate.

This allows us to remove qttools's dependency on the
qtdeclarative sources.

To use the library:

QT += qmldevtools-private

 #include <private/qdeclarativejsparser_p.h>

Change-Id: Ia43751b9be3d9fe05da03e65c6aca1cd9e3fdbbc
Reviewed-on: http://codereview.qt-project.org/6116
Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: Roberto Raggi <roberto.raggi@nokia.com>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@nokia.com>
Reviewed-by: Aaron Kennedy <aaron.kennedy@nokia.com>
modules/qt_qmldevtools.pri [new file with mode: 0644]
src/declarative/qml/parser/qdeclarativejsglobal_p.h
src/qmldevtools/qmldevtools.pro [new file with mode: 0644]
src/src.pro
sync.profile
tests/auto/auto.pro
tests/auto/qmldevtools/compile/compile.pro [new file with mode: 0644]
tests/auto/qmldevtools/compile/tst_compile.cpp [new file with mode: 0644]
tests/auto/qmldevtools/qmldevtools.pro [new file with mode: 0644]

diff --git a/modules/qt_qmldevtools.pri b/modules/qt_qmldevtools.pri
new file mode 100644 (file)
index 0000000..7365f13
--- /dev/null
@@ -0,0 +1,19 @@
+QT.qmldevtools.VERSION = 5.0.0
+QT.qmldevtools.MAJOR_VERSION = 5
+QT.qmldevtools.MINOR_VERSION = 0
+QT.qmldevtools.PATCH_VERSION = 0
+
+QT.qmldevtools.name = QtQmlDevTools
+QT.qmldevtools.bins = $$QT_MODULE_BIN_BASE
+QT.qmldevtools.includes = $$QT_MODULE_INCLUDE_BASE/QtQmlDevTools
+QT.qmldevtools.private_includes = $$QT_MODULE_INCLUDE_BASE/QtQmlDevTools/$$QT.qmldevtools.VERSION
+QT.qmldevtools.sources = $$QT_MODULE_BASE/src/qmldevtools
+QT.qmldevtools.libs = $$QT_MODULE_LIB_BASE
+QT.qmldevtools.plugins = $$QT_MODULE_PLUGIN_BASE
+QT.qmldevtools.imports = $$QT_MODULE_IMPORT_BASE
+QT.qmldevtools.depends = core
+QT.qmldevtools.module_config = staticlib
+QT.qmldevtools.DEFINES = QT_QMLDEVTOOLS_LIB
+
+QT_CONFIG += qmldevtools
+
index 83b5b95..83ee2d8 100644 (file)
 #else // !QT_CREATOR
 #  define QT_QML_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
 #  define QT_QML_END_NAMESPACE QT_END_NAMESPACE
-#  define QML_PARSER_EXPORT Q_AUTOTEST_EXPORT
+#  if defined(QT_BUILD_QMLDEVTOOLS_LIB) || defined(QT_QMLDEVTOOLS_LIB)
+     // QmlDevTools is a static library
+#    define QML_PARSER_EXPORT
+#  else
+#    define QML_PARSER_EXPORT Q_AUTOTEST_EXPORT
+#  endif
 #endif // QT_CREATOR
 
 #endif // QDECLARATIVEJSGLOBAL_P_H
diff --git a/src/qmldevtools/qmldevtools.pro b/src/qmldevtools/qmldevtools.pro
new file mode 100644 (file)
index 0000000..3aac5e5
--- /dev/null
@@ -0,0 +1,20 @@
+load(qt_module)
+TARGET     = QtQmlDevTools
+QT         = core
+TEMPLATE   = lib
+DESTDIR    = $$QMAKE_LIBDIR_QT
+
+CONFIG += module
+CONFIG += staticlib
+
+MODULE_PRI = ../../modules/qt_qmldevtools.pri
+
+DEFINES += QT_BUILD_QMLDEVTOOLS_LIB
+
+load(qt_module_config)
+
+HEADERS += qtqmldevtoolsversion.h
+
+unix|win32-g++*:QMAKE_PKGCONFIG_REQUIRES = QtCore
+
+include($$QT.declarative.sources/qml/parser/parser.pri)
index 6fbfc24..3f71db2 100644 (file)
@@ -5,4 +5,5 @@ SUBDIRS += declarative qtquick1 plugins
 contains(QT_CONFIG, qmltest): SUBDIRS += qmltest
 
 SUBDIRS += imports
+SUBDIRS += qmldevtools
 
index 2ea92fb..0cedfd4 100644 (file)
@@ -2,8 +2,10 @@
     "QtDeclarative" => "$basedir/src/declarative",
     "QtQuick1" => "$basedir/src/qtquick1",
     "QtQuickTest" => "$basedir/src/qmltest",
+    "QtQmlDevTools" => "$basedir/src/qmldevtools",
 );
 %moduleheaders = ( # restrict the module headers to those found in relative path
+    "QtQmlDevTools" => "../declarative/qml/parser",
 );
 %classnames = (
     "qtdeclarativeversion.h" => "QtDeclarativeVersion",
@@ -18,6 +20,7 @@
     "QtDeclarative" => "$basedir/modules/qt_declarative.pri",
     "QtQuick1" => "$basedir/modules/qt_qtquick1.pri",
     "QtQuickTest" => "$basedir/modules/qt_qmltest.pri",
+    "QtQmlDevTools" => "$basedir/modules/qt_qmldevtools.pri",
 );
 # Module dependencies.
 # Every module that is required to build this module should have one entry.
index 44ed571..c3ec723 100644 (file)
@@ -6,4 +6,6 @@ SUBDIRS=\
 # ### refactor: port properly
 # contains(QT_CONFIG, qmltest): SUBDIRS += qmltest
 
+SUBDIRS += qmldevtools
+
 !cross_compile:                             SUBDIRS += host.pro
diff --git a/tests/auto/qmldevtools/compile/compile.pro b/tests/auto/qmldevtools/compile/compile.pro
new file mode 100644 (file)
index 0000000..9fe2216
--- /dev/null
@@ -0,0 +1,7 @@
+load(qttest_p4)
+QT = core qmldevtools-private
+macx:CONFIG -= app_bundle
+
+SOURCES += tst_compile.cpp
+
+CONFIG += parallel_test
diff --git a/tests/auto/qmldevtools/compile/tst_compile.cpp b/tests/auto/qmldevtools/compile/tst_compile.cpp
new file mode 100644 (file)
index 0000000..afca929
--- /dev/null
@@ -0,0 +1,62 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this
+** file. Please review the following information to ensure the GNU Lesser
+** General Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#include <qtest.h>
+
+#include <private/qdeclarativejsengine_p.h>
+#include <private/qdeclarativejslexer_p.h>
+#include <private/qdeclarativejsparser_p.h>
+#include <private/qdeclarativejsastvisitor_p.h>
+#include <private/qdeclarativejsast_p.h>
+
+class tst_compile : public QObject
+{
+    Q_OBJECT
+public:
+    tst_compile() { }
+
+private slots:
+    // Nothing - this test just makes sure that the QmlDevTools headers
+    // are present, and that we can link against the library.
+};
+
+QTEST_MAIN(tst_compile)
+
+#include "tst_compile.moc"
diff --git a/tests/auto/qmldevtools/qmldevtools.pro b/tests/auto/qmldevtools/qmldevtools.pro
new file mode 100644 (file)
index 0000000..28ab27b
--- /dev/null
@@ -0,0 +1,9 @@
+TEMPLATE = subdirs
+
+contains(QT_CONFIG, private_tests) {
+    SUBDIRS += \
+        compile
+}
+
+# Tests which should run in Pulse
+PULSE_TESTS = $$SUBDIRS