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.3k
xcconfig pitfalls
presented at iOSDC Japan 2017
toshi0383
September 17, 2017
Tweet
Share
More Decks by toshi0383
See All by toshi0383
Sheets API使ってみた
toshi0383
2
180
visionOSについてGlobeeが取り組んでいること
toshi0383
0
330
agile20150512-150512055145-lva1-app6892.pdf
toshi0383
0
90
たのしいAirPlay
toshi0383
1
600
Profiling using Signpost
toshi0383
2
820
AVPlayer周りの設計tips
toshi0383
6
780
cmdshelf::from("Swift")
toshi0383
3
780
AbemaTV iOSのダウンロード再生機能
toshi0383
4
920
tvOSのリスト系のインデックスラベルを自作してみる
toshi0383
0
540
Other Decks in Programming
See All in Programming
Exploring Type-Informed Lint Rules in Rust based TypeScript Linters
unvalley
3
650
Amazon Aurora Serverless v2が意外と高かった話と、AWS Database Migration Serviceの話
satoshi256kbyte
1
110
An adventure of Happy Eyeballs
coe401_
1
310
RailsConf 2024: Riffing on Rails: sketch your way to better designed code
kaspth
1
220
欠陥を早期に発見するための Software Engineer in Test とその重要性 / What is Software Engineer in Test and How they works
orgachem
PRO
19
2.5k
2024 コーディング研修
ckazu
2
680
TypeScriptから始める VR生活
tamagokakeg
2
140
Jetpack Composeとデザインシステム
rmakiyama
0
240
slow types ってなんだろう?
karad
0
210
otelcol receiver 自作RTA / Pepabo Tech Conference #22 春のSREまつり
arthur1
0
1.1k
ペパボOpenTelemetry革命
pyama86
2
1.2k
GitLab CI/CD で C#/WPFアプリケーションのテストとインストーラーのビルド・デプロイを自動化する
hacarus
0
630
Featured
See All Featured
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
117
18k
Stop Working from a Prison Cell
hatefulcrawdad
266
19k
Making Projects Easy
brettharned
109
5.5k
Fight the Zombie Pattern Library - RWD Summit 2016
marcelosomers
228
16k
The Mythical Team-Month
searls
217
42k
Code Reviewing Like a Champion
maltzj
516
39k
Easily Structure & Communicate Ideas using Wireframe
afnizarnur
188
16k
Into the Great Unknown - MozCon
thekraken
15
1.1k
Making the Leap to Tech Lead
cromwellryan
125
8.6k
In The Pink: A Labor of Love
frogandcode
138
21k
Building an army of robots
kneath
300
42k
jQuery: Nuts, Bolts and Bling
dougneiner
60
7.2k
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