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
Hierarchical Structure について / About Hierarchica...
Search
Jierong Li
July 29, 2021
Programming
530
1
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Hierarchical Structure について / About Hierarchical Structure
Jierong Li
July 29, 2021
More Decks by Jierong Li
See All by Jierong Li
一般的な通信でも使える バックグラウンドURLSessionの活用方法 / How to use background URLSession for general network data transfer tasks.
myihsan
0
3k
Multi-Module 101
myihsan
0
360
What’s New in Accessibility WWDC21
myihsan
1
350
Property WrapperでDecodableのデフォルト値を設定 / Providing Default Value for Decodable Property by Property Wrapper
myihsan
1
370
モックフレームワーク比較 / Mocking Framework Comparison
myihsan
0
560
Other Decks in Programming
See All in Programming
ルールを書いて終わらせないハーネスエンジニアリング
yug1224
4
1.7k
霧の中の代数的エフェクト
funnyycat
1
420
PHPだって関数型したい 〜できること、できないこと〜 / fp-in-php
jsoizo
1
240
Prismを使った型安全な暗号化_関数型まつり2026
_fhhmm
0
150
関数型プログラミングのメリットって何だろう?
wanko_it
0
190
音楽のための関数型プログラミング言語mimiumにおける多段階計算の活用
tomoyanonymous
1
350
Foundation Models frameworkで画像分析
ryodeveloper
1
130
信頼性について考えてみる(SRE NEXT 2026 miniLT)
hayama17
0
210
Haskell/Servantを通してWebミドルウェアを捉え直す
pizzacat83
1
610
【やさしく解説 設計編・中級 #4】ルールの寿命と、システムの年輪
panda728
PRO
2
160
AWS CDK を「作」ってみた 〜フルスクラッチで見えた CDK の裏側〜 / aws-cdk-from-scratch
gotok365
3
500
えっ!!コードを読まずに開発を!?
hananouchi
0
230
Featured
See All Featured
Avoiding the “Bad Training, Faster” Trap in the Age of AI
tmiket
0
200
How to build a perfect <img>
jonoalderson
1
5.8k
Ruling the World: When Life Gets Gamed
codingconduct
0
290
Agile that works and the tools we love
rasmusluckow
331
22k
What's in a price? How to price your products and services
michaelherold
247
13k
Building AI with AI
inesmontani
PRO
1
1.1k
JavaScript: Past, Present, and Future - NDC Porto 2020
reverentgeek
52
6k
Building Applications with DynamoDB
mza
96
7.1k
Are puppies a ranking factor?
jonoalderson
1
3.7k
HTML-Aware ERB: The Path to Reactive Rendering @ RubyCon 2026, Rimini, Italy
marcoroth
3
360
Conquering PDFs: document understanding beyond plain text
inesmontani
PRO
4
2.9k
Fantastic passwords and where to find them - at NoRuKo
philnash
52
3.8k
Transcript
HIERARCHICAL STRUCTURE について KOTLIN MULTIPLATFORM MOBILE勉強会 WANTEDLY × チームラボ #2
⾃⼰紹介 JIERONG LI (李) ▸ 株式会社ゆめみ ▸ iOSエンジニア ▸ KMMでAndroid開発キャッチアップ
▸ 永遠にリリースできず個⼈開発 ▸ https://jierong.dev
HIERARCHICAL STRUCTURE とは
HIERARCHICAL STRUCTURE とは コード共有の階層化 同じプラットフォームでアーキテクチャー複数
HIERARCHICAL STRUCTURE とは HIERARCHY STRUCTURE 有効にする gradle.propertiesに下記を追加するだけ kotlin.mpp.enableGranularSourceSetsMetadata=true
HIERARCHICAL STRUCTURE とは ⼿動で定義 kotlin { iosX64() iosArm64() sourceSets {
val commonMain by sourceSets.getting val iosX64Main by sourceSets.getting val iosArm64Main by sourceSets.getting val iosMain by sourceSets.creating { dependsOn(commonMain) iosX64Main.dependsOn(this) iosArm64Main.dependsOn(this) } } }
HIERARCHICAL STRUCTURE とは シートカット ▸ ios ▸ iosArm64、iosX64 ▸ watchOS
▸ watchosArm32、watchosArm64、watchosX64 ▸ tvOS ▸ tvosArm64、tvosX64
HIERARCHICAL STRUCTURE とは TARGET SHORTCUT kotlin { ios() }
既知の不具合
既知の不具合 コード補完とシンタックス ハイライトが機能しない ▸ 外部依存(公式情報) ▸ Hierarchical structureサポートしないmultiplatformライブラリー ▸ サードパーティ
ネーティブ ライブラリー ▸ マルチモジュール(DroidKaigi / conference-app-2021で発覚)
既知の不具合 外部依存による不具合のワークアラウンド kotlin { val iosTarget: (String, KotlinNativeTarget.() -> Unit)
-> KotlinNativeTarget = if (System.getenv("SDK_NAME") ? . startsWith("iphoneos") == true) :: iosArm64 else :: iosX64 iosTarget("ios") }
既知の不具合 外部依存による不具合のワークアラウンド ビルド対象アーキテクチャーのみターゲットを作り、ターゲット名をiosにする (iosMainがソースになる) ▸ アーキテクチャーひとつずつでビルドする場合が⼗分 ▸ XCFramework配布で両⽅のアーキテクチャーが必要な場合では不都合
既知の不具合 外部依存による不具合のワークアラウンド・改 kotlin { iosArm64() iosX64("ios") sourceSets { val iosMain
by getting val iosArm64Main by getting { dependsOn(iosMain) } } }
既知の不具合 外部依存による不具合のワークアラウンド・改 ビルド対象に関わらず⽚⽅のターゲット名をiosにし(iosMainがソースになる)、もう⽚⽅からiosMainを依存 ▸ 両⽅のアーキテクチャーのターゲットが存在 ▸ テストがある場合 ▸ IntelプロセッサのMacでしか実⾏できない ▸
iosArm64ターゲットではテストタスクがない ▸ Appleシリコン未対応のが原因かも ▸ iosX64のターゲット名をiosにする必要がある ▸ iosArm64にするとなぜかiosX64Testタスクが依存しているlinkDebugTestIosX64タスクが compileKotlinIos(実質comipleKotlinIosArm64)タスクを依存し、失敗になる
既知の不具合 マルチモジュールによる不具合のワークアラウンド BY WATANAVEX 依存関係の解決にバグがあるようで、明記的にコンパイルさせることで解決 tasks.getByName("preBuild").dependsOn(tasks.getByName("compileKotlinIos"))
HIERARCHICAL STRUCTURE について 参考資料 ▸ Share code on platforms ▸
Workaround to enable IDE support for the shared iOS source set ▸ ワークアラウンド by watanavex