summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2022-12-22 00:16:53 +0800
committerruki <[email protected]>2022-12-22 00:16:53 +0800
commit71ed0306bb97860e7bb7586dbce49b73008d4186 (patch)
treee01dfa1a6db374df4fc093a606ee54474ea7367f
parent30fbe9007008e20e709af947272719ea31e43a67 (diff)
improve menu #3187
-rw-r--r--xmake/core/platform/menu.lua37
1 files changed, 29 insertions, 8 deletions
diff --git a/xmake/core/platform/menu.lua b/xmake/core/platform/menu.lua
index 483059119..7f0c7be98 100644
--- a/xmake/core/platform/menu.lua
+++ b/xmake/core/platform/menu.lua
@@ -22,16 +22,37 @@
local menu = menu or {}
-- load modules
-local os = require("base/os")
-local path = require("base/path")
-local utils = require("base/utils")
-local table = require("base/table")
-local platform = require("platform/platform")
+local os = require("base/os")
+local path = require("base/path")
+local utils = require("base/utils")
+local table = require("base/table")
+local config = require("project/config")
+local platform = require("platform/platform")
+
+-- the remote build client is connected?
+--
+-- @see https://github.com/xmake-io/xmake/issues/3187
+function _remote_build_is_connected()
+ -- the current process is in service? we cannot enable it
+ if os.getenv("XMAKE_IN_SERVICE") then
+ return false
+ end
+ local projectdir = os.projectdir()
+ local projectfile = os.projectfile()
+ if projectfile and os.isfile(projectfile) and projectdir then
+ local workdir = path.join(config.directory(), "remote_build")
+ local statusfile = path.join(workdir, "status.txt")
+ if os.isfile(statusfile) then
+ local status = io.load(statusfile)
+ if status and status.connected then
+ return true
+ end
+ end
+ end
+end
-- get the option menu for action: xmake config or global
function menu.options(action)
-
- -- check
assert(action)
-- get all platforms
@@ -51,7 +72,7 @@ function menu.options(action)
-- get menu of the supported platform on the current host
local menu = instance:menu()
- if menu and os.is_host(table.unpack(table.wrap(instance:hosts()))) then
+ if menu and (os.is_host(table.unpack(table.wrap(instance:hosts()))) or _remote_build_is_connected()) then
-- get the options for this action
local options = menu[action]