summaryrefslogtreecommitdiff
path: root/xmake/core/project/target.lua
diff options
context:
space:
mode:
authorruki <[email protected]>2021-04-23 00:48:07 +0800
committerruki <[email protected]>2021-04-23 00:48:07 +0800
commit742e916cbd2a2d72ec8e7f59b3ca02e137d0bae2 (patch)
treea3fafa0187b77681553b8c1fae0ecab8e424822b /xmake/core/project/target.lua
parente124d5d2cc26aa76a0c295791c2ba18f101de7f8 (diff)
improve target sourcefiles
Diffstat (limited to 'xmake/core/project/target.lua')
-rw-r--r--xmake/core/project/target.lua18
1 files changed, 12 insertions, 6 deletions
diff --git a/xmake/core/project/target.lua b/xmake/core/project/target.lua
index 531ffb887..356358fab 100644
--- a/xmake/core/project/target.lua
+++ b/xmake/core/project/target.lua
@@ -1180,6 +1180,7 @@ function _instance:sourcefiles()
local sourcefiles_deleted = {}
local sourcefiles_inserted = {}
local deleted_count = 0
+ local targetcache = memcache.cache("core.project.target")
for _, file in ipairs(table.wrap(files)) do
-- mark as deleted files?
@@ -1189,13 +1190,18 @@ function _instance:sourcefiles()
deleted = true
end
- -- find source files
- local results = os.files(file)
- if #results == 0 then
- -- attempt to find source directories if maybe compile it as directory with the custom rules
- if #self:filerules(file) > 0 then
- results = os.dirs(file)
+ -- find source files and try to cache the matching results of os.match across targets
+ -- @see https://github.com/xmake-io/xmake/issues/1353
+ local results = targetcache:get2("sourcefiles", file)
+ if not results then
+ results = os.files(file)
+ if #results == 0 then
+ -- attempt to find source directories if maybe compile it as directory with the custom rules
+ if #self:filerules(file) > 0 then
+ results = os.dirs(file)
+ end
end
+ targetcache:set2("sourcefiles", file, results)
end
if #results == 0 then
local sourceinfo = (self:get("__sourceinfo_files") or {})[file] or {}