diff options
| author | ruki <[email protected]> | 2025-09-30 20:57:22 +0800 |
|---|---|---|
| committer | GitHub <[email protected]> | 2025-09-30 20:57:22 +0800 |
| commit | c5a738cfb37fab1c2aed211f1abe26ef0444923f (patch) | |
| tree | 92033c745b1fedfe427eb27b721286a3e4ed79a7 | |
| parent | 25c60fd7db271e2f59bae730366867b7d648684f (diff) | |
| parent | c99d1ee6094597d5e13f6d9b1d141faa20e6c1e4 (diff) | |
Merge pull request #6874 from Shiffted/fix-project-packages
add scriptdir to project packages
| -rw-r--r-- | xmake/core/package/package.lua | 10 | ||||
| -rw-r--r-- | xmake/modules/package/tools/xmake.lua | 2 |
2 files changed, 8 insertions, 4 deletions
diff --git a/xmake/core/package/package.lua b/xmake/core/package/package.lua index 4b0ddd036..2c42a4c94 100644 --- a/xmake/core/package/package.lua +++ b/xmake/core/package/package.lua @@ -929,9 +929,13 @@ end 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 + if self:repo() == nil and self:base() then rulesdir = self:base():rulesdir() + else + rulesdir = path.join(self:scriptdir(), "rules") + if not os.isdir(rulesdir) and self:base() then + rulesdir = self:base():rulesdir() + end end if rulesdir == nil or not os.isdir(rulesdir) then rulesdir = false @@ -3063,7 +3067,7 @@ function package.load_from_project(packagename, project) end -- new an instance - instance = _instance.new(packagename, packageinfo) + instance = _instance.new(packagename, packageinfo, {scriptdir = os.projectdir()}) package._memcache():set2("packages", instance) return instance end diff --git a/xmake/modules/package/tools/xmake.lua b/xmake/modules/package/tools/xmake.lua index e2b22f926..6a5d13af5 100644 --- a/xmake/modules/package/tools/xmake.lua +++ b/xmake/modules/package/tools/xmake.lua @@ -485,7 +485,7 @@ function install(package, configs, opt) -- copy the ported xmake.lua in the default position if it's missing local xmakefile = path.join(opt.curdir or os.curdir(), "xmake.lua") - if not os.isfile(xmakefile) then + if not os.isfile(xmakefile) and package:repo() ~= nil then local xmakefile_port = path.join(package:scriptdir(), "port", "xmake.lua") if os.isfile(xmakefile_port) then os.cp(xmakefile_port, xmakefile) |
