diff options
| -rw-r--r-- | xmake/core/project/package.lua | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/xmake/core/project/package.lua b/xmake/core/project/package.lua index 9e899d2a3..bf1e61ea8 100644 --- a/xmake/core/project/package.lua +++ b/xmake/core/project/package.lua @@ -249,10 +249,17 @@ function _instance:rules() local installdir = self:installdir() local rulesdir = path.join(installdir, "rules") if os.isdir(rulesdir) then - local files = os.match(path.join(rulesdir, "**.lua")) + local files = os.filedirs(path.join(rulesdir, "*")) if files then for _, filepath in ipairs(files) do - local results, errors = rule._load(filepath) + local results, errors + if filepath:endswith(".lua") then + results, errors = rule._load(filepath) + elseif os.isdir(filepath) and os.isfile(path.join(filepath, "xmake.lua")) then + results, errors = rule._load(path.join(filepath, "xmake.lua")) + else + os.raise("unknown rule %s: %s", os.isdir(filepath) and "directory" or "file", filepath) + end if results then table.join2(ruleinfos, results) else |
