diff --git a/BPSampleApp/BPSampleApp.xcodeproj/project.pbxproj b/BPSampleApp/BPSampleApp.xcodeproj/project.pbxproj index 97674f84..865ca8b2 100644 --- a/BPSampleApp/BPSampleApp.xcodeproj/project.pbxproj +++ b/BPSampleApp/BPSampleApp.xcodeproj/project.pbxproj @@ -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)"; @@ -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)"; diff --git a/BPSampleApp/BPSampleApp.xcodeproj/xcshareddata/xcschemes/BPSampleApp.xcscheme b/BPSampleApp/BPSampleApp.xcodeproj/xcshareddata/xcschemes/BPSampleApp.xcscheme index b77f06b3..a7dc36d7 100644 --- a/BPSampleApp/BPSampleApp.xcodeproj/xcshareddata/xcschemes/BPSampleApp.xcscheme +++ b/BPSampleApp/BPSampleApp.xcodeproj/xcshareddata/xcschemes/BPSampleApp.xcscheme @@ -1,6 +1,6 @@ *)testsFromXCTestRunDict:(NSDictionary *)xcTestRunDict andXCTestRunPath:(NSString *)xcTestRunPath + andXcodePath:(NSString *)xcodePath withError:(NSError *__autoreleasing *)error { NSMutableArray *allTests = [[NSMutableArray alloc] init]; @@ -72,7 +73,8 @@ @implementation BPApp for (NSString *key in xcTestRunDict) { BPXCTestFile *xcTestFile = [BPXCTestFile BPXCTestFileFromDictionary:[xcTestRunDict objectForKey:key] withTestRoot:[xcTestRunPath stringByDeletingLastPathComponent] - andError:error]; + andXcodePath:xcodePath + andError:error]; if (!xcTestFile) { [BPUtils printInfo:ERROR withString:@"Failed to read data for %@", key]; errorCount++; @@ -98,7 +100,8 @@ + (instancetype)appWithConfig:(BPConfiguration *)config [BPUtils printInfo:INFO withString:@"Using xctestrun configuration"]; NSArray *loadedTests = [BPApp testsFromXCTestRunDict:config.xcTestRunDict andXCTestRunPath:config.xcTestRunPath - withError:error]; + andXcodePath:config.xcodePath + withError:error]; if (loadedTests == nil) { return nil; } diff --git a/Bluepill-runner/Bluepill-runner/main.m b/Bluepill-runner/Bluepill-runner/main.m index cb592712..f897036b 100644 --- a/Bluepill-runner/Bluepill-runner/main.m +++ b/Bluepill-runner/Bluepill-runner/main.m @@ -64,19 +64,21 @@ int main(int argc, char * argv[]) { exit(0); } - //Check if xcode version running on the host match the intended Bluepill branch: Xcode 9 branch is not backward compatible + // Check if xcode version running on the host match the intended Bluepill branch: Xcode 9 branch is not backward compatible NSString *xcodeVersion = [BPUtils runShell:@"xcodebuild -version"]; if ([xcodeVersion rangeOfString:@BP_DEFAULT_XCODE_VERSION].location == NSNotFound) { fprintf(stderr, "ERROR: Invalid Xcode version:\n%s;\nOnly %s is supported\n", [xcodeVersion UTF8String], BP_DEFAULT_XCODE_VERSION); exit(1); } - //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]) { - printf("Bluepill runtime version and compile time version are matched: %s\n", XCODE_VERSION); + // 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 + // Only compare major and minor version version Exg. 9.1 == 9.1 + if ([[[BPUtils getXcodeRuntimeVersion] substringToIndex:3] isEqualToString:[@XCODE_VERSION substringToIndex:3]]) { + printf("Bluepill runtime version and compile time version are matched: %s\n", [[@XCODE_VERSION substringToIndex:3] UTF8String]); } else { - fprintf(stderr, "ERROR: Bluepill runtime version %s and compile time version %s are mismatched\n", [[BPUtils getXcodeRuntimeVersion] UTF8String], XCODE_VERSION); + fprintf(stderr, "ERROR: Bluepill runtime version %s and compile time version %s are mismatched\n", + [[[BPUtils getXcodeRuntimeVersion] substringToIndex:3] UTF8String], [[@XCODE_VERSION substringToIndex:3] UTF8String]); exit(1); } if (argv[1] && (!strcmp(argv[1], "--matrix"))) { diff --git a/Bluepill-runner/Bluepill.xcodeproj/project.pbxproj b/Bluepill-runner/Bluepill.xcodeproj/project.pbxproj index 7cb5765f..9b6c5fbf 100644 --- a/Bluepill-runner/Bluepill.xcodeproj/project.pbxproj +++ b/Bluepill-runner/Bluepill.xcodeproj/project.pbxproj @@ -277,7 +277,7 @@ BAEF4B2C1DAC539400E68294 /* Project object */ = { isa = PBXProject; attributes = { - LastUpgradeCheck = 0900; + LastUpgradeCheck = 0910; ORGANIZATIONNAME = LinkedIn; TargetAttributes = { BA1809DF1DBA8FB100D7D130 = { diff --git a/Bluepill-runner/Bluepill.xcodeproj/xcshareddata/xcschemes/BPIntegrationTests.xcscheme b/Bluepill-runner/Bluepill.xcodeproj/xcshareddata/xcschemes/BPIntegrationTests.xcscheme index b6633cf9..4c35a344 100644 --- a/Bluepill-runner/Bluepill.xcodeproj/xcshareddata/xcschemes/BPIntegrationTests.xcscheme +++ b/Bluepill-runner/Bluepill.xcodeproj/xcshareddata/xcschemes/BPIntegrationTests.xcscheme @@ -1,6 +1,6 @@ 0, only retry tests that failed | N | false | -| runtime | -r | What runtime to use. | N | iOS 10.3 | +| runtime | -r | What runtime to use. | N | iOS 11.1 | | stuck-timeout | -S | Timeout in seconds for a test that seems stuck (no output). | N | 300s | | test-timeout | -T | Timeout in seconds for a test that is producing output. | N | 300s | | test-bundle-path | -t | The path to the test bundle to execute (single .xctest). | N | n/a | @@ -98,8 +98,10 @@ A full list supported options are listed here. ## Requirements -Bluepill only works with **Xcode 9.0**. If you're looking for Xcode 8 support, please check out the -[xcode8](https://github.com/linkedin/bluepill/tree/xcode8) branch. +Bluepill only works with **Xcode 9.1**. If you're looking for old Xcode support, please check out the other branches: + +* [Xcode-8](https://github.com/linkedin/bluepill/tree/xcode8) +* [Xcode-9.0](https://github.com/linkedin/bluepill/tree/xcode-9.0) ## Acknowledgement diff --git a/Source/Shared/BPConstants.h b/Source/Shared/BPConstants.h index 51a5384f..796efb79 100644 --- a/Source/Shared/BPConstants.h +++ b/Source/Shared/BPConstants.h @@ -9,9 +9,9 @@ #import -#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 diff --git a/Source/Shared/BPXCTestFile.h b/Source/Shared/BPXCTestFile.h index 076c4599..198e4c01 100644 --- a/Source/Shared/BPXCTestFile.h +++ b/Source/Shared/BPXCTestFile.h @@ -34,6 +34,7 @@ + (instancetype)BPXCTestFileFromDictionary:(NSDictionary*) dict withTestRoot:(NSString *)testRoot + andXcodePath:(NSString *)xcodePath andError:(NSError **)error; - (NSUInteger)numTests; diff --git a/Source/Shared/BPXCTestFile.m b/Source/Shared/BPXCTestFile.m index 218a25d2..7ee34aa8 100644 --- a/Source/Shared/BPXCTestFile.m +++ b/Source/Shared/BPXCTestFile.m @@ -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) { @@ -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"]; } diff --git a/circle.yml b/circle.yml index 78f37c5b..506b166b 100644 --- a/circle.yml +++ b/circle.yml @@ -1,6 +1,6 @@ machine: xcode: - version: 9.0 + version: 9.1 compile: override: diff --git a/scripts/bluepill.sh b/scripts/bluepill.sh index 2aba792f..0338dc78 100755 --- a/scripts/bluepill.sh +++ b/scripts/bluepill.sh @@ -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 || {