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
"Gradle meets Kotlin"ってどんな感じ?
Search
ukaznil
November 22, 2017
Programming
3
410
"Gradle meets Kotlin"ってどんな感じ?
どこでもKotlin #4の資料です。
https://m3-engineer.connpass.com/event/70561/
ukaznil
November 22, 2017
Tweet
Share
More Decks by ukaznil
See All by ukaznil
「Flutterってなんなん」と思って1週間経った
ukaznil
1
630
"Convert Java File to Kotlin File"の甘い罠
ukaznil
0
1.2k
Swiftは""" """のか?
ukaznil
0
900
Other Decks in Programming
See All in Programming
デザインパターンで理解するLLMエージェントの作り方 / How to develop an LLM agent using agentic design patterns
rkaga
3
190
Vapor Revolution
kazupon
1
140
광고 소재 심사 과정에 AI를 도입하여 광고 서비스 생산성 향상시키기
kakao
PRO
0
170
watsonx.ai Dojo #4 生成AIを使ったアプリ開発、応用編
oniak3ibm
PRO
1
170
macOS でできる リアルタイム動画像処理
biacco42
9
2.4k
[Do iOS '24] Ship your app on a Friday...and enjoy your weekend!
polpielladev
0
110
Why Jakarta EE Matters to Spring - and Vice Versa
ivargrimstad
0
1.2k
flutterkaigi_2024.pdf
kyoheig3
0
150
型付き API リクエストを実現するいくつかの手法とその選択 / Typed API Request
euxn23
8
2.3k
イベント駆動で成長して委員会
happymana
1
340
ActiveSupport::Notifications supporting instrumentation of Rails apps with OpenTelemetry
ymtdzzz
1
250
見せてあげますよ、「本物のLaravel批判」ってやつを。
77web
7
7.8k
Featured
See All Featured
Building Better People: How to give real-time feedback that sticks.
wjessup
364
19k
Put a Button on it: Removing Barriers to Going Fast.
kastner
59
3.5k
How to Ace a Technical Interview
jacobian
276
23k
Designing on Purpose - Digital PM Summit 2013
jponch
115
7k
The Invisible Side of Design
smashingmag
298
50k
Being A Developer After 40
akosma
87
590k
Navigating Team Friction
lara
183
14k
CoffeeScript is Beautiful & I Never Want to Write Plain JavaScript Again
sstephenson
159
15k
Building Flexible Design Systems
yeseniaperezcruz
327
38k
How to Create Impact in a Changing Tech Landscape [PerfNow 2023]
tammyeverts
47
2.1k
Learning to Love Humans: Emotional Interface Design
aarron
273
40k
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
250
21k
Transcript
"Gradle meets Kotlin" ͬͯͲΜͳײ͡ʁ 2017/11/22 Wed. Ͳ͜ͰKotlin #4 @ukaznil :
Tatsuya KONISHI http://ukaznil.com/
Gradle is ... • JVMܥͷϏϧυπʔϧ • AntɼMavenɼsbtͱ͔ͱಉ͡ • GroovyϕʔεͷDSLͰهड़ •
GradleͰͰ͖Δ͜ͱ • ϏϧυͰ͖·͢ (SBEMFͰ,PUMJOαϙʔτ ʢ!ʣ@ • Ϗϧυʹؔ͢ΔϩδοΫΛΊΔ • ಠࣗtaskͷ࣮ɼґଘؔʢલޙؔʣͷ੍ޚ • ࣾϦϙδτϦͷೝূ
None
͔͠GroovyͰ͋Δɻ ʮϏϧυ͍͚ͨͩ͠ͳͷʹʯ
ຊൃදͷૂ͍ • ʮGradleΑ͘Θ͔ΒΜʯΛ১͍ͨ͠ • GroovyΛॻ͚ͳ͍ͳΒɼ KotlinΛॻ͚͍͍͡Όͳ͍
it's me !! • Android app dev • झຯͰ6 Kotlinྺ2
• ຊAndroidͷձ ֶੜ෦OB • misc • name: Tatsuya KONISHI • major: machine learning • web site: http://ukaznil.com/ , Twitter: @ukaznil • job: '17 ৽ଔ >> γεςϜ։ൃ / AI • langs: Java(5yrs), Kotlin(2yrs), Scala(1yr) Papyrus
ʲεϥΠυͷݟํʳ ʊGroovy / Kotlinʊ ʹؔ͢Δهड़ίʔυ (SPPWZ ,PUMJO println('hello Groovy.') println("hello
Kotlin.")
build.gradleͷجຊతͳॻ͖ํ buildscript { repositories { maven { url 'https://plugins.gradle.org/m2/' }
} dependencies { classpath 'com.github.jengelman.gradle.plguins.shadow:2.0.1' } } apply plugin: 'java' apply plugin: 'com.github.johnrengelman.shadow' repositories { jcenter() maven { url 'https://your.domain.com/repo/' } } dependencies { compile 'your.group:your.compile-module:x.y.z' runtime 'your.group:your.runtime-module:x.y.z' } shadowJar { manifest { attributes 'Main-Class': 'com.your.domain.Main' } } (SPPWZ
build.gradleͷجຊతͳॻ͖ํ buildscript { repositories { maven { url 'https://plugins.gradle.org/m2/' }
} dependencies { classpath 'com.github.jengelman.gradle.plguins.shadow:2.0.1' } } apply plugin: 'java' apply plugin: 'com.github.johnrengelman.shadow' repositories { jcenter() maven { url 'https://your.domain.com/repo/' } } dependencies { compile 'your.group:your.compile-module:x.y.z' runtime 'your.group:your.runtime-module:x.y.z' } shadowJar { manifest { attributes 'Main-Class': 'com.your.domain.Main' } } (SPPWZ
build.gradleͷجຊతͳॻ͖ํ buildscript { repositories { maven { url 'https://plugins.gradle.org/m2/' }
} dependencies { classpath 'com.github.jengelman.gradle.plguins.shadow:2.0.1' } } apply plugin: 'java' apply plugin: 'com.github.johnrengelman.shadow' repositories { jcenter() maven { url 'https://your.domain.com/repo/' } } dependencies { compile 'your.group:your.compile-module:x.y.z' runtime 'your.group:your.runtime-module:x.y.z' } shadowJar { manifest { attributes 'Main-Class': 'com.your.domain.Main' } } (SPPWZ
ʢ͓·͚ʣϓϥάΠϯͰڞ༗ buildscript { repositories { maven { url 'https:// plugins.gradle.org/m2/'
} } dependencies { classpath 'your.plugin:1.0' } } apply plugin: 'java' apply plugin: 'your.plugin' repositories { jcenter() } dependencies { compile 'your.group:your.compile- module:x.y.z' runtime 'your.group:your.runtime- module:x.y.z' } class MyP implements Plugin<Project> { @Override void apply(Project project) { // Private repository project.allprojects { p -> p.repositories { maven { url 'https://hoge.com/' credentials { username = 'taro' password = 'kotlin' } } } } // Original task project.task('unhappy-task') { description 'aiueo' dependsOn project.jar } << { throw new GradleException('> <') } } } (SPPWZ
ʢ͓·͚ʣϓϥάΠϯͰڞ༗ buildscript { repositories { maven { url 'https:// plugins.gradle.org/m2/'
} } dependencies { classpath 'your.plugin:1.0' } } apply plugin: 'java' apply plugin: 'your.plugin' repositories { jcenter() } dependencies { compile 'your.group:your.compile- module:x.y.z' runtime 'your.group:your.runtime- module:x.y.z' } class MyP implements Plugin<Project> { @Override void apply(Project project) { // Private repository project.allprojects { p -> p.repositories { maven { url 'https://hoge.com/' credentials { username = 'taro' password = 'kotlin' } } } } // Original task project.task('unhappy-task') { description 'aiueo' dependsOn project.jar } << { throw new GradleException('> <') } } } (SPPWZ
GradleͰKotlin • ϓϥάΠϯͷద༻ • λεΫͷએݴ • .propertiesϑΝΠϧͷม • ɹ •
ɹ
ϓϥάΠϯͷద༻ plugins { id 'java' id 'org.jetbrains.kotlin.jvm' version '1.1.60' }
plugins { id("java") //id("org.jetbrains.kotlin.jvm") version "1.1.60" kotlin("jvm") version "1.1.60" } • 'java', 'kotlin'ϓϥάΠϯͰఆٛ͞Ε͍ͯΔλ εΫ͕͑ΔΑ͏ʹͳΔ dependencies { compile "org.jetbrains.kotlin:kotlin-stdlib:$version_kotlin" } (SPPWZ ,PUMJO
ϓϥάΠϯͷద༻ plugins { id 'java' id 'org.jetbrains.kotlin.jvm' version '1.1.60' }
plugins { id("java") //id("org.jetbrains.kotlin.jvm") version "1.1.60" kotlin("jvm") version "1.1.60" } • 'java', 'kotlin'ϓϥάΠϯͰఆٛ͞Ε͍ͯΔλ εΫ͕͑ΔΑ͏ʹͳΔ dependencies { compile "org.jetbrains.kotlin:kotlin-stdlib:$version_kotlin" } (SPPWZ ,PUMJO
λεΫͷఆٛ task myGroovyTask { description = 'my task' desctiption 'my
task' } doLast { //'<< {}' is deprecated println("with groovy") } task("myKotlinTask") { description = "my task" }.doLast { println("with kotlin") } (SPPWZ ,PUMJO
λεΫͷఆٛ task myGroovyTask { description = 'my task' desctiption 'my
task' } doLast { //'<< {}' is deprecated println("with groovy") } task("myKotlinTask") { description = "my task" }.doLast { println("with kotlin") } • Groovy / KotlinͷϓϩύςΟΞΫηεͷҧ͍ description = 'desc' || setDescription('desc') description 'desc' || description('desc') description = "desc" || setDescription("desc") (SPPWZ ,PUMJO
.propertiesϑΝΠϧͷม dependencies { compile "org.jetbrains.kotlin:kotlin- stdlib:$vKotlin" } val vKotlin by
project val vKotlin: String by extra val verkotlin = extra["vKotlin"] dependencies { compile "org.jetbrains.kotlin:kotlin- stdlib:$vKotlin" } vKotlin=1.1.60 (SPPWZ ,PUMJO HSBEMFQSPQFSUJFT
.propertiesϑΝΠϧͷม dependencies { compile "org.jetbrains.kotlin:kotlin- stdlib:$vKotlin" } val vKotlin by
project val vKotlin: String by extra val verkotlin = extra["vKotlin"] dependencies { compile "org.jetbrains.kotlin:kotlin- stdlib:$vKotlin" } vKotlin=1.1.60 (SPPWZ ,PUMJO HSBEMFQSPQFSUJFT ,PUMJO͢͜͠໘ɻɻɻ
GradleͰKotlin • ϓϥάΠϯͷద༻ • λεΫͷએݴ • .propertiesϑΝΠϧͷม • ɹ •
ɹ
GradleͰKotlin • ϓϥάΠϯͷద༻ • λεΫͷએݴ • .propertiesϑΝΠϧͷม • ɹ •
ɹ
GradleͰKotlin • ϓϥάΠϯͷద༻ • λεΫͷએݴ • .propertiesϑΝΠϧͷม • IDE͕ෆ •
ɹ
IDE͕@Groovy (SPPWZ ͳΜͯஸೡͳΤϥʔϝοηʔδʜʜοʂ
IDE͕ෆ@Kotlin ,PUMJO 0I
IDE͕ෆ@Kotlin(͓͔ΘΓ) ,PUMJO 0IʢBHBJOʣ
GradleͰKotlin • ϓϥάΠϯͷద༻ • λεΫͷએݴ • .propertiesϑΝΠϧͷม • IDE͕ෆ •
ɹ
GradleͰKotlin • ϓϥάΠϯͷద༻ • λεΫͷએݴ • .propertiesϑΝΠϧͷม • IDE͕ෆ •
IDE͕
IDE͕ෆ@Groovy (SPPWZ NBQͷLFZΛ֮͑ͳ͍ͱ͍͚ͳ͍ͷπϥ͍ɻɻɻ
IDE͕@Kotlin ,PUMJO FYDMVEF͓͚֮͑͑ͯ͞Կͱ͔ͳΔʂ UIBOLTUP֦ுؔ
ຊൃදͷ·ͱΊ • ʮGradleΑ͘Θ͔ΒΜʯΛ১͍ͨ͠ 㱺 buildπʔϧͷཧղʮٸ͕ճΕʯ • GroovyΛॻ͚ͳ͍ͳΒɼ KotlinΛॻ͚͍͍͡Όͳ͍ 㱺 λεΫͰΰϦΰϦ͢ΔͳΒԸܙେʁ
"Gradle meets Kotlin" ͬͯͲΜͳײ͡ʁ That's all of 2017/11/22 Wed. Ͳ͜ͰKotlin
#4 @ukaznil : Tatsuya KONISHI http://ukaznil.com/
Thank you, Kotliners !!