summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2025-04-10 22:37:08 +0800
committerruki <[email protected]>2025-04-10 22:37:08 +0800
commit803bf74e1eb6d589fc2d5709a2c4861a14241c2f (patch)
tree492a7dec9297c8cd9e506c23232fcc933be7fcb2
parent55dc13e2761a4b832bb8c7953043c494f50d90b7 (diff)
improve run.autobuild
-rw-r--r--xmake/actions/build/main.lua13
-rw-r--r--xmake/actions/run/main.lua2
-rw-r--r--xmake/core/base/option.lua2
-rw-r--r--xmake/core/sandbox/modules/import/core/base/option.lua51
4 files changed, 20 insertions, 48 deletions
diff --git a/xmake/actions/build/main.lua b/xmake/actions/build/main.lua
index 5a6aa1535..d9ad6818f 100644
--- a/xmake/actions/build/main.lua
+++ b/xmake/actions/build/main.lua
@@ -160,7 +160,8 @@ function build_targets(targetnames, opt)
_do_project_rules("build_after")
end
-function main()
+function main(opt)
+ opt = opt or {}
-- try building it using third-party buildsystem if xmake.lua not exists
if not os.isfile(project.rootfile()) and _try_build() then
@@ -206,9 +207,11 @@ function main()
project.unlock()
-- trace
- local str = ""
- if build_time then
- str = string.format(", spent %ss", build_time / 1000)
+ if not opt.disable_dump then
+ local str = ""
+ if build_time then
+ str = string.format(", spent %ss", build_time / 1000)
+ end
+ progress.show(100, "${color.success}build ok%s", str)
end
- progress.show(100, "${color.success}build ok%s", str)
end
diff --git a/xmake/actions/run/main.lua b/xmake/actions/run/main.lua
index ab2db5cd1..72fe8bbac 100644
--- a/xmake/actions/run/main.lua
+++ b/xmake/actions/run/main.lua
@@ -196,7 +196,7 @@ function main()
-- we need clear the previous config and reload it
-- to avoid trigger recheck configs
config.clear()
- task.run("build", {target = option.get("target"), all = option.get("all")})
+ task.run("build", {target = option.get("target"), all = option.get("all")}, {disable_dump = true})
end
-- load targets
diff --git a/xmake/core/base/option.lua b/xmake/core/base/option.lua
index 8448788c5..62551dda3 100644
--- a/xmake/core/base/option.lua
+++ b/xmake/core/base/option.lua
@@ -51,8 +51,6 @@ function option._translate(menu)
-- save menu
option._MENU = menu
-
- -- ok
return true
end
diff --git a/xmake/core/sandbox/modules/import/core/base/option.lua b/xmake/core/sandbox/modules/import/core/base/option.lua
index 42ac2477a..852115667 100644
--- a/xmake/core/sandbox/modules/import/core/base/option.lua
+++ b/xmake/core/sandbox/modules/import/core/base/option.lua
@@ -18,33 +18,23 @@
-- @file option.lua
--
--- define module
-local sandbox_core_base_option = sandbox_core_base_option or {}
-
-- load modules
local table = require("base/table")
local option = require("base/option")
local raise = require("sandbox/modules/raise")
--- get the option value
-function sandbox_core_base_option.get(name)
- return option.get(name)
-end
-
--- set the option value
-function sandbox_core_base_option.set(name, value)
- option.set(name, value)
-end
+-- define module
+local sandbox_core_base_option = sandbox_core_base_option or {}
--- get the default option value
-function sandbox_core_base_option.default(name)
- return option.default(name)
-end
-
--- get the given task menu
-function sandbox_core_base_option.taskmenu(taskname)
- return option.taskmenu(taskname)
-end
+-- inherit some builtin interfaces
+sandbox_core_base_option.get = option.get
+sandbox_core_base_option.set = option.set
+sandbox_core_base_option.default = option.default
+sandbox_core_base_option.save = option.save
+sandbox_core_base_option.restore = option.restore
+sandbox_core_base_option.boolean = option.boolean
+sandbox_core_base_option.taskname = option.taskname
+sandbox_core_base_option.taskmenu = option.taskmenu
-- get the options
function sandbox_core_base_option.options()
@@ -68,8 +58,6 @@ end
-- parse arguments with the given options
function sandbox_core_base_option.raw_parse(argv, options, opt)
-
- -- check
assert(argv and options)
-- parse it
@@ -82,8 +70,6 @@ end
-- parse arguments with the given options
function sandbox_core_base_option.parse(argv, options, ...)
-
- -- check
assert(argv and options)
-- add common options
@@ -117,20 +103,5 @@ function sandbox_core_base_option.parse(argv, options, ...)
return results
end
--- save context
-function sandbox_core_base_option.save(taskname)
- return option.save(taskname)
-end
-
--- restore context
-function sandbox_core_base_option.restore()
- option.restore()
-end
-
--- get the boolean value
-function sandbox_core_base_option.boolean(value)
- return option.boolean(value)
-end
-
-- return module
return sandbox_core_base_option