Lua: Add supported platfroms list to Project class

Change-Id: I35781b16ca9b7098418654c3bf57a72d2fbd3cf4
Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
This commit is contained in:
Justyna Hudziak
2024-09-27 14:54:24 +02:00
parent 3de26e3752
commit 36f1d6f66f
4 changed files with 36 additions and 1 deletions

View File

@@ -28,11 +28,22 @@ void setupProjectModule()
sol::table result = lua.create_table();
result.new_usertype<Kit>(
"Kit",
sol::no_constructor,
"supportedPlatforms",
[](Kit *kit) {
const auto set = kit->supportedPlatforms();
return QList<Utils::Id>(set.constBegin(), set.constEnd());
});
result.new_usertype<RunConfiguration>(
"RunConfiguration",
sol::no_constructor,
"runnable",
sol::property(&RunConfiguration::runnable));
sol::property(&RunConfiguration::runnable),
"kit",
sol::property(&RunConfiguration::kit));
result.new_usertype<Project>(
"Project",
@@ -99,6 +110,9 @@ void setupProjectModule()
result["RunMode"] = lua.create_table_with(
"Normal", Constants::NORMAL_RUN_MODE, "Debug", Constants::DEBUG_RUN_MODE);
result["Platforms"] = lua.create_table_with(
"Desktop", Utils::Id(Constants::DESKTOP_DEVICE_TYPE));
return result;
});

View File

@@ -11,6 +11,7 @@
#include <utils/futuresynchronizer.h>
#include <utils/hostosinfo.h>
#include <utils/icon.h>
#include <utils/id.h>
#include <utils/processinterface.h>
#include <QDesktopServices>
@@ -93,6 +94,10 @@ void setupUtilsModule()
utils["pid"] = QCoreApplication::applicationPid();
utils.new_usertype<Utils::Id>(
"Id",
sol::no_constructor);
auto hostOsInfoType = utils.new_usertype<HostOsInfo>("HostOsInfo");
hostOsInfoType["isWindowsHost"] = &HostOsInfo::isWindowsHost;
hostOsInfoType["isMacHost"] = &HostOsInfo::isMacHost;

View File

@@ -9,8 +9,21 @@ project.RunMode {
Debug = "RunConfiguration.DebugRunMode",
}
---@enum Platforms
project.Platforms {
Desktop = 0,
}
---@class Kit
project.Kit = {}
---Returns the list of supported platforms (device types) for this kit.
---@return [Id] The list of supported platforms (device types) for this kit.
function project.Kit:supportedPlatforms() end
---@class RunConfiguration
---@field runnable ProcessRunData
---@field kit Kit
project.RunConfiguration = {}
---@class Project

View File

@@ -18,6 +18,9 @@ function utils.waitms_cb(ms, callback) end
---@return QString Arbitrary UUID string.
function utils.createUuid() end
---@class Id
utils.Id = {}
---@class FilePath
utils.FilePath = {}