Skip to content

Commit b35f6ca

Browse files
committed
Fix warning and CI build cripts
1 parent 2992453 commit b35f6ca

File tree

2 files changed

+100
-102
lines changed

2 files changed

+100
-102
lines changed

Sources/Extensions/UIView+PinLayout.swift

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -84,12 +84,8 @@ extension UIView: Layoutable, SizeCalculable {
8484
case .auto:
8585
if #available(iOS 10.0, tvOS 10.0, *) {
8686
return effectiveUserInterfaceLayoutDirection == .leftToRight
87-
} else if #available(iOS 9.0, *) {
88-
return UIView.userInterfaceLayoutDirection(for: semanticContentAttribute) == .leftToRight
89-
} else if let shared = UIApplication.value(forKey: "sharedApplication") as? UIApplication {
90-
return shared.userInterfaceLayoutDirection == .leftToRight
9187
} else {
92-
return true
88+
return UIView.userInterfaceLayoutDirection(for: semanticContentAttribute) == .leftToRight
9389
}
9490
case .ltr: return true
9591
case .rtl: return false

build-ci.sh

Lines changed: 99 additions & 97 deletions
Original file line numberDiff line numberDiff line change
@@ -1,68 +1,70 @@
1+
set -e
2+
13
DERIVED_DATA=${1:-/tmp/PinLayout}
24
BASEDIR=$(pwd)
35

4-
set -e &&
5-
set -o pipefail &&
6-
rm -rf $DERIVED_DATA &&
7-
8-
echo "===============================" &&
9-
echo "PinLayout-iOS" &&
10-
echo "===============================" &&
11-
time xcodebuild build -project PinLayout.xcodeproj -scheme PinLayout-iOS \
12-
-derivedDataPath $DERIVED_DATA -sdk iphonesimulator15.2 \
13-
-destination 'platform=iOS Simulator,name=iPhone 8,OS=15.2' \
14-
| xcpretty &&
6+
set -e
7+
set -o pipefail
8+
rm -rf $DERIVED_DATA
159

16-
echo "===============================" &&
17-
echo "PinLayout-tvOS" &&
18-
echo "===============================" &&
19-
time xcodebuild build -project PinLayout.xcodeproj -scheme PinLayout-tvOS \
10+
# echo "==============================="
11+
# echo "PinLayout-iOS"
12+
# echo "==============================="
13+
# xcodebuild build -project PinLayout.xcodeproj -scheme PinLayout-iOS \
14+
# -derivedDataPath $DERIVED_DATA -sdk iphonesimulator15.2 \
15+
# -destination 'platform=iOS Simulator,name=iPhone 8,OS=15.2' \
16+
# | xcpretty
17+
18+
echo "==============================="
19+
echo "PinLayout-tvOS"
20+
echo "==============================="
21+
xcodebuild build -project PinLayout.xcodeproj -scheme PinLayout-tvOS \
2022
-derivedDataPath $DERIVED_DATA -sdk appletvsimulator15.2 \
2123
-destination 'platform=tvOS Simulator,name=Apple TV 4K (2nd generation),OS=15.2' \
22-
| xcpretty &&
23-
24-
echo "===============================" &&
25-
echo "PinLayout-macOS" &&
26-
echo "===============================" &&
27-
time xcodebuild build -project PinLayout.xcodeproj -scheme PinLayout-macOS \
28-
-derivedDataPath $DERIVED_DATA -sdk macosx11.3 \
29-
| xcpretty &&
30-
31-
echo "===============================" &&
32-
echo "PinLayoutSample" &&
33-
echo "===============================" &&
34-
time xcodebuild build -workspace PinLayout.xcworkspace -scheme PinLayoutSample \
24+
| xcpretty
25+
26+
echo "==============================="
27+
echo "PinLayout-macOS"
28+
echo "==============================="
29+
xcodebuild build -project PinLayout.xcodeproj -scheme PinLayout-macOS \
30+
-derivedDataPath $DERIVED_DATA -sdk macosx12.1 \
31+
| xcpretty
32+
33+
echo "==============================="
34+
echo "PinLayoutSample"
35+
echo "==============================="
36+
xcodebuild build -workspace PinLayout.xcworkspace -scheme PinLayoutSample \
3537
-derivedDataPath $DERIVED_DATA -sdk iphonesimulator15.2 \
3638
-destination 'platform=iOS Simulator,name=iPhone 8,OS=15.2' \
37-
| xcpretty &&
39+
| xcpretty
3840

39-
time xcodebuild build -workspace PinLayout.xcworkspace -scheme PinLayoutSample \
41+
xcodebuild build -workspace PinLayout.xcworkspace -scheme PinLayoutSample \
4042
-derivedDataPath $DERIVED_DATA -sdk iphonesimulator15.2 \
4143
-destination 'platform=iOS Simulator,name=iPhone 7,OS=11.4' \
42-
| xcpretty &&
44+
| xcpretty
4345

44-
echo "===============================" &&
45-
echo "iOS unit test" &&
46-
echo "===============================" &&
47-
time xcodebuild build test -workspace PinLayout.xcworkspace -scheme PinLayout-iOS \
46+
echo "==============================="
47+
echo "iOS unit test"
48+
echo "==============================="
49+
xcodebuild build test -workspace PinLayout.xcworkspace -scheme PinLayout-iOS \
4850
-derivedDataPath $DERIVED_DATA -sdk iphonesimulator15.2 \
4951
-destination 'platform=iOS Simulator,name=iPhone 7,OS=11.4' \
50-
| xcpretty &&
52+
| xcpretty
5153

52-
time xcodebuild build test -workspace PinLayout.xcworkspace -scheme PinLayout-iOS \
54+
xcodebuild build test -workspace PinLayout.xcworkspace -scheme PinLayout-iOS \
5355
-derivedDataPath $DERIVED_DATA -sdk iphonesimulator15.2 \
5456
-destination 'platform=iOS Simulator,name=iPhone 8,OS=13.5' \
55-
| xcpretty &&
57+
| xcpretty
5658

57-
time xcodebuild build test -workspace PinLayout.xcworkspace -scheme PinLayout-iOS \
59+
xcodebuild build test -workspace PinLayout.xcworkspace -scheme PinLayout-iOS \
5860
-derivedDataPath $DERIVED_DATA -sdk iphonesimulator15.2 \
5961
-destination 'platform=iOS Simulator,name=iPhone 8,OS=15.2' \
60-
| xcpretty &&
62+
| xcpretty
6163

6264
# echo "==============================="
6365
# echo "tvOS unit test"
6466
# echo "==============================="
65-
# time xcodebuild build test -workspace PinLayout.xcworkspace -scheme PinLayout-tvOS \
67+
# xcodebuild build test -workspace PinLayout.xcworkspace -scheme PinLayout-tvOS \
6668
# -derivedDataPath $DERIVED_DATA -sdk appletvos15.2 \
6769
# -destination 'platform=tvOS Simulator,name=Apple TV 4K (2nd generation),OS=15.2' \
6870
# | xcpretty
@@ -71,66 +73,66 @@ time xcodebuild build test -workspace PinLayout.xcworkspace -scheme PinLayout-i
7173
# echo "==============================="
7274
# echo "macOS unit test"
7375
# echo "==============================="
74-
# time xcodebuild clean test -workspace PinLayout.xcworkspace -scheme PinLayout-macOS \
75-
# -derivedDataPath $DERIVED_DATA -sdk macosx11.3 \
76+
# xcodebuild clean test -workspace PinLayout.xcworkspace -scheme PinLayout-macOS \
77+
# -derivedDataPath $DERIVED_DATA -sdk macosx12.1 \
7678
# | xcpretty
7779

78-
echo "===============================" &&
79-
echo " Cocoapods: iOS Empty project" &&
80-
echo "===============================" &&
81-
cd TestProjects/cocoapods/ios &&
82-
rm -rf $DERIVED_DATA &&
83-
pod install &&
84-
time xcodebuild clean build -workspace PinLayout-iOS.xcworkspace -scheme PinLayout-iOS \
80+
echo "==============================="
81+
echo " Cocoapods: iOS Empty project"
82+
echo "==============================="
83+
cd TestProjects/cocoapods/ios
84+
rm -rf $DERIVED_DATA
85+
pod install
86+
xcodebuild clean build -workspace PinLayout-iOS.xcworkspace -scheme PinLayout-iOS \
8587
-sdk iphonesimulator15.2 -derivedDataPath $DERIVED_DATA \
8688
-destination 'platform=iOS Simulator,name=iPhone 8,OS=15.2' \
87-
| xcpretty &&
88-
cd ../../.. &&
89-
90-
91-
echo "===============================" &&
92-
echo " Cocoapods: macOS Empty project" &&
93-
echo "===============================" &&
94-
cd TestProjects/cocoapods/macos &&
95-
rm -rf $DERIVED_DATA &&
96-
pod install &&
97-
time xcodebuild clean build -workspace PinLayout-macOS.xcworkspace -scheme PinLayout-macOS \
98-
-sdk macosx11.3 -derivedDataPath $DERIVED_DATA \
99-
| xcpretty &&
100-
rm -rf $DERIVED_DATA &&
101-
cd ../../.. &&
102-
103-
104-
echo "===============================" &&
105-
echo " Cocoapods: tvOS Empty project" &&
106-
echo "===============================" &&
107-
cd TestProjects/cocoapods/tvos &&
108-
rm -rf $DERIVED_DATA &&
109-
pod install &&
110-
time xcodebuild clean build -workspace PinLayout-tvOS.xcworkspace -scheme PinLayout-tvOS \
89+
| xcpretty
90+
cd ../../..
91+
92+
93+
echo "==============================="
94+
echo " Cocoapods: macOS Empty project"
95+
echo "==============================="
96+
cd TestProjects/cocoapods/macos
97+
rm -rf $DERIVED_DATA
98+
pod install
99+
xcodebuild clean build -workspace PinLayout-macOS.xcworkspace -scheme PinLayout-macOS \
100+
-sdk macosx12.1 -derivedDataPath $DERIVED_DATA \
101+
| xcpretty
102+
rm -rf $DERIVED_DATA
103+
cd ../../..
104+
105+
106+
echo "==============================="
107+
echo " Cocoapods: tvOS Empty project"
108+
echo "==============================="
109+
cd TestProjects/cocoapods/tvos
110+
rm -rf $DERIVED_DATA
111+
pod install
112+
xcodebuild clean build -workspace PinLayout-tvOS.xcworkspace -scheme PinLayout-tvOS \
111113
-sdk appletvsimulator15.2 -derivedDataPath $DERIVED_DATA \
112114
-destination 'platform=tvOS Simulator,name=Apple TV 4K (2nd generation),OS=15.2' \
113-
| xcpretty &&
114-
rm -rf $DERIVED_DATA &&
115-
cd ../../.. &&
116-
117-
118-
echo "===============================" &&
119-
echo " Carthage: iOS Empty project" &&
120-
echo "===============================" &&
121-
cd TestProjects/carthage/ios &&
122-
rm -rf $DERIVED_DATA &&
123-
rm Cartfile &&
124-
echo "git \"file:///$BASEDIR\"" > Cartfile &&
125-
carthage update --use-ssh --platform iOS --use-xcframeworks &&
126-
time xcodebuild clean build -project PinLayout-Carthage-iOS.xcodeproj \
115+
| xcpretty
116+
rm -rf $DERIVED_DATA
117+
cd ../../..
118+
119+
120+
echo "==============================="
121+
echo " Carthage: iOS Empty project"
122+
echo "==============================="
123+
cd TestProjects/carthage/ios
124+
rm -rf $DERIVED_DATA
125+
rm Cartfile
126+
echo "git \"file:///$BASEDIR\"" > Cartfile
127+
carthage update --use-ssh --platform iOS --use-xcframeworks
128+
xcodebuild clean build -project PinLayout-Carthage-iOS.xcodeproj \
127129
-scheme PinLayout-Carthage-iOS -sdk iphonesimulator15.2 \
128130
-derivedDataPath $DERIVED_DATA \
129131
-destination 'platform=iOS Simulator,name=iPhone 8,OS=15.2' \
130-
| xcpretty &&
131-
rm -rf $DERIVED_DATA &&
132-
rm Cartfile.resolved &&
133-
cd ../../.. &&
132+
| xcpretty
133+
rm -rf $DERIVED_DATA
134+
rm Cartfile.resolved
135+
cd ../../..
134136

135137

136138
echo "=========================================="
@@ -139,13 +141,13 @@ echo "=========================================="
139141
cd TestProjects/swift-package-manager/ios
140142
rm -rf $DERIVED_DATA
141143
rm -rf .build
142-
time xcodebuild clean build -project PinLayout-SPM-iOS.xcodeproj -scheme PinLayout-SPM-iOS -sdk iphonesimulator15.2 -derivedDataPath $DERIVED_DATA \
144+
xcodebuild clean build -project PinLayout-SPM-iOS.xcodeproj -scheme PinLayout-SPM-iOS -sdk iphonesimulator15.2 -derivedDataPath $DERIVED_DATA \
143145
-destination 'platform=iOS Simulator,name=iPhone 8,OS=15.2' \
144146
| xcpretty
145147
cd ../../..
146148

147149

148-
echo "===============================" &&
149-
echo " Pod lib lint" &&
150-
echo "===============================" &&
151-
time bundle exec pod lib lint --allow-warnings
150+
echo "==============================="
151+
echo " Pod lib lint"
152+
echo "==============================="
153+
bundle exec pod lib lint --allow-warnings

0 commit comments

Comments
 (0)