From 5bd3969119ce1faf2d005865612b25024b23dd07 Mon Sep 17 00:00:00 2001 From: Joao Matos Date: Sat, 21 Sep 2024 13:09:18 +0100 Subject: [PATCH] Adds `desktop` system tag to desktop systems. This can be useful to use to filter desktop systems, such as `os.istarget("desktop")`. --- src/base/os.lua | 16 +++++++-------- website/docs/os.getSystemTags.md | 35 ++++++++++++++++++++++++++++++++ website/docs/os.is.md | 5 ++++- website/docs/os.istarget.md | 18 ++++++++++++++++ website/sidebars.js | 2 ++ 5 files changed, 67 insertions(+), 9 deletions(-) create mode 100644 website/docs/os.getSystemTags.md create mode 100644 website/docs/os.istarget.md diff --git a/src/base/os.lua b/src/base/os.lua index e815ed6e41..f66fa64f8f 100644 --- a/src/base/os.lua +++ b/src/base/os.lua @@ -804,15 +804,15 @@ os.systemTags = { - ["aix"] = { "aix", "posix" }, - ["bsd"] = { "bsd", "posix" }, - ["haiku"] = { "haiku", "posix" }, + ["aix"] = { "aix", "posix", "desktop" }, + ["bsd"] = { "bsd", "posix", "desktop" }, + ["haiku"] = { "haiku", "posix", "desktop" }, ["ios"] = { "ios", "darwin", "posix", "mobile" }, - ["linux"] = { "linux", "posix" }, - ["macosx"] = { "macosx", "darwin", "posix" }, - ["solaris"] = { "solaris", "posix" }, - ["uwp"] = { "uwp", "windows" }, - ["windows"] = { "windows", "win32" }, + ["linux"] = { "linux", "posix", "desktop" }, + ["macosx"] = { "macosx", "darwin", "posix", "desktop" }, + ["solaris"] = { "solaris", "posix", "desktop" }, + ["uwp"] = { "uwp", "windows", "desktop" }, + ["windows"] = { "windows", "win32", "desktop" }, } function os.getSystemTags(name) diff --git a/website/docs/os.getSystemTags.md b/website/docs/os.getSystemTags.md new file mode 100644 index 0000000000..89e9d9ff23 --- /dev/null +++ b/website/docs/os.getSystemTags.md @@ -0,0 +1,35 @@ +Returns the list of tags corresponding to a system. + +There are tags specific to each operating system (see [system()](system.md) for a complete list of identifiers.), +and meta tags like `posix`, `darwin`, `desktop` and `mobile` tags. + +### Tags ### + +| OS | Tags | +|----------|-----------------------------------------| +| aix | aix, posix, desktop | +| android | android, mobile | +| bsd | bsd, posix, desktop | +| haiku | haiku, posix, desktop | +| ios | ios, darwin, posix, mobile | +| linux | linux, posix, desktop | +| macosx | macosx, darwin, posix, desktop | +| solaris | solaris, posix, desktop | +| uwp | uwp, windows, desktop | +| windows | windows, win32, desktop | + +### Examples ### + +```lua +print("iOS system tags: " .. table.concat(os.getSystemTags("ios"), ", ")) +-- iOS system tags: ios, darwin, posix, mobile +``` + +### See Also ### +[os.istarget](os.istarget.md) +[os.target](os.target.md) + +### Availability ### + +Premake 5.0.0 alpha 12 or later. + diff --git a/website/docs/os.is.md b/website/docs/os.is.md index 02dcb4c877..f196f33ab7 100644 --- a/website/docs/os.is.md +++ b/website/docs/os.is.md @@ -1,5 +1,5 @@ :::caution -**This function has been deprecated.** Use [os.target()](os.target.md) or [os.host()](os.host.md) instead. +**This function has been deprecated.** Use [os.istarget()](os.istarget.md), os.target()](os.target.md), or [os.host()](os.host.md) instead. ::: Checks the current operating system identifier against a particular value. @@ -27,4 +27,7 @@ Premake 4.0 or later. ### See Also ### +* [os.istarget](os.istarget.md) +* [os.target](os.target.md) +* [os.host](os.host.md) * [os.getversion](os.getversion.md) diff --git a/website/docs/os.istarget.md b/website/docs/os.istarget.md new file mode 100644 index 0000000000..2c93b05b35 --- /dev/null +++ b/website/docs/os.istarget.md @@ -0,0 +1,18 @@ +Checks the target operating system against a particular identifier or tag. +See [os.getSystemTags](os.getSystemTags.md) for documentation about OS tags. + +### Examples ### +```lua +print("Android: " .. os.istarget("android")) +print("Mobile: " .. os.istarget("mobile")) +print("Desktop: " .. os.istarget("desktop")) +``` + +### See Also ### +[os.target](os.target.md) +[os.getSystemTags](os.getSystemTags.md) + +### Availability ### + +Premake 5.0.0 alpha 12 or later. + diff --git a/website/sidebars.js b/website/sidebars.js index 48a3484fb8..9ba8f4616d 100644 --- a/website/sidebars.js +++ b/website/sidebars.js @@ -386,6 +386,7 @@ module.exports = { 'os.getenv', 'os.getnumcpus', 'os.getpass', + 'os.getSystemTags', 'os.getversion', 'os.host', 'os.is', @@ -393,6 +394,7 @@ module.exports = { 'os.isdir', 'os.isfile', 'os.islink', + 'os.istarget', 'os.locate', 'os.matchdirs', 'os.matchfiles',