Skip to content

Commit 1b09542

Browse files
committed
suppress logs
1 parent a699eea commit 1b09542

File tree

3 files changed

+6
-48
lines changed

3 files changed

+6
-48
lines changed

xmake/core/base/option.lua

-14
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,6 @@ end
6464

6565
-- get the top context
6666
function option._context()
67-
68-
-- the contexts
6967
local contexts = option._CONTEXTS
7068
if contexts then
7169
return contexts[#contexts]
@@ -74,29 +72,17 @@ end
7472

7573
-- save context
7674
function option.save(taskname)
77-
78-
-- init contexts
7975
option._CONTEXTS = option._CONTEXTS or {}
80-
81-
-- new a context
8276
local context = {options = {}, defaults = {}, taskname = taskname}
83-
84-
-- init defaults
8577
if taskname then
8678
context.defaults = option.defaults(taskname) or context.defaults
8779
end
88-
89-
-- push this new context to the top stack
9080
table.insert(option._CONTEXTS, context)
91-
92-
-- ok
9381
return context
9482
end
9583

9684
-- restore context
9785
function option.restore()
98-
99-
-- pop it
10086
if option._CONTEXTS then
10187
table.remove(option._CONTEXTS)
10288
end

xmake/core/base/utils.lua

-34
Original file line numberDiff line numberDiff line change
@@ -142,67 +142,35 @@ end
142142

143143
-- print format string with newline
144144
function utils.print(format, ...)
145-
146-
-- check
147145
assert(format)
148-
149-
-- init message
150146
local message = string.tryformat(format, ...)
151-
152-
-- trace
153147
utils._print(message)
154-
155-
-- write to the log file
156148
log:printv(message)
157149
end
158150

159151
-- print format string without newline
160152
function utils.printf(format, ...)
161-
162-
-- check
163153
assert(format)
164-
165-
-- init message
166154
local message = string.tryformat(format, ...)
167-
168-
-- trace
169155
utils._iowrite(message)
170-
171-
-- write to the log file
172156
log:write(message)
173157
end
174158

175159
-- print format string and colors with newline
176160
function utils.cprint(format, ...)
177-
178-
-- check
179161
assert(format)
180-
181-
-- init message
182162
local message = string.tryformat(format, ...)
183-
184-
-- trace
185163
utils._print(colors.translate(message))
186-
187-
-- write to the log file
188164
if log:file() then
189165
log:printv(colors.ignore(message))
190166
end
191167
end
192168

193169
-- print format string and colors without newline
194170
function utils.cprintf(format, ...)
195-
196-
-- check
197171
assert(format)
198-
199-
-- init message
200172
local message = string.tryformat(format, ...)
201-
202-
-- trace
203173
utils._iowrite(colors.translate(message))
204-
205-
-- write to the log file
206174
if log:file() then
207175
log:write(colors.ignore(message))
208176
end
@@ -237,8 +205,6 @@ end
237205

238206
-- add warning message
239207
function utils.warning(format, ...)
240-
241-
-- check
242208
assert(format)
243209

244210
-- format message

xmake/modules/utils/ci/packageskey.lua

+6
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,10 @@ import("private.action.require.impl.utils.get_requires")
4040
--
4141
function main(requires_raw)
4242

43+
-- suppress all logs
44+
option.save()
45+
option.set("quiet", true, {force = true})
46+
4347
-- get requires and extra config
4448
local requires_extra = nil
4549
local requires, requires_extra = get_requires(requires_raw)
@@ -54,6 +58,8 @@ function main(requires_raw)
5458
end
5559
table.sort(keys)
5660
keys = table.concat(keys, ",")
61+
62+
option.restore()
5763
print(hash.uuid4(keys):gsub('-', ''):lower())
5864
end
5965

0 commit comments

Comments
 (0)