From 0ba3f6ca3922ad860ac8100c4b56a7f4c56d5cb8 Mon Sep 17 00:00:00 2001 From: Michael Zanetti Date: Wed, 10 Jul 2019 11:05:04 +0200 Subject: [PATCH] Add a workaround to allow some customer plugins to still build. --- libnymea/devices/pluginmetadata.cpp | 9 +++++++++ libnymea/devices/pluginmetadata.h | 6 ++++++ 2 files changed, 15 insertions(+) diff --git a/libnymea/devices/pluginmetadata.cpp b/libnymea/devices/pluginmetadata.cpp index dfa41676..eb7ccceb 100644 --- a/libnymea/devices/pluginmetadata.cpp +++ b/libnymea/devices/pluginmetadata.cpp @@ -155,6 +155,10 @@ void PluginMetadata::parse(const QJsonObject &jsonObject) // Load deviceclasses of this vendor foreach (const QJsonValue &deviceClassJson, vendorJson.toObject().value("deviceClasses").toArray()) { + + // FIXME: Drop this when possible, see .h for context + m_currentScopUuids.clear(); + QJsonObject deviceClassObject = deviceClassJson.toObject(); /*! Returns a list of all valid JSON properties a DeviceClass JSON definition can have. */ QStringList deviceClassProperties = QStringList() << "id" << "name" << "displayName" << "createMethods" << "setupMethod" @@ -720,6 +724,11 @@ QPair PluginMetadata::loadAndVerifyInputType(const QStri bool PluginMetadata::verifyDuplicateUuid(const QUuid &uuid) { if (m_allUuids.contains(uuid)) { + // FIXME: Drop debug, activate return! (see .h for more context) + qCWarning(dcPluginMetadata()) << "THIS PLUGIN USES DUPLICATE UUID" << uuid.toString() << "! THIS WILL STOP WORKING SOON."; +// return false; + } + if (m_currentScopUuids.contains(uuid)) { return false; } m_allUuids.append(uuid); diff --git a/libnymea/devices/pluginmetadata.h b/libnymea/devices/pluginmetadata.h index 72e40d7b..9ccd9231 100644 --- a/libnymea/devices/pluginmetadata.h +++ b/libnymea/devices/pluginmetadata.h @@ -65,6 +65,12 @@ private: DeviceClasses m_deviceClasses; QList m_allUuids; + + // FIXME: Due to the fact that we have duplicate UUIDs in use in plugins out there in + // products, we can't just break those plugins now. For now, let's make the check + // As strict as possible without breaking them, but this should be removed ASAP + // and only m_allUuids should be used to check for dupes + QList m_currentScopUuids; }; #endif // PLUGINMETADATA_H