summaryrefslogtreecommitdiff
path: root/xmake/modules
diff options
context:
space:
mode:
Diffstat (limited to 'xmake/modules')
-rw-r--r--xmake/modules/detect/sdks/find_xcode.lua42
-rw-r--r--xmake/modules/private/tools/codesign.lua45
2 files changed, 44 insertions, 43 deletions
diff --git a/xmake/modules/detect/sdks/find_xcode.lua b/xmake/modules/detect/sdks/find_xcode.lua
index 6382ae577..22025da1d 100644
--- a/xmake/modules/detect/sdks/find_xcode.lua
+++ b/xmake/modules/detect/sdks/find_xcode.lua
@@ -120,47 +120,7 @@ function _find_xcode(sdkdir, opt)
-- find the target minver
local target_minver = _find_target_minver(sdkdir, sdkver, opt)
-
- -- find codesign
- local codesign_identity, mobile_provision
- if opt.find_codesign then
-
- -- find 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
- if codesign_identity == nil then
- local codesign_identities = codesign.codesign_identities()
- if codesign_identities then
- for identity, _ in pairs(codesign_identities) do
- codesign_identity = identity
- break
- end
- end
- end
-
- -- find mobile provision only for iphoneos
- if opt.plat == "iphoneos" then
- local mobile_provisions = codesign.mobile_provisions()
- if mobile_provisions then
- mobile_provision = config.get("xcode_mobile_provision")
- if mobile_provision == nil then -- we will disable mobile_provision if be false
- mobile_provision = global.get("xcode_mobile_provision")
- end
- if mobile_provision == nil then
- for provision, _ in pairs(mobile_provisions) do
- mobile_provision = provision
- break
- end
- -- valid mobile provision not found? reset it
- elseif not mobile_provisions[mobile_provision] then
- mobile_provision = nil
- end
- end
- end
- end
- return {sdkdir = sdkdir, sdkver = sdkver, target_minver = target_minver, codesign_identity = codesign_identity, mobile_provision = mobile_provision}
+ return {sdkdir = sdkdir, sdkver = sdkver, target_minver = target_minver}
end
-- find xcode toolchain
diff --git a/xmake/modules/private/tools/codesign.lua b/xmake/modules/private/tools/codesign.lua
index f38b3e073..8a1cd10b0 100644
--- a/xmake/modules/private/tools/codesign.lua
+++ b/xmake/modules/private/tools/codesign.lua
@@ -20,6 +20,8 @@
-- imports
import("lib.detect.find_tool")
+import("core.base.global")
+import("core.project.config")
import("core.cache.global_detectcache")
-- get mobile provision name
@@ -134,8 +136,47 @@ function unsign(programdir)
os.vrunv(codesign.program, {"--remove-signature", programdir})
end
--- main entry
-function main (programdir, codesign_identity, mobile_provision, opt)
+-- get the current codesign identity of xcode
+function xcode_codesign_identity()
+ local 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
+ if codesign_identity == nil then
+ local identities = codesign_identities()
+ if identities then
+ for identity, _ in pairs(identities) do
+ codesign_identity = identity
+ break
+ end
+ end
+ end
+ return codesign_identity
+end
+
+-- get the current mobile provision of xcode
+function xcode_mobile_provision()
+ local mobile_provision = config.get("xcode_mobile_provision")
+ if mobile_provision == nil then -- we will disable mobile_provision if be false
+ mobile_provision = global.get("xcode_mobile_provision")
+ end
+
+ local provisions = mobile_provisions()
+ if provisions then
+ if mobile_provision == nil then
+ for provision, _ in pairs(provisions) do
+ mobile_provision = provision
+ break
+ end
+ -- valid mobile provision not found? reset it
+ elseif not provisions[mobile_provision] then
+ mobile_provision = nil
+ end
+ end
+ return mobile_provision
+end
+
+function main(programdir, codesign_identity, mobile_provision, opt)
-- only for macosx
opt = opt or {}