From ddd137f3b1f77fdf5fa63a0c4348cdb8fc412a9d Mon Sep 17 00:00:00 2001 From: Marcus Tillmanns Date: Thu, 13 Jun 2024 10:52:43 +0200 Subject: [PATCH] Lua: Move lua plugins into normal plugin folder Change-Id: I14ab0bb755a4279bc255673596fe084cd556433c Reviewed-by: Eike Ziller --- cmake/QtCreatorAPI.cmake | 4 ++-- qbs/imports/QtcLuaPlugin.qbs | 2 +- src/plugins/lua/README.md | 8 ++++---- src/plugins/lua/luaplugin.cpp | 5 +---- 4 files changed, 8 insertions(+), 11 deletions(-) diff --git a/cmake/QtCreatorAPI.cmake b/cmake/QtCreatorAPI.cmake index 786e2d85533..c0f61301111 100644 --- a/cmake/QtCreatorAPI.cmake +++ b/cmake/QtCreatorAPI.cmake @@ -1129,7 +1129,7 @@ function (add_qtc_lua_plugin name) qtc_copy_to_builddir(${name} FILES ${_arg_SOURCES} - DESTINATION ${IDE_PLUGIN_PATH}/lua-plugins + DESTINATION ${IDE_PLUGIN_PATH} ) if (NOT _arg_EXCLUDE_FROM_INSTALL) @@ -1138,7 +1138,7 @@ function (add_qtc_lua_plugin name) install( FILES ${CMAKE_CURRENT_SOURCE_DIR}/${SOURCE} - DESTINATION ${IDE_PLUGIN_PATH}/lua-plugins/${SOURCE_DIR} + DESTINATION ${IDE_PLUGIN_PATH}/${SOURCE_DIR} ) endforeach() endif() diff --git a/qbs/imports/QtcLuaPlugin.qbs b/qbs/imports/QtcLuaPlugin.qbs index e7976501c34..1684590480c 100644 --- a/qbs/imports/QtcLuaPlugin.qbs +++ b/qbs/imports/QtcLuaPlugin.qbs @@ -7,6 +7,6 @@ Product { prefix: sourceDirectory + '/' + product.name + '/' files: luafiles qbs.install: true - qbs.installDir: qtc.ide_plugin_path + '/lua-plugins/' + product.name + qbs.installDir: qtc.ide_plugin_path + '/' + product.name } } diff --git a/src/plugins/lua/README.md b/src/plugins/lua/README.md index 108420735ed..ba5fbba8d94 100644 --- a/src/plugins/lua/README.md +++ b/src/plugins/lua/README.md @@ -6,7 +6,7 @@ The Lua plugin provides support for writing plugins using the Lua scripting lang ## Usage -The plugin scans the folder `lua-plugins` folder inside the normal plugin folder of Qt Creator +The plugin scans the normal plugin folders of Qt Creator `ExtensionSystem::PluginManager::pluginPaths()`. It loads scripts from any folder that contains a .lua script named the same as the folder. Whether or not the script is enabled is determined by the `disabledByDefault` field in the plugin @@ -17,7 +17,7 @@ table and the settings configured via the "About Plugins" dialog in Qt Creator. A Lua script needs to provide the following table to be considered a plugin: ```lua --- lua-plugins/myluaplugin/myluaplugin.lua +-- myluaplugin/myluaplugin.lua return { name = "MyLuaPlugin", version = "1.0.0", @@ -50,13 +50,13 @@ It must only return the plugin specification table and not execute or require an Use `require` to load other files from within the setup function. ```lua --- lua-plugins/myluaplugin/myluaplugin.lua +-- myluaplugin/myluaplugin.lua return { -- ... required fields omitted .. setup = function() require 'init'.setup() end, } --[[@as QtcPlugin]] --- lua-plugins/myluaplugin/init.lua +-- myluaplugin/init.lua local function setup() print("Hello from Lua!") end diff --git a/src/plugins/lua/luaplugin.cpp b/src/plugins/lua/luaplugin.cpp index 60505ade850..ec3007294f2 100644 --- a/src/plugins/lua/luaplugin.cpp +++ b/src/plugins/lua/luaplugin.cpp @@ -106,10 +106,7 @@ public: bool delayedInitialize() final { - scanForPlugins(transform(PluginManager::pluginPaths(), [](const FilePath &path) { - return path / "lua-plugins"; - })); - + scanForPlugins(PluginManager::pluginPaths()); return true; }