diff options
Diffstat (limited to 'xmake/core/base/interpreter.lua')
| -rw-r--r-- | xmake/core/base/interpreter.lua | 45 |
1 files changed, 37 insertions, 8 deletions
diff --git a/xmake/core/base/interpreter.lua b/xmake/core/base/interpreter.lua index 6060fc319..7ba677a8f 100644 --- a/xmake/core/base/interpreter.lua +++ b/xmake/core/base/interpreter.lua @@ -1686,20 +1686,49 @@ function interpreter:api_builtin_includes(...) local subpaths = table.join(...) local subpaths_matched = {} for _, subpath in ipairs(subpaths) do - -- find the given files from the project directory local found = false - local files = os.match(subpath, not subpath:endswith(".lua")) - if files and #files > 0 then - table.join2(subpaths_matched, files) - found = true - elseif not path.is_absolute(subpath) then - -- attempt to find files from programdir/includes/*.lua - files = os.files(path.join(os.programdir(), "includes", subpath)) + -- attempt to find files from programdir/includes/*.lua + -- e.g. includes("@builtin/check") + if subpath:startswith("@builtin/") then + local builtin_path = subpath:sub(10) + local files + if builtin_path:endswith(".lua") then + files = os.files(path.join(os.programdir(), "includes", builtin_path)) + else + files = os.files(path.join(os.programdir(), "includes", builtin_path, "xmake.lua")) + end + if files and #files > 0 then + table.join2(subpaths_matched, files) + found = true + end + end + -- find the given files from the project directory + if not found then + local files = os.match(subpath, not subpath:endswith(".lua")) if files and #files > 0 then table.join2(subpaths_matched, files) found = true end end + -- attempt to find files from programdir/includes/*.lua (deprecated) + if not found and not path.is_absolute(subpath) then + -- e.g. includes("check_cflags.lua") + if subpath:startswith("check_") then + local files = os.files(path.join(os.programdir(), "includes", "check", subpath)) + if files and #files > 0 then + table.join2(subpaths_matched, files) + found = true + utils.warning("deprecated: please use includes(\"@builtin/check\") instead of includes(\"%s\")", subpath) + end + elseif subpath:startswith("qt_") then + local files = os.files(path.join(os.programdir(), "includes", "qt", subpath)) + if files and #files > 0 then + table.join2(subpaths_matched, files) + found = true + utils.warning("deprecated: please use includes(\"@builtin/qt\") instead of includes(\"%s\")", subpath) + end + end + end if not found then utils.warning("includes(\"%s\") cannot find any files!", subpath) end |
