From ef5992bb58473bca8c019f2eba9faa0048aa0c05 Mon Sep 17 00:00:00 2001 From: Jake Petroules Date: Tue, 9 Jun 2015 23:53:05 -0700 Subject: Add code signing support for OS X and iOS. Change-Id: Ia85f68692974288780484fa47a896d66f16bc11b Reviewed-by: Christian Kandeler --- share/qbs/modules/bundle/BundleModule.qbs | 36 +++++++++++++++++++++++++------ 1 file changed, 30 insertions(+), 6 deletions(-) (limited to 'share/qbs/modules/bundle/BundleModule.qbs') diff --git a/share/qbs/modules/bundle/BundleModule.qbs b/share/qbs/modules/bundle/BundleModule.qbs index c553946d8..d1dee8e14 100644 --- a/share/qbs/modules/bundle/BundleModule.qbs +++ b/share/qbs/modules/bundle/BundleModule.qbs @@ -426,7 +426,7 @@ Module { condition: qbs.targetOS.contains("darwin") multiplex: true inputs: ["infoplist", "pkginfo", "hpp", - "icns", "resourcerules", "ipa", + "icns", "resourcerules", "compiled_nib", "compiled_storyboard", "compiled_assetcatalog"] outputFileTags: ["bundle", @@ -610,12 +610,36 @@ Module { if (cmd.sources && cmd.sources.length) commands.push(cmd); - if (product.type.contains("application") && product.moduleProperty("qbs", "hostOS").contains("darwin")) { + if (product.moduleProperty("qbs", "hostOS").contains("darwin")) { for (i in bundles) { - cmd = new Command(ModUtils.moduleProperty(product, "lsregisterPath"), - ["-f", bundles[i].filePath]); - cmd.description = "register " + ModUtils.moduleProperty(product, "bundleName"); - commands.push(cmd); + var actualSigningIdentity = product.moduleProperty("xcode", "actualSigningIdentity"); + var codesignDisplayName = product.moduleProperty("xcode", "actualSigningIdentityDisplayName"); + if (actualSigningIdentity) { + // If this is a framework, we need to sign its versioned directory + var subpath = ""; + var frameworkVersion = ModUtils.moduleProperty(product, "frameworkVersion"); + if (frameworkVersion) { + subpath = ModUtils.moduleProperty(product, "contentsFolderPath"); + subpath = subpath.substring(subpath.indexOf(ModUtils.moduleProperty("qbs", "pathSeparator"))); + } + + cmd = new Command(product.moduleProperty("xcode", "codesignPath"), + (product.moduleProperty("xcode", "codesignFlags") || []) + .concat(["--force", "--sign", actualSigningIdentity, + bundles[i].filePath + subpath])); + cmd.description = "codesign " + + ModUtils.moduleProperty(product, "bundleName") + + " using " + codesignDisplayName + + " (" + actualSigningIdentity + ")"; + commands.push(cmd); + } + + if (product.type.contains("application")) { + cmd = new Command(ModUtils.moduleProperty(product, "lsregisterPath"), + ["-f", bundles[i].filePath]); + cmd.description = "register " + ModUtils.moduleProperty(product, "bundleName"); + commands.push(cmd); + } } } -- cgit v1.2.3