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
Xcode Meets Gradle
Search
RyuNen344
August 01, 2023
Programming
0
310
Xcode Meets Gradle
RyuNen344
August 01, 2023
Tweet
Share
More Decks by RyuNen344
See All by RyuNen344
サプライチェーン攻撃に備える
ryunen344
0
1.6k
Okioに愛を込めて
ryunen344
3
1.8k
Firebase Hostingを使ってPasskeyをandroidアプリで試してみよう
ryunen344
2
1.5k
わかった気になる、Coroutine1.7.0のチャンネルのパフォーマンス向上
ryunen344
0
330
K/NとNSKeyedArchiverと私
ryunen344
0
450
ComposeのModalBottomSheetは (まだ)沼
ryunen344
1
1.6k
うわっ…もしかして私のコー ド、遅すぎ…?
ryunen344
1
810
K/NでCryptoKit使いたかった
ryunen344
0
380
SwiftPM with KMMをprivateなGitHub Releaseで運用する
ryunen344
0
340
Other Decks in Programming
See All in Programming
From Translations to Multi Dimension Entities
alexanderschranz
2
130
今からはじめるAndroidアプリ開発 2024 / DevFest 2024
star_zero
0
1k
htmxって知っていますか?次世代のHTML
hiro_ghap1
0
330
Go の GC の不得意な部分を克服したい
taiyow
2
770
Haze - Real time background blurring
chrisbanes
1
510
return文におけるstd::moveについて
onihusube
1
1k
[JAWS-UG横浜 #76] イケてるアップデートを宇宙いち早く紹介するよ!
maroon1st
0
460
クリエイティブコーディングとRuby学習 / Creative Coding and Learning Ruby
chobishiba
0
3.9k
競技プログラミングへのお誘い@阪大BOOSTセミナー
kotamanegi
0
360
「Chatwork」Android版アプリを 支える単体テストの現在
okuzawats
0
180
php-conference-japan-2024
tasuku43
0
220
103 Early Hints
sugi_0000
1
230
Featured
See All Featured
個人開発の失敗を避けるイケてる考え方 / tips for indie hackers
panda_program
95
17k
Designing Dashboards & Data Visualisations in Web Apps
destraynor
229
52k
Sharpening the Axe: The Primacy of Toolmaking
bcantrill
38
1.9k
Intergalactic Javascript Robots from Outer Space
tanoku
270
27k
Rebuilding a faster, lazier Slack
samanthasiow
79
8.7k
YesSQL, Process and Tooling at Scale
rocio
169
14k
For a Future-Friendly Web
brad_frost
175
9.4k
[RailsConf 2023] Rails as a piece of cake
palkan
53
5k
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
132
33k
The World Runs on Bad Software
bkeepers
PRO
65
11k
Practical Orchestrator
shlominoach
186
10k
Navigating Team Friction
lara
183
15k
Transcript
Xcode Meets Gradle 2023.08.01 Mobileษڧձ Wantedly × νʔϜϥϘ #10 Bunjiro
Miyoshi
About Me • teamLab Inc.ॴଐ • (ࣗশ)ϚϧνϓϥοτϑΥʔϜܳਓ • 6݄ʹങͬͨMacBook ProͷηοτΞοϓΛӬԕʹ์ஔͯ͠Δ্ʹ࠷
ۙങͬͨPixel Fold์ஔؾຯ
͢͜ͱɾ͞ͳ͍͜ͱ • ͢͜ͱ • KMMͷςετΛ࣮ߦ͢ΔࡍͷͭΒΈ • xcode, xctest gradle pluginʹ͍ͭͯ
• gradle-xcodePlugin • ͞ͳ͍͜ͱ • Tink/Obj-Cͷ1.7.0ΛCocoaPodsʹpublishͯ͘͠Εͳ͍͜ͱͷෆຬ • ͦͷ͍ͤͰbazelೖ͢Δ͜ͱʹͳͬͨɾɾɾɾ • xcodebuildίϚϯυɺXCTestͷৄࡉͳ͋Ε͜Ε
Tink KMM࡞ͬͯ·͢
Tink KMM࡞ͬͯ·͢ • Google/TinkΛKMMͰ͑ΔΑ͏ʹ͢Δϥούʔ • android͚JavaɺiOS͚C++(obj-c)Ͱ࣮͞Ε͍ͯΔͷΛ ϥοϓ͍ͯ͠Δ • ͜ΕΛ͑಄ΘͣʹAES-GCM−256Λ͑ΔΑ͏ʹͳΔ
KMMͷςετΛ࣮ߦ͢ΔࡍͷͭΒΈ • iosX64Test, iosSimulatorArm64Test͡ΌͩΊͳͷʁ →Swiftఏڙ͢ΔAPI(Obj-C header)ͷมߋ(Ҿ໊ͱ͔)ΛײͰ͖ͳ ͍ • iOSΞϓϦͰͪΌΜͱಈ࡞͢ΔΑ͏ʹͳ͍ͬͯΔͷ͔ෆ҆ →LinkerपΓͷ࠷ऴతͳ֬ೝ͕͍ͨ͠
KMMͷςετΛ࣮ߦ͢ΔࡍͷͭΒΈ • ͱʹ͔͘iOSͷInstrumented TestΛ͖Ε͍ʹཧ͍ͨ͠ • Android StudioͷProject WizardͰ࡞͢Δͱɾɾɾ • XcodeͰ։͘
• shellͰxcodebuildίϚϯυΛ͏ શ෦GradleͰͳΜͱ͔ͨ͠ʔ͍ʂ
Gradleͱ • JVMͰ࣮ߦͰ͖ΔBuild Tool • ͷ͘͢͝ࡶʹݴ͏ͱiOSͰ͍͏ͱ͜ΖͷFastlane • ϓϩδΣΫτߏɺґଘཧɺϏϧυɺςετͳͲͳΜͰ͜ͳ͢ • ݩʑGroovyͰॻ͘ͷ͕ͩͬͨ࠷ۙKotlinͰॻ͘ͷ͕ਪ͞ΕͯΔ
Gradleͱ • PluginʹΑΔػೳ֦ு͕ڧྗ • *͍͍ͩͨͳΜͰͰ͖Δ • android, KMM(Kotlin Multiplatform)PluginʹΑͬͯͨΒ͞Ε͍ͯ Δ
• ެࣜͷPlugin͕αϙʔτ͍ͯ͠ΔͷͬͯҰମԿ͕ɾɾɾɾʁ
Gradleͱ ͍ͬͺ͍͋Δ😋 (ଞʹ͍ͬͺ͍͋Δ)
macOSͱLinux͚ͷ ͋Ε͜Ε͔͠ͳʔ͍😂
FastlaneͰղܾɾɾɾɾ ͍ɺRubyΛࠞࡏͤͨ͘͞ͳʔ͍😂
OSSͷxcodebuildίϚϯυΛϥοϓͯ͘͠ΕΔ openbakery/gradle-xcodePluginΛΈ߹ΘͤΔ
openbakery/gradle-xcodePlugin • xcodebuildίϚϯυΛϥοϓͯ͘͠ΕΔ • archive, KeyChainपΓͷূ໌ॻཧɺplistಡΈࠐΈ࡞ɺॺ໊ɺ Carthage, CocoaPodsपΓؚΊͯϥοϓ͢Δ • App
Store, Deploy Gateͷ৴Ͱ͖Δ • ෳcon fi gɺschemeΛରԠ͢Δʹͪΐͬͱඞཁ(ࠓճ৮Εͳ ͍)
openbakery Tipsᶃ • gradle-xcodePlugin͕͍͔ͭ͘ͷϏϧυ࣌ڥมΛઃఆ͢Δ͕ૉͷ ··Ͱ௨Βͳ͍ͷͰՃઃఆ͕ඞཁ • DerivedDataPath, DSTROOT, OBJROOT, SYMROOT,
SHARED_PRECOMPS_DIR -> plugin͕GradleͷbuildDirʹมߋ͞ΕΔ • SYMROOT͕มΘΔӨڹͰXCTest࣮ߦ࣌ʹappΛಡΈࠐΊͳ͘ͳΔ
openbakery Tipsᶃ ͓͋ʔ😇
openbakery Tipsᶃ additionalParamʹڥมઃఆΛͯ͠ா৲Λ߹ΘͤΔ
openbakery Tipsᶄ • git cloneͯ͠./gradlew :iosApp:xcodetestΛ࣮ߦࣦͯ͠ഊ͢Δ • ./gradlew xcodetest࣮ߦલʹXCFramework͕ੜ͞Ε͍ͯͳ͍ͷ͕ݪҼ •
KMM pluginͰϓϩδΣΫτΛ࡞Δ߹iOSϓϩδΣΫτ2௨Γͷґଘํ๏ͰKMMΛiOSϓϩδΣΫτʹ Ճ͢Δ • Build PhaseͷRun Script • CocoaPods • Run ScriptͰxcframeworkͷు͖ग़͠λΠϛϯά͕͍ • CocoaPods͍ͷͱ৭ʑͳπϥϛΛ๊͑ΔͷͰ͍ͨ͘ͳ͍(1KMMϥΠϒϥϦͷςετ༻ͱͯ͠໌ Β͔ʹToo Much)
openbakery Tipsᶄ • Gradle TaskͷґଘΛͬͯղܾ͢Δ :iosApp:xcodetestΛ:kmm:assembleXCFrameworkʹґଘͤ͞Δ
openbakery Tipsᶄ tasks.dependsOnͰඞͣXCFrameworkੜ͕ઌʹ࣮ߦ͞ΕΔΑ͏ʹ͢Δ
͜͏ͳͬͨ 👇 Ճ͑ͯIDEͷGradleλϒͰϙνϙνͯ͠XCTestΛ࣮ߦͰ͖ΔΑ͏ʹͳͬͨ (ςετ͚ͩ͡Όͳ͘ɺී௨ͷϏϧυϙνϙνͰ࣮ߦͰ͖Δ)
·ͱΊ • Gradleͷxcode, xctest pluginiOSʹରԠ͍ͯ͠ͳ͍ • ͍͔ͭ͘᠘͕͋Δ͕gradle-xcodePluginΛ༻͢ΕXcodeͱ Android StudioͱTerminalΛߦͬͨΓདྷͨΓ͢ΔճΛݮΒͤͨ •
CI্ͰίϚϯυҰൃͰKMMͷϏϧυͱXCTestͷ࣮ߦ͕Ͱ͖ΔΑ͏ʹ ͳͬͯخ͍͠
࠷ޙʹᶃ GitHubͷStar͍ͩ͘͞😉
࠷ޙʹᶄ LTલʹͦΜͳͰ͔͍Ϳͬ͜·Εͯ😇
Ҿ༻ • https://docs.gradle.org/current/userguide/xcode_plugin.html • https://docs.gradle.org/current/userguide/ xctest_plugin.html#xctest_plugin • https://github.com/openbakery/gradle-xcodePlugin • https://github.com/RyuNen344/tink-kmm/pull/116