Slide 1

Slide 1 text

௏ౣܽݍ࠽٘झ௼݀౟ ,PUMJO,PSFB.FFUVQ 

Slide 2

Slide 2 text

௏ౣܽݍӒېٜ

Slide 3

Slide 3 text

@importre • Jaewe Heo ೲ੤ਤ @ !iiid! ܡ੉٘! • Kotlin Korea • Android • ReactiveX • Probot for Github automation • ...

Slide 4

Slide 4 text

׼न਷ • Kotlin • Gradle • Gradle with Kotlin DSL1 1 kotlin-dsl: Kotlin language support for Gradle build scripts

Slide 5

Slide 5 text

য়ט਷ • ௏ౣܽਵ۽ Ӓېٜ ೒۞Ӓੋ ٜ݅ӝ • ੉޷ ઓ੤ೞח ׼न੄ ೐۽ં౟ী ੸ਊೞӝ

Slide 6

Slide 6 text

Ҷ੉৵ 

Slide 7

Slide 7 text

زӝ

Slide 8

Slide 8 text

Բ৉Բ৉ • ҅ࣘ ӡয૑ח build.gradle • apply from: ...? • ೒۞Ӓੋ? • Groovy • ز੸ ೐۽Ӓې߁ ঱য • ੗ز৮ࢿ !

Slide 9

Slide 9 text

੉ઁח • Groovy Kotlin • ࠽٘झ௼݀౟/೒۞Ӓੋ/উ٘۽੉٘ ੌਗച • ز੸ ъ۱ೠ ੿੸ ఋੑ੄ ೐۽Ӓې߁ ঱য • ੗ز৮ࢿ !

Slide 10

Slide 10 text

೒۞Ӓੋٜ݅ӝ

Slide 11

Slide 11 text

೒۞Ӓੋٜ݅ӝ ௏ౣܽਵ۽

Slide 12

Slide 12 text

݅٘חߑߨ • build.gradle Groovy ৔৉੉פ ֤৻۽ • buildSrc ೐۽ં౟ • or ة݀੸ੋStandalone ೐۽ં౟

Slide 13

Slide 13 text

buildSrc೐۽ં౟ $rootProject/buildSrc/ • ೒۞Ӓੋ ௏٘ܳ ੘ࢿೞݶ • ࠽٘झ௼݀౟ classpathী ನೣغয • ݫੋ/ࢲ࠳ ݽٕٜ੄ ࠽٘झ௼݀౟ীࢲ ࢎਊ оמ • ҕਬ ࠛо • ݫੋ ݽٕਸ ߩযաݶ ॶ ࣻ হ਺

Slide 14

Slide 14 text

ة݀੸ੋStandalone೐۽ં౟ • buildSrc৬ ࠺त • ডр੄ ࢸ੿੉ ؊ ೙ਃ • ҕਬ оמ https://plugins.gradle.org

Slide 15

Slide 15 text

ѐߊജ҃

Slide 16

Slide 16 text

ѐߊജ҃ Dependency Version Android Studio 3.1.3 Android Gradle Plugin 3.2.0-beta01 Gradle Wrapper 4.7

Slide 17

Slide 17 text

(SBEMFীٮܲ,PUMJO%4-ߡ੹ Gradle Wrapper Kotlin DSL Kotlin 4.8 0.17.5 1.2.4x 4.7 0.16.3 1.2.3x 4.6 0.15.6 1.2.2x 2 Releases: https://github.com/gradle/kotlin-dsl/releases

Slide 18

Slide 18 text

݅٘חߑߨ

Slide 19

Slide 19 text

GreetingPlugin GFBUbuildSrc 1. buildSrc ٣۩షܻ ࢤࢿ 2. buildSrc/build.gradle.kts ࢤࢿ 3. Ӓېٜ ೒۞Ӓੋ ߂ కझ௼ ੘ࢿ 4. ӝઓ ࠽٘झ௼݀౟build.gradle ী ੸ਊ 5. కझ௼ प೯

Slide 20

Slide 20 text

buildSrc٣۩షܻ߂झ௼݀౟౵ੌࢤࢿ % # ܖ౟ ೐۽ં౟ীࢲ % mkdir -p buildSrc/src % touch buildSrc/build.gradle.kts

Slide 21

Slide 21 text

buildSrc٣۩షܻ߂झ௼݀౟౵ੌࢤࢿ % # ܖ౟ ೐۽ં౟ীࢲ % mkdir -p buildSrc/src/main/kotlin/importre % touch buildSrc/build.gradle.kts

Slide 22

Slide 22 text

No content

Slide 23

Slide 23 text

No content

Slide 24

Slide 24 text

Ӓېٜ೒۞Ӓੋ߂కझ௼੘ࢿ class GreetingPlugin : Plugin { private fun greeting(): String = "Hello, World!" override fun apply(project: Project): Unit = project.run { tasks { "greeting" { group = "kotlin-flavored" description = "௏ౣܽ ݍ Ӓېٜ ೒۞Ӓੋ" doLast { .run( ::println) } } } } }

Slide 25

Slide 25 text

Ӓېٜ೒۞Ӓੋ߂కझ௼੘ࢿ class GreetingPlugin : Plugin { private fun greeting(): String = "Hello, World!" override fun apply(project: Project): Unit = project.run { tasks { "greeting" { group = "kotlin-flavored" description = "௏ౣܽ ݍ Ӓېٜ ೒۞Ӓੋ" doLast { greeting().run( ::println) } } } } }

Slide 26

Slide 26 text

Ӓېٜ೒۞Ӓੋ߂కझ௼੘ࢿ class GreetingPlugin : Plugin { private fun greeting(): String = "Hello, World!" override fun apply(project: Project): Unit = project.run { tasks { "greeting" { group = "kotlin-flavored" description = "௏ౣܽ ݍ Ӓېٜ ೒۞Ӓੋ" doLast { greeting().run( ::println) } } } } }

Slide 27

Slide 27 text

Ӓېٜ೒۞Ӓੋ߂కझ௼੘ࢿ class GreetingPlugin : Plugin { private fun greeting(): String = "Hello, World!" override fun apply(project: Project): Unit = project.run { tasks { "greeting" { group = "kotlin-flavored" description = "௏ౣܽ ݍ Ӓېٜ ೒۞Ӓੋ" doLast { greeting().run( ::println) } } } } }

Slide 28

Slide 28 text

ࢤࢿೠ೒۞Ӓੋ֢୹ plugins { `kotlin-dsl` `java-gradle-plugin` } gradlePlugin { (plugins) { "greeting-plugin" { id = "greeting" implementationClass = "importre.GreetingPlugin" } } } 3 java-gradle-plugin: https://docs.gradle.org/current/userguide/java_gradle_plugin.html

Slide 29

Slide 29 text

ࢤࢿೠ೒۞Ӓੋ֢୹ plugins { `kotlin-dsl` `java-gradle-plugin` } gradlePlugin { (plugins) { "greeting-plugin" { id = "greeting" implementationClass = "importre.GreetingPlugin" } } } 3 java-gradle-plugin: https://docs.gradle.org/current/userguide/java_gradle_plugin.html

Slide 30

Slide 30 text

ࢤࢿೠ೒۞Ӓੋ֢୹ plugins { `kotlin-dsl` `java-gradle-plugin` } gradlePlugin { (plugins) { "greeting-plugin" { id = "greeting" implementationClass = "importre.GreetingPlugin" } } } 3 java-gradle-plugin: https://docs.gradle.org/current/userguide/java_gradle_plugin.html

Slide 31

Slide 31 text

ࢤࢿೠ೒۞Ӓੋ֢୹ plugins { `kotlin-dsl` `java-gradle-plugin` } gradlePlugin { (plugins) { // As an expression "greeting-plugin" { id = "greeting" implementationClass = "importre.GreetingPlugin" } } } 3 java-gradle-plugin: https://docs.gradle.org/current/userguide/java_gradle_plugin.html

Slide 32

Slide 32 text

ӝઓ࠽٘झ௼݀౟build.gradleী੸ਊ apply plugin: 'com.android.application' apply plugin: 'kotlin-android' apply plugin: 'kotlin-android-extensions' apply plugin: 'greeting' android { // ...

Slide 33

Slide 33 text

ӝઓ࠽٘झ௼݀౟build.gradleী੸ਊ apply plugin: 'com.android.application' apply plugin: 'kotlin-android' apply plugin: 'kotlin-android-extensions' apply plugin: 'greeting' android { // ...

Slide 34

Slide 34 text

No content

Slide 35

Slide 35 text

కझ௼प೯ % ./gradlew -q greeting Hello, World!

Slide 36

Slide 36 text

࡮աझ೒۞Ӓੋ੊झబ࣌

Slide 37

Slide 37 text

(PBMuserNameࢸ੿ apply plugin: 'com.android.application' apply plugin: 'kotlin-android' apply plugin: 'kotlin-android-extensions' apply plugin: 'greeting' greeting { userName = "Kotlin" } android { // ...

Slide 38

Slide 38 text

(PBMకझ௼प೯ % ./gradlew -q greeting Hello, Kotlin

Slide 39

Slide 39 text

੊झబ࣌ࢤࢿ package importre /** * [GreetingPlugin] Extension * * @property userName for **greeting ** */ open class GreetingExt( var userName: String? = null )

Slide 40

Slide 40 text

కझ௼ীݒೝ class GreetingPlugin : Plugin { private fun greeting(userName: String?) = "Hello, ${userName ?: "World"}!" override fun apply(project: Project): Unit = project.run { val ext = extensions.create("greeting", GreetingExt ::class.java) tasks { "greeting" { group = "kotlin-flavored" description = "௏ౣܽ ݍ Ӓېٜ ೒۞Ӓੋ" doLast { greeting(ext.userName).run( ::println) } } } } }

Slide 41

Slide 41 text

కझ௼ীݒೝ class GreetingPlugin : Plugin { private fun greeting(userName: String?) = "Hello, ${userName ?: "World"}!" override fun apply(project: Project): Unit = project.run { val ext = extensions.create("greeting", GreetingExt ::class.java) tasks { "greeting" { group = "kotlin-flavored" description = "௏ౣܽ ݍ Ӓېٜ ೒۞Ӓੋ" doLast { greeting(ext.userName).run( ::println) } } } } }

Slide 42

Slide 42 text

కझ௼प೯ % ./gradlew -q greeting Hello, Kotlin

Slide 43

Slide 43 text

݅٘חߑߨ

Slide 44

Slide 44 text

GreetingPlugin GFBU4UBOEBMPOF 1. ݃਺؀۽ ٣۩షܻ ࢤࢿ 2. ೒۞Ӓੋ ҳഅ 3. ӝઓ ࠽٘झ௼݀౟৬ Composit 4. ӝઓ ࠽٘झ௼݀౟build.gradle ী ੸ਊ 5. కझ௼ प೯

Slide 45

Slide 45 text

೒۞Ӓੋ೐۽ં౟ࢤࢿ % # `plugins` ߃ী `greeting` ࢤࢿ % take plugins/greeting % gradle init --type basic --dsl kotlin

Slide 46

Slide 46 text

೒۞Ӓੋ೐۽ં౟ࢤࢿ % # `plugins` ߃ী `greeting` ࢤࢿ % take plugins/greeting % gradle init --type basic --dsl kotlin

Slide 47

Slide 47 text

DGgradle init Task name Type Description init InitBuild Generates a Gradle project • Types of InitBuild • java-application • java-library • scala-library • ... • basic

Slide 48

Slide 48 text

DGgradle initXJUIkotiln-dsl $ gradle init --type java-library --dsl kotlin $ tree . ├── build.gradle.kts ├── gradle │ └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── settings.gradle.kts └── src ├── main │ └── java │ └── Library.java └── test └── java └── LibraryTest.java 7 directories, 8 files

Slide 49

Slide 49 text

DGgradle initXJUIkotiln-dsl $ gradle init --type java-library --dsl kotlin $ tree . ├── build.gradle.kts ├── gradle │ └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── settings.gradle.kts └── src ├── main │ └── java │ └── Library.java └── test └── java └── LibraryTest.java 7 directories, 8 files

Slide 50

Slide 50 text

೒۞Ӓੋҳഅ খࢲ ҳഅೠ Ѫҗ ӝઓҗ زੌ !

Slide 51

Slide 51 text

$PNQPTJU#VJMET • ݣ౭ ࠽٘৬ ࠽तೞա ة݀੸ਵ۽ ѐߊೞҊ ನೣदఆ ࣻ ੓਺ • include؀न includeBuild ೣࣻܳ ࢎਊ • settings.gradle੉ ੓যঠ ೣ • ӝઓ ೐۽ં౟੄ ੉ܴҗ ઺ࠂೲਊ ࠛо 4 Composite Builds: https://docs.gradle.org/current/userguide/composite_builds.html

Slide 52

Slide 52 text

settings.gradle include ':app' includeBuild('./plugins/greeting') { dependencySubstitution { substitute module('com.importre.example:greeting') with project(':') } }

Slide 53

Slide 53 text

settings.gradle include ':app' includeBuild('./plugins/greeting') { dependencySubstitution { substitute module('com.importre.example:greeting') with project(':') } }

Slide 54

Slide 54 text

settings.gradle include ':app' includeBuild('./plugins/greeting') { dependencySubstitution { substitute module('com.importre.example:greeting') with project(':') } }

Slide 55

Slide 55 text

settings.gradle include ':app' includeBuild('./plugins/greeting') { dependencySubstitution { substitute module('com.importre.example:greeting') with project(':') } }

Slide 56

Slide 56 text

ӝઓ࠽٘झ௼݀౟build.gradleী੸ਊ buildscript { dependencies { classpath 'com.importre.example:greeting' } } apply plugin: 'com.android.application' apply plugin: 'kotlin-android' apply plugin: 'kotlin-android-extensions' apply plugin: 'greeting' android {

Slide 57

Slide 57 text

ӝઓ࠽٘झ௼݀౟build.gradleী੸ਊ buildscript { dependencies { classpath 'com.importre.example:greeting' } } apply plugin: 'com.android.application' apply plugin: 'kotlin-android' apply plugin: 'kotlin-android-extensions' apply plugin: 'greeting' android {

Slide 58

Slide 58 text

కझ௼प೯ % # Root Project % ./gradlew -q greeting Hello, World!

Slide 59

Slide 59 text

ਃড

Slide 60

Slide 60 text

ਃড • buildSrc ೐۽ં౟ • buildSrc ࢤࢿ • ೒۞Ӓੋ ҳഅ • ӝઓ ೐۽ં౟ী ೒۞Ӓੋ ੸ਊ • ೒۞Ӓੋ ഛ੢ ҳഅ ߂ ੸ਊ • ة݀੸ੋStandalone ೐۽ં౟ • ೒۞Ӓੋ ೐۽ં౟ ࢤࢿ • ೒۞Ӓੋ ҳഅ • ӝઓ ೐۽ં౟ী ೒۞Ӓੋ ನೣ • ӝઓ ೐۽ં౟ী ೒۞Ӓੋ ੸ਊ

Slide 61

Slide 61 text

݃ޖܻ • ੉޷ ழ૓ झ௼݀౟ܳ ೠߣী gradle.build.kts۽ ৤ӝӝূ ൨ٝ • ೞաঀ ৤ѹࢲ build.gradle ୭ࣗച • ੘ই૓ build.gradleਸ build.gradle.kts۽ ߸ജ

Slide 62

Slide 62 text

ઁউ • buildSrc ೐۽ં౟ • ই૒ হ׮ݶ ੉઱ द੘ • ة݀੸ੋStandalone ೐۽ં౟ • ੉޷ buildSrcо ੓Ѣա • ݧ૓ ೒۞Ӓੋਸ ҳഅ ߂ ҕਬ & ߓನ

Slide 63

Slide 63 text

Ѿҗޛ • Github • importre/kotlin-flavored-buildscripts • Speakerdeck • importre/kotlin-flavored-buildscripts

Slide 64

Slide 64 text

ӒܻҊ

Slide 65

Slide 65 text

਋ܻח ଻ਊ઺

Slide 66

Slide 66 text

!iiid!

Slide 67

Slide 67 text

get rid of sth — ~ਸ ઁѢೞ׮, হগ׮

Slide 68

Slide 68 text

WE ARE HIRING! !iiid! : AI-based EdTech • যରೖ ؋૕ೡѢ ೯ࠂೞѱ ؋૕ೞ੗ • ࢑ఋష੊ • ష੊೟ਗ ӝࣿഥࢎ • ...

Slide 69

Slide 69 text

ನ૑࣌ • AI Scientist / Data Engineer • Android • Backend • iOS • or Something else • e.g. Content Developers Headless CMS5 5 CMS: Content Management System

Slide 70

Slide 70 text

хࢎ೤פ׮

Slide 71

Slide 71 text

૕ޙ ੓ਵनоਃ