summaryrefslogtreecommitdiff
path: root/xmake/core/package/package.lua
diff options
context:
space:
mode:
authorruki <[email protected]>2023-09-19 00:42:19 +0800
committerruki <[email protected]>2023-09-19 00:42:19 +0800
commita4a9b3ac3f599249c8ed72bc773fed55d85c2753 (patch)
tree8366b80de64ed4ddfc2a0088477916a26ea0496d /xmake/core/package/package.lua
parent9000d29d7038da45f6ae481404c9ff1dd189c702 (diff)
improve rules directory for base package
Diffstat (limited to 'xmake/core/package/package.lua')
-rw-r--r--xmake/core/package/package.lua16
1 files changed, 16 insertions, 0 deletions
diff --git a/xmake/core/package/package.lua b/xmake/core/package/package.lua
index a18d6f882..e86d87ce6 100644
--- a/xmake/core/package/package.lua
+++ b/xmake/core/package/package.lua
@@ -806,6 +806,22 @@ function _instance:scriptdir()
return self._SCRIPTDIR
end
+-- get the rules directory
+function _instance:rulesdir()
+ local rulesdir = self._RULESDIR
+ if rulesdir == nil then
+ rulesdir = path.join(self:scriptdir(), "rules")
+ if not os.isdir(rulesdir) and self:base() then
+ rulesdir = self:base():rulesdir()
+ end
+ if not os.isdir(rulesdir) then
+ rulesdir = false
+ end
+ self._RULESDIR = rulesdir
+ end
+ return rulesdir or nil
+end
+
-- get the references info of this package
function _instance:references()
local references_file = path.join(self:installdir({readonly = true}), "references.txt")