summaryrefslogtreecommitdiff
path: root/xmake
diff options
context:
space:
mode:
authorruki <[email protected]>2024-03-29 09:42:11 +0800
committerGitHub <[email protected]>2024-03-29 09:42:11 +0800
commitb5fbc28b673cd901602f54443c4679bc2a064346 (patch)
tree8462ad149ad96cbacb285b3c1f5552c69669a056 /xmake
parent4b5819f37565750c6b7da673dc7862f21d3db7bd (diff)
parent339c6712f390c511c98159ad7c5c8731734ba0c0 (diff)
Merge pull request #4894 from xmake-io/select
Improve to select scripts
Diffstat (limited to 'xmake')
-rw-r--r--xmake/core/base/private/select_script.lua19
1 files changed, 18 insertions, 1 deletions
diff --git a/xmake/core/base/private/select_script.lua b/xmake/core/base/private/select_script.lua
index 3fe88163f..23c8b55b6 100644
--- a/xmake/core/base/private/select_script.lua
+++ b/xmake/core/base/private/select_script.lua
@@ -36,6 +36,9 @@ function _match_pattern(pattern, plat, arch, opt)
local is_excluded_pattern = pattern_plat:find('!', 1, true)
if excluded and is_excluded_pattern then
matched = not ('!' .. plat):match('^' .. pattern_plat .. '$')
+ if matched then
+ return true
+ end
elseif not is_excluded_pattern then
matched = plat:match('^' .. pattern_plat .. '$')
end
@@ -68,11 +71,25 @@ end
-- match patterns
function _match_patterns(patterns, plat, arch, opt)
+ local patterns_excluded = {}
for _, pattern in ipairs(patterns) do
+ if pattern:startswith("!") then
+ table.insert(patterns_excluded, pattern)
+ else
+ if _match_pattern(pattern, plat, arch, opt) then
+ return true
+ end
+ end
+ end
+ local matched = 0
+ for _, pattern in ipairs(patterns_excluded) do
if _match_pattern(pattern, plat, arch, opt) then
- return true
+ matched = matched + 1
end
end
+ if #patterns_excluded > 0 and #patterns_excluded == matched then
+ return true
+ end
end
-- mattch the script pattern