summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2024-08-22 00:34:06 +0800
committerruki <[email protected]>2024-08-23 08:14:32 +0800
commitd19c47eac0a44b0bfbbf2e4ce7cf98713720a245 (patch)
tree7dda2c3d769c40aeb9d66efbfff91c7ff3d4d34c
parent84f170de57c8c58d37ccdefed7ad99e6c0c3ae48 (diff)
suppress logs
-rw-r--r--xmake/core/base/option.lua14
-rw-r--r--xmake/core/base/utils.lua34
-rw-r--r--xmake/modules/utils/ci/packageskey.lua6
3 files changed, 6 insertions, 48 deletions
diff --git a/xmake/core/base/option.lua b/xmake/core/base/option.lua
index 76dcc633a..8448788c5 100644
--- a/xmake/core/base/option.lua
+++ b/xmake/core/base/option.lua
@@ -64,8 +64,6 @@ end
-- get the top context
function option._context()
-
- -- the contexts
local contexts = option._CONTEXTS
if contexts then
return contexts[#contexts]
@@ -74,29 +72,17 @@ end
-- save context
function option.save(taskname)
-
- -- init contexts
option._CONTEXTS = option._CONTEXTS or {}
-
- -- new a context
local context = {options = {}, defaults = {}, taskname = taskname}
-
- -- init defaults
if taskname then
context.defaults = option.defaults(taskname) or context.defaults
end
-
- -- push this new context to the top stack
table.insert(option._CONTEXTS, context)
-
- -- ok
return context
end
-- restore context
function option.restore()
-
- -- pop it
if option._CONTEXTS then
table.remove(option._CONTEXTS)
end
diff --git a/xmake/core/base/utils.lua b/xmake/core/base/utils.lua
index e8b6401f6..5125d224e 100644
--- a/xmake/core/base/utils.lua
+++ b/xmake/core/base/utils.lua
@@ -142,49 +142,25 @@ end
-- print format string with newline
function utils.print(format, ...)
-
- -- check
assert(format)
-
- -- init message
local message = string.tryformat(format, ...)
-
- -- trace
utils._print(message)
-
- -- write to the log file
log:printv(message)
end
-- print format string without newline
function utils.printf(format, ...)
-
- -- check
assert(format)
-
- -- init message
local message = string.tryformat(format, ...)
-
- -- trace
utils._iowrite(message)
-
- -- write to the log file
log:write(message)
end
-- print format string and colors with newline
function utils.cprint(format, ...)
-
- -- check
assert(format)
-
- -- init message
local message = string.tryformat(format, ...)
-
- -- trace
utils._print(colors.translate(message))
-
- -- write to the log file
if log:file() then
log:printv(colors.ignore(message))
end
@@ -192,17 +168,9 @@ end
-- print format string and colors without newline
function utils.cprintf(format, ...)
-
- -- check
assert(format)
-
- -- init message
local message = string.tryformat(format, ...)
-
- -- trace
utils._iowrite(colors.translate(message))
-
- -- write to the log file
if log:file() then
log:write(colors.ignore(message))
end
@@ -237,8 +205,6 @@ end
-- add warning message
function utils.warning(format, ...)
-
- -- check
assert(format)
-- format message
diff --git a/xmake/modules/utils/ci/packageskey.lua b/xmake/modules/utils/ci/packageskey.lua
index 50e3e2d1b..a293009af 100644
--- a/xmake/modules/utils/ci/packageskey.lua
+++ b/xmake/modules/utils/ci/packageskey.lua
@@ -40,6 +40,10 @@ import("private.action.require.impl.utils.get_requires")
--
function main(requires_raw)
+ -- suppress all logs
+ option.save()
+ option.set("quiet", true, {force = true})
+
-- get requires and extra config
local requires_extra = nil
local requires, requires_extra = get_requires(requires_raw)
@@ -54,6 +58,8 @@ function main(requires_raw)
end
table.sort(keys)
keys = table.concat(keys, ",")
+
+ option.restore()
print(hash.uuid4(keys):gsub('-', ''):lower())
end