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
97
Swiftコードバトル必勝法
toshi0383
1
200
Sheets API使ってみた
toshi0383
2
250
visionOSについてGlobeeが取り組んでいること
toshi0383
0
430
agile20150512-150512055145-lva1-app6892.pdf
toshi0383
0
120
たのしいAirPlay
toshi0383
1
660
Profiling using Signpost
toshi0383
2
870
AVPlayer周りの設計tips
toshi0383
6
810
cmdshelf::from("Swift")
toshi0383
3
830
Other Decks in Programming
See All in Programming
Make Impossible States Impossibleを 意識してReactのPropsを設計しよう
ikumatadokoro
0
170
TypeScriptでライブラリとの依存を限定的にする方法
tutinoko
2
660
Enabling DevOps and Team Topologies Through Architecture: Architecting for Fast Flow
cer
PRO
0
330
タクシーアプリ『GO』のリアルタイムデータ分析基盤における機械学習サービスの活用
mot_techtalk
4
1.4k
Quine, Polyglot, 良いコード
qnighy
4
640
どうして僕の作ったクラスが手続き型と言われなきゃいけないんですか
akikogoto
1
120
Better Code Design in PHP
afilina
PRO
0
120
Jakarta EE meets AI
ivargrimstad
0
150
C++でシェーダを書く
fadis
6
4.1k
エンジニアとして関わる要件と仕様(公開用)
murabayashi
0
290
Realtime API 入門
riofujimon
0
150
3rd party scriptでもReactを使いたい! Preact + Reactのハイブリッド開発
righttouch
PRO
1
600
Featured
See All Featured
Intergalactic Javascript Robots from Outer Space
tanoku
269
27k
How to Think Like a Performance Engineer
csswizardry
20
1.1k
How to Ace a Technical Interview
jacobian
276
23k
Building Better People: How to give real-time feedback that sticks.
wjessup
364
19k
Build your cross-platform service in a week with App Engine
jlugia
229
18k
Designing for Performance
lara
604
68k
[Rails World 2023 - Day 1 Closing Keynote] - The Magic of Rails
eileencodes
33
1.9k
BBQ
matthewcrist
85
9.3k
個人開発の失敗を避けるイケてる考え方 / tips for indie hackers
panda_program
93
16k
The MySQL Ecosystem @ GitHub 2015
samlambert
250
12k
Music & Morning Musume
bryan
46
6.2k
Building Adaptive Systems
keathley
38
2.3k
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