Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Minor fixes for XCode 9.1 #207

Merged
merged 11 commits into from
Nov 29, 2017
4 changes: 2 additions & 2 deletions BPSampleApp/BPSampleApp.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -829,7 +829,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
DEVELOPMENT_TEAM = "";
INFOPLIST_FILE = BPSampleApp/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
IPHONEOS_DEPLOYMENT_TARGET = 11.1;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = LI.BPSampleApp;
PRODUCT_NAME = "$(TARGET_NAME)";
Expand All @@ -843,7 +843,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
DEVELOPMENT_TEAM = "";
INFOPLIST_FILE = BPSampleApp/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
IPHONEOS_DEPLOYMENT_TARGET = 11.1;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = LI.BPSampleApp;
PRODUCT_NAME = "$(TARGET_NAME)";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0900"
LastUpgradeVersion = "0910"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
2 changes: 1 addition & 1 deletion Bluepill-cli/BPInstanceTests/BluepillTests.m
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ - (void)setUp {
XCTAssert(self.config.simDeviceType != nil);

for (SimRuntime *runtime in [sc supportedRuntimes]) {
if ([[runtime name] isEqualToString:self.config.runtime]) {
if ([[runtime name] containsString:self.config.runtime]) {
self.config.simRuntime = runtime;
break;
}
Expand Down
2 changes: 1 addition & 1 deletion Bluepill-cli/Bluepill-cli.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -655,7 +655,7 @@
7A79017A1D5CB679004D4325 /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 0900;
LastUpgradeCheck = 0910;
ORGANIZATIONNAME = LinkedIn;
TargetAttributes = {
7A7901811D5CB679004D4325 = {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0900"
LastUpgradeVersion = "0910"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0900"
LastUpgradeVersion = "0910"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0900"
LastUpgradeVersion = "0910"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0900"
LastUpgradeVersion = "0910"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
2 changes: 1 addition & 1 deletion Bluepill-cli/Bluepill-cli/Bluepill/Helpers/BPHandler.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
dispatch_once_t onceToken;
}

typedef void (^BasicHandlerBlock)();
typedef void (^BasicHandlerBlock)(void);
typedef void (^BasicErrorBlock)(NSError *error);

@property (nonatomic, strong) BPWaitTimer *timer;
Expand Down
2 changes: 1 addition & 1 deletion Bluepill-cli/Bluepill-cli/Bluepill/Helpers/BPWaitTimer.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
@class BPWaitTimer;

typedef void (^BPWaitTimerBlock)(BPWaitTimer *timer);
typedef void (^BPWaitTimerTimeoutBlock)();
typedef void (^BPWaitTimerTimeoutBlock)(void);

/**
This class will call the specified timeout block if the
Expand Down
2 changes: 1 addition & 1 deletion Bluepill-cli/Bluepill-cli/Bluepill/Helpers/BPWaitTimer.m
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ - (void)start {
}];
}

- (void)startTimerFor:(NSTimeInterval)seconds withCompletion:(void (^)())block {
- (void)startTimerFor:(NSTimeInterval)seconds withCompletion:(void (^)(void))block {
self.timer = dispatch_source_create(DISPATCH_SOURCE_TYPE_TIMER, 0, 0, dispatch_get_global_queue(QOS_CLASS_BACKGROUND, 0));
__weak typeof(self) __self = self;
dispatch_source_set_timer(self.timer, dispatch_time(DISPATCH_TIME_NOW, seconds * NSEC_PER_SEC), DISPATCH_TIME_FOREVER, 0.1 * NSEC_PER_SEC);
Expand Down
2 changes: 1 addition & 1 deletion Bluepill-cli/Bluepill-cli/Simulator/SimulatorHelper.m
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ + (NSString *)testEnvironmentWithConfiguration:(BPConfiguration *)config {
xctConfig.treatMissingBaselinesAsFailures = NO;
xctConfig.targetApplicationPath = config.appBundlePath;
xctConfig.reportResultsToIDE = YES;
xctConfig.automationFrameworkPath = [NSString stringWithFormat:@"%@/Platforms/iPhoneSimulator.platform/Developer/Library/PrivateFrameworks/XCTAutomationSupport.framework", config.xcodePath],
xctConfig.automationFrameworkPath = [NSString stringWithFormat:@"%@/Platforms/iPhoneSimulator.platform/Developer/Library/PrivateFrameworks/XCTAutomationSupport.framework", config.xcodePath];
testHostPath = config.appBundlePath;

if (config.testRunnerAppPath) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0900"
LastUpgradeVersion = "0910"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
3 changes: 3 additions & 0 deletions Bluepill-runner/Bluepill-runner/BPApp.m
Original file line number Diff line number Diff line change
Expand Up @@ -65,13 +65,15 @@ @implementation BPApp

+ (NSArray <BPXCTestFile *>*)testsFromXCTestRunDict:(NSDictionary *)xcTestRunDict
andXCTestRunPath:(NSString *)xcTestRunPath
andXcodePath: (NSString *)xcodePath
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

extra space

withError:(NSError *__autoreleasing *)error {

NSMutableArray<BPXCTestFile *> *allTests = [[NSMutableArray alloc] init];
NSUInteger errorCount = 0;
for (NSString *key in xcTestRunDict) {
BPXCTestFile *xcTestFile = [BPXCTestFile BPXCTestFileFromDictionary:[xcTestRunDict objectForKey:key]
withTestRoot:[xcTestRunPath stringByDeletingLastPathComponent]
andXcodePath:xcodePath
andError:error];
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

indent is wrong

if (!xcTestFile) {
[BPUtils printInfo:ERROR withString:@"Failed to read data for %@", key];
Expand All @@ -98,6 +100,7 @@ + (instancetype)appWithConfig:(BPConfiguration *)config
[BPUtils printInfo:INFO withString:@"Using xctestrun configuration"];
NSArray<BPXCTestFile *> *loadedTests = [BPApp testsFromXCTestRunDict:config.xcTestRunDict
andXCTestRunPath:config.xcTestRunPath
andXcodePath:config.xcodePath
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

indent

withError:error];
if (loadedTests == nil) {
return nil;
Expand Down
3 changes: 2 additions & 1 deletion Bluepill-runner/Bluepill-runner/main.m
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,8 @@ int main(int argc, char * argv[]) {

//Check if Bluepill compile time Xcode version is matched with Bluepill runtime Xcode version
//Senario to prevent: Bluepill is compiled with Xcode 8, but runs with host installed with Xcode 9
if ([[BPUtils getXcodeRuntimeVersion] isEqualToString:@XCODE_VERSION]) {
//Only compare major version Exg. 9.1 == 9.1
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

major and minor version (not comparing patch version)

if ([[[BPUtils getXcodeRuntimeVersion] substringToIndex:3] isEqualToString:[@XCODE_VERSION substringToIndex:3]]) {
printf("Bluepill runtime version and compile time version are matched: %s\n", XCODE_VERSION);
} else {
fprintf(stderr, "ERROR: Bluepill runtime version %s and compile time version %s are mismatched\n", [[BPUtils getXcodeRuntimeVersion] UTF8String], XCODE_VERSION);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should also update the error msg to only use substring to index 3.. otherwise people would think you need the exact patch version

Expand Down
2 changes: 1 addition & 1 deletion Bluepill-runner/Bluepill.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@
BAEF4B2C1DAC539400E68294 /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 0900;
LastUpgradeCheck = 0910;
ORGANIZATIONNAME = LinkedIn;
TargetAttributes = {
BA1809DF1DBA8FB100D7D130 = {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0900"
LastUpgradeVersion = "0910"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0900"
LastUpgradeVersion = "0910"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0900"
LastUpgradeVersion = "0910"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
4 changes: 2 additions & 2 deletions Source/Shared/BPConstants.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@

#import <Foundation/Foundation.h>

#define BP_DEFAULT_RUNTIME "iOS 11.0"
#define BP_DEFAULT_RUNTIME "iOS 11.1"
#define BP_DEFAULT_DEVICE_TYPE "iPhone 7"
#define BP_DEFAULT_XCODE_VERSION "Xcode 9"
#define BP_DEFAULT_XCODE_VERSION "Xcode 9.1"
#define BP_TM_PROTOCOL_VERSION 17
#define BP_DAEMON_PROTOCOL_VERSION 24

Expand Down
1 change: 1 addition & 0 deletions Source/Shared/BPXCTestFile.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@

+ (instancetype)BPXCTestFileFromDictionary:(NSDictionary<NSString *, NSString *>*) dict
withTestRoot:(NSString *)testRoot
andXcodePath:(NSString *)xcodePath
andError:(NSError **)error;

- (NSUInteger)numTests;
Expand Down
25 changes: 16 additions & 9 deletions Source/Shared/BPXCTestFile.m
Original file line number Diff line number Diff line change
Expand Up @@ -101,11 +101,13 @@ + (instancetype)BPXCTestFileFromXCTestBundle:(NSString *)path

+ (instancetype)BPXCTestFileFromDictionary:(NSDictionary *)dict
withTestRoot:(NSString *)testRoot
andXcodePath:(NSString *)xcodePath
andError:(NSError *__autoreleasing *)error {
NSAssert(dict, @"A dictionary should be provided");
NSAssert(testRoot, @"A testRoot argument must be supplied");
NSString * const TESTROOT = @"__TESTROOT__";
NSString * const TESTHOST = @"__TESTHOST__";
NSString * const PLATFORMS = @"__PLATFORMS__";
NSString *testHostPath = [dict objectForKey:@"TestHostPath"];
NSString *testHostBundleIdentifier = [dict objectForKey:@"TestHostBundleIdentifier"];
if (!testHostPath) {
Expand All @@ -129,15 +131,20 @@ + (instancetype)BPXCTestFileFromDictionary:(NSDictionary *)dict
if ([testBundlePath rangeOfString:TESTHOST].location != NSNotFound) {
testBundlePath = [testBundlePath stringByReplacingOccurrencesOfString:TESTHOST withString:testHostPath];
} else if ([testBundlePath rangeOfString:TESTROOT].location != NSNotFound) {
testHostPath = [testHostPath stringByDeletingLastPathComponent]; //remove /bluepill
NSString *temp = [testHostPath stringByDeletingLastPathComponent]; //remove /iphonesimulator
//extract app name with .app extension
NSRange dotPosition = [testHostBundleIdentifier rangeOfString:@"." options:NSBackwardsSearch];
NSString *appName = [testHostBundleIdentifier substringFromIndex:dotPosition.location + 1];
NSString *appNameWithExtension = [appName stringByAppendingString:@".app"];
//append the app name to the direction
testHostPath = [testHostPath stringByAppendingString:appNameWithExtension];
testBundlePath = [testBundlePath stringByReplacingOccurrencesOfString:TESTROOT withString:temp];
if ([testHostPath rangeOfString:PLATFORMS].location != NSNotFound) {
NSString *platformsPath = [xcodePath stringByAppendingPathComponent:@"Platforms"];
testBundlePath = [testBundlePath stringByReplacingOccurrencesOfString:PLATFORMS withString:platformsPath];
} else {
testHostPath = [testHostPath stringByDeletingLastPathComponent]; //remove /bluepill
NSString *temp = [testHostPath stringByDeletingLastPathComponent]; //remove /iphonesimulator
//extract app name with .app extension
NSRange dotPosition = [testHostBundleIdentifier rangeOfString:@"." options:NSBackwardsSearch];
NSString *appName = [testHostBundleIdentifier substringFromIndex:dotPosition.location + 1];
NSString *appNameWithExtension = [appName stringByAppendingString:@".app"];
//append the app name to the direction
testHostPath = [testHostPath stringByAppendingString:appNameWithExtension];
testBundlePath = [testBundlePath stringByReplacingOccurrencesOfString:TESTROOT withString:temp];
}
} else {
[BPUtils printInfo:ERROR withString:@"testBundlePath is incorrect, please check xctestrun file"];
}
Expand Down
2 changes: 1 addition & 1 deletion circle.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
machine:
xcode:
version: 9.0
version: 9.1

compile:
override:
Expand Down
2 changes: 1 addition & 1 deletion scripts/bluepill.sh
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ bluepill_build_sample_app()
-workspace Bluepill.xcworkspace \
-scheme BPSampleApp \
-sdk iphonesimulator \
-destination 'platform=iOS Simulator,name=iPhone 7,OS=11.0.1' \
-destination 'platform=iOS Simulator,name=iPhone 7,OS=11.1' \
-derivedDataPath "build/" 2>&1 | tee result.txt | $XCPRETTY

test $? == 0 || {
Expand Down