Add codesign script and disable more signing for release modes

We have a custom codesign-after-copy script because Xcode's code sign on copy feature is bad when it
comes to frameworks including signable tools. In release build configurations, nothing we build uses
an ad-hoc code signature. This is logical because ad-hoc signatures are only meant to be used for testing purposes.
This commit is contained in:
Zorg committed 2016-04-17 03:20:57 -04:00
1 parent b9f2a24660
commit 22e32a2304
6 files changed
+53 -8

No files matched your search

+1 -2
View File
@@ -1,4 +1,4 @@
// Test Application only
// Test Application
INFOPLIST_FILE = TestApplication/TestApplication-Info.plist
WRAPPER_EXTENSION = app
@@ -6,4 +6,3 @@ ASSETCATALOG_COMPILER_APPICON_NAME = $(SPARKLE_ICON_NAME)
LD_RUNPATH_SEARCH_PATHS = @executable_path/../Frameworks
PRODUCT_BUNDLE_IDENTIFIER = org.sparkle-project.SparkleTestApp
CODE_SIGN_ENTITLEMENTS = TestApplication/Sparkle-Test-App.entitlements
CODE_SIGN_IDENTITY = -
@@ -0,0 +1,4 @@
// Test Application Debug
#include "ConfigTestApp.xcconfig"
CODE_SIGN_IDENTITY = -
+1 -2
View File
@@ -1,7 +1,6 @@
// Test Application Helper only
// Test Application Helper
INFOPLIST_FILE = TestAppHelper/Info.plist
WRAPPER_EXTENSION = xpc
LD_RUNPATH_SEARCH_PATHS = @executable_path/../../../../Frameworks
PRODUCT_BUNDLE_IDENTIFIER = org.sparkle-project.TestAppHelper
CODE_SIGN_IDENTITY = -
@@ -0,0 +1,4 @@
// Test Application Helper Debug
#include "ConfigTestAppHelper.xcconfig"
CODE_SIGN_IDENTITY = -
+8 -4
View File
@@ -903,6 +903,8 @@
72F94ED61CC344A7002DEE68 /* ConfigUpdateDownloaderDebug.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = ConfigUpdateDownloaderDebug.xcconfig; sourceTree = "<group>"; };
72F94ED71CC344E4002DEE68 /* ConfigAppcastDownloaderDebug.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = ConfigAppcastDownloaderDebug.xcconfig; sourceTree = "<group>"; };
72F94ED81CC34529002DEE68 /* ConfigRemoteMessagePortDebug.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = ConfigRemoteMessagePortDebug.xcconfig; sourceTree = "<group>"; };
72F94EDA1CC36C37002DEE68 /* ConfigTestAppDebug.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = ConfigTestAppDebug.xcconfig; sourceTree = "<group>"; };
72F94EDB1CC36C6F002DEE68 /* ConfigTestAppHelperDebug.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = ConfigTestAppHelperDebug.xcconfig; sourceTree = "<group>"; };
767B61AA1972D488004E0C3C /* SUGuidedPackageInstaller.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SUGuidedPackageInstaller.h; sourceTree = "<group>"; };
767B61AB1972D488004E0C3C /* SUGuidedPackageInstaller.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SUGuidedPackageInstaller.m; sourceTree = "<group>"; };
8DC2EF5A0486A6940098B216 /* Sparkle-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "Sparkle-Info.plist"; sourceTree = "<group>"; };
@@ -1619,7 +1621,9 @@
FA1941CE0D94A70100DD942E /* ConfigRelaunch.xcconfig */,
721C24571CB754E8005440CB /* ConfigInstallerProgress.xcconfig */,
FA1941CD0D94A70100DD942E /* ConfigTestApp.xcconfig */,
72F94EDA1CC36C37002DEE68 /* ConfigTestAppDebug.xcconfig */,
726E4A281C86CAB500C57C6A /* ConfigTestAppHelper.xcconfig */,
72F94EDB1CC36C6F002DEE68 /* ConfigTestAppHelperDebug.xcconfig */,
FA3AAF3B1050B273004B3130 /* ConfigUnitTest.xcconfig */,
149B78641B7D3A4800D7D62C /* ConfigUnitTestCoverage.xcconfig */,
729F10FD1C65A9B500DFCCC5 /* ConfigUITest.xcconfig */,
@@ -2896,7 +2900,7 @@
};
149B785C1B7D398100D7D62C /* Coverage */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = FA1941CD0D94A70100DD942E /* ConfigTestApp.xcconfig */;
baseConfigurationReference = 72F94EDA1CC36C37002DEE68 /* ConfigTestAppDebug.xcconfig */;
buildSettings = {
};
name = Coverage;
@@ -3012,7 +3016,7 @@
};
61B5F90609C4CEE300B25A18 /* Debug */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = FA1941CD0D94A70100DD942E /* ConfigTestApp.xcconfig */;
baseConfigurationReference = 72F94EDA1CC36C37002DEE68 /* ConfigTestAppDebug.xcconfig */;
buildSettings = {
};
name = Debug;
@@ -3124,14 +3128,14 @@
};
726E4A231C86C88F00C57C6A /* Debug */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 726E4A281C86CAB500C57C6A /* ConfigTestAppHelper.xcconfig */;
baseConfigurationReference = 72F94EDB1CC36C6F002DEE68 /* ConfigTestAppHelperDebug.xcconfig */;
buildSettings = {
};
name = Debug;
};
726E4A241C86C88F00C57C6A /* Coverage */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 726E4A281C86CAB500C57C6A /* ConfigTestAppHelper.xcconfig */;
baseConfigurationReference = 72F94EDB1CC36C6F002DEE68 /* ConfigTestAppHelperDebug.xcconfig */;
buildSettings = {
};
name = Coverage;
+35
View File
@@ -0,0 +1,35 @@
# You can run this by creating a new sh run script in your application target's build phase eg like so:
# /usr/bin/python ${SRCROOT}/codesign_sparkle.py
#
# You must also disable "Code Sign on Copy" option which Xcode defaults to having 'on' when copying Sparkle.framework into your application.
# We use this script instead because Apple's code sign on copy functionality does not work well for frameworks that include other bundles.
# Note this script is safe to run even if no code signing identity is being used (nothing would happen in this case)
import os, sys, subprocess
def code_sign(identity, path):
process = subprocess.Popen(["codesign", "-fs", identity, path], stdout=subprocess.PIPE)
process.communicate()
assert(process.returncode == 0)
if __name__ == "__main__":
sparkle_path = os.path.join(os.path.join(os.environ["TARGET_BUILD_DIR"], os.environ["FRAMEWORKS_FOLDER_PATH"]), "Sparkle.framework")
# It's ok if no code signing identity exists, that just means we won't have to do anything
try:
signing_identity = os.environ["CODE_SIGN_IDENTITY"]
except KeyError:
sys.exit(0)
if len(signing_identity) == 0:
sys.exit(0)
#Sign any services inside of our framework
services_directory = os.path.join(sparkle_path, "XPCServices")
for filename in os.listdir(services_directory):
if filename.endswith(".xpc"):
full_path = os.path.join(services_directory, filename)
code_sign(signing_identity, full_path)
#Finally sign our framework
code_sign(signing_identity, sparkle_path)