From eee8cb50dcb464955e3f758f96e0aca94e84cbb5 Mon Sep 17 00:00:00 2001 From: Kent Hansen Date: Fri, 23 Sep 2011 10:08:30 +0200 Subject: Say hello to QtQmlDevTools library 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 Change-Id: Ia43751b9be3d9fe05da03e65c6aca1cd9e3fdbbc Reviewed-on: http://codereview.qt-project.org/6116 Reviewed-by: Qt Sanity Bot Reviewed-by: Roberto Raggi Reviewed-by: Friedemann Kleint Reviewed-by: Oswald Buddenhagen Reviewed-by: Aaron Kennedy --- modules/qt_qmldevtools.pri | 19 +++++++ .../qml/parser/qdeclarativejsglobal_p.h | 7 ++- src/qmldevtools/qmldevtools.pro | 20 +++++++ src/src.pro | 1 + sync.profile | 3 ++ tests/auto/auto.pro | 2 + tests/auto/qmldevtools/compile/compile.pro | 7 +++ tests/auto/qmldevtools/compile/tst_compile.cpp | 62 ++++++++++++++++++++++ tests/auto/qmldevtools/qmldevtools.pro | 9 ++++ 9 files changed, 129 insertions(+), 1 deletion(-) create mode 100644 modules/qt_qmldevtools.pri create mode 100644 src/qmldevtools/qmldevtools.pro create mode 100644 tests/auto/qmldevtools/compile/compile.pro create mode 100644 tests/auto/qmldevtools/compile/tst_compile.cpp create mode 100644 tests/auto/qmldevtools/qmldevtools.pro diff --git a/modules/qt_qmldevtools.pri b/modules/qt_qmldevtools.pri new file mode 100644 index 0000000000..7365f13404 --- /dev/null +++ b/modules/qt_qmldevtools.pri @@ -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 + diff --git a/src/declarative/qml/parser/qdeclarativejsglobal_p.h b/src/declarative/qml/parser/qdeclarativejsglobal_p.h index 83b5b95a2f..83ee2d8d27 100644 --- a/src/declarative/qml/parser/qdeclarativejsglobal_p.h +++ b/src/declarative/qml/parser/qdeclarativejsglobal_p.h @@ -58,7 +58,12 @@ #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 index 0000000000..3aac5e5a9c --- /dev/null +++ b/src/qmldevtools/qmldevtools.pro @@ -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) diff --git a/src/src.pro b/src/src.pro index 6fbfc243de..3f71db2472 100644 --- a/src/src.pro +++ b/src/src.pro @@ -5,4 +5,5 @@ SUBDIRS += declarative qtquick1 plugins contains(QT_CONFIG, qmltest): SUBDIRS += qmltest SUBDIRS += imports +SUBDIRS += qmldevtools diff --git a/sync.profile b/sync.profile index 2ea92fb94e..0cedfd42d8 100644 --- a/sync.profile +++ b/sync.profile @@ -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. diff --git a/tests/auto/auto.pro b/tests/auto/auto.pro index 44ed5718ef..c3ec7231cc 100644 --- a/tests/auto/auto.pro +++ b/tests/auto/auto.pro @@ -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 index 0000000000..9fe2216eb0 --- /dev/null +++ b/tests/auto/qmldevtools/compile/compile.pro @@ -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 index 0000000000..afca92994d --- /dev/null +++ b/tests/auto/qmldevtools/compile/tst_compile.cpp @@ -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 + +#include +#include +#include +#include +#include + +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 index 0000000000..28ab27b949 --- /dev/null +++ b/tests/auto/qmldevtools/qmldevtools.pro @@ -0,0 +1,9 @@ +TEMPLATE = subdirs + +contains(QT_CONFIG, private_tests) { + SUBDIRS += \ + compile +} + +# Tests which should run in Pulse +PULSE_TESTS = $$SUBDIRS -- cgit v1.2.3