summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2020-02-15 23:02:08 +0800
committerruki <[email protected]>2020-02-15 23:02:08 +0800
commitf7f0c37a44d58412cf0d1a41c4864696084f4e1d (patch)
treebc277848976b0415c18f9c09e1fbd6f2874496a4
parent9aa15302ae9fdb3a1be0b382f9bd5b3a64db0098 (diff)
add is_subhost
-rw-r--r--tests/plugins/project/test.lua5
-rw-r--r--xmake/core/project/project.lua6
-rw-r--r--xmake/core/sandbox/modules/is_subhost.lua23
3 files changed, 31 insertions, 3 deletions
diff --git a/tests/plugins/project/test.lua b/tests/plugins/project/test.lua
index c6e1069d9..e64142f7c 100644
--- a/tests/plugins/project/test.lua
+++ b/tests/plugins/project/test.lua
@@ -5,12 +5,11 @@ import("core.platform.environment")
function test_vsxmake(t)
- if os.host() ~= "windows" then
+ if os.subhost() ~= "windows" then
return t:skip("wrong host platform")
end
local projname = "testproj"
-
local tempdir = os.tmpfile()
os.mkdir(tempdir)
os.cd(tempdir)
@@ -27,8 +26,8 @@ function test_vsxmake(t)
local vs = config.get("vs")
environment.enter("toolchains")
- local vstype = "vsxmake" .. vs
-- create sln & vcxproj
+ local vstype = "vsxmake" .. vs
os.execv("xmake", {"project", "-k", vstype, "-a", arch})
os.cd(vstype)
diff --git a/xmake/core/project/project.lua b/xmake/core/project/project.lua
index f0e80d63b..2511e3554 100644
--- a/xmake/core/project/project.lua
+++ b/xmake/core/project/project.lua
@@ -95,6 +95,11 @@ function project._api_is_host(interp, ...)
return os.is_host(...)
end
+-- the current subsystem host is belong to the given hosts?
+function project._api_is_subhost(interp, ...)
+ return os.is_subhost(...)
+end
+
-- the current config is belong to the given config values?
function project._api_is_config(interp, name, ...)
return config.is_value(name, ...)
@@ -213,6 +218,7 @@ function project.interpreter()
, {"is_kind", project._api_is_kind }
, {"is_arch", project._api_is_arch }
, {"is_host", project._api_is_host }
+ , {"is_subhost", project._api_is_subhost }
, {"is_mode", project._api_is_mode }
, {"is_plat", project._api_is_plat }
, {"is_config", project._api_is_config }
diff --git a/xmake/core/sandbox/modules/is_subhost.lua b/xmake/core/sandbox/modules/is_subhost.lua
new file mode 100644
index 000000000..f29fd3d36
--- /dev/null
+++ b/xmake/core/sandbox/modules/is_subhost.lua
@@ -0,0 +1,23 @@
+--!A cross-platform build utility based on Lua
+--
+-- Licensed under the Apache License, Version 2.0 (the "License");
+-- you may not use this file except in compliance with the License.
+-- You may obtain a copy of the License at
+--
+-- http://www.apache.org/licenses/LICENSE-2.0
+--
+-- Unless required by applicable law or agreed to in writing, software
+-- distributed under the License is distributed on an "AS IS" BASIS,
+-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+-- See the License for the specific language governing permissions and
+-- limitations under the License.
+--
+-- Copyright (C) 2015-2020, TBOOX Open Source Group.
+--
+-- @author ruki
+-- @file is_subhost.lua
+--
+
+-- return module
+return require("base/os").is_subhost
+