2023년 05/13 (토) KotlinConf'23 Global in Songdo 행사에서의 발표자료입니다. https://festa.io/events/3416
Sungyong An@fornewidKotlinConf’23SongdoKotlinMultiplatformLibrary ߓನೞӝ
View Slide
KOTLINCONF’23 SONGDOSungyong AnNAVER WEBTOONAndroid GDE@fornewid⚠ Ӓېࢲ য়ט ߊب Android ѐߊ ҙਵ۽ ೯ؾפ! ⚠
KOTLINCONF’23 SONGDOয়ט ߊחKotlinConf’23 ࣁ࣌ ղਊਸ ଵҊೞৈ ٜ݅णפ.• How to Publish Your First Kotlin Multiplatform• Kotlin Multiplatform Conversions at Android Jetpack Scale Library• Compose Multiplatform on iOSLink: https://kotlinconf.com/talks/
KOTLINCONF’23 SONGDO❤Android ѐߊח Kotlinী ࣼೞ.
KOTLINCONF’23 SONGDO👀ೞ݅ Multiplatformীח ҙब .
KOTLINCONF’23 SONGDOKotlin Multiplatform?नӏ জ ӝઓ জLink: https://kotlinlang.org/lp/multiplatform/নೠ ۖಬী ೧ زੌೠ ٘ܳ ҕਬೞৈ ѐߊೡ ࣻ .
KOTLINCONF’23 SONGDO৵ Ӓۡө?ܲ ۖಬ ѐߊо Kotlinਸ ण೧ঠ ೠ.ఋੋਸ ࢸٙೞח Ѫ য۵.Link: https://kotlinlang.org/docs/multiplatform-mobile-introduce-your-team.html
KOTLINCONF’23 SONGDOӒۧ݅…🚀Android ୭न UI ోఉ, Jetpack Compose!Link: https://goo.gle/compose
KOTLINCONF’23 SONGDOLink: https://www.jetbrains.com/lp/compose-multiplatform/ KOTLINCONF’23 SONGDO
KOTLINCONF’23 SONGDO ঌҊ ח Compose APIܳ ਊ೧ৈ۞ ۖಬী زೞח UIܳ ٜ݅ ࣻ .≈Link: https://www.jetbrains.com/lp/compose-multiplatform/
KOTLINCONF’23 SONGDOLink: https://www.jetbrains.com/lp/compose-multiplatform/݃ஜղ ױੌ ٘݅ਵ۽ب Kotlin Multiplatform জਸ ٜ݅ ࣻ .Kotlin Multiplatform Library ژ ܲ оמࢿ!
KOTLINCONF’23 SONGDOKotlin Multiplatform ѐ֛ਸ ೧ೞҊ, Library۽ ߓನೡ ٸ Ҋ۰ೡ ਸ ঌইࠇפ.ݾMultiplatform জਸ ٜ݅ ࣻ ח ജ҃ਸ оԼࠁ!
KOTLINCONF’23 SONGDOKotlin MultiplatformLink: https://kotlinlang.org/docs/multiplatform.html
KOTLINCONF’23 SONGDOOverviewKotlin/Native Kotlin/JVMп ۖಬ ۽ંীࢲ ҕా ݽٕী ઓࢿਸ ыח ҳઑ.
KOTLINCONF’23 SONGDOexpect / actualKotlin Multiplatform ݽٕী ۖಬ APIܳ োѾೞח ߑߨ.Link: https://kotlinlang.org/docs/multiplatform-connect-to-apis.html
KOTLINCONF’23 SONGDOexpect / actualزੌೠ ܴਸ оݴ, زੌೠ ಁఃী ਤ೧ঠ ೠ.Link: https://kotlinlang.org/docs/multiplatform-connect-to-apis.html
KOTLINCONF’23 SONGDOexpect / actualп ۖಬ ٘ח ೞա ݽٕ উীࢲ Source Setsਵ۽ ҳ࠙ೡ ࣻ .Link: https://kotlinlang.org/docs/multiplatform-connect-to-apis.html
KOTLINCONF’23 SONGDOGet startedѐߊജ҃ਸ ળ࠺ೠ.• ਃೠ بҳܳ ࢸೠ: Android Studio, XCode, JDK, KMM plugin, Kotlin plugin, CocoaPods dependency manager• ѐߊജ҃ ੜ ҳࢿغח ഛੋೠ: KDoctorLink: https://kotlinlang.org/docs/multiplatform-mobile-setup.html
KOTLINCONF’23 SONGDOGet startedKotlin Multiplatform জ ۽ંܳ ݅ٚ.• Project Templateਵ۽ KMM ۽ંܳ ࢤࢿೠ.• ۽ં ҳઑܳ ഛੋೡ ࣻ ѱ Androidীࢲ Project۽ ജೠ.Link: https://kotlinlang.org/docs/multiplatform-mobile-create-first-app.html
KOTLINCONF’23 SONGDOGet startedKotlin Multiplatform জਸ प೯೧ࠄ.Link: https://kotlinlang.org/docs/multiplatform-mobile-create-first-app.html#run-your-application
KOTLINCONF’23 SONGDOProject Structure۽ં ҳઑܳ ಝࠁ.Link: https://kotlinlang.org/docs/multiplatform-mobile-create-first-app.html#examine-the-project-structure
KOTLINCONF’23 SONGDOProject StructureLink: https://kotlinlang.org/docs/multiplatform-hierarchy.htmlTargetSource Sets
KOTLINCONF’23 SONGDOandroidTargetLink: https://kotlinlang.org/docs/multiplatform-hierarchy.html#see-the-full-hierarchy-template
KOTLINCONF’23 SONGDOSource SetsandroidMain
KOTLINCONF’23 SONGDOSource Setsр ױ҅ Source Setsਸ ٜ݅ ࣻ .Link: https://kotlinlang.org/docs/multiplatform-hierarchy.html#target-shortcuts
KOTLINCONF’23 SONGDOConfigure compilationsLink: https://kotlinlang.org/docs/multiplatform-configure-compilations.html
KOTLINCONF’23 SONGDORestrictions• IntelliJ ژח Android Studio, Gradle ӝ߈ۄࢲ iOS ѐߊח Ӕࢿ ڄয.• ߈۽ iOS ۖಬীࢲ ѐߊೞ۰ݶ ݓ ਃೞ.• ৈ۞ Targetਸ ਗೞח Multiplatform ۄ࠳۞ܻо .• kotlinx ۄ࠳۞ܻب Target ੌࠗ݅ ਗೞח Ѫٜ ݆.• Logging ۄ࠳۞ܻب ઑӘ গݒೞ. https://tonisives.com/blog/2021/03/03/kotlin-multiplatform-logging-libraries/• non-JVM targetਸ Ҋ۰ೞݶ, common ٘ী Java ٘ܳ ನೣೡ ࣻ হ.• IOException, @Jvm- annotation ١ਸ ࢎਊೡ ࣻ হ.• ١١…
KOTLINCONF’23 SONGDOCompose MultiplatformLink: https://www.jetbrains.com/lp/compose-multiplatform/
KOTLINCONF’23 SONGDOAvailable in Compose Multiplatform 1.4Link: https://github.com/JetBrains/compose-multiplatform/releases/tag/v1.4.0
KOTLINCONF’23 SONGDOMaking Compose MultiplatformKOTLINCONF’23 SONGDOLink: https://github.com/androidx/androidx/tree/androidx-main/compose#readme
KOTLINCONF’23 SONGDOMaking Compose MultiplatformKOTLINCONF’23 SONGDOGoogleীࢲ Compose ࠗ࠙ਸ common Kotlinਵ۽ ࢿ೮!Link: https://github.com/androidx/androidx/tree/androidx-main/compose/ui/ui/src
KOTLINCONF’23 SONGDOMaking Compose MultiplatformLink: https://github.com/JetBrains/compose-multiplatform-core
KOTLINCONF’23 SONGDOMaking Compose MultiplatformLink: https://github.com/JetBrains/compose-multiplatform-core/tree/jb-main/compose/ui/ui/src
KOTLINCONF’23 SONGDOCompose Multiplatform ArchitectureComposeAndroidSkiaSkikoDesktop iOS WebLink: https://github.com/JetBrains/skiko
KOTLINCONF’23 SONGDOiOS portComposeSkikoSkiaiOS specificKotlin/NativeUIViewControllerUIKit SwiftUI
KOTLINCONF’23 SONGDOGet startedCompose Multiplatform জਸ प೯೧ࠄ.• Github Template Repository۽ Compose Multiplatform ۽ંܳ ࢤࢿೠ.Link: https://github.com/JetBrains/compose-multiplatform-template
KOTLINCONF’23 SONGDOGet startedজਸ प೯೧ࠄ.Link: https://kotlinlang.org/docs/multiplatform-mobile-create-first-app.html#run-your-application
KOTLINCONF’23 SONGDOGet started۽ં ҳઑܳ ಝࠁ.Link: https://github.com/JetBrains/compose-multiplatform-template#examine-the-project-structureKotlinGradledesktop appKotlinGradleSwiftXcodeKotlinGradleiOS appAndroid appShared moduleRoot project
KOTLINCONF’23 SONGDOCompose Multiplatform on Android
KOTLINCONF’23 SONGDOCompose Multiplatform on Desktop
KOTLINCONF’23 SONGDOCompose Multiplatform on iOS
KOTLINCONF’23 SONGDOWrapping platform widgets<- AndroidViewLink: https://github.com/JetBrains/compose-multiplatform-core/blob/jb-main/.../interop/UIKitView.uikit.kt
KOTLINCONF’23 SONGDORestrictions• iOS ۽ંীࢲ ଵઑೞח Kotlin Multiplatform Moduleীח ݽٚ Composable ೣࣻо private ژח internal۽݅ غযঠ ೠ. https://github.com/JetBrains/compose-multiplatform/issues/2346#issuecomment-1381339854• ܻࣗझܳ ҙܻೞח ࠗ࠙ গݒೞ. (ex. Ҵয, ١) https://github.com/JetBrains/compose-multiplatform/issues/1255• iOS/Webীࢲח ই ܻࣗझܳ ۪؊݂ೡ ࣻ হ. (JPG, PNG, SVG ١) https://github.com/JetBrains/compose-multiplatform/issues/2498• JetBrainsীࢲ ܲ ۖಬө ഛೞৈ ҳഅೞ ࠁפ, android ৻ীח زೞ ঋח APIо ҵؘҵؘ . (गח ܻನ!)• ۖಬ݃ UXо ׳ۄࢲ ࢎਊࢿਸ Ҋ۰ೞݶ, ױੌ ٘݅ਵ۽ ҳഅೞח Ѫী ೠ҅о .• ١١…
KOTLINCONF’23 SONGDOজࠁח, ۄ࠳۞ܻܳ ٜ݅য ߓನ೧ࠁ! 🚀
KOTLINCONF’23 SONGDOLink: https://github.com/fornewid/material-motion-composeAndroid জীࢲ ࢎਊೡ ݾਵ۽ ݅ٚ Jetpack Compose LibraryܳCompose Multiplatformਵ۽ ഛ೮.
KOTLINCONF’23 SONGDOAndroid Library ߓನೞӝLink: https://developer.android.com/studio/projects/android-library
KOTLINCONF’23 SONGDOLifecycle🧑💻Develop📝 👾Requirements🚀Release👥Users
KOTLINCONF’23 SONGDO٘ܳ ࢿೠ.DevelopKOTLINCONF’23 SONGDO
KOTLINCONF’23 SONGDORelease• Maven ࣗܳ ࢤࢿೠ.• ܳ ٜয, Maven Central Repositoryۄݶ1. गܳ ࢤࢿೞҊ,2. Project URL ӂೠਸ ੋૐೠ.• زੌೠ Group IDח Repositoryܳ ೠߣ݅ ࢤࢿೞݶ ػ.Link: https://issues.sonatype.org/browse/OSSRH-80194
KOTLINCONF’23 SONGDORelease• ই౭ಂܳ ѱदೠ.1. GPG ఃܳ ࢤࢿೠ. https://central.sonatype.org/publish/requirements/gpg/2. ۽ંী ই౭ಂ ࠁܳ ࢸೠ. https://github.com/vanniktech/gradle-maven-publish-plugin3. Gradle Task۽ ѱदೠ. https://central.sonatype.org/publish/publish-guide/$ gpg --full-gen-keyLink: https://developer.android.com/studio/projects/android-library// gradle.propertiesGROUP=io.github.fornewidPOM_ARTIFACT_ID=material-motion-compose-corePOM_PACKAGING=aarVERSION_NAME=1.0.0...// {library_module_name}/build.gradleplugins {id 'com.vanniktech.maven.publish'}./gradlew publish --no-daemon --no-parallelsigning.keyId={GPG_KEY}signing.password={password}signing.secretKeyRingFile=release/secring.gpgmavenCentralUsername=fornewidmavenCentralPassword=***********🔑
KOTLINCONF’23 SONGDORelease• ই౭ಂܳ ҕѐೠ. https://s01.oss.sonatype.org/#stagingRepositories• Close, Release ࣽਵ۽ ೯ೠ.• Gradle Taskب ઁҕػ.Link: https://central.sonatype.org/publish/release/./gradlew closeAndReleaseRepository
KOTLINCONF’23 SONGDODevelop & Release Tools߈ࠂ೧ࢲ ѐߊ/ߓನೞӝ औѱ, ৈ۞о بҳ بਸ ߉ਸ ࣻ .• Public API: Kotlin Explicit API mode• Compatibility: Metalava• Code Format: spotless• Documentation: KDoc + Dokka, .md + mkdocs + Github Pages• Publish: vanniktech/gradle-maven-publish-plugin• CI: Github Actions• ١١…
KOTLINCONF’23 SONGDO• APIী Ӕ৬ return typeਸ ݺदೞب۾, ҃Ҋ য়ܨܳ ߊࢤदఅ.Public APIKotlin Explicit API mode💾 {library_module}/build.gradleandroid {kotlinOptions {freeCompilerArgs += '-Xexplicit-api=warning'}}Link: https://github.com/Kotlin/KEEP/blob/master/proposals/explicit-api-mode.md
KOTLINCONF’23 SONGDOCompatibilityMetalava• API Metadataܳ ୶ೞৈ ഐജࢿ ߸҃غחܳ хೠ.Link: https://github.com/tylerbwong/metalava-gradle💾 .github/workflows/build.yaml./gradlew metalavaCheckCompatibilitypackage com.webtoonscorp.android.readmore {public final class ReadMoreTextView extends androidx.appcompat.widget.AppCompatTextView {ctor public ReadMoreTextView(android.content.Context context, optional android.util.AttributeSet? attrs, optional int defStyleAttr);ctor public ReadMoreTextView(android.content.Context context, optional android.util.AttributeSet? attrs);ctor public ReadMoreTextView(android.content.Context context);method public boolean isExpanded();method public void setExpanded(boolean expanded);method public void setOnStateChangeListener(com.webtoonscorp.android.readmore.ReadMoreTextView.OnStateChangeListener listener);method public void toggle();field public static final int OVERFLOW_CLIP = 1; // 0x1field public static final int OVERFLOW_ELLIPSIS = 2; // 0x2}public static fun interface ReadMoreTextView.OnStateChangeListener {method public void onStateChanged(boolean expanded);}}Generate: 💾 {library_module}/api/current.api./gradlew metalavaGenerateSignatureIf changes APIs intentionally:
KOTLINCONF’23 SONGDO• ࣗझ٘ ഋध ৢ߄ܲ Ѩࢎೠ.• ࣗझ٘ী LICENSE ࢳਸ ୶оೞח Ѫب زചೡ ࣻ .Code FormatspotlessLink: https://github.com/diffplug/spotless// build.gradleplugins {id 'com.diffplug.spotless' version '5.12.4'}subprojects {apply plugin: 'com.diffplug.spotless'spotless {kotlin {target '**/*.kt'targetExclude("$buildDir/**/*.kt")targetExclude('bin/**/*.kt')ktlint(“0.42.1")licenseHeaderFile rootProject.file('spotless/copyright.kt')}}}// spotless/copyright.kt/** Copyright $YEAR SOUP** ...*/
KOTLINCONF’23 SONGDO• APIী যك ٘ ࢳਸ, API ޙࢲ۽ ߸ജೡ ࣻ .DocumentationKDoc + DokkaLink: https://kotlinlang.org/docs/kotlin-doc.html, https://github.com/Kotlin/dokka💾 .github/workflows/publish-docs.yml💾 generate_docs.sh# Generate API docs./gradlew dokkaHtmlMultiModulejobs:update_draft_release:...steps:...- name: Generate docsrun: ./generate_docs.sh...
KOTLINCONF’23 SONGDODocumentation.md + mkdocs + Github Pages• .md ੌী ۄ࠳۞ܻী ೠ ࢸݺਸ ܻ೧فҊ, ਢಕ۽ ߸ജೠ.Link: https://www.mkdocs.org/jobs:update_draft_release:...steps:...- name: Install dependenciesrun: |python3 -m pip install --upgrade pippython3 -m pip install mkdocspython3 -m pip install mkdocs-material- name: Build siterun: mkdocs build...💾 .github/workflows/publish-docs.yml 💾 mkdocs.yml...remote_branch: gh-pages# Navigationnav:- "Overview": index.md- "View":- 'Guide': readmore-view.md- 'API': api/readmore-view/# Configurationtheme:name: materiallanguage: "en"
KOTLINCONF’23 SONGDODocumentation.md + mkdocs + Github Pages• Github Actionਸ ਊೞৈ, ࢤࢿػ ਢಕܳ Github Page۽ ഐझೡ ࣻ .Link: https://github.com/peaceiris/actions-gh-pageson:push:tags:- v*jobs:update_draft_release:...steps:...- name: Deployuses: peaceiris/[email protected]with:github_token: ${{ secrets.GITHUB_TOKEN }}publish_dir: ./site💾 .github/workflows/publish-docs.yml
KOTLINCONF’23 SONGDOGithub Actions• খࢲ ࣗѐೠ بҳٜਸ ۽ஸݠनীࢲ ࣻزਵ۽ Ѩࢎೞ ঋҊ, زചೡ ࣻ .Link: https://docs.github.com/ko/actionsCI (Continuous Integration)
KOTLINCONF’23 SONGDOLink: https://getstream.io/blog/publishing-libraries-to-mavencentral-2021/, https://proandroiddev.com/3a008b50b808Futhermore…
KOTLINCONF’23 SONGDOKotlin MultiplatformLibrary۽ ജೞӝLink: https://kotlinlang.org/docs/multiplatform-library.html
KOTLINCONF’23 SONGDOKOTLINCONF’23 SONGDO٘ܳ ߸҃ೠ.Develop
KOTLINCONF’23 SONGDODevelopbuild.gradle1. Kotlin pluginਸ ߸҃ೠ.2. Targetਸ ࢶೠ.3. Source Setਸ ೞҊ, dependenciesܳ ӟ.• ߈٘द Groovyীࢲ KTS۽ ߸҃೧ঠ ೞח Ѫ ইפ.Link: https://kotlinlang.org/docs/multiplatform-dsl-reference.html, https://developer.android.com/build/migrate-to-kotlin-dsl
KOTLINCONF’23 SONGDO• ҕాചೞ۰ח ٘ח commonMainਵ۽ زೠ.• ӝઓ Android ٘ח ইېۢ ӟ.• ӝࠄਵ۽ androidInstrumentedTestীࢲח commonTestী Ӕೡ ࣻ হ.DevelopSource Setsী ݏࢲ srcী ۖಬ ਊ ಫ؊ܳ ୶оೠ.Link: https://kotlinlang.org/docs/whatsnew18.html#kotlinsourceset-naming-schemaKotlin 1.8 Kotlin 1.8 റAndroid
KOTLINCONF’23 SONGDODevelopౠ ۖಬী ઙࣘػ APIܳ ઁѢೞҊ,Link: https://github.com/fornewid/material-motion-compose/pull/190/files#diff
KOTLINCONF’23 SONGDODevelopҕా ٘۽ ߸҃೧ঠ ೠ. ইפݶ expect / actualਸ ҳഅ೧ঠ ೠ.Link: https://github.com/fornewid/material-motion-compose/pull/190/files#diff
KOTLINCONF’23 SONGDODevelopੌࠗ Jetpack ۄ࠳۞ܻب ݣ౭ۖಬਸ ਗೠ.Link: https://android-developers.googleblog.com/2023/04/whats-new-in-jetpack-multiplatform.html
KOTLINCONF’23 SONGDODevelop & Release Tools೯ ݽف Kotlin Multiplatformਸ ਗೞח بҳ. (ױ, ߡ ഛੋ೧ࠅ Ѫ!)• Public API: Kotlin Explicit API mode ✅• Compatibility: Metalava ✅• Code Format: spotless ✅• Documentation: KDoc + Dokka ✅, .md + mkdocs + Github Pages ✅• Publish: vanniktech/gradle-maven-publish-plugin ✅• CI: Github Actions ⚠• ١١…
KOTLINCONF’23 SONGDOGithub Actions• ਗೞח Targetী ݏѱ, runnerܳ ઑ೧ঠ ೮.Link: https://docs.github.com/ko/actions/using-workflows/workflow-syntax-for-github-actions#choosing-github-hosted-runnersCI (Continuous Integration)
KOTLINCONF’23 SONGDORelease• ߓನೞח ߑߨ Ѣ زੌೞ݅, Ѿҗޛ ׳ۄ. (vanniktech/gradle-maven-publish-plugin ࢎਊೞח Ѫਸ ୶ୌ!)Link: https://search.maven.org/search?q=material-motion-compose-coreAndroid ۄ࠳۞ܻܳ ѱदೞ۰ݶ variant nameਸ ݺद೧ঠ פ.Link: https://kotlinlang.org/docs/multiplatform-publish-lib.html
KOTLINCONF’23 SONGDOUsersۄ࠳۞ܻ ઓࢿ ୶оೞӝ• ݽٚ Source Setਸ ਗೞח ۄ࠳۞ܻח ҕా Source Setী ୶оೡ ࣻ . Kotlin Multiplatform plugin п Source Setী ݏח زਵ۽ ୶о೧ળ.Link: https://kotlinlang.org/docs/multiplatform-add-dependencies.html#library-shared-for-all-source-sets
KOTLINCONF’23 SONGDOUsersۄ࠳۞ܻ ઓࢿ ୶оೞӝ• ౠ Source Setীࢲ݅ ݣ౭ۖಬ ۄ࠳۞ܻܳ ࢎਊೡ ࣻب .• ݣ౭ۖಬ ۄ࠳۞ܻо ইפۄݶ ഒزغ ঋب۾, ۖಬ ݺடਸ ࢎਊೞ ঋח Ѫਸ ӂೠ. Link: https://kotlinlang.org/docs/multiplatform-add-dependencies.html#library-used-in-specific-source-sets
KOTLINCONF’23 SONGDODemo
хࢎפ!Slide Link: https://speakerdeck.com/fornewid/publishing-kotlin-multiplatform-library