summaryrefslogtreecommitdiff
path: root/xmake/modules/core
diff options
context:
space:
mode:
authorruki <[email protected]>2023-10-11 00:46:12 +0800
committerruki <[email protected]>2023-10-11 00:46:12 +0800
commit5ccc226acf853c44e845ee76c7adc16ce7799de1 (patch)
tree25ce8430d3f73dde38b90ca2fa93f728339caeca /xmake/modules/core
parentcfb5ce758e5ffd7bcc41d09fafa9d5be3604c7a8 (diff)
add diagnosis.check_build_deps policy
Diffstat (limited to 'xmake/modules/core')
-rw-r--r--xmake/modules/core/project/depend.lua26
1 files changed, 26 insertions, 0 deletions
diff --git a/xmake/modules/core/project/depend.lua b/xmake/modules/core/project/depend.lua
index 5e96c7b2a..1e9bee660 100644
--- a/xmake/modules/core/project/depend.lua
+++ b/xmake/modules/core/project/depend.lua
@@ -68,6 +68,20 @@ function load(dependfile, opt)
end
end
+-- show diagnosis info?
+function _is_show_diagnosis_info()
+ local show = _g.is_show_diagnosis_info
+ if show == nil then
+ if option.get("diagnosis") and project.policy("diagnosis.check_build_deps") then
+ show = true
+ else
+ show = false
+ end
+ _g.is_show_diagnosis_info = show
+ end
+ return show
+end
+
-- save dependent info to file
function save(dependinfo, dependfile)
io.save(dependfile, dependinfo)
@@ -100,6 +114,9 @@ function is_changed(dependinfo, opt)
-- source and header files have been changed or not exists?
if mtime == 0 or mtime > lastmtime then
+ if _is_show_diagnosis_info() then
+ cprint("${color.warning}depend file %s is changed, mtime: %s, lastmtime: %s", file, mtime, lastmtime)
+ end
return true
end
end
@@ -117,10 +134,16 @@ function is_changed(dependinfo, opt)
if deptype ~= opttype then
return true
elseif deptype == "string" and depvalue ~= optvalue then
+ if _is_show_diagnosis_info() then
+ cprint("${color.warning}depend value %s != %s", depvalue, optvalue)
+ end
return true
elseif deptype == "table" then
for subidx, subvalue in ipairs(depvalue) do
if subvalue ~= optvalue[subidx] then
+ if _is_show_diagnosis_info() then
+ cprint("${color.warning}depend value %s != %s at index %d", subvalue, optvalue[subidx], subidx)
+ end
return true
end
end
@@ -135,6 +158,9 @@ function is_changed(dependinfo, opt)
end
for idx, file in ipairs(files) do
if file ~= optfiles[idx] then
+ if _is_show_diagnosis_info() then
+ cprint("${color.warning}depend file %s != %s at index %d", file, optfiles[subidx], idx)
+ end
return true
end
end