summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2025-08-19 22:37:52 +0800
committerruki <[email protected]>2025-08-19 22:37:52 +0800
commit56eaa5721cb8408013ebde1d95b84a3b3872d9d7 (patch)
tree353fb4fa36e91c585d1140c30d1267a3918e59b0
parent37cea6d0b4b2efabe259ac27b20d5a2538c00342 (diff)
improve extrafiles
-rw-r--r--xmake/core/base/private/match_copyfiles.lua25
-rw-r--r--xmake/core/project/target.lua5
2 files changed, 14 insertions, 16 deletions
diff --git a/xmake/core/base/private/match_copyfiles.lua b/xmake/core/base/private/match_copyfiles.lua
index 06eca0e55..9570a8c4b 100644
--- a/xmake/core/base/private/match_copyfiles.lua
+++ b/xmake/core/base/private/match_copyfiles.lua
@@ -83,21 +83,19 @@ function match_copyfiles(instance, filetype, outputdir, opt)
-- add the source copied files
table.join2(srcfiles, srcpaths)
- -- the copied directory exists?
- if outputdir then
+ -- get the file info
+ local fileinfo = extrainfo[copyfile] or {}
- -- get the file info
- local fileinfo = extrainfo[copyfile] or {}
-
- -- get the prefix directory
- local prefixdir = fileinfo.prefixdir
- if fileinfo.rootdir then
- rootdir = fileinfo.rootdir
- end
+ -- get the prefix directory
+ local prefixdir = fileinfo.prefixdir
+ if fileinfo.rootdir then
+ rootdir = fileinfo.rootdir
+ end
- -- add the destinate copied files
- for _, srcpath in ipairs(srcpaths) do
+ -- add the destinate copied files
+ for _, srcpath in ipairs(srcpaths) do
+ if outputdir then
-- get the destinate directory
local dstdir = outputdir
if prefixdir then
@@ -125,8 +123,9 @@ function match_copyfiles(instance, filetype, outputdir, opt)
-- add it
table.insert(dstfiles, dstfile)
- table.insert(fileinfos, fileinfo)
end
+
+ table.insert(fileinfos, fileinfo)
end
end
end
diff --git a/xmake/core/project/target.lua b/xmake/core/project/target.lua
index 74bc438af..3b08223a6 100644
--- a/xmake/core/project/target.lua
+++ b/xmake/core/project/target.lua
@@ -2195,9 +2195,8 @@ function _instance:installfiles(outputdir, opt)
end
-- get the extra files
-function _instance:extrafiles()
- local extrafiles, _, extrainfo = match_copyfiles(self, "extrafiles")
- return extrafiles, extrainfo
+function _instance:extrafiles(outputdir)
+ return match_copyfiles(self, "extrafiles", outputdir)
end
-- get depend file from object file