diff options
| author | ruki <[email protected]> | 2022-05-14 00:41:39 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2022-05-14 00:41:39 +0800 |
| commit | 1d7e2f54f9da78e6e2d40f2f4f0510755bddf439 (patch) | |
| tree | 28c8719baceb5d66e709de198fe2eb1bfebb9a59 /xmake/modules | |
| parent | 2ff45f35b6e2c68ef4e9b84374e46bd8a204d4d2 (diff) | |
get distcc
Diffstat (limited to 'xmake/modules')
| -rw-r--r-- | xmake/modules/private/service/distcc_build/client.lua | 17 | ||||
| -rw-r--r-- | xmake/modules/private/service/remote_build/action.lua | 2 | ||||
| -rw-r--r-- | xmake/modules/private/service/remote_build/client.lua | 17 |
3 files changed, 33 insertions, 3 deletions
diff --git a/xmake/modules/private/service/distcc_build/client.lua b/xmake/modules/private/service/distcc_build/client.lua index f79b540b3..02399d927 100644 --- a/xmake/modules/private/service/distcc_build/client.lua +++ b/xmake/modules/private/service/distcc_build/client.lua @@ -338,8 +338,23 @@ function is_connected() end end -function main() +-- new a client instance +function new() local instance = distcc_build_client() instance:init() return instance end + +-- get the singleton +function singleton() + local instance = _g.singleton + if not instance then + instance = new() + _g.singleton = instance + end + return instance +end + +function main() + return new() +end diff --git a/xmake/modules/private/service/remote_build/action.lua b/xmake/modules/private/service/remote_build/action.lua index c7519bf5c..fcf3fff89 100644 --- a/xmake/modules/private/service/remote_build/action.lua +++ b/xmake/modules/private/service/remote_build/action.lua @@ -29,5 +29,5 @@ end function main() config.load() - remote_build_client():runcmd("xmake", xmake.argv()) + remote_build_client.singleton():runcmd("xmake", xmake.argv()) end diff --git a/xmake/modules/private/service/remote_build/client.lua b/xmake/modules/private/service/remote_build/client.lua index 565b0f3c3..841ca6b8c 100644 --- a/xmake/modules/private/service/remote_build/client.lua +++ b/xmake/modules/private/service/remote_build/client.lua @@ -530,8 +530,23 @@ function is_connected() end end -function main() +-- new a client instance +function new() local instance = remote_build_client() instance:init() return instance end + +-- get the singleton +function singleton() + local instance = _g.singleton + if not instance then + instance = new() + _g.singleton = instance + end + return instance +end + +function main() + return new() +end |
