SlideShare ist ein Scribd-Unternehmen logo
1 von 53
Downloaden Sie, um offline zu lesen
Gradle Dependency
Management when Multi
Module
êč€ê·œí•˜
Why?
playServicesAnalytics = "com.google.android.gms:play-services-analytics:$analyticsVersion"
playServicesAds = "com.google.android.gms:play-services-ads:$adsVersion"
appboy = 'com.appboy:android-sdk-ui-x:$appboyVersion'
twitter = 'com.twitter.sdk.android:twitter:$twitterVersion'
facebook = 'com.facebook.android:facebook-android-sdk:$facebookVersion'
fresco = "com.facebook.fresco:fresco:$frescoVersion"
frescoStetho = "com.facebook.fresco:stetho:$frescoVersion"
frescoAnimatedGif = "com.facebook.fresco:animated-gif:$frescoVersion"
frescoImagepipelineOkhttp = "com.facebook.fresco:imagepipeline-okhttp3:$frescoVersion"
naver = 'com.naver.nid:naveridlogin-android-sdk:$naverVersion'
bottomDialogs ='com.github.javiersantos:BottomDialogs:$bottomDialogsVersion''
crashlytics ='com.crashlytics.sdk.android:crashlytics:$crashlyticsVersion'
dagger2 ="com.google.dagger:dagger:$daggerVersion"
dagger2Compiler ="com.google.dagger:dagger-compiler:$daggerVersion"
eventbus ='org.greenrobot:eventbus:$eventbusVersion'
glide = "com.github.bumptech.glide:glide:$glideVersion"
glideOkHttp = "com.github.bumptech.glide:okhttp3-integration:$glideVersion"
glideCompiler ="com.github.bumptech.glide:compiler:$glideVersion"
gson ='com.google.code.gson:gson:$gsonVersion'
gsonConverter ="com.squareup.retrofit2:converter-gson:$retrofitVersion"
kotlin = "org.jetbrains.kotlin:kotlin-stdlib:$kotlinVersion"
kotlinReflect = "org.jetbrains.kotlin:kotlin-reflect:$kotlinVersion"
kotlinJdk8 = "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlinVersion"
licensesDialog ='de.psdev.licensesdialog:licensesdialog:$licensesDIalogVersion'
materialShowcaseView ='com.github.lezhin:MaterialShowcaseView:$materialShowcaseVersion'
mockito ='org.mockito:mockito-core:$mockitoVersion'
okhttp3 ="com.squareup.okhttp3:okhttp:$okhttpVersion"
okhttp3Interceptor ="com.squareup.okhttp3:logging-interceptor:$okhttpVersion"
.... 40 more
implementation ‘org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.3.21’
implementation 'androidx.appcompat:appcompat:1.0.2'
implementation 'androidx.core:core-ktx:1.0.1'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
testImplementation 'junit:junit:4.12'
A Module
implementation ‘org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.3.21’
implementation 'androidx.appcompat:appcompat:1.0.2'
implementation 'androidx.core:core-ktx:1.0.1'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
testImplementation 'junit:junit:4.12'
C Module
implementation ‘org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.3.21’
implementation 'androidx.appcompat:appcompat:1.0.2'
implementation 'androidx.core:core-ktx:1.0.1'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
testImplementation 'junit:junit:4.12'
B Module
implementation ‘org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.3.21’
implementation 'androidx.appcompat:appcompat:1.0.2'
implementation 'androidx.core:core-ktx:1.0.1'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
testImplementation 'junit:junit:4.12'
.
.
.
.
.
No!!
Extra Properties?
All extra properties must be defined through the "ext" namespace. Once an extra property has been defined, it is available
directly on the owning object (in the below case the Project, Task, and sub-projects respectively) and can be read and updated.
Only the initial declaration that needs to be done via the namespace.
buildscript {
dependencies {
apply from: “dependencies.gradle”


}
}
allprojects { 
 }
subprojects { 
 }
task clean(type: Delete) { 
 }
implementation ‘org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.3.21’
implementation 'androidx.appcompat:appcompat:1.0.2'
implementation 'androidx.core:core-ktx:1.0.1'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
testImplementation 'junit:junit:4.12'
implementation ‘(org.jetbrains.kotlin:kotlin-stdlib-jdk7):(1.3.21)’
implementation '(androidx.appcompat:appcompat):(1.0.2)'
implementation '(androidx.core:core-ktx):(1.0.1)'
implementation '(androidx.constraintlayout:constraintlayout):(1.1.3)'
testImplementation '(junit:junit):(4.12)'
org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.3.21
androidx.appcompat:appcompat:1.0.2
androidx.core:core-ktx:1.0.1
androidx.constraintlayout:constraintlayout:1.1.3
junit:junit:4.12
ext {


...
}
org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.3.21
androidx.appcompat:appcompat:1.0.2
androidx.core:core-ktx:1.0.1
androidx.constraintlayout:constraintlayout:1.1.3
junit:junit:4.12
ext {

 // versions

 // paths
}
org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.3.21
androidx.appcompat:appcompat:1.0.2
androidx.core:core-ktx:1.0.1
androidx.constraintlayout:constraintlayout:1.1.3
junit:junit:4.12
ext {
kotlinVersion = '1.3.21'
appcompatVersion = '1.0.2'
coreVersion = '1.0.1'
constraintLayoutVersion = '1.1.3'
junitVersion = '4.12'

 // paths
}
org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.3.21
androidx.appcompat:appcompat:1.0.2
androidx.core:core-ktx:1.0.1
androidx.constraintlayout:constraintlayout:1.1.3
junit:junit:4.12
ext {

 // versions
kotlinStdLibrary = "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlinVersion"
appcompatLibrary = "androidx.appcompat:appcompat:$appcompatVersion"
androidCoreLibrary = "androidx.core:core-ktx:$coreVersion"
constraintLayoutLibrary = "androidx.constraintlayout:constraintlayout:$constraintLayoutVersion"
junitLibrary = "junit:junit:$junitVersion"
}
implementation ‘org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.3.21’
implementation 'androidx.appcompat:appcompat:1.0.2'
implementation 'androidx.core:core-ktx:1.0.1'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
testImplementation 'junit:junit:4.12'
dependencies {
implementation rootProject.ext.kotlinStdLibrary
implementation rootProject.ext.appcompatLibrary
implementation rootProject.ext.androidCoreLibrary
implementation rootProject.ext.constraintLayoutLibrary
testImplementation rootProject.ext.junitLibrary
}
A Module
dependencies {
implementation rootProject.ext.kotlinStdLibrary
implementation rootProject.ext.appcompatLibrary
implementation rootProject.ext.androidCoreLibrary
implementation rootProject.ext.constraintLayoutLibrary
testImplementation rootProject.ext.jUnitLibrary
}
C Module
dependencies {
implementation rootProject.ext.kotlinStdLibrary
implementation rootProject.ext.appcompatLibrary
implementation rootProject.ext.androidCoreLibrary
implementation rootProject.ext.constraintLayoutLibrary
testImplementation rootProject.ext.jUnitLibrary
}
B Module
dependencies {
implementation rootProject.ext.kotlinStdLibrary
implementation rootProject.ext.appcompatLibrary
implementation rootProject.ext.androidCoreLibrary
implementation rootProject.ext.constraintLayoutLibrary
testImplementation rootProject.ext.jUnitLibrary
}
.
.
.
.
.
END?
No!!
ext {
kotlinVersion = '1.3.21'
appcompatVersion = '1.0.2'
coreVersion = '1.0.1'
constraintLayoutVersion = '1.1.3'
jUnitVersion = '4.12'
kotlinStdLibrary = "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlinVersion"
appcompatLibrary = "androidx.appcompat:appcompat:$appcompatVersion"
androidCoreLibrary = "androidx.core:core-ktx:$coreVersion"
constraintLayoutLibrary = "androidx.constraintlayout:constraintlayout:$constraintLayoutVersion"
junitLibrary = "junit:junit:$junitVersion"
}
ext {
kotlinVersion = '1.3.21'
appcompatVersion = '1.0.2'
coreVersion = '1.0.1'
constraintLayoutVersion = '1.1.3'
jUnitVersion = '4.12'
kotlinStdLibrary = "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlinVersion"
appcompatLibrary = "androidx.appcompat:appcompat:$appcompatVersion"
androidCoreLibrary = "androidx.core:core-ktx:$coreVersion"
constraintLayoutLibrary = "androidx.constraintlayout:constraintlayout:$constraintLayoutVersion"
jUnitLibrary = "junit:junit:$jUnitVersion"
}
A Module
dependencies {
implementation rootProject.ext.kotlinStdLibrary
implementation rootProject.ext.appcompatLibrary
implementation rootProject.ext.androidCoreLibrary
implementation rootProject.ext.constraintLayoutLibrary
testImplementation rootProject.ext.jUnitLibrary
}
C Module
dependencies {
implementation rootProject.ext.kotlinStdLibrary
implementation rootProject.ext.appcompatLibrary
implementation rootProject.ext.androidCoreLibrary
implementation rootProject.ext.constraintLayoutLibrary
testImplementation rootProject.ext.jUnitLibrary
}
B Module
dependencies {
implementation rootProject.ext.kotlinStdLibrary
implementation rootProject.ext.appcompatLibrary
implementation rootProject.ext.androidCoreLibrary
implementation rootProject.ext.constraintLayoutLibrary
testImplementation rootProject.ext.jUnitLibrary
}
.
.
.
.
.
A Module
dependencies {
implementation rootProject.ext.appcompatLibrary
implementation rootProject.ext.androidCoreLibrary
testImplementation rootProject.ext.jUnitLibrary
}
C Module
dependencies {
implementation rootProject.ext.appcompatLibrary
implementation rootProject.ext.androidCoreLibrary
testImplementation rootProject.ext.jUnitLibrary
}
B Module
dependencies {
implementation rootProject.ext.appcompatLibrary
implementation rootProject.ext.androidCoreLibrary
testImplementation rootProject.ext.jUnitLibrary
}
.
.
.
.
.
a
.?
buildscript {
dependencies {
apply from: "dependencies_version.gradle"


}
}
allprojects { 
 }
subprojects {
dependencies {
apply from: “$rootProject.rootDir/dependencies_group.gradle”
apply from: “$rootProject.rootDir/dependencies.gradle”


}
}
task clean(type: Delete) { 
 }
ext {
kotlinVersion = '1.3.21'
appcompatVersion = '1.0.2'
coreVersion = '1.0.1'
constraintLayoutVersion = '1.1.3'
jUnitVersion = '4.12'
kotlinStdLibrary = "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlinVersion"
appcompatLibrary = "androidx.appcompat:appcompat:$appcompatVersion"
androidCoreLibrary = "androidx.core:core-ktx:$coreVersion"
constraintLayoutLibrary = "androidx.constraintlayout:constraintlayout:$constraintLayoutVersion"
junitLibrary = "junit:junit:$junitVersion"
}
ext {

 // version

 // paths
}
ext.versions = [ 
 ] // in dependencies_version.gradle
ext.deps = [ 
 ] // in dependencies_group.gradle
ext {
kotlinVersion = '1.3.21'
appcompatVersion = '1.0.2'
coreVersion = '1.0.1'
constraintLayoutVersion = '1.1.3'
jUnitVersion = '4.12'
...
}
ext.versions = [
"kotlin" : "1.3.21",
"appcompat" : "1.0.2",
"core" : "1.0.1",
"constraintLayout": "1.1.3",
"junit" : "4.12"
]
ext {


kotlinStdLibrary = "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlinVersion"
appcompatLibrary = "androidx.appcompat:appcompat:$appcompatVersion"
androidCoreLibrary = "androidx.core:core-ktx:$coreVersion"
constraintLayoutLibrary = "androidx.constraintlayout:constraintlayout:$constraintLayoutVersion"
jUnitLibrary = "junit:junit:$jUnitVersion"
}
ext.deps = [
"kotlin" : [
"std": "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$versions.kotlin"
],
"android": [
"appcompat" : "androidx.appcompat:appcompat:$versions.appcompat",
"core" : "androidx.core:core-ktx:$versions.core",
"constraintLayout": "androidx.constraintlayout:constraintlayout:$versions.constraintLayout"
],
"test" : [
"junit": "junit:junit:$versions.junit"
]
]
def Group(Closure closure) {
closure.delegate = dependencies
return closure
}
ext {
...
}
def Group(Closure closure) { 
 }
ext {
kotlin = Group {
implementation deps.kotlin.std
}
android = Group {
implementation deps.android.appcompat
implementation deps.android.core
implementation deps.android.constraintLayout
}
test = Group {
testImplementation deps.test.junit
}
}
dependencies {
implementation rootProject.ext.kotlinStdLibrary
implementation rootProject.ext.appcompatLibrary
implementation rootProject.ext.androidCoreLibrary
implementation rootProject.ext.constraintLayoutLibrary
testImplementation rootProject.ext.junitLibrary
}
dependencies {
kotlin()
android()
test()
}
A Module
dependencies {
kotlin()
android()
test()
}
C Module
dependencies {
kotlin()
android()
test()
}
B Module
dependencies {
kotlin()
android()
test()
}
.
.
.
.
.
HMM
.?
1. Groovy
2. Inconvenience
3. Complexity
Kotlin Gradle읎
나왔닀는데...
repositories {
jcenter()
}
plugins {
`kotlin-dsl`
}
ext.versions = [
"kotlin" : "1.3.21",
"appcompat" : "1.0.2",
"core" : "1.0.1",
"constraintLayout": "1.1.3",
"junit" : "4.12"
]
object Versions {
const val kotlin = "1.3.21"
const val appcompat = "1.0.2"
const val core = "1.0.1"
const val constraintLayout = "1.1.3"
const val junit = "4.12"
}
ext.deps = [
"kotlin" : [
"std": "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$versions.kotlin"
],
"android": [
"appcompat" : "androidx.appcompat:appcompat:$versions.appcompat",
"core" : "androidx.core:core-ktx:$versions.core",
"constraintLayout": "androidx.constraintlayout:constraintlayout:$versions.constraintLayout"
],
"test" : [
"junit": "junit:junit:$versions.junit"
]
]
object Groups {
const val std = "org.jetbrains.kotlin:kotlin-stdlib-jdk7:${Versions.kotlin}"
const val appcompat = "androidx.appcompat:appcompat:${Versions.appcompat}"
const val core = "androidx.core:core-ktx:${Versions.core}"
const val constraintLayout = "androidx.constraintlayout:constraintlayout:${Versions.constraintLayout}"
const val junit = "junit:junit:${Versions.junit}"
}
def Group(Closure closure) {
closure.delegate = dependencies
return closure
}
private fun DependencyHandler.implementation(
dependencyString: String
) {
add("implementation", dependencyString)
}
private fun DependencyHandler.testImplementation(
dependencyString: String
) {
add("testImplementation", dependencyString)
}
.
.
.
def Group(Closure closure) { 
 }
ext {
kotlin = Group {
implementation deps.kotlin.std
}
android = Group {
implementation deps.android.appcompat
implementation deps.android.core
implementation deps.android.constraintLayout
}
test = Group {
testImplementation deps.test.junit
}
}
import org.gradle.api.artifacts.dsl.DependencyHandler
fun DependencyHandler.kotlinGroup() {
implementation(Groups.std)
}
fun DependencyHandler.androidGroup() {
implementation(Groups.appcompat)
implementation(Groups.core)
implementation(Groups.constraintLayout)
}
fun DependencyHandler.testGroup() {
testImplementation(Groups.junit)
}
private fun DependencyHandler.implementation 

dependencies {
kotlinGroup()
androidGroup()
testGroup()
}
dependencies {
kotlin()
android()
test()
}
C Module
dependencies {
kotlinGroup()
androidGroup()
testGroup()
}
B Module
dependencies {
kotlinGroup()
androidGroup()
testGroup()
}
.
.
.
.
.
A Module
dependencies {
kotlinGroup()
androidGroup()
testGroup()
}
SO
1. Kotlin!!!
2. Convenience
3. Simple
ê°ì‚Źí•©ë‹ˆë‹€.

Weitere Àhnliche Inhalte

Ähnlich wie Gradle dependency management when multi module

rssfeeds.classpathrssfeeds.project rssfeed .docx
rssfeeds.classpathrssfeeds.project  rssfeed  .docxrssfeeds.classpathrssfeeds.project  rssfeed  .docx
rssfeeds.classpathrssfeeds.project rssfeed .docx
joellemurphey
 
DEVIEW2013: Automating Performance Tests for Android Applications
DEVIEW2013: Automating Performance Tests for Android ApplicationsDEVIEW2013: Automating Performance Tests for Android Applications
DEVIEW2013: Automating Performance Tests for Android Applications
Kyungmin Lee
 

Ähnlich wie Gradle dependency management when multi module (20)

Single Page JavaScript WebApps... A Gradle Story
Single Page JavaScript WebApps... A Gradle StorySingle Page JavaScript WebApps... A Gradle Story
Single Page JavaScript WebApps... A Gradle Story
 
7 Ways to improve your gradle build
7 Ways to improve your gradle build7 Ways to improve your gradle build
7 Ways to improve your gradle build
 
Making the most of your gradle build - Gr8Conf 2017
Making the most of your gradle build - Gr8Conf 2017Making the most of your gradle build - Gr8Conf 2017
Making the most of your gradle build - Gr8Conf 2017
 
Making the most of your gradle build - Greach 2017
Making the most of your gradle build - Greach 2017Making the most of your gradle build - Greach 2017
Making the most of your gradle build - Greach 2017
 
Design Patterns for Tablets and Smartphones
Design Patterns for Tablets and SmartphonesDesign Patterns for Tablets and Smartphones
Design Patterns for Tablets and Smartphones
 
Native Android Development Practices
Native Android Development PracticesNative Android Development Practices
Native Android Development Practices
 
Infinum Android Talks #14 - Data binding to the rescue... or not (?) by Krist...
Infinum Android Talks #14 - Data binding to the rescue... or not (?) by Krist...Infinum Android Talks #14 - Data binding to the rescue... or not (?) by Krist...
Infinum Android Talks #14 - Data binding to the rescue... or not (?) by Krist...
 
Fragments: Why, How, What For?
Fragments: Why, How, What For?Fragments: Why, How, What For?
Fragments: Why, How, What For?
 
Internal Android Library Management (DroidCon SF 2016, Droidcon Italy 2016)
Internal Android Library Management (DroidCon SF 2016, Droidcon Italy 2016)Internal Android Library Management (DroidCon SF 2016, Droidcon Italy 2016)
Internal Android Library Management (DroidCon SF 2016, Droidcon Italy 2016)
 
GKAC 2014 Nov. - ì•ˆë“œëĄœìŽë“œ 5.0의 ìƒˆëĄœìšŽ Ʞ늄
GKAC 2014 Nov. - ì•ˆë“œëĄœìŽë“œ 5.0의 ìƒˆëĄœìšŽ Ʞ늄GKAC 2014 Nov. - ì•ˆë“œëĄœìŽë“œ 5.0의 ìƒˆëĄœìšŽ Ʞ늄
GKAC 2014 Nov. - ì•ˆë“œëĄœìŽë“œ 5.0의 ìƒˆëĄœìšŽ Ʞ늄
 
Invading the home screen
Invading the home screenInvading the home screen
Invading the home screen
 
Beginning Native Android Apps
Beginning Native Android AppsBeginning Native Android Apps
Beginning Native Android Apps
 
rssfeeds.classpathrssfeeds.project rssfeed .docx
rssfeeds.classpathrssfeeds.project  rssfeed  .docxrssfeeds.classpathrssfeeds.project  rssfeed  .docx
rssfeeds.classpathrssfeeds.project rssfeed .docx
 
android level 3
android level 3android level 3
android level 3
 
Android Data Binding
Android Data BindingAndroid Data Binding
Android Data Binding
 
DEVIEW2013: Automating Performance Tests for Android Applications
DEVIEW2013: Automating Performance Tests for Android ApplicationsDEVIEW2013: Automating Performance Tests for Android Applications
DEVIEW2013: Automating Performance Tests for Android Applications
 
Considerations with Writing JavaScript in your DotNetNuke site
Considerations with Writing JavaScript in your DotNetNuke siteConsiderations with Writing JavaScript in your DotNetNuke site
Considerations with Writing JavaScript in your DotNetNuke site
 
Best Practices for Using Mobile SDKs - Lilach Wagner, SafeDK (AppLovin)
Best Practices for Using Mobile SDKs - Lilach Wagner, SafeDK (AppLovin)Best Practices for Using Mobile SDKs - Lilach Wagner, SafeDK (AppLovin)
Best Practices for Using Mobile SDKs - Lilach Wagner, SafeDK (AppLovin)
 
Getting started with building your own standalone Gradle plugin
Getting started with building your own standalone Gradle pluginGetting started with building your own standalone Gradle plugin
Getting started with building your own standalone Gradle plugin
 
Android workshop - 02. Glass development 101
Android workshop - 02. Glass development 101Android workshop - 02. Glass development 101
Android workshop - 02. Glass development 101
 

KĂŒrzlich hochgeladen

+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎+971_581248768%)**%*]'#abortion pills for sale in dubai@
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 

KĂŒrzlich hochgeladen (20)

Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 

Gradle dependency management when multi module

  • 1. Gradle Dependency Management when Multi Module êč€ê·œí•˜
  • 3. playServicesAnalytics = "com.google.android.gms:play-services-analytics:$analyticsVersion" playServicesAds = "com.google.android.gms:play-services-ads:$adsVersion" appboy = 'com.appboy:android-sdk-ui-x:$appboyVersion' twitter = 'com.twitter.sdk.android:twitter:$twitterVersion' facebook = 'com.facebook.android:facebook-android-sdk:$facebookVersion' fresco = "com.facebook.fresco:fresco:$frescoVersion" frescoStetho = "com.facebook.fresco:stetho:$frescoVersion" frescoAnimatedGif = "com.facebook.fresco:animated-gif:$frescoVersion" frescoImagepipelineOkhttp = "com.facebook.fresco:imagepipeline-okhttp3:$frescoVersion" naver = 'com.naver.nid:naveridlogin-android-sdk:$naverVersion' bottomDialogs ='com.github.javiersantos:BottomDialogs:$bottomDialogsVersion'' crashlytics ='com.crashlytics.sdk.android:crashlytics:$crashlyticsVersion' dagger2 ="com.google.dagger:dagger:$daggerVersion" dagger2Compiler ="com.google.dagger:dagger-compiler:$daggerVersion" eventbus ='org.greenrobot:eventbus:$eventbusVersion' glide = "com.github.bumptech.glide:glide:$glideVersion" glideOkHttp = "com.github.bumptech.glide:okhttp3-integration:$glideVersion" glideCompiler ="com.github.bumptech.glide:compiler:$glideVersion" gson ='com.google.code.gson:gson:$gsonVersion' gsonConverter ="com.squareup.retrofit2:converter-gson:$retrofitVersion" kotlin = "org.jetbrains.kotlin:kotlin-stdlib:$kotlinVersion" kotlinReflect = "org.jetbrains.kotlin:kotlin-reflect:$kotlinVersion" kotlinJdk8 = "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlinVersion" licensesDialog ='de.psdev.licensesdialog:licensesdialog:$licensesDIalogVersion' materialShowcaseView ='com.github.lezhin:MaterialShowcaseView:$materialShowcaseVersion' mockito ='org.mockito:mockito-core:$mockitoVersion' okhttp3 ="com.squareup.okhttp3:okhttp:$okhttpVersion" okhttp3Interceptor ="com.squareup.okhttp3:logging-interceptor:$okhttpVersion" .... 40 more
  • 4. implementation ‘org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.3.21’ implementation 'androidx.appcompat:appcompat:1.0.2' implementation 'androidx.core:core-ktx:1.0.1' implementation 'androidx.constraintlayout:constraintlayout:1.1.3' testImplementation 'junit:junit:4.12'
  • 5. A Module implementation ‘org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.3.21’ implementation 'androidx.appcompat:appcompat:1.0.2' implementation 'androidx.core:core-ktx:1.0.1' implementation 'androidx.constraintlayout:constraintlayout:1.1.3' testImplementation 'junit:junit:4.12' C Module implementation ‘org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.3.21’ implementation 'androidx.appcompat:appcompat:1.0.2' implementation 'androidx.core:core-ktx:1.0.1' implementation 'androidx.constraintlayout:constraintlayout:1.1.3' testImplementation 'junit:junit:4.12' B Module implementation ‘org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.3.21’ implementation 'androidx.appcompat:appcompat:1.0.2' implementation 'androidx.core:core-ktx:1.0.1' implementation 'androidx.constraintlayout:constraintlayout:1.1.3' testImplementation 'junit:junit:4.12' . . . . .
  • 8. All extra properties must be defined through the "ext" namespace. Once an extra property has been defined, it is available directly on the owning object (in the below case the Project, Task, and sub-projects respectively) and can be read and updated. Only the initial declaration that needs to be done via the namespace.
  • 9.
  • 10.
  • 11. buildscript { dependencies { apply from: “dependencies.gradle” 
 } } allprojects { 
 } subprojects { 
 } task clean(type: Delete) { 
 }
  • 12. implementation ‘org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.3.21’ implementation 'androidx.appcompat:appcompat:1.0.2' implementation 'androidx.core:core-ktx:1.0.1' implementation 'androidx.constraintlayout:constraintlayout:1.1.3' testImplementation 'junit:junit:4.12'
  • 13. implementation ‘(org.jetbrains.kotlin:kotlin-stdlib-jdk7):(1.3.21)’ implementation '(androidx.appcompat:appcompat):(1.0.2)' implementation '(androidx.core:core-ktx):(1.0.1)' implementation '(androidx.constraintlayout:constraintlayout):(1.1.3)' testImplementation '(junit:junit):(4.12)'
  • 16. org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.3.21 androidx.appcompat:appcompat:1.0.2 androidx.core:core-ktx:1.0.1 androidx.constraintlayout:constraintlayout:1.1.3 junit:junit:4.12 ext { kotlinVersion = '1.3.21' appcompatVersion = '1.0.2' coreVersion = '1.0.1' constraintLayoutVersion = '1.1.3' junitVersion = '4.12' 
 // paths }
  • 17. org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.3.21 androidx.appcompat:appcompat:1.0.2 androidx.core:core-ktx:1.0.1 androidx.constraintlayout:constraintlayout:1.1.3 junit:junit:4.12 ext { 
 // versions kotlinStdLibrary = "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlinVersion" appcompatLibrary = "androidx.appcompat:appcompat:$appcompatVersion" androidCoreLibrary = "androidx.core:core-ktx:$coreVersion" constraintLayoutLibrary = "androidx.constraintlayout:constraintlayout:$constraintLayoutVersion" junitLibrary = "junit:junit:$junitVersion" }
  • 18. implementation ‘org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.3.21’ implementation 'androidx.appcompat:appcompat:1.0.2' implementation 'androidx.core:core-ktx:1.0.1' implementation 'androidx.constraintlayout:constraintlayout:1.1.3' testImplementation 'junit:junit:4.12' dependencies { implementation rootProject.ext.kotlinStdLibrary implementation rootProject.ext.appcompatLibrary implementation rootProject.ext.androidCoreLibrary implementation rootProject.ext.constraintLayoutLibrary testImplementation rootProject.ext.junitLibrary }
  • 19. A Module dependencies { implementation rootProject.ext.kotlinStdLibrary implementation rootProject.ext.appcompatLibrary implementation rootProject.ext.androidCoreLibrary implementation rootProject.ext.constraintLayoutLibrary testImplementation rootProject.ext.jUnitLibrary } C Module dependencies { implementation rootProject.ext.kotlinStdLibrary implementation rootProject.ext.appcompatLibrary implementation rootProject.ext.androidCoreLibrary implementation rootProject.ext.constraintLayoutLibrary testImplementation rootProject.ext.jUnitLibrary } B Module dependencies { implementation rootProject.ext.kotlinStdLibrary implementation rootProject.ext.appcompatLibrary implementation rootProject.ext.androidCoreLibrary implementation rootProject.ext.constraintLayoutLibrary testImplementation rootProject.ext.jUnitLibrary } . . . . .
  • 20. END?
  • 21. No!!
  • 22. ext { kotlinVersion = '1.3.21' appcompatVersion = '1.0.2' coreVersion = '1.0.1' constraintLayoutVersion = '1.1.3' jUnitVersion = '4.12' kotlinStdLibrary = "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlinVersion" appcompatLibrary = "androidx.appcompat:appcompat:$appcompatVersion" androidCoreLibrary = "androidx.core:core-ktx:$coreVersion" constraintLayoutLibrary = "androidx.constraintlayout:constraintlayout:$constraintLayoutVersion" junitLibrary = "junit:junit:$junitVersion" }
  • 23. ext { kotlinVersion = '1.3.21' appcompatVersion = '1.0.2' coreVersion = '1.0.1' constraintLayoutVersion = '1.1.3' jUnitVersion = '4.12' kotlinStdLibrary = "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlinVersion" appcompatLibrary = "androidx.appcompat:appcompat:$appcompatVersion" androidCoreLibrary = "androidx.core:core-ktx:$coreVersion" constraintLayoutLibrary = "androidx.constraintlayout:constraintlayout:$constraintLayoutVersion" jUnitLibrary = "junit:junit:$jUnitVersion" }
  • 24. A Module dependencies { implementation rootProject.ext.kotlinStdLibrary implementation rootProject.ext.appcompatLibrary implementation rootProject.ext.androidCoreLibrary implementation rootProject.ext.constraintLayoutLibrary testImplementation rootProject.ext.jUnitLibrary } C Module dependencies { implementation rootProject.ext.kotlinStdLibrary implementation rootProject.ext.appcompatLibrary implementation rootProject.ext.androidCoreLibrary implementation rootProject.ext.constraintLayoutLibrary testImplementation rootProject.ext.jUnitLibrary } B Module dependencies { implementation rootProject.ext.kotlinStdLibrary implementation rootProject.ext.appcompatLibrary implementation rootProject.ext.androidCoreLibrary implementation rootProject.ext.constraintLayoutLibrary testImplementation rootProject.ext.jUnitLibrary } . . . . .
  • 25. A Module dependencies { implementation rootProject.ext.appcompatLibrary implementation rootProject.ext.androidCoreLibrary testImplementation rootProject.ext.jUnitLibrary } C Module dependencies { implementation rootProject.ext.appcompatLibrary implementation rootProject.ext.androidCoreLibrary testImplementation rootProject.ext.jUnitLibrary } B Module dependencies { implementation rootProject.ext.appcompatLibrary implementation rootProject.ext.androidCoreLibrary testImplementation rootProject.ext.jUnitLibrary } . . . . .
  • 27.
  • 28. buildscript { dependencies { apply from: "dependencies_version.gradle" 
 } } allprojects { 
 } subprojects { dependencies { apply from: “$rootProject.rootDir/dependencies_group.gradle” apply from: “$rootProject.rootDir/dependencies.gradle” 
 } } task clean(type: Delete) { 
 }
  • 29. ext { kotlinVersion = '1.3.21' appcompatVersion = '1.0.2' coreVersion = '1.0.1' constraintLayoutVersion = '1.1.3' jUnitVersion = '4.12' kotlinStdLibrary = "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlinVersion" appcompatLibrary = "androidx.appcompat:appcompat:$appcompatVersion" androidCoreLibrary = "androidx.core:core-ktx:$coreVersion" constraintLayoutLibrary = "androidx.constraintlayout:constraintlayout:$constraintLayoutVersion" junitLibrary = "junit:junit:$junitVersion" }
  • 30. ext { 
 // version 
 // paths } ext.versions = [ 
 ] // in dependencies_version.gradle ext.deps = [ 
 ] // in dependencies_group.gradle
  • 31. ext { kotlinVersion = '1.3.21' appcompatVersion = '1.0.2' coreVersion = '1.0.1' constraintLayoutVersion = '1.1.3' jUnitVersion = '4.12' ... } ext.versions = [ "kotlin" : "1.3.21", "appcompat" : "1.0.2", "core" : "1.0.1", "constraintLayout": "1.1.3", "junit" : "4.12" ]
  • 32. ext { 
 kotlinStdLibrary = "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlinVersion" appcompatLibrary = "androidx.appcompat:appcompat:$appcompatVersion" androidCoreLibrary = "androidx.core:core-ktx:$coreVersion" constraintLayoutLibrary = "androidx.constraintlayout:constraintlayout:$constraintLayoutVersion" jUnitLibrary = "junit:junit:$jUnitVersion" } ext.deps = [ "kotlin" : [ "std": "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$versions.kotlin" ], "android": [ "appcompat" : "androidx.appcompat:appcompat:$versions.appcompat", "core" : "androidx.core:core-ktx:$versions.core", "constraintLayout": "androidx.constraintlayout:constraintlayout:$versions.constraintLayout" ], "test" : [ "junit": "junit:junit:$versions.junit" ] ]
  • 33. def Group(Closure closure) { closure.delegate = dependencies return closure } ext { ... }
  • 34. def Group(Closure closure) { 
 } ext { kotlin = Group { implementation deps.kotlin.std } android = Group { implementation deps.android.appcompat implementation deps.android.core implementation deps.android.constraintLayout } test = Group { testImplementation deps.test.junit } }
  • 35. dependencies { implementation rootProject.ext.kotlinStdLibrary implementation rootProject.ext.appcompatLibrary implementation rootProject.ext.androidCoreLibrary implementation rootProject.ext.constraintLayoutLibrary testImplementation rootProject.ext.junitLibrary } dependencies { kotlin() android() test() }
  • 36. A Module dependencies { kotlin() android() test() } C Module dependencies { kotlin() android() test() } B Module dependencies { kotlin() android() test() } . . . . .
  • 40.
  • 41.
  • 43.
  • 44.
  • 45. ext.versions = [ "kotlin" : "1.3.21", "appcompat" : "1.0.2", "core" : "1.0.1", "constraintLayout": "1.1.3", "junit" : "4.12" ] object Versions { const val kotlin = "1.3.21" const val appcompat = "1.0.2" const val core = "1.0.1" const val constraintLayout = "1.1.3" const val junit = "4.12" }
  • 46. ext.deps = [ "kotlin" : [ "std": "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$versions.kotlin" ], "android": [ "appcompat" : "androidx.appcompat:appcompat:$versions.appcompat", "core" : "androidx.core:core-ktx:$versions.core", "constraintLayout": "androidx.constraintlayout:constraintlayout:$versions.constraintLayout" ], "test" : [ "junit": "junit:junit:$versions.junit" ] ] object Groups { const val std = "org.jetbrains.kotlin:kotlin-stdlib-jdk7:${Versions.kotlin}" const val appcompat = "androidx.appcompat:appcompat:${Versions.appcompat}" const val core = "androidx.core:core-ktx:${Versions.core}" const val constraintLayout = "androidx.constraintlayout:constraintlayout:${Versions.constraintLayout}" const val junit = "junit:junit:${Versions.junit}" }
  • 47. def Group(Closure closure) { closure.delegate = dependencies return closure } private fun DependencyHandler.implementation( dependencyString: String ) { add("implementation", dependencyString) } private fun DependencyHandler.testImplementation( dependencyString: String ) { add("testImplementation", dependencyString) } . . .
  • 48. def Group(Closure closure) { 
 } ext { kotlin = Group { implementation deps.kotlin.std } android = Group { implementation deps.android.appcompat implementation deps.android.core implementation deps.android.constraintLayout } test = Group { testImplementation deps.test.junit } } import org.gradle.api.artifacts.dsl.DependencyHandler fun DependencyHandler.kotlinGroup() { implementation(Groups.std) } fun DependencyHandler.androidGroup() { implementation(Groups.appcompat) implementation(Groups.core) implementation(Groups.constraintLayout) } fun DependencyHandler.testGroup() { testImplementation(Groups.junit) } private fun DependencyHandler.implementation 

  • 50. C Module dependencies { kotlinGroup() androidGroup() testGroup() } B Module dependencies { kotlinGroup() androidGroup() testGroup() } . . . . . A Module dependencies { kotlinGroup() androidGroup() testGroup() }
  • 51. SO