summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2022-04-06 00:41:51 +0800
committerruki <[email protected]>2022-04-06 00:41:51 +0800
commit979d106b38f86a6c4aedf3cfa666f2c45ddb2548 (patch)
tree8d4841e66e8187c7e2bd6636c71e807e8f7b7551
parent824d3af986a880887a616fc96e0cfe96433180bd (diff)
improve remote build client
-rw-r--r--xmake/modules/private/service/client/client.lua21
-rw-r--r--xmake/modules/private/service/client/remote_build_client.lua21
-rw-r--r--xmake/modules/private/service/show_status.lua4
3 files changed, 21 insertions, 25 deletions
diff --git a/xmake/modules/private/service/client/client.lua b/xmake/modules/private/service/client/client.lua
index 037535ad1..f0e4e0d32 100644
--- a/xmake/modules/private/service/client/client.lua
+++ b/xmake/modules/private/service/client/client.lua
@@ -40,27 +40,6 @@ function client:workdir()
return os.tmpfile(tostring(self)) .. ".dir"
end
--- is connected?
-function client:is_connected()
- return os.isfile(self:statusfile())
-end
-
--- get the status
-function client:status()
- local status = self._STATUS
- local statusfile = self:statusfile()
- if not status and os.isfile(statusfile) then
- status = io.load(statusfile)
- self._STATUS = status
- end
- return status
-end
-
--- get the status file
-function client:statusfile()
- return path.join(self:workdir(), "status.txt")
-end
-
function client:__tostring()
return "<client>"
end
diff --git a/xmake/modules/private/service/client/remote_build_client.lua b/xmake/modules/private/service/client/remote_build_client.lua
index b4e95e45c..df9e43b2a 100644
--- a/xmake/modules/private/service/client/remote_build_client.lua
+++ b/xmake/modules/private/service/client/remote_build_client.lua
@@ -36,6 +36,27 @@ function remote_build_client:class()
return remote_build_client
end
+-- is connected?
+function remote_build_client:is_connected()
+ return os.isfile(self:statusfile())
+end
+
+-- get the status
+function remote_build_client:status()
+ local status = self._STATUS
+ local statusfile = self:statusfile()
+ if not status and os.isfile(statusfile) then
+ status = io.load(statusfile)
+ self._STATUS = status
+ end
+ return status
+end
+
+-- get the status file
+function remote_build_client:statusfile()
+ return path.join(self:workdir(), "status.txt")
+end
+
function remote_build_client:__tostring()
return "<remote_build_client>"
end
diff --git a/xmake/modules/private/service/show_status.lua b/xmake/modules/private/service/show_status.lua
index 1eb1fe7c1..bb64a3cec 100644
--- a/xmake/modules/private/service/show_status.lua
+++ b/xmake/modules/private/service/show_status.lua
@@ -19,10 +19,6 @@
--
-- imports
-import("core.base.option")
-import("core.base.socket")
-import("core.base.scheduler")
-import("private.service.config")
import("private.service.client.remote_build_client")
function main()