summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2020-02-21 00:36:37 +0800
committerruki <[email protected]>2020-02-20 21:39:44 +0800
commit6304f7d221ce28d51f4651e8db0951e3ccaf53b5 (patch)
treef52e8c9d37953d6bbc8602cad23e68df14dbf44a
parent872f3e8c83f3c58606b32860274216f7d74a0771 (diff)
check config platform for trybuild
-rw-r--r--xmake/modules/private/action/trybuild/bazel.lua6
-rw-r--r--xmake/modules/private/action/trybuild/cmake.lua3
-rw-r--r--xmake/modules/private/action/trybuild/make.lua2
-rw-r--r--xmake/modules/private/action/trybuild/meson.lua3
-rw-r--r--xmake/modules/private/action/trybuild/msbuild.lua6
-rw-r--r--xmake/modules/private/action/trybuild/scons.lua5
-rw-r--r--xmake/modules/private/action/trybuild/xcodebuild.lua9
7 files changed, 33 insertions, 1 deletions
diff --git a/xmake/modules/private/action/trybuild/bazel.lua b/xmake/modules/private/action/trybuild/bazel.lua
index 626fb372d..946be30ac 100644
--- a/xmake/modules/private/action/trybuild/bazel.lua
+++ b/xmake/modules/private/action/trybuild/bazel.lua
@@ -20,6 +20,7 @@
-- imports
import("core.base.option")
+import("core.project.config")
import("lib.detect.find_file")
import("lib.detect.find_tool")
@@ -36,6 +37,11 @@ end
-- do build
function build()
+
+ -- only support the current subsystem host platform now!
+ assert(is_subhost(config.plat()), "bazel: %s not supported!", config.plat())
+
+ -- do build
local bazel = assert(find_tool("bazel"), "bazel not found!")
os.vexecv(bazel.program, {"build"})
cprint("${bright}build ok!")
diff --git a/xmake/modules/private/action/trybuild/cmake.lua b/xmake/modules/private/action/trybuild/cmake.lua
index 94cfc9e3e..167c8bc50 100644
--- a/xmake/modules/private/action/trybuild/cmake.lua
+++ b/xmake/modules/private/action/trybuild/cmake.lua
@@ -83,6 +83,9 @@ end
-- do build
function build()
+ -- only support the current subsystem host platform now!
+ assert(is_subhost(config.plat()), "cmake: %s not supported!", config.plat())
+
-- get artifacts directory
local artifacts_dir = _get_artifacts_dir()
if not os.isdir(artifacts_dir) then
diff --git a/xmake/modules/private/action/trybuild/make.lua b/xmake/modules/private/action/trybuild/make.lua
index 41a6175a5..01ea217c0 100644
--- a/xmake/modules/private/action/trybuild/make.lua
+++ b/xmake/modules/private/action/trybuild/make.lua
@@ -20,6 +20,7 @@
-- imports
import("core.base.option")
+import("core.project.config")
import("lib.detect.find_file")
-- detect build-system and configuration file
@@ -38,6 +39,7 @@ end
-- do build
function build()
+ assert(is_subhost(config.plat()), "make: %s not supported!", config.plat())
if is_subhost("windows") then
os.vexec("nmake")
else
diff --git a/xmake/modules/private/action/trybuild/meson.lua b/xmake/modules/private/action/trybuild/meson.lua
index 80d1185bd..9967cb467 100644
--- a/xmake/modules/private/action/trybuild/meson.lua
+++ b/xmake/modules/private/action/trybuild/meson.lua
@@ -86,6 +86,9 @@ end
-- do build
function build()
+ -- only support the current subsystem host platform now!
+ assert(is_subhost(config.plat()), "meson: %s not supported!", config.plat())
+
-- get artifacts directory
local artifacts_dir = _get_artifacts_dir()
if not os.isdir(artifacts_dir) then
diff --git a/xmake/modules/private/action/trybuild/msbuild.lua b/xmake/modules/private/action/trybuild/msbuild.lua
index 8536dbc11..a896dce8a 100644
--- a/xmake/modules/private/action/trybuild/msbuild.lua
+++ b/xmake/modules/private/action/trybuild/msbuild.lua
@@ -20,6 +20,7 @@
-- imports
import("core.base.option")
+import("core.project.config")
import("lib.detect.find_file")
-- detect build-system and configuration file
@@ -36,6 +37,11 @@ end
-- do build
function build()
+
+ -- only support the current subsystem host platform now!
+ assert(is_subhost(config.plat()), "msbuild: %s not supported!", config.plat())
+
+ -- do build
os.vexec("msbuild \"%s\" -nologo -t:Build -p:Configuration=Release -p:Platform=%s", configfile, is_arch("x64") and "x64" or "Win32")
cprint("${bright}build ok!")
end
diff --git a/xmake/modules/private/action/trybuild/scons.lua b/xmake/modules/private/action/trybuild/scons.lua
index 7b6c51511..c39de07c3 100644
--- a/xmake/modules/private/action/trybuild/scons.lua
+++ b/xmake/modules/private/action/trybuild/scons.lua
@@ -36,6 +36,11 @@ end
-- do build
function build()
+
+ -- only support the current subsystem host platform now!
+ assert(is_subhost(config.plat()), "scons: %s not supported!", config.plat())
+
+ -- do build
local scons = assert(find_tool("scons"), "scons not found!")
os.vexec(scons.program)
cprint("${bright}build ok!")
diff --git a/xmake/modules/private/action/trybuild/xcodebuild.lua b/xmake/modules/private/action/trybuild/xcodebuild.lua
index 0637dcb40..00d915a68 100644
--- a/xmake/modules/private/action/trybuild/xcodebuild.lua
+++ b/xmake/modules/private/action/trybuild/xcodebuild.lua
@@ -20,6 +20,7 @@
-- imports
import("core.base.option")
+import("core.project.config")
import("lib.detect.find_directory")
-- detect build-system and configuration file
@@ -31,11 +32,17 @@ end
-- do clean
function clean()
+ os.exec("xcodebuild clean CODE_SIGN_IDENTITY=\"\" CODE_SIGNING_REQUIRED=NO")
end
-- do build
function build()
- os.exec("xcodebuild clean build CODE_SIGN_IDENTITY=\"\" CODE_SIGNING_REQUIRED=NO")
+
+ -- only support the current subsystem host platform now!
+ assert(is_subhost(config.plat()), "xcodebuild: %s not supported!", config.plat())
+
+ -- do build
+ os.exec("xcodebuild build CODE_SIGN_IDENTITY=\"\" CODE_SIGNING_REQUIRED=NO")
cprint("${bright}build ok!")
end