diff options
| author | ruki <[email protected]> | 2023-03-07 22:53:18 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2023-03-07 22:53:18 +0800 |
| commit | 6fd71700ffb08da576eb33b38e86a19162bf5f7e (patch) | |
| tree | 31eaafbe7de63518db5a7cb83331e86853f8163b | |
| parent | b169f8987311921524cb51312d26e8c18c5d9b99 (diff) | |
improve export embed binary package
| -rw-r--r-- | xmake/core/package/package.lua | 11 | ||||
| -rw-r--r-- | xmake/modules/private/action/require/impl/export_packages.lua | 10 |
2 files changed, 18 insertions, 3 deletions
diff --git a/xmake/core/package/package.lua b/xmake/core/package/package.lua index f8a59bfc1..a7171c1d1 100644 --- a/xmake/core/package/package.lua +++ b/xmake/core/package/package.lua @@ -586,16 +586,21 @@ function _instance:is_parallelize() return self:get("parallelize") ~= false end --- is local embed package? +-- is local embed source code package? -- we install directly from the local source code instead of downloading it remotely -function _instance:is_embed() +function _instance:is_source_embed() return self:get("sourcedir") and #self:urls() == 0 and self:script("install") end +-- is local embed binary package? it's come from `xmake package` +function _instance:is_binary_embed() + return self:get("installdir") and #self:urls() == 0 and not self:script("install") and self:script("fetch") +end + -- is local package? -- we will use local installdir and cachedir in current project function _instance:is_local() - return self:is_embed() or self:is_thirdparty() + return self:is_source_embed() or self:is_binary_embed() or self:is_thirdparty() end -- use external includes? diff --git a/xmake/modules/private/action/require/impl/export_packages.lua b/xmake/modules/private/action/require/impl/export_packages.lua index 8dd8ab61a..a5d518914 100644 --- a/xmake/modules/private/action/require/impl/export_packages.lua +++ b/xmake/modules/private/action/require/impl/export_packages.lua @@ -33,6 +33,16 @@ function main(requires, opt) local installdir = instance:installdir() local rootdir = core_package.installdir() local exportpath, count = installdir:replace(rootdir, packagedir, {plain = true}) + if count == 0 and instance:is_binary_embed() then + -- maybe local binary embed package + -- @see https://github.com/xmake-io/xmake/issues/3470 + local name = instance:name() + installdir = instance:scriptdir() + if installdir:endswith(path.join(name:sub(1, 1), name)) then + rootdir = path.directory(path.directory(installdir)) + exportpath, count = installdir:replace(rootdir, packagedir, {plain = true}) + end + end -- export this package if exportpath and count == 1 and instance:fetch({force = true}) then |
