summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--xmake/core/base/private/match_copyfiles.lua16
-rw-r--r--xmake/plugins/pack/xpack.lua8
-rw-r--r--xmake/plugins/pack/xpack_component.lua9
3 files changed, 28 insertions, 5 deletions
diff --git a/xmake/core/base/private/match_copyfiles.lua b/xmake/core/base/private/match_copyfiles.lua
index 594ac6cdf..90fd0affd 100644
--- a/xmake/core/base/private/match_copyfiles.lua
+++ b/xmake/core/base/private/match_copyfiles.lua
@@ -60,6 +60,20 @@ function match_copyfiles(instance, filetype, outputdir, opt)
removed = true
end
+ -- keep the raw pattern for the extraconf lookup, because the extraconf
+ -- is indexed by the value before filtering the builtin variables
+ local rawfile = copyfile
+
+ -- filter the builtin variables in path, e.g. $(projectdir)/xxx
+ --
+ -- @note we must filter it before parsing the root directory and stripping
+ -- the parentheses, because the builtin variable also uses `$(...)`
+ --
+ -- @see https://github.com/xmake-io/xmake/issues/7632
+ if opt.filter then
+ copyfile = opt.filter(copyfile)
+ end
+
-- get the root directory
local rootdir, count = copyfile:gsub("|.*$", ""):gsub("%(.*%)$", "")
if count == 0 then
@@ -85,7 +99,7 @@ function match_copyfiles(instance, filetype, outputdir, opt)
table.join2(srcfiles, srcpaths)
-- get the file info
- local fileinfo = extrainfo[copyfile] or {}
+ local fileinfo = extrainfo[rawfile] or {}
-- get the prefix directory
local prefixdir = fileinfo.prefixdir
diff --git a/xmake/plugins/pack/xpack.lua b/xmake/plugins/pack/xpack.lua
index fbd53ae22..312878a78 100644
--- a/xmake/plugins/pack/xpack.lua
+++ b/xmake/plugins/pack/xpack.lua
@@ -436,7 +436,9 @@ end
-- get the install files
function xpack:installfiles()
- return match_copyfiles(self, "installfiles", self:installdir())
+ return match_copyfiles(self, "installfiles", self:installdir(), {filter = function (value)
+ return filter.handle(value, self)
+ end})
end
-- get the installed root directory, this is just a temporary sandbox installation path,
@@ -457,7 +459,9 @@ end
-- get the source files
function xpack:sourcefiles()
- return match_copyfiles(self, "sourcefiles", self:sourcedir())
+ return match_copyfiles(self, "sourcefiles", self:sourcedir(), {filter = function (value)
+ return filter.handle(value, self)
+ end})
end
-- get the source root directory
diff --git a/xmake/plugins/pack/xpack_component.lua b/xmake/plugins/pack/xpack_component.lua
index fa12a1646..fb219cf55 100644
--- a/xmake/plugins/pack/xpack_component.lua
+++ b/xmake/plugins/pack/xpack_component.lua
@@ -25,6 +25,7 @@ import("core.project.config")
import("core.project.project")
import("private.core.base.select_script")
import("private.core.base.match_copyfiles")
+import("filter")
-- define module
local xpack_component = xpack_component or object {_init = {"_name", "_info", "_package"}}
@@ -115,7 +116,9 @@ end
-- get the install files
function xpack_component:installfiles()
- return match_copyfiles(self, "installfiles", self:package():installdir())
+ return match_copyfiles(self, "installfiles", self:package():installdir(), {filter = function (value)
+ return filter.handle(value, self:package())
+ end})
end
-- get the installed root directory, this is just a temporary sandbox installation path,
@@ -131,7 +134,9 @@ end
-- get the source files
function xpack_component:sourcefiles()
- return match_copyfiles(self, "sourcefiles", self:package():sourcedir())
+ return match_copyfiles(self, "sourcefiles", self:package():sourcedir(), {filter = function (value)
+ return filter.handle(value, self:package())
+ end})
end
-- get the source root directory