summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2023-09-21 22:56:34 +0800
committerruki <[email protected]>2023-09-21 22:56:34 +0800
commit03cc3f6e5d024984f4a2f1612fd6130a86d9610a (patch)
tree92af24f9024fad7035fbc4648e8e860a74586f3e
parent087d67db2430da466cd915ab9441d6a24106447c (diff)
add run.autobuild policy
-rw-r--r--xmake/actions/run/main.lua5
-rw-r--r--xmake/core/project/policy.lua2
2 files changed, 7 insertions, 0 deletions
diff --git a/xmake/actions/run/main.lua b/xmake/actions/run/main.lua
index 22748b388..c51825d8c 100644
--- a/xmake/actions/run/main.lua
+++ b/xmake/actions/run/main.lua
@@ -208,6 +208,11 @@ function main()
-- load config first
config.load()
+ -- Automatically build before running
+ if project.policy("run.autobuild") then
+ task.run("build")
+ end
+
-- load targets
project.load_targets()
diff --git a/xmake/core/project/policy.lua b/xmake/core/project/policy.lua
index 3ce75ca27..8bda6cded 100644
--- a/xmake/core/project/policy.lua
+++ b/xmake/core/project/policy.lua
@@ -78,6 +78,8 @@ function policy.policies()
["build.c++.gcc.modules.cxx11abi"] = {description = "Force to enable new cxx11 abi in C++ modules for gcc.", type = "boolean"},
-- Enable cuda device link
["build.cuda.devlink"] = {description = "Enable Cuda devlink.", type = "boolean"},
+ -- Automatically build before running
+ ["run.autobuild"] = {description = "Automatically build before running.", type = "boolean"},
-- Preprocessor configuration for ccache/distcc, we can disable linemarkers to speed up preprocess
["preprocessor.linemarkers"] = {description = "Enable linemarkers for preprocessor.", default = true, type = "boolean"},
-- Preprocessor configuration for ccache/distcc, we can disable it to avoid cache object file with __DATE__, __TIME__