Skip to content

Commit

Permalink
Xcode 12.0 support (#458)
Browse files Browse the repository at this point in the history
Xcode 12.0 support

* Fix Paths and use libXCTestBundleInject from the app, not from Xcode
* Fix error message that changed
* Clean up some scripts and fix a failing test
* Fix xctestrun path

Co-authored-by: Oscar Bonilla <6f6231@gmail.com>
  • Loading branch information
ravimandala and ob authored Sep 29, 2020
1 parent 506e399 commit 2e80798
Show file tree
Hide file tree
Showing 10 changed files with 49 additions and 53 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/PR.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ jobs:
steps:
# actions/checkout@v2 but we use the SHA1 because tags can be re-written in git
- uses: actions/checkout@722adc63f1aa60a57ec37892e133b1d319cae598
- name: Select Xcode 11.5
run: sudo xcode-select -s /Applications/Xcode_11.5.app
- name: Select Xcode 12
run: sudo xcode-select -s /Applications/Xcode_12.app
- name: Run Bluepill tests
run: ./scripts/bluepill.sh instance_tests

Expand All @@ -22,8 +22,8 @@ jobs:
steps:
# actions/checkout@v2 but we use the SHA1 because tags can be re-written in git
- uses: actions/checkout@722adc63f1aa60a57ec37892e133b1d319cae598
- name: Select Xcode 11.5
run: sudo xcode-select -s /Applications/Xcode_11.5.app
- name: Select Xcode 12
run: sudo xcode-select -s /Applications/Xcode_12.app
- name: Run BP tests
run: ./scripts/bluepill.sh runner_tests
- name: Build and Package
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/master.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,24 +11,24 @@ jobs:
# First machine, runs Bluepill tests
integration_tests:
name: Bluepill Test
runs-on: macOS-latest
runs-on: macos-latest
steps:
# actions/checkout@v2 but we use the sha because tags can be rewritten in git
- uses: actions/checkout@722adc63f1aa60a57ec37892e133b1d319cae598
- name: Select Xcode 11.5
run: sudo xcode-select -s /Applications/Xcode_11.5.app
- name: Select Xcode 12
run: sudo xcode-select -s /Applications/Xcode_12.app
- name: Run Bluepill tests
run: ./scripts/bluepill.sh instance_tests

# Second machine, runs BP tests and makes build
build:
name: BP Test and build
runs-on: macOS-latest
runs-on: macos-latest
steps:
# actions/checkout@v2 but we use the sha because tags can be rewritten in git
- uses: actions/checkout@722adc63f1aa60a57ec37892e133b1d319cae598
- name: Select Xcode 11.5
run: sudo xcode-select -s /Applications/Xcode_11.5.app
- name: Select Xcode 12
run: sudo xcode-select -s /Applications/Xcode_12.app
- name: Run BP tests
run: ./scripts/bluepill.sh runner_tests
- name: Build and Package
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,27 +9,27 @@ jobs:
# First machine, runs Bluepill tests
integration_tests:
name: Bluepill Test
runs-on: macOS-latest
runs-on: macos-latest
steps:
# actions/checkout@v2 but we use the sha because tags can be rewritten in git
- uses: actions/checkout@722adc63f1aa60a57ec37892e133b1d319cae598
- name: Select Xcode 11.5
run: sudo xcode-select -s /Applications/Xcode_11.5.app
- name: Select Xcode 12
run: sudo xcode-select -s /Applications/Xcode_12.app
- name: Run Bluepill tests
run: ./scripts/bluepill.sh instance_tests

# Second machine, runs BP tests and makes build
build:
name: BP Test and build
runs-on: macOS-latest
runs-on: macos-latest
steps:
# actions/checkout@v2 but we use the sha because tags can be rewritten in git
- uses: actions/checkout@722adc63f1aa60a57ec37892e133b1d319cae598
- name: Report event trigger data
run: |
echo "Event ${{ github.event_name }}, ref: ${{ github.ref }}"
- name: Select Xcode 11.5
run: sudo xcode-select -s /Applications/Xcode_11.5.app
- name: Select Xcode 12
run: sudo xcode-select -s /Applications/Xcode_12.app
- name: Run Bluepill tests
run: ./scripts/bluepill.sh runner_tests
- name: Build Bluepill
Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ Here is a list of Bluepill exit codes. If a Bluepill execution has multiple exit
## Requirements
Bluepill officially supports **Xcode 11.5**. If you're looking for old Xcode support, please checkout the following branches:
Bluepill officially supports **Xcode 12.0**. If you're looking for old Xcode support, please checkout the following branches:
* [Xcode-8](https://github.com/linkedin/bluepill/tree/xcode8)
* [Xcode-9.0](https://github.com/linkedin/bluepill/tree/xcode-9.0)
Expand All @@ -136,6 +136,7 @@ Bluepill officially supports **Xcode 11.5**. If you're looking for old Xcode sup
* [Xcode-11.2](https://github.com/linkedin/bluepill/tree/xcode-11.2)
* [Xcode-11.3](https://github.com/linkedin/bluepill/tree/xcode-11.3)
* [Xcode-11.4](https://github.com/linkedin/bluepill/tree/xcode-11.4)
* [Xcode-11.5](https://github.com/linkedin/bluepill/tree/xcode-11.5)
If you're looking for newer Xcode version support, try using Bluepill with `unsafe-skip-xcode-version-check` flag but make sure your app is tested with it and the underlying risks are understand.
Expand Down
2 changes: 1 addition & 1 deletion bluepill/tests/BPIntegrationTests.m
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ - (void)testTwoBPInstancesWithXCTestRunFile {
config.testBundlePath = nil;
config.testRunnerAppPath = nil;
NSString *baseSDK = [[NSString stringWithUTF8String:BP_DEFAULT_BASE_SDK] stringByReplacingOccurrencesOfString:@"iOS " withString:@""];
NSString *xcTestRunFile = [NSString stringWithFormat:@"Build/Products/BPSampleApp_iphonesimulator%@-x86_64.xctestrun", baseSDK];
NSString *xcTestRunFile = [NSString stringWithFormat:@"Build/Products/BPSampleApp_iphonesimulator%@-arm64-i386-x86_64.xctestrun", baseSDK];
config.xcTestRunPath = [[[BPTestHelper derivedDataPath] stringByDeletingLastPathComponent] stringByAppendingPathComponent:xcTestRunFile];
NSError *err;
[config validateConfigWithError:&err];
Expand Down
6 changes: 3 additions & 3 deletions bp/src/BPConstants.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
#import <Foundation/Foundation.h>

#pragma mark - Version Constants
#define BP_DEFAULT_XCODE_VERSION "11.5"
#define BP_DEFAULT_RUNTIME "iOS 13.5"
#define BP_DEFAULT_BASE_SDK "13.5"
#define BP_DEFAULT_XCODE_VERSION "12.0"
#define BP_DEFAULT_RUNTIME "iOS 14.0"
#define BP_DEFAULT_BASE_SDK "14.0"

#define BP_DEFAULT_DEVICE_TYPE "iPhone 8"

Expand Down
10 changes: 6 additions & 4 deletions bp/src/SimulatorHelper.m
Original file line number Diff line number Diff line change
Expand Up @@ -63,13 +63,15 @@ + (NSDictionary *)appLaunchEnvironmentWithBundleID:(NSString *)hostBundleID
device:(SimDevice *)device
config:(BPConfiguration *)config {
NSString *hostAppExecPath = [SimulatorHelper executablePathforPath:config.appBundlePath];
NSString *testSimulatorFrameworkPath = [[hostAppExecPath stringByDeletingLastPathComponent] stringByDeletingLastPathComponent];
NSString *hostAppPath = [hostAppExecPath stringByDeletingLastPathComponent];
NSString *testSimulatorFrameworkPath = [hostAppPath stringByDeletingLastPathComponent];
NSString *libXCTestBundleInject = [[hostAppPath stringByAppendingPathComponent:@"Frameworks"] stringByAppendingPathComponent:@"libXCTestBundleInject.dylib"];
NSMutableDictionary<NSString *, NSString *> *environment = [@{
@"DYLD_FALLBACK_FRAMEWORK_PATH" : [NSString stringWithFormat:@"%@/Library/Frameworks:%@/Platforms/iPhoneSimulator.platform/Developer/Library/Frameworks", config.xcodePath, config.xcodePath],
@"DYLD_FALLBACK_LIBRARY_PATH" : [NSString stringWithFormat:@"%@/Platforms/iPhoneOS.platform/Developer/Library/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/usr/lib", config.xcodePath],
@"DYLD_INSERT_LIBRARIES" : [NSString stringWithFormat:@"%@/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/Developer/usr/lib/libXCTTargetBootstrapInject.dylib", config.xcodePath],
@"DYLD_FALLBACK_LIBRARY_PATH" : [NSString stringWithFormat:@"%@/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/usr/lib", config.xcodePath],
@"DYLD_INSERT_LIBRARIES" : libXCTestBundleInject,
@"DYLD_LIBRARY_PATH" : [NSString stringWithFormat:@"%@/Platforms/iPhoneSimulator.platform/Developer/Library/Frameworks", config.xcodePath],
@"DYLD_ROOT_PATH" : [NSString stringWithFormat:@"%@/Platforms/iPhoneOS.platform/Developer/Library/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot", config.xcodePath],
@"DYLD_ROOT_PATH" : [NSString stringWithFormat:@"%@/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot", config.xcodePath],
@"NSUnbufferedIO" : @"1",
@"OS_ACTIVITY_DT_MODE" : @"1",
@"XCODE_DBG_XPC_EXCLUSIONS" : @"com.apple.dt.xctestSymbolicator",
Expand Down
2 changes: 1 addition & 1 deletion bp/tests/Resource Files/BPAppNegativeTests-results.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<testcase classname="BPAppNegativeTests" name="testAssertTrue">
</testcase>
<testcase classname="BPAppNegativeTests" name="testRaiseException">
<error type="Error" message="-[BPAppNegativeTests testRaiseException] : failed: caught &quot;Invalid foo value&quot;, &quot;foo of 1 is invalid&quot;">
<error type="Error" message="-[BPAppNegativeTests testRaiseException] : foo of 1 is invalid (Invalid foo value)">
/Users/obonilla/o/bluepill/BPSampleApp/BPAppNegativeTests/BPAppNegativeTests.m:48
</error>
<system-out>
Expand Down
2 changes: 1 addition & 1 deletion bp/tests/SimulatorHelperTests.m
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ - (void)testAppLaunchEnvironment {
config.outputDirectory = @"/Users/test/output";
NSDictionary *appLaunchEnvironment = [SimulatorHelper appLaunchEnvironmentWithBundleID:hostBundleId device:nil config:config];
XCTAssert([appLaunchEnvironment[@"DYLD_FALLBACK_FRAMEWORK_PATH"] containsString:@"Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/Library/Frameworks"]);
XCTAssert([appLaunchEnvironment[@"DYLD_INSERT_LIBRARIES"] containsString:@"Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/Developer/usr/lib/libXCTTargetBootstrapInject.dylib"]);
XCTAssert([appLaunchEnvironment[@"DYLD_INSERT_LIBRARIES"] containsString:@"libXCTestBundleInject.dylib"]);
XCTAssert([appLaunchEnvironment[@"DYLD_LIBRARY_PATH"] containsString:@"/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/Library/Frameworks"]);
XCTAssert([appLaunchEnvironment[@"XCTestConfigurationFilePath"] containsString:@"T/BPSampleAppTests-"]);
XCTAssertEqualObjects(appLaunchEnvironment[@"LLVM_PROFILE_FILE"], @"/Users/test/output/%p.profraw");
Expand Down
45 changes: 19 additions & 26 deletions scripts/bluepill.sh
Original file line number Diff line number Diff line change
@@ -1,25 +1,18 @@
# // Copyright 2016 LinkedIn Corporation
# // Licensed under the BSD 2-Clause License (the "License");
# // you may not use this file except in compliance with the License.
# // You may obtain a copy of the License at https://opensource.org/licenses/BSD-2-Clause
# //
# // Unless required by applicable law or agreed to in writing, software
# // distributed under the License is distributed on an "AS IS" BASIS,
# // WITHOUT WARRANTIES OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

#!/bin/bash
# Copyright 2016 LinkedIn Corporation
# Licensed under the BSD 2-Clause License (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at https://opensource.org/licenses/BSD-2-Clause
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

XCPRETTY='xcpretty --report junit'
command -v $XCPRETTY >/dev/null 2>&1 || {
XCPRETTY=cat
command -v "$XCPRETTY" >/dev/null 2>&1 || {
XCPRETTY="cat"
}

if [ "$1" == "-v" ]
then
VERBOSE=1
shift
fi

if [[ $# -ne 1 ]]; then
echo "$0: usage: bluepill.sh <command>"
exit 1
Expand Down Expand Up @@ -60,18 +53,18 @@ bluepill_build()
# package bluepill
TAG=$(git describe --always --tags)
DST="Bluepill-$TAG"
mkdir -p build/$DST/bin
cp build/Build/Products/Release/{bp,bluepill} build/$DST/bin
mkdir -p "build/$DST/bin"
cp build/Build/Products/Release/{bp,bluepill} "build/$DST/bin"
## build the man page
mkdir -p build/$DST/man/man1
/usr/bin/python scripts/man.py build/$DST/man/man1/bluepill.1
mkdir -p "build/$DST/man/man1"
/usr/bin/python scripts/man.py "build/$DST/man/man1/bluepill.1"
# License
cp LICENSE build/$DST
cp LICENSE "build/$DST"
# bptestrunner
cp bptestrunner/* build/$DST
cp bptestrunner/* "build/$DST"

(cd build && zip -qr $DST.zip $DST)
echo Release in build/$DST.zip
(cd build && zip -qr "$DST.zip" "$DST")
echo Release in "build/$DST.zip"
}

bluepill_build_sample_app()
Expand Down Expand Up @@ -142,6 +135,6 @@ then
bluepill_build_sample_app
fi

bluepill_$conf
"bluepill_$conf"

exit 0

0 comments on commit 2e80798

Please sign in to comment.