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

Gradle Script Kotlin for Android

Gradle Script Kotlin for Android

KotlinでGradleを書く話

Yamamoto Shun

June 14, 2017
Tweet

More Decks by Yamamoto Shun

Other Decks in Technology

Transcript

  1. G r a d l e S c r i

    p t Ko t l i n f o r A n d r o i d
  2. ࣗ ݾ ঺ հ w ࢁຊॢ!(VOPTZɹɹ w ೥݄ۀ຿ҕୗˠ೥౓৽ଔ ɹ w

    ά ϊγʔ"OESPJEͷ,PUMJOԽͱ͔Λ͍ͯ͠·͢ w ৽نࣄۀͷ"OESPJEΞϓϦͱ͔΋࡞͍ͬͯ·͢ɹɹɹ
  3. ΅ ͘ͷ C V J M E  H S

    B E M F w ϥΠϒϥϦͷ(JUIVCʹॻ͚ͱݴΘΕͨͷͰ w qBWPS૿΍ͨ͠Γ͢Δͱߏจ͕͸͑ͯͨΓ͍ͯ͢͠͝ w ࠐΈೖͬͨ͜ͱ͢Δͱίʔυิ׬͖͔ͳ͍͚Ͳͦ͏͍ ͏΋ΜͳΜͩΖ͏ w ߏจ͕Α͘Θ͔Βͳ͔ͬͨͷͰωοτ͔Βίϐʔͨ͠
  4. G r a d l e S c r i

    p t Ko t l i n CVJMEHSBEMFΛ,PUMJOͰॻ͚ΔΑ͏ʹͳΔ ίʔυิ׬͖͘Α ߏจΤϥʔͱ͔*%&ͰΈΕΔΑ
  5. ໰ ୊ ఺ w ੈ͸ϚϧνϞδϡʔϧͷ࣌୅ w BQQ DPSF GFBUVSF GFBUVSF

    w *OTUBOU"QQରԠʹ͸΄΅ඞਢ w Ϗϧυߴ଎Խ https://medium.freecodecamp.com/how-modularisation-affects-build-time-of-an-android-application-43a984ce9968
  6. ೰ Ή ͱ ͜ Ζ wUBSHFU4ELͱ͔NJO4ELΛશϞδϡʔϧͰ౷Ұ͍ͨ͠ wHSPPWZͩͱˣ buildscript { ext

    { buildTools = "25.0.2" compileSdk = 25 targetSdk = 25 minSdk = 23 build.gradle app/build.gradle defaultConfig { minSdkVersion rootProject.minSdk targetSdkVersion rootProject.targetSdk versionCode rootProject.versionCode versionName rootProject.versionName
  7. ໰ ୊ ఺ ,P U M J O buildSrc/…/ProjectConfiguration.kt data

    class ProjectConfiguration( val buildTools: String, val compileSdk: Int, val targetSdk: Int, val minSdk : Int ) buildSrc/…/dependencies.gradle.kts var projectConfiguration: ProjectConfiguration by extra projectConfiguration = ProjectConfiguration( buildTools = "25.0.2", compileSdk = 25, targetSdk = 25, minSdk = 25 ) app/build.gradle.kts applyFrom("../dependencies.gradle.kts") val projectConfiguration: ProjectConfiguration by extra android { defaultConfig { minSdkVersion(projectConfiguration.miSdk) targetSdkVersion(projectConfiguration.android.targetSdk)