summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2021-05-15 00:45:01 +0800
committerruki <[email protected]>2021-05-15 00:45:01 +0800
commitafdbc1e7ecd6815e807901d573749a6224311545 (patch)
treed95dd13e93802e6a561f3569613e2196f917bac4
parent901c937daf4e72aac6de2019f1107ba0b885ee1b (diff)
improve and fix find codesign
-rw-r--r--xmake/modules/detect/sdks/find_xcode.lua4
-rw-r--r--xmake/modules/private/tools/codesign.lua17
2 files changed, 11 insertions, 10 deletions
diff --git a/xmake/modules/detect/sdks/find_xcode.lua b/xmake/modules/detect/sdks/find_xcode.lua
index 02ea606bf..b78bc29c3 100644
--- a/xmake/modules/detect/sdks/find_xcode.lua
+++ b/xmake/modules/detect/sdks/find_xcode.lua
@@ -82,10 +82,11 @@ function _find_xcode(sdkdir, opt)
end
-- find codesign
+ local codesign_identity, mobile_provision
if opt.find_codesign then
-- find codesign identity
- local codesign_identity = config.get("xcode_codesign_identity")
+ codesign_identity = config.get("xcode_codesign_identity")
if codesign_identity == nil then -- we will disable codesign_identity if be false
codesign_identity = global.get("xcode_codesign_identity")
end
@@ -100,7 +101,6 @@ function _find_xcode(sdkdir, opt)
end
-- find mobile provision only for iphoneos
- local mobile_provision
if opt.plat == "iphoneos" then
local mobile_provisions = codesign.mobile_provisions()
if mobile_provisions then
diff --git a/xmake/modules/private/tools/codesign.lua b/xmake/modules/private/tools/codesign.lua
index f74c36f5b..42ca094bc 100644
--- a/xmake/modules/private/tools/codesign.lua
+++ b/xmake/modules/private/tools/codesign.lua
@@ -48,16 +48,17 @@ function codesign_identities()
local identities = _g.identities
if identities == nil then
identities = {}
- local results = try { function() return os.iorun("/usr/bin/security find-identity -v -p codesigning") end }
- if not results then
- results = try { function() return os.iorun("/usr/bin/security find-identity") end }
- if results then
- local splitinfo = results:split("Valid identities only", {plain = true})
- if splitinfo and #splitinfo > 1 then
- results = splitinfo[2]
- end
+ local results = try { function() return os.iorun("/usr/bin/security find-identity") end }
+ if results then
+ local splitinfo = results:split("Valid identities only", {plain = true})
+ if splitinfo and #splitinfo > 1 then
+ results = splitinfo[2]
end
end
+ if not results then
+ -- it may be slower
+ results = try { function() return os.iorun("/usr/bin/security find-identity -v -p codesigning") end }
+ end
if results then
for _, line in ipairs(results:split('\n', {plain = true})) do
local sign, identity = line:match("%) (%w+) \"(.+)\"")