Skip to content

Commit 532ca91

Browse files
authored
Merge pull request #170 from SDWebImage/update_travis
Update the Travis to use Xcode 12
2 parents 00deaa8 + 78a2769 commit 532ca91

File tree

3 files changed

+31
-7
lines changed

3 files changed

+31
-7
lines changed

.travis.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
language: swift
2-
osx_image: xcode11.4
2+
osx_image: xcode12
33

44
env:
55
global:
@@ -33,8 +33,8 @@ script:
3333
- pod install --project-directory=Example
3434
- xcodebuild build -workspace Example/SDWebImageSwiftUI.xcworkspace -scheme SDWebImageSwiftUIDemo -destination 'name=iPhone 11 Pro Max' -configuration Debug | xcpretty -c
3535

36-
- carthage update --configuration Debug
37-
- xcodebuild build -project SDWebImageSwiftUI.xcodeproj -scheme 'SDWebImageSwiftUI' -sdk iphonesimulator -configuration Debug | xcpretty -c
36+
- ./carthage.sh update --configuration Debug
37+
- xcodebuild build -project SDWebImageSwiftUI.xcodeproj -scheme 'SDWebImageSwiftUI' -destination 'name=iPhone 11 Pro Max' -configuration Debug | xcpretty -c
3838

3939
- echo Clean DerivedData
4040
- rm -rf ~/Library/Developer/Xcode/DerivedData/

Tests/WebImageTests.swift

+9-4
Original file line numberDiff line numberDiff line change
@@ -162,10 +162,15 @@ class WebImageTests: XCTestCase {
162162
let displayImage = try? imageView.inspect().group().image(0).nsImage()
163163
XCTAssertNotNil(displayImage)
164164
#else
165-
let displayImage = try? imageView.inspect().group().image(0).cgImage()
166-
let orientation = try! imageView.inspect().group().image(0).orientation()
167-
XCTAssertNotNil(displayImage)
168-
XCTAssertEqual(orientation, .leftMirrored)
165+
if #available(iOS 14.0, watchOS 7.0, tvOS 14.0, *) {
166+
let displayImage = try? imageView.inspect().group().image(0).uiImage()
167+
XCTAssertEqual(displayImage, image)
168+
} else {
169+
let displayImage = try? imageView.inspect().group().image(0).cgImage()
170+
let orientation = try? imageView.inspect().group().image(0).orientation()
171+
XCTAssertNotNil(displayImage)
172+
XCTAssertEqual(orientation, .leftMirrored)
173+
}
169174
#endif
170175
expectation.fulfill()
171176
}.onFailure { error in

carthage.sh

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# carthage.sh
2+
# Usage example: ./carthage.sh build --platform iOS
3+
4+
set -euo pipefail
5+
6+
xcconfig=$(mktemp /tmp/static.xcconfig.XXXXXX)
7+
trap 'rm -f "$xcconfig"' INT TERM HUP EXIT
8+
9+
# For Xcode 12 make sure EXCLUDED_ARCHS is set to arm architectures otherwise
10+
# the build will fail on lipo due to duplicate architectures.
11+
12+
CURRENT_XCODE_VERSION=$(xcodebuild -version | grep "Build version" | cut -d' ' -f3)
13+
echo "EXCLUDED_ARCHS__EFFECTIVE_PLATFORM_SUFFIX_simulator__NATIVE_ARCH_64_BIT_x86_64__XCODE_1200__BUILD_$CURRENT_XCODE_VERSION = arm64 arm64e armv7 armv7s armv6 armv8" >> $xcconfig
14+
15+
echo 'EXCLUDED_ARCHS__EFFECTIVE_PLATFORM_SUFFIX_simulator__NATIVE_ARCH_64_BIT_x86_64__XCODE_1200 = $(EXCLUDED_ARCHS__EFFECTIVE_PLATFORM_SUFFIX_simulator__NATIVE_ARCH_64_BIT_x86_64__XCODE_1200__BUILD_$(XCODE_PRODUCT_BUILD_VERSION))' >> $xcconfig
16+
echo 'EXCLUDED_ARCHS = $(inherited) $(EXCLUDED_ARCHS__EFFECTIVE_PLATFORM_SUFFIX_$(EFFECTIVE_PLATFORM_SUFFIX)__NATIVE_ARCH_64_BIT_$(NATIVE_ARCH_64_BIT)__XCODE_$(XCODE_VERSION_MAJOR))' >> $xcconfig
17+
18+
export XCODE_XCCONFIG_FILE="$xcconfig"
19+
carthage "$@"

0 commit comments

Comments
 (0)