Weitere Ă€hnliche Inhalte Ăhnlich wie Gradle dependency management when multi module (20) KĂŒrzlich hochgeladen (20) Gradle dependency management when multi module3. 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
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.
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
}
.
.
.
.
.
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
}
.
.
.
.
.
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"
]
]
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
}
}
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 âŠ