Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
xcconfig pitfalls
Search
toshi0383
September 17, 2017
Programming
0
1.5k
xcconfig pitfalls
presented at iOSDC Japan 2017
toshi0383
September 17, 2017
Tweet
Share
More Decks by toshi0383
See All by toshi0383
CoreDataはじめました
toshi0383
0
120
Swiftコードバトル必勝法
toshi0383
1
260
Sheets API使ってみた
toshi0383
2
320
visionOSについてGlobeeが取り組んでいること
toshi0383
0
490
agile20150512-150512055145-lva1-app6892.pdf
toshi0383
0
190
たのしいAirPlay
toshi0383
1
690
Profiling using Signpost
toshi0383
2
930
AVPlayer周りの設計tips
toshi0383
6
860
cmdshelf::from("Swift")
toshi0383
3
870
Other Decks in Programming
See All in Programming
Orleans + Sekiban + SignalR でリアルタイムWeb作ってみた
tomohisa
0
130
Cursor/Devin全社導入の理想と現実
saitoryc
24
18k
Rollupのビルド時間高速化によるプレビュー表示速度改善とバンドラとASTを駆使したプロダクト開発の難しさ
plaidtech
PRO
1
180
七輪ライブラリー: Claude AI で作る Next.js アプリ
suneo3476
1
130
Golangci-lint v2爆誕: 君たちはどうすべきか
logica0419
1
170
2ヶ月で生産性2倍、お買い物アプリ「カウシェ」4チーム同時改善の取り組み
ike002jp
1
100
GitHub Copilot for Azureを使い倒したい
ymd65536
1
200
KawaiiLT 登壇資料 キャリアとモチベーション
hiiragi
0
150
Building Scalable Mobile Projects: Fast Builds, High Reusability and Clear Ownership
cyrilmottier
2
310
「理解」を重視したAI活用開発
fast_doctor
0
200
State of Namespace
tagomoris
4
2.1k
파급효과: From AI to Android Development
l2hyunwoo
0
130
Featured
See All Featured
Dealing with People You Can't Stand - Big Design 2015
cassininazir
367
26k
10 Git Anti Patterns You Should be Aware of
lemiorhan
PRO
656
60k
Into the Great Unknown - MozCon
thekraken
38
1.7k
Code Reviewing Like a Champion
maltzj
523
40k
CoffeeScript is Beautiful & I Never Want to Write Plain JavaScript Again
sstephenson
160
15k
Building Better People: How to give real-time feedback that sticks.
wjessup
367
19k
The MySQL Ecosystem @ GitHub 2015
samlambert
251
12k
jQuery: Nuts, Bolts and Bling
dougneiner
63
7.7k
Evolution of real-time – Irina Nazarova, EuRuKo, 2024
irinanazarova
8
670
Rebuilding a faster, lazier Slack
samanthasiow
81
8.9k
Build The Right Thing And Hit Your Dates
maggiecrowley
35
2.7k
Performance Is Good for Brains [We Love Speed 2024]
tammyeverts
9
760
Transcript
xcconfig pitfalls (LT) iOSDC 2017 Sep 17, 2017 Toshihiro Suzuki
© Toshihiro Suzuki 2017 1
whoami — ླ ढ़༟ (@toshi0383) Toshihiro Suzuki — iOS/tvOS Dev
at AbemaTV — Father (5 month) — F1, GT SPORT © Toshihiro Suzuki 2017 2
tools and apps https://toshi0383.github.io/LGTM © Toshihiro Suzuki 2017 3
Agenda — What's xcconfig and Why would you use it?
— Common Pitfails © Toshihiro Suzuki 2017 4
What's xcconfig? where you put your build se!ings © Toshihiro
Suzuki 2017 5
How it looks on Xcode © Toshihiro Suzuki 2017 6
How it looks inside xcconfig © Toshihiro Suzuki 2017 7
Why? — Easier to review in Pull requests — Refactor
using #include — Reusable © Toshihiro Suzuki 2017 8
Recommended way to extract — Extract using toshi0383/xcconfig-extractor — Validate
using xcodebuild -showBuildSettings © Toshihiro Suzuki 2017 9
Let's Do it ! CONFIGURATION =-configuration Debug WORKSPACE =-workspace iOSSingleViewApp.xcworkspace
SCHEME =-scheme iOSSingleViewApp OPTIONS=$(CONFIGURATION) $(WORKSPACE) $(SCHEME) xcodebuild -showBuildSettings $(OPTIONS) > before xcconfig-extractor --no-trim-duplicates *.xcodeproj Config/xcconfigs xcodebuild -showBuildSettings $(OPTIONS) > after diff before after © Toshihiro Suzuki 2017 10
Sample App © Toshihiro Suzuki 2017 11
Result © Toshihiro Suzuki 2017 12
$(inherited) is ignored ! — ./Config/xcconfigs/iOSSingleViewApp-Debug.xcconfig FRAMEWORK_SEARCH_PATHS = $(inherited) $
(PROJECT_DIR)/Carthage/Build/iOS — ./Pods/Target Support Files/Pods-iOSSingleViewApp/ Pods-iOSSingleViewApp.debug.xcconfig FRAMEWORK_SEARCH_PATHS = $(inherited) "$ {PODS_ROOT}/TwitterCore/iOS" "${PODS_ROOT}/ TwitterKit/iOS" © Toshihiro Suzuki 2017 13
On CI.. e.g. fastlane's increment_version_number depends on agvtool © Toshihiro
Suzuki 2017 14
Migration failed! — Unwanted FRAMEWORK_SEACH_PATHS diff ! — Failed to
increment version using agvtool © Toshihiro Suzuki 2017 15
How $(inherited) works? — Inherites from parent LEVEL's value in
Build Settings — Does NOT work for #include © Toshihiro Suzuki 2017 16
App's FRAMEWORK_SEACH_PATHS overwri!en CocoaPods's © Toshihiro Suzuki 2017 17
Fix ✅ Set FRAMEWORK_SEACH_PATHS in rootObject's xcconfig © Toshihiro Suzuki
2017 18
Why agvtool failed to update version? — Answer: agvtool is
not clever enough — It does NOT search for INFOPLIST_FILE value in xcconfig. © Toshihiro Suzuki 2017 19
Workaround #1 Restore INFOPLIST_FILE in Xcode's buildSettings section © Toshihiro
Suzuki 2017 20
Workaround #2 Use /usr/libexec/PlistBuddy instead of agvtool e.g. APP_VERSION=$(git describe
--tags --abbrev=0) BUILD_VERSION=$BITRISE_BUILD_NUMBER /usr/libexec/PlistBuddy -c "Set :CFBundleShortVersionString ${APP_VERSION}" AbemaTV/Info.plist /usr/libexec/PlistBuddy -c "Set :CFBundleVersion ${BUILD_VERSION}" AbemaTV/Info.plist © Toshihiro Suzuki 2017 21
Summary © Toshihiro Suzuki 2017 22
$(inherited) — works btw LEVELs but not for #include INFOPLIST_FILE
— agvtool compatibility © Toshihiro Suzuki 2017 23
xcconfig-extractor Options: --no-trim-duplicates [default: false] --no-edit-pbxproj [default: false] --include-existing [default:
true] --no-set-configurations [default: false] © Toshihiro Suzuki 2017 24
End © Toshihiro Suzuki 2017 25
Toshihiro Suzuki Feel free to reach out! Twitter: @toshi0383 GitHub:
@toshi0383 Qiita: @toshi0383 Email:
[email protected]
© Toshihiro Suzuki 2017 26