Corrected test app updates check when it's signed.

This commit is contained in:
Dmytro Tretiakov committed 2015-08-26 12:07:42 +03:00
1 parent bf11f076dc
commit 45345c0a44
2 files changed
+20

No files matched your search

+1
View File
@@ -5,3 +5,4 @@ WRAPPER_EXTENSION = app
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon
LD_RUNPATH_SEARCH_PATHS = @executable_path/../Frameworks
PRODUCT_BUNDLE_IDENTIFIER = org.sparkle-project.SparkleTestApp
GCC_PREPROCESSOR_DEFINITIONS = $(inherited) CODE_SIGN_IDENTITY="$(CODE_SIGN_IDENTITY)"
@@ -9,6 +9,13 @@
#import "SUTestApplicationDelegate.h"
#import "SUUpdateSettingsWindowController.h"
#define MACROSTRING(x) #x
#define NSSTRING_MACRO(x) @MACROSTRING(x)
#ifndef CODE_SIGN_IDENTITY
#define CODE_SIGN_IDENTITY
#endif
@interface SUTestApplicationDelegate ()
@property (nonatomic) SUUpdateSettingsWindowController *updateSettingsWindowController;
@@ -22,6 +29,7 @@
@synthesize serverTask = _serverTask;
static NSString * const UPDATED_VERSION = @"2.0";
static NSString * const CODE_SIGN_ID = NSSTRING_MACRO(CODE_SIGN_IDENTITY);
- (void)applicationDidFinishLaunching:(NSNotification * __unused)notification
{
@@ -91,6 +99,17 @@ static NSString * const UPDATED_VERSION = @"2.0";
BOOL wroteInfoFile = [infoDictionary writeToURL:infoURL atomically:NO];
assert(wroteInfoFile);
if ([CODE_SIGN_ID length])
{
NSTask *codesignTask = [[NSTask alloc] init];
codesignTask.launchPath = @"/usr/bin/codesign";
codesignTask.arguments = @[@"-s", CODE_SIGN_ID, @"-fv", destinationBundleURL.path];
[codesignTask launch];
[codesignTask waitUntilExit];
assert(codesignTask.terminationStatus == 0);
}
// Change current working directory so web server knows where to list files
BOOL changedCurrentWorkingDirectory = [fileManager changeCurrentDirectoryPath:serverDirectoryURL.path];
assert(changedCurrentWorkingDirectory);