Skip to content

Commit

Permalink
Say hello to QtQmlDevTools library
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Kent Hansen authored and Qt by Nokia committed Oct 7, 2011
1 parent fcfea59 commit eee8cb5
Show file tree
Hide file tree
Showing 9 changed files with 129 additions and 1 deletion.
19 changes: 19 additions & 0 deletions 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

7 changes: 6 additions & 1 deletion src/declarative/qml/parser/qdeclarativejsglobal_p.h
Expand Up @@ -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
20 changes: 20 additions & 0 deletions 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)
1 change: 1 addition & 0 deletions src/src.pro
Expand Up @@ -5,4 +5,5 @@ SUBDIRS += declarative qtquick1 plugins
contains(QT_CONFIG, qmltest): SUBDIRS += qmltest

SUBDIRS += imports
SUBDIRS += qmldevtools

3 changes: 3 additions & 0 deletions sync.profile
Expand Up @@ -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",
Expand All @@ -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.
Expand Down
2 changes: 2 additions & 0 deletions tests/auto/auto.pro
Expand Up @@ -6,4 +6,6 @@ SUBDIRS=\
# ### refactor: port properly
# contains(QT_CONFIG, qmltest): SUBDIRS += qmltest

SUBDIRS += qmldevtools

!cross_compile: SUBDIRS += host.pro
7 changes: 7 additions & 0 deletions 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
62 changes: 62 additions & 0 deletions 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 <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"
9 changes: 9 additions & 0 deletions 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

0 comments on commit eee8cb5

Please sign in to comment.