QmlDesigner: Disable Qml*Parser if there is no QmlDom

We simple provide an empty implementation. The project storage is anyway
not used by default. So it is expected that the programmer is providing
a qml dom if he wants to use the project storage.

Change-Id: Ib652e7589b4f773a4474974f6762490c5d515999
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
This commit is contained in:
Marco Bubke
2022-06-15 11:54:13 +02:00
committed by Tim Jenssen
parent 97da8a6b5b
commit 6aa826436c
3 changed files with 50 additions and 0 deletions

View File

@@ -50,6 +50,28 @@ add_qtc_plugin(QmlDesigner
include(qmldesignercore.cmake)
extend_with_qmldesigner_core(QmlDesigner)
get_filename_component(
QMLDOM_STANDALONE_CMAKELISTS
"${CMAKE_CURRENT_SOURCE_DIR}/../../../../qmldom_standalone/src/qmldom/standalone/"
ABSOLUTE
)
if(EXISTS ${QMLDOM_STANDALONE_CMAKELISTS} AND Qt6_FOUND AND NOT TARGET qmldomlib)
add_subdirectory(
../../../../qmldom_standalone/src/qmldom/standalone
${CMAKE_BINARY_DIR}/qmldom_standalone)
set_target_properties(qmldomlib PROPERTIES
RUNTIME_OUTPUT_DIRECTORY "$<TARGET_PROPERTY:QmlJS,RUNTIME_OUTPUT_DIRECTORY>"
LIBRARY_OUTPUT_DIRECTORY "$<TARGET_PROPERTY:QmlJS,LIBRARY_OUTPUT_DIRECTORY>")
endif()
extend_qtc_target(QmlDesigner
CONDITION TARGET qmldomlib
DEFINES QDS_HAS_QMLDOM
DEPENDS qmldomlib
)
if (QTC_STATIC_BUILD AND TARGET QmlDesigner)
get_target_property(_designerType Qt5::Designer TYPE)
if (${_designerType} STREQUAL "STATIC_LIBRARY")

View File

@@ -30,13 +30,17 @@
#include <sqlitedatabase.h>
#ifdef QDS_HAS_QMLDOM
#include <qmldom/qqmldomtop_p.h>
#endif
#include <filesystem>
#include <QDateTime>
namespace QmlDesigner {
#ifdef QDS_HAS_QMLDOM
namespace QmlDom = QQmlJS::Dom;
namespace {
@@ -195,4 +199,15 @@ Storage::Type QmlDocumentParser::parse(const QString &sourceContent,
return type;
}
#else
Storage::Type QmlDocumentParser::parse([[maybe_unused]] const QString &sourceContent,
[[maybe_unused]] Storage::Imports &imports,
[[maybe_unused]] SourceId sourceId,
[[maybe_unused]] Utils::SmallStringView directoryPath)
{
return Storage::Type{};
}
#endif
} // namespace QmlDesigner

View File

@@ -30,8 +30,10 @@
#include <sqlitedatabase.h>
#ifdef QDS_HAS_QMLDOM
#include <qmlcompiler/qqmljstypedescriptionreader_p.h>
#include <qmldom/qqmldomtop_p.h>
#endif
#include <QDateTime>
@@ -40,6 +42,7 @@
namespace QmlDesigner {
#ifdef QDS_HAS_QMLDOM
namespace QmlDom = QQmlJS::Dom;
namespace {
@@ -304,4 +307,14 @@ void QmlTypesParser::parse(const QString &sourceContent,
addTypes(types, projectData, components, m_storage);
}
#else
void QmlTypesParser::parse([[maybe_unused]] const QString &sourceContent,
[[maybe_unused]] Storage::Imports &imports,
[[maybe_unused]] Storage::Types &types,
[[maybe_unused]] const Storage::ProjectData &projectData)
{}
#endif
} // namespace QmlDesigner