Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Gradle Version Catalog with KTS [KotlinConf'24 Global]

Gradle Version Catalog with KTS [KotlinConf'24 Global]

junsuPark

June 18, 2024
Tweet

Other Decks in Programming

Transcript

  1. Gradle Build Tool • য়೑ࣗझ • ҟߧਤೠ৔৉੄ࣗ೐౟ਝয࠽٘दաܻয়੗زച • Ҋࣻળ੄ࢶ঱ഋ࠽٘঱য۽֫਷оةࢿઁҕ •

    ೐۽ં౟ӏݽࠂ੟بীҙ҅হ੉नࣘ ਬো • ૐ࠙࠽٘ ࠽٘நय ߽۳୊ܻઁҕ 👍
  2. +

  3. Kotlin vs Groovy • ࠙ঠ গ೒ܻா੉࣌ѐߊWTझ௼݀౴  • օࣁ੉೐౭ ࠁ੢WTࠁ੢9

     • ۞׬ழ࠳ рѾWT੗߄৬ਬࢎ  • ஹ౵ੌ ੿੸ఋੑWTز੸ఋੑ  • ࢿמ ੗߄৬ਬࢎ WT$MPTVSF۽ੋ೧וܿ  • *%&૑ਗ ࢚؀੸ਵ۽݆਺ WT࢚؀੸ਵ۽੸਺
  4. 1 • 🤓 Ӓܖ࠺UP௏ౣܽஶߡఠоઓ੤ೞաਃ  • 🤗 ߄۽׼न?? Ӓܖ࠺ to

    ௏ౣܽ ஶߡఠо ੓աਃ? ݢ੷ Ӓܖ࠺ ౵ੌਸ ௏ౣܽ ౵ੌ۽ ੉ܴਸ ߄ԲदҊ.. য૵ҳ੷૵ҳ
  5. 2. Kotlin ޙߨী ݏѱ ௏٘ ߸҃ plugins { id 'com.android.application'

    version '8.4.1' id 'org.jetbrains.kotlin.android' version '1.9.0' } • ޙ੗ৌࢶ঱ࣻ੿ • ੘਷ٮ১಴ r ௾ٮ১಴ t
  6. 2. Kotlin ޙߨী ݏѱ ௏٘ ߸҃ plugins { id “com.android.application”

    version “8.4.1" id “org.jetbrains.kotlin.android" version “1.9.0” } plugins { id 'com.android.application' version '8.4.1' id 'org.jetbrains.kotlin.android' version '1.9.0' } • ޙ੗ৌࢶ঱ࣻ੿ • ੘਷ٮ১಴ r ௾ٮ১಴ t
  7. 2. Kotlin ޙߨী ݏѱ ௏٘ ߸҃ plugins { id(”com.android.application”) version

    ”8.4.1” id(”org.jetbrains.kotlin.android”) version ”1.9.0” } plugins { id “com.android.application” version “8.4.1" id “org.jetbrains.kotlin.android" version “1.9.0” } • ೣࣻഐ୹ࣻ੿ • Қഐ   ୶о
  8. • ؀ੑো࢑୶о • ؀ੑӝഐ  ୶о 2. Kotlin ޙߨী ݏѱ

    ௏٘ ߸҃ java { sourceCompatibility JavaVersion.VERSION_17 targetCompatibility JavaVersion.VERSION_17 }
  9. • ؀ੑো࢑୶о • ؀ੑӝഐ  ୶о 2. Kotlin ޙߨী ݏѱ

    ௏٘ ߸҃ java { sourceCompatibility = JavaVersion.VERSION_17 targetCompatibility = JavaVersion.VERSION_17 } java { sourceCompatibility JavaVersion.VERSION_17 targetCompatibility JavaVersion.VERSION_17 }
  10. • ߸ࣻࢶ঱৘ডযࣻ੿ • EFGªWBM WBS 2. Kotlin ޙߨী ݏѱ ௏٘

    ߸҃ val activityComposeVersion = “1.9.0” def activityComposeVersion = ‘1.9.0’
  11. plugins { alias(libs.plugins.android.application) alias(libs.plugins.jetbrains.kotlin.android) } android { namespace 'app.junsu.gvc' compileSdk

    34 defaultConfig { applicationId ’app.junsu.gvc’ minSdk 32 targetSdk 34 versionCode 1 versionName ‘1.0’ testInstrumentationRunner ‘androidx.test.runner.AndroidJUnitRunner’ vectorDrawables { useSupportLibrary true }
  12. plugins { alias(libs.plugins.android.application) alias(libs.plugins.jetbrains.kotlin.android) } android { namespace = "app.junsu.gvc"

    compileSdk = 34 defaultConfig { applicationId = "app.junsu.gvc" minSdk = 32 targetSdk = 34 versionCode = 1 versionName = "1.0" testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" vectorDrawables { useSupportLibrary = true }
  13. plugins { alias(libs.plugins.android.application) alias(libs.plugins.jetbrains.kotlin.android) } android { namespace = "app.junsu.gvc"

    compileSdk = 34 defaultConfig { applicationId = "app.junsu.gvc" minSdk = 32 targetSdk = 34 versionCode = 1 versionName = "1.0" testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" vectorDrawables { useSupportLibrary = true } namespace = "app.junsu.gvc" compileSdk = 34 defaultConfig { applicationId = "app.junsu.gvc" minSdk = 32 targetSdk = 34 versionCode = 1 versionName = "1.0" testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" vectorDrawables { useSupportLibrary = true }
  14. namespace 'app.junsu.gvc' compileSdk 34 defaultConfig { applicationId ‘app.junsu.gvc’ minSdk 32

    targetSdk 34 versionCode 1 versionName ‘1.0’ testInstrumentationRunner ‘…’ vectorDrawables { useSupportLibrary true } namespace = "app.junsu.gvc" compileSdk = 34 defaultConfig { applicationId = "app.junsu.gvc" minSdk = 32 targetSdk = 34 versionCode = 1 versionName = "1.0" testInstrumentationRunner = "android vectorDrawables { useSupportLibrary = true }
  15. Kotlin Script੄ ࢿמ • (SBEMF$*ӝળࢿמஏ੿ Use case Groovy Kotlin Differences

    First use 🟢 32s 🔴 76s Groovy DSL is 2.4x faster buildSrc abi change 🟢 10s 🔴 33s Groovy DSL is 3.3x faster buildSrc non-abi change 🔴 10s 🟢 5.3s Kotlin DSL is 1.9x faster configuration 🟢 2s 🔴 2.2s Groovy DSL is 0.11x faster https://github.com/gradle/gradle/issues/15886
  16. Gradle Version Catalog ? • (SBEMF੄ઓࢿਸݾ۾ਵ۽ҙܻ • 50.-঱যࢎਊ ாߏா੉झ •

    ೞա੄ߡ੹ݾ۾ਸࢤࢿ ৈ۞Ҕীࢲ5ZQFTBGFೞѱଵઑ • (SBEMF੉റࢎਊоמ ࠗఠউ੿ച
  17. [versions] compileSdk = "34" minSdk = "32" targetSdk = "34"

    agp = "8.4.1" kotlin = "1.9.0" coreKtx = "1.13.1" junit = "4.13.2" junitVersion = "1.1.5" espressoCore = "3.5.1" lifecycleRuntimeKtx = "2.8.2" activityCompose = "1.9.0" composeBom = "2024.06.00" [libraries] androidx-core-ktx = { group = "androidx.core", name = "core-ktx", version.ref = "coreKtx" } junit = { group = "junit", name = "junit", version.ref = "junit" } androidx-junit = { group = "androidx.test.ext", name = "junit", version.ref = "junitVersion" } androidx-espresso-core = { group = "androidx.test.espresso", name = "espresso-core", version.ref = androidx-lifecycle-runtime-ktx = { group = "androidx.lifecycle", name = "lifecycle-runtime-ktx", v androidx-activity-compose = { group = "androidx.activity", name = "activity-compose", version.ref androidx-compose-bom = { group = "androidx.compose", name = "compose-bom", version.ref = "composeB androidx-ui = { group = "androidx.compose.ui", name = "ui" } libs.versions.toml
  18. [versions] compileSdk = "34" minSdk = "32" targetSdk = "34"

    agp = "8.4.1" kotlin = "1.9.0" coreKtx = "1.13.1" junit = "4.13.2" junitVersion = "1.1.5" espressoCore = "3.5.1" lifecycleRuntimeKtx = "2.8.2" activityCompose = "1.9.0" composeBom = "2024.06.00" [libraries] androidx-core-ktx = { group = "androidx.core", name = "core-ktx", version.ref = "coreKtx" } junit = { group = "junit", name = "junit", version.ref = "junit" } androidx-junit = { group = "androidx.test.ext", name = "junit", version.ref = "junitVersion" } androidx-espresso-core = { group = "androidx.test.espresso", name = "espresso-core", version.ref = androidx-lifecycle-runtime-ktx = { group = "androidx.lifecycle", name = "lifecycle-runtime-ktx", v androidx-activity-compose = { group = "androidx.activity", name = "activity-compose", version.ref androidx-compose-bom = { group = "androidx.compose", name = "compose-bom", version.ref = "composeB androidx-ui = { group = "androidx.compose.ui", name = "ui" } ߡ੹ ߸ࣻ ۄ੉࠳۞ܻ ߸ࣻ libs.versions.toml ߡ੹ ࣂ࣌ ۄ੉࠳۞ܻ ࣂ࣌
  19. ࣂ࣌ • WFSTJPOT • MJCSBSJFT • QMVHJOT • CVOEMFT [bundles]

    ui = ["androidx-core-ktx", "androidx-compose-bom", "andro test = ["junit", "androidx-junit", "androidx-ui-test-juni [versions] activityCompose = "1.9.0" minSdk = "32" [libraries] androidx-ui = { group = "androidx.compose.ui", name = "ui junit = { group = "junit", name = "junit", version.ref = [plugins] android-application = { id = "com.android.application", v jetbrains-kotlin-android = { id = "org.jetbrains.kotlin.a "kotlin" }
  20. plugins { alias(libs.plugins.android.application) alias(libs.plugins.jetbrains.kotlin.android) } android { namespace 'app.junsu.gvc' compileSdk

    34 defaultConfig { applicationId ’app.junsu.gvc’ minSdk 32 targetSdk 34 versionCode 1 versionName ‘1.0’ testInstrumentationRunner ‘androidx.test.runner.AndroidJUnitRunner’ vectorDrawables { useSupportLibrary true }
  21. plugins { alias(libs.plugins.android.application) alias(libs.plugins.jetbrains.kotlin.android) } android { namespace = "app.junsu.gvc"

    compileSdk = 34 defaultConfig { applicationId = "app.junsu.gvc" minSdk = 32 targetSdk = 34 versionCode = 1 versionName = "1.0" testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" vectorDrawables { useSupportLibrary = true }
  22. ੸ਊೞӝ ੹ Ҋ޹ • ,54 • Ӓܖ࠺৬࠺Ү೮ਸٸ  • (SBEMF7FSTJPO$BUBMPH

    • ߡ੹ҙܻݽٕ੉হח೐۽ં౟৬࠺Ү೮ਸٸ  • CVJME4SD৬࠺Ү೮ਸٸ