Skip to content

Commit

Permalink
suppress logs
Browse files Browse the repository at this point in the history
  • Loading branch information
waruqi committed Aug 21, 2024
1 parent a699eea commit 1b09542
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 48 deletions.
14 changes: 0 additions & 14 deletions xmake/core/base/option.lua
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,6 @@ end

-- get the top context
function option._context()

-- the contexts
local contexts = option._CONTEXTS
if contexts then
return contexts[#contexts]
Expand All @@ -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
Expand Down
34 changes: 0 additions & 34 deletions xmake/core/base/utils.lua
Original file line number Diff line number Diff line change
Expand Up @@ -142,67 +142,35 @@ 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
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
Expand Down Expand Up @@ -237,8 +205,6 @@ end

-- add warning message
function utils.warning(format, ...)

-- check
assert(format)

-- format message
Expand Down
6 changes: 6 additions & 0 deletions xmake/modules/utils/ci/packageskey.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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

Expand Down

0 comments on commit 1b09542

Please sign in to comment.