summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Jenssen <tim.jenssen@qt.io>2019-01-17 14:06:53 +0100
committerTim Jenssen <tim.jenssen@qt.io>2019-01-18 13:16:30 +0000
commit372e239d2dd89be5b339d3546e4f46617e856b58 (patch)
treea994c464ba217aa23e538bc4141db78e914eb5e2
parentd4beced19f22053d108a8ab417a80162f657abb5 (diff)
downloadqt-creator-372e239d2dd89be5b339d3546e4f46617e856b58.tar.gz
QmlJS: remove qtquick1 leftovers
QT_INSTALL_IMPORTS and the used ProjectInfo.qtImportsPath variable were only used for QtQuick1. Change-Id: I34da0cfc77effa84f3a7578e7f91fed0768a9bf4 Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
-rw-r--r--src/libs/qmljs/qmljsinterpreter.cpp6
-rw-r--r--src/libs/qmljs/qmljsmodelmanagerinterface.cpp27
-rw-r--r--src/libs/qmljs/qmljsmodelmanagerinterface.h1
-rw-r--r--src/libs/qmljs/qmljsplugindumper.cpp37
-rw-r--r--src/libs/qmljs/qmljsplugindumper.h2
-rw-r--r--src/plugins/qmljseditor/qmltaskmanager.cpp2
-rw-r--r--src/plugins/qmljstools/qmljsmodelmanager.cpp6
7 files changed, 14 insertions, 67 deletions
diff --git a/src/libs/qmljs/qmljsinterpreter.cpp b/src/libs/qmljs/qmljsinterpreter.cpp
index e8ac4c162b..03083501b6 100644
--- a/src/libs/qmljs/qmljsinterpreter.cpp
+++ b/src/libs/qmljs/qmljsinterpreter.cpp
@@ -2229,12 +2229,6 @@ ImportInfo::ImportInfo()
ImportInfo ImportInfo::moduleImport(QString uri, ComponentVersion version,
const QString &as, UiImport *ast)
{
- // treat Qt 4.7 as QtQuick 1.0
- if (uri == QLatin1String("Qt") && version == ComponentVersion(4, 7)) {
- uri = QLatin1String("QtQuick");
- version = ComponentVersion(1, 0);
- }
-
ImportInfo info;
info.m_type = ImportType::Library;
info.m_name = uri;
diff --git a/src/libs/qmljs/qmljsmodelmanagerinterface.cpp b/src/libs/qmljs/qmljsmodelmanagerinterface.cpp
index 1d5d178664..9fa907ccfa 100644
--- a/src/libs/qmljs/qmljsmodelmanagerinterface.cpp
+++ b/src/libs/qmljs/qmljsmodelmanagerinterface.cpp
@@ -120,8 +120,6 @@ ModelManagerInterface::ModelManagerInterface(QObject *parent)
qRegisterMetaType<QmlJS::PathAndLanguage>("QmlJS::PathAndLanguage");
qRegisterMetaType<QmlJS::PathsAndLanguages>("QmlJS::PathsAndLanguages");
- m_defaultProjectInfo.qtImportsPath = QFileInfo(
- QLibraryInfo::location(QLibraryInfo::ImportsPath)).canonicalFilePath();
m_defaultProjectInfo.qtQmlPath = QFileInfo(
QLibraryInfo::location(QLibraryInfo::Qml2ImportsPath)).canonicalFilePath();
@@ -410,10 +408,6 @@ bool pInfoLessThanImports(const ModelManagerInterface::ProjectInfo &p1, const Mo
return true;
if (p1.qtQmlPath > p2.qtQmlPath)
return false;
- if (p1.qtImportsPath < p2.qtImportsPath)
- return true;
- if (p1.qtImportsPath > p2.qtImportsPath)
- return false;
const PathsAndLanguages &s1 = p1.importPaths;
const PathsAndLanguages &s2 = p2.importPaths;
if (s1.size() < s2.size())
@@ -537,7 +531,6 @@ void ModelManagerInterface::updateProjectInfo(const ProjectInfo &pinfo, ProjectE
if (oldInfo.qmlDumpPath != pinfo.qmlDumpPath
|| oldInfo.qmlDumpEnvironment != pinfo.qmlDumpEnvironment) {
m_pluginDumper->scheduleRedumpPlugins();
- m_pluginDumper->scheduleMaybeRedumpBuiltins(pinfo);
}
@@ -609,12 +602,8 @@ void ModelManagerInterface::removeProjectInfo(ProjectExplorer::Project *project)
*/
ModelManagerInterface::ProjectInfo ModelManagerInterface::projectInfoForPath(const QString &path) const
{
- QList<ProjectInfo> infos = allProjectInfosForPath(path);
-
ProjectInfo res;
- foreach (const ProjectInfo &pInfo, infos) {
- if (res.qtImportsPath.isEmpty())
- res.qtImportsPath = pInfo.qtImportsPath;
+ foreach (const ProjectInfo &pInfo, allProjectInfosForPath(path)) {
if (res.qtQmlPath.isEmpty())
res.qtQmlPath = pInfo.qtQmlPath;
for (int i = 0; i < pInfo.importPaths.size(); ++i)
@@ -1346,12 +1335,10 @@ ModelManagerInterface::CppDataHash ModelManagerInterface::cppData() const
LibraryInfo ModelManagerInterface::builtins(const Document::Ptr &doc) const
{
- ProjectInfo info = projectInfoForPath(doc->fileName());
- if (!info.isValid())
- return LibraryInfo();
- if (!info.qtQmlPath.isEmpty())
+ const ProjectInfo info = projectInfoForPath(doc->fileName());
+ if (info.isValid() && !info.qtQmlPath.isEmpty())
return m_validSnapshot.libraryInfo(info.qtQmlPath);
- return m_validSnapshot.libraryInfo(info.qtImportsPath);
+ return LibraryInfo();
}
ViewerContext ModelManagerInterface::completeVContext(const ViewerContext &vCtx,
@@ -1370,8 +1357,6 @@ ViewerContext ModelManagerInterface::completeVContext(const ViewerContext &vCtx,
info = projectInfoForPath(doc->fileName());
ViewerContext defaultVCtx = defaultVContext(res.language, Document::Ptr(nullptr), false);
ProjectInfo defaultInfo = defaultProjectInfo();
- if (info.qtImportsPath.isEmpty())
- info.qtImportsPath = defaultInfo.qtImportsPath;
if (info.qtQmlPath.isEmpty())
info.qtQmlPath = defaultInfo.qtQmlPath;
switch (res.flags) {
@@ -1388,7 +1373,6 @@ ViewerContext ModelManagerInterface::completeVContext(const ViewerContext &vCtx,
case Dialect::AnyLanguage:
case Dialect::Qml:
res.maybeAddPath(info.qtQmlPath);
- res.maybeAddPath(info.qtImportsPath);
Q_FALLTHROUGH();
case Dialect::QmlQtQuick2:
case Dialect::QmlQtQuick2Ui:
@@ -1429,9 +1413,6 @@ ViewerContext ModelManagerInterface::completeVContext(const ViewerContext &vCtx,
case ViewerContext::AddDefaultPaths:
foreach (const QString &path, defaultVCtx.paths)
res.maybeAddPath(path);
- if (res.language == Dialect::AnyLanguage || res.language == Dialect::Qml
- || res.language == Dialect::QmlQtQuick2 || res.language == Dialect::QmlQtQuick2Ui)
- res.maybeAddPath(info.qtImportsPath);
if (res.language == Dialect::AnyLanguage || res.language == Dialect::Qml)
res.maybeAddPath(info.qtQmlPath);
if (res.language == Dialect::AnyLanguage || res.language == Dialect::Qml
diff --git a/src/libs/qmljs/qmljsmodelmanagerinterface.h b/src/libs/qmljs/qmljsmodelmanagerinterface.h
index b4256f35e8..4b3e2a1a58 100644
--- a/src/libs/qmljs/qmljsmodelmanagerinterface.h
+++ b/src/libs/qmljs/qmljsmodelmanagerinterface.h
@@ -94,7 +94,6 @@ public:
QString qmlDumpPath;
::Utils::Environment qmlDumpEnvironment;
- QString qtImportsPath;
QString qtQmlPath;
QString qtVersionString;
QmlJS::QmlLanguageBundles activeBundle;
diff --git a/src/libs/qmljs/qmljsplugindumper.cpp b/src/libs/qmljs/qmljsplugindumper.cpp
index e8bd19a906..fbfe22174e 100644
--- a/src/libs/qmljs/qmljsplugindumper.cpp
+++ b/src/libs/qmljs/qmljsplugindumper.cpp
@@ -83,42 +83,34 @@ void PluginDumper::scheduleRedumpPlugins()
metaObject()->invokeMethod(this, "dumpAllPlugins", Qt::QueuedConnection);
}
-void PluginDumper::scheduleMaybeRedumpBuiltins(const QmlJS::ModelManagerInterface::ProjectInfo &info)
-{
- // move to the owning thread
- metaObject()->invokeMethod(this, "dumpBuiltins", Qt::QueuedConnection,
- Q_ARG(QmlJS::ModelManagerInterface::ProjectInfo, info));
-}
-
void PluginDumper::onLoadBuiltinTypes(const QmlJS::ModelManagerInterface::ProjectInfo &info, bool force)
{
- const QString baseImportsPath = info.qtQmlPath.isEmpty() ? info.qtImportsPath : info.qtQmlPath;
- if (info.qmlDumpPath.isEmpty() || baseImportsPath.isEmpty())
+ if (info.qmlDumpPath.isEmpty() || info.qtQmlPath.isEmpty())
return;
- const QString importsPath = QDir::cleanPath(baseImportsPath);
+ const QString importsPath = QDir::cleanPath(info.qtQmlPath);
if (m_runningQmldumps.values().contains(importsPath))
return;
LibraryInfo builtinInfo;
if (!force) {
const Snapshot snapshot = m_modelManager->snapshot();
- builtinInfo = snapshot.libraryInfo(baseImportsPath);
+ builtinInfo = snapshot.libraryInfo(info.qtQmlPath);
if (builtinInfo.isValid())
return;
}
builtinInfo = LibraryInfo(LibraryInfo::Found);
- m_modelManager->updateLibraryInfo(baseImportsPath, builtinInfo);
+ m_modelManager->updateLibraryInfo(info.qtQmlPath, builtinInfo);
// prefer QTDIR/qml/builtins.qmltypes if available
- const QString builtinQmltypesPath = baseImportsPath + QLatin1String("/builtins.qmltypes");
+ const QString builtinQmltypesPath = info.qtQmlPath + QLatin1String("/builtins.qmltypes");
if (QFile::exists(builtinQmltypesPath)) {
- loadQmltypesFile(QStringList(builtinQmltypesPath), baseImportsPath, builtinInfo);
+ loadQmltypesFile(QStringList(builtinQmltypesPath), info.qtQmlPath, builtinInfo);
return;
}
- runQmlDump(info, QStringList(QLatin1String("--builtins")), baseImportsPath);
- m_qtToInfo.insert(baseImportsPath, info);
+ runQmlDump(info, QStringList(QLatin1String("--builtins")), info.qtQmlPath);
+ m_qtToInfo.insert(info.qtQmlPath, info);
}
static QString makeAbsolute(const QString &path, const QString &base)
@@ -190,19 +182,6 @@ void PluginDumper::onLoadPluginTypes(const QString &libraryPath, const QString &
dump(plugin);
}
-void PluginDumper::dumpBuiltins(const QmlJS::ModelManagerInterface::ProjectInfo &info)
-{
- // if the builtin types were generated with a different qmldump, regenerate!
- if (m_qtToInfo.contains(info.qtImportsPath)) {
- QmlJS::ModelManagerInterface::ProjectInfo oldInfo = m_qtToInfo.value(info.qtImportsPath);
- if (oldInfo.qmlDumpPath != info.qmlDumpPath
- || oldInfo.qmlDumpEnvironment != info.qmlDumpEnvironment) {
- m_qtToInfo.remove(info.qtImportsPath);
- onLoadBuiltinTypes(info, true);
- }
- }
-}
-
void PluginDumper::dumpAllPlugins()
{
foreach (const Plugin &plugin, m_plugins) {
diff --git a/src/libs/qmljs/qmljsplugindumper.h b/src/libs/qmljs/qmljsplugindumper.h
index d6ff9224ba..d38b09bea4 100644
--- a/src/libs/qmljs/qmljsplugindumper.h
+++ b/src/libs/qmljs/qmljsplugindumper.h
@@ -50,14 +50,12 @@ public:
void loadPluginTypes(const QString &libraryPath, const QString &importPath,
const QString &importUri, const QString &importVersion);
void scheduleRedumpPlugins();
- void scheduleMaybeRedumpBuiltins(const QmlJS::ModelManagerInterface::ProjectInfo &info);
private:
Q_INVOKABLE void onLoadBuiltinTypes(const QmlJS::ModelManagerInterface::ProjectInfo &info,
bool force = false);
Q_INVOKABLE void onLoadPluginTypes(const QString &libraryPath, const QString &importPath,
const QString &importUri, const QString &importVersion);
- Q_INVOKABLE void dumpBuiltins(const QmlJS::ModelManagerInterface::ProjectInfo &info);
Q_INVOKABLE void dumpAllPlugins();
void qmlPluginTypeDumpDone(int exitCode);
void qmlPluginTypeDumpError(QProcess::ProcessError error);
diff --git a/src/plugins/qmljseditor/qmltaskmanager.cpp b/src/plugins/qmljseditor/qmltaskmanager.cpp
index 85a9936405..0a20b7569f 100644
--- a/src/plugins/qmljseditor/qmltaskmanager.cpp
+++ b/src/plugins/qmljseditor/qmltaskmanager.cpp
@@ -88,7 +88,7 @@ void QmlTaskManager::collectMessages(
QHash<QString, QList<DiagnosticMessage> > linkMessages;
ContextPtr context;
if (updateSemantic) {
- QmlJS::Link link(snapshot, vContext, snapshot.libraryInfo(info.qtImportsPath));
+ QmlJS::Link link(snapshot, vContext, QmlJS::LibraryInfo());
context = link(&linkMessages);
}
diff --git a/src/plugins/qmljstools/qmljsmodelmanager.cpp b/src/plugins/qmljstools/qmljsmodelmanager.cpp
index 0bd258e5c0..53262a880a 100644
--- a/src/plugins/qmljstools/qmljsmodelmanager.cpp
+++ b/src/plugins/qmljstools/qmljsmodelmanager.cpp
@@ -119,11 +119,9 @@ ModelManagerInterface::ProjectInfo ModelManager::defaultProjectInfoForProject(
if (qtVersion && qtVersion->isValid()) {
projectInfo.tryQmlDump = project && qtVersion->type() == QLatin1String(QtSupport::Constants::DESKTOPQT);
projectInfo.qtQmlPath = qtVersion->qmlPath().toFileInfo().canonicalFilePath();
- projectInfo.qtImportsPath = QFileInfo(qtVersion->qmakeProperty("QT_INSTALL_IMPORTS")).canonicalFilePath();
projectInfo.qtVersionString = qtVersion->qtVersionString();
} else {
projectInfo.qtQmlPath = QFileInfo(QLibraryInfo::location(QLibraryInfo::Qml2ImportsPath)).canonicalFilePath();
- projectInfo.qtImportsPath = QFileInfo(QLibraryInfo::location(QLibraryInfo::ImportsPath)).canonicalFilePath();
projectInfo.qtVersionString = QLatin1String(qVersion());
}
@@ -149,9 +147,7 @@ void setupProjectInfoQmlBundles(ModelManagerInterface::ProjectInfo &projectInfo)
if (projectInfo.project)
activeTarget = projectInfo.project->activeTarget();
Kit *activeKit = activeTarget ? activeTarget->kit() : KitManager::defaultKit();
- QHash<QString, QString> replacements;
- replacements.insert(QLatin1String("$(QT_INSTALL_IMPORTS)"), projectInfo.qtImportsPath);
- replacements.insert(QLatin1String("$(QT_INSTALL_QML)"), projectInfo.qtQmlPath);
+ const QHash<QString, QString> replacements = {{QLatin1String("$(QT_INSTALL_QML)"), projectInfo.qtQmlPath}};
for (IBundleProvider *bp : IBundleProvider::allBundleProviders())
bp->mergeBundlesForKit(activeKit, projectInfo.activeBundle, replacements);