diff options
| author | ruki <[email protected]> | 2025-09-20 00:49:52 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2025-09-20 00:49:52 +0800 |
| commit | 072c91d17ec55b94e9af3ce7fed09d885b2c2075 (patch) | |
| tree | 74ec1f9673ca22718914e9a32911cfdf00340674 /xmake/modules/private/tools/codesign.lua | |
| parent | 7186aec3786cd31f4dea25716ddf57954bef5bf6 (diff) | |
optimize codesign
Diffstat (limited to 'xmake/modules/private/tools/codesign.lua')
| -rw-r--r-- | xmake/modules/private/tools/codesign.lua | 45 |
1 files changed, 43 insertions, 2 deletions
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 {} |
