Skip to content

Commit 8ebb623

Browse files
authored
Move dependencies to Version Catalog (#299)
1 parent 89799f7 commit 8ebb623

File tree

31 files changed

+470
-397
lines changed

31 files changed

+470
-397
lines changed

build.gradle

Lines changed: 10 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,14 @@
11
// Top-level build file where you can add configuration options common to all sub-projects/modules.
2-
apply plugin: 'org.jetbrains.dokka'
3-
apply plugin: 'io.github.gradle-nexus.publish-plugin'
4-
5-
buildscript {
6-
apply from: 'dependencies.gradle'
7-
repositories {
8-
maven { url "https://plugins.gradle.org/m2/" }
9-
google()
10-
mavenCentral()
11-
}
12-
dependencies {
13-
classpath 'com.android.tools.build:gradle:7.4.2'
14-
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion"
15-
classpath "com.github.dcendents:android-maven-gradle-plugin:2.1"
16-
17-
// maven central dependencies
18-
classpath 'io.github.gradle-nexus:publish-plugin:1.1.0'
19-
classpath 'org.jetbrains.dokka:dokka-gradle-plugin:1.5.0'
20-
21-
// ktlint & detekt dependencies
22-
classpath "org.jlleitschuh.gradle:ktlint-gradle:11.1.0"
23-
classpath "io.gitlab.arturbosch.detekt:detekt-gradle-plugin:$detektVersion"
24-
}
2+
plugins {
3+
alias(libs.plugins.dokka)
4+
alias(libs.plugins.gradle.nexus.publish)
5+
alias(libs.plugins.android.library) apply false
6+
alias(libs.plugins.android.application) apply false
7+
alias(libs.plugins.kotlin.android) apply false
8+
alias(libs.plugins.kotlin.parcelize) apply false
9+
alias(libs.plugins.ksp) apply false
10+
alias(libs.plugins.detekt) apply false
11+
alias(libs.plugins.ktlint) apply false
2512
}
2613

2714
allprojects {

dependencies.gradle

Lines changed: 0 additions & 19 deletions
This file was deleted.

gradle/libs.versions.toml

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
[versions]
2+
3+
java = "1.8"
4+
5+
minSdk = "21"
6+
targetSdk = "32"
7+
compileSdk = "33"
8+
buildTools = "32.0.0"
9+
10+
agp = "7.4.2"
11+
androidXCore = "1.6.0"
12+
androidXLifecycle = "2.4.0"
13+
compose = "1.4.0"
14+
composeCompiler = "1.4.7"
15+
composeMaterial3 = "1.1.2"
16+
detekt = "1.19.0"
17+
kotlin = "1.8.21"
18+
ktlint-plugin = "11.1.0"
19+
ktor = "2.3.2"
20+
ksp = "1.8.21-1.0.11"
21+
moshi = "1.13.0"
22+
navigation = "2.4.1"
23+
okhttp = "4.9.1"
24+
retrofit = "2.9.0"
25+
room = "2.5.1"
26+
27+
[plugins]
28+
29+
android-application = { id = "com.android.application", version.ref = "agp" }
30+
android-library = { id = "com.android.library", version.ref = "agp" }
31+
detekt = { id = "io.gitlab.arturbosch.detekt", version.ref = "detekt" }
32+
dokka = { id = "org.jetbrains.dokka", version = "1.5.0" }
33+
gradle-nexus-publish = { id = "io.github.gradle-nexus.publish-plugin", version = "1.1.0" }
34+
kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" }
35+
kotlin-parcelize = { id = "org.jetbrains.kotlin.plugin.parcelize", version.ref = "kotlin" }
36+
kotlin-serialization = { id = "org.jetbrains.kotlin.plugin.serialization", version.ref = "kotlin" }
37+
ksp = { id = "com.google.devtools.ksp", version.ref = "ksp" }
38+
ktlint = { id = "org.jlleitschuh.gradle.ktlint", version.ref = "ktlint-plugin" }
39+
40+
[libraries]
41+
42+
androidx-annotation = { module = "androidx.annotation:annotation", version = "1.4.0" }
43+
androidx-appcompat = { module = "androidx.appcompat:appcompat", version = "1.4.0" }
44+
androidx-browser = { module = "androidx.browser:browser", version = "1.4.0" }
45+
androidx-cardview = { module = "androidx.cardview:cardview", version = "1.0.0" }
46+
androidx-constraintlayout = { module = "androidx.constraintlayout:constraintlayout", version = "2.1.2" }
47+
androidx-core = { module = "androidx.core:core-ktx", version.ref = "androidXCore" }
48+
androidx-lifecycle-common = { module = "androidx.lifecycle:lifecycle-common-java8", version.ref = "androidXLifecycle" }
49+
androidx-lifecycle-livedata = { module = "androidx.lifecycle:lifecycle-livedata-ktx", version.ref = "androidXLifecycle" }
50+
androidx-lifecycle-viewmodel = { module = "androidx.lifecycle:lifecycle-viewmodel-ktx", version.ref = "androidXLifecycle" }
51+
androidx-lifecycle-runtime = { module = "androidx.lifecycle:lifecycle-runtime-ktx", version.ref = "androidXLifecycle" }
52+
androidx-navigation-fragment = { module = "androidx.navigation:navigation-fragment-ktx", version.ref = "navigation" }
53+
androidx-navigation-ui = { module = "androidx.navigation:navigation-ui", version.ref = "navigation" }
54+
androidx-preference = { module = "androidx.preference:preference-ktx", version = "1.2.0" }
55+
androidx-recyclerview = { module = "androidx.recyclerview:recyclerview", version = "1.2.1" }
56+
androidx-swiperefreshlayout = { module = "androidx.swiperefreshlayout:swiperefreshlayout", version = "1.1.0" }
57+
58+
compose-foundation = { module = "androidx.compose.foundation:foundation", version.ref = "compose" }
59+
compose-material3 = { module = "androidx.compose.material3:material3", version.ref = "composeMaterial3" }
60+
compose-runtime = { module = "androidx.compose.runtime:runtime", version.ref = "compose" }
61+
compose-ui = { module = "androidx.compose.ui:ui", version.ref = "compose" }
62+
compose-ui-tooling = { module = "androidx.compose.ui:ui-tooling", version.ref = "compose" }
63+
compose-ui-tooling-preview = { module = "androidx.compose.ui:ui-tooling-preview", version.ref = "compose" }
64+
constraintlayout-compose = { module = "androidx.constraintlayout:constraintlayout-compose", version = "1.0.1" }
65+
66+
datastore-preferences = { module = "androidx.datastore:datastore-preferences", version = "1.0.0" }
67+
68+
google-material = { module = "com.google.android.material:material", version = "1.6.1" }
69+
70+
junit = { module = "junit:junit", version = "4.13.2" }
71+
72+
kotlin-stdlib-jdk8 = { module = "org.jetbrains.kotlin:kotlin-stdlib-jdk8", version.ref = "kotlin" }
73+
kotlinx-coroutines-core = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-core", version = "1.6.0" }
74+
kotlinx-serialization-json = { module = "org.jetbrains.kotlinx:kotlinx-serialization-json", version = "1.5.1" }
75+
ktor-client-android = { module = "io.ktor:ktor-client-android", version.ref = "ktor" }
76+
ktor-client-content-negotiation = { module = "io.ktor:ktor-client-content-negotiation", version.ref = "ktor" }
77+
ktor-client-core-jvm = { module = "io.ktor:ktor-client-core-jvm", version.ref = "ktor" }
78+
ktor-serialization-kotlinx-json = { module = "io.ktor:ktor-serialization-kotlinx-json", version.ref = "ktor" }
79+
80+
leakcanary-android = { module = "com.squareup.leakcanary:leakcanary-android", version = "2.7" }
81+
82+
moshi = { module = "com.squareup.moshi:moshi", version.ref = "moshi" }
83+
moshi-codegen = { module = "com.squareup.moshi:moshi-kotlin-codegen", version.ref = "moshi" }
84+
85+
okhttp = { module = "com.squareup.okhttp3:okhttp", version.ref = "okhttp" }
86+
okhttp-logging-interceptor = { module = "com.squareup.okhttp3:logging-interceptor", version.ref = "okhttp" }
87+
okio = { module = "com.squareup.okio:okio", version = "2.10.0" }
88+
89+
retrofit = { module = "com.squareup.retrofit2:retrofit", version.ref = "retrofit" }
90+
retrofit-converter-moshi = { module = "com.squareup.retrofit2:converter-moshi", version.ref = "retrofit" }
91+
room = { module = "androidx.room:room-ktx", version.ref = "room" }
92+
room-compiler = { module = "androidx.room:room-compiler", version.ref = "room" }
93+
94+
timber = { module = "com.jakewharton.timber:timber", version = "5.0.1" }
Lines changed: 18 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
plugins {
2-
id 'com.android.library'
3-
id 'kotlin-android'
2+
alias(libs.plugins.android.library)
3+
alias(libs.plugins.kotlin.android)
44
}
55

66
apply from: "$rootDir/scripts/build/utils.gradle"
@@ -16,16 +16,16 @@ ext {
1616
}
1717

1818
android {
19-
compileSdkVersion rootProject.compileSdkVersion
20-
buildToolsVersion rootProject.buildToolsVersion
19+
compileSdk = libs.versions.compileSdk.get().toInteger()
20+
buildToolsVersion = libs.versions.buildTools.get()
2121

2222
buildFeatures {
2323
viewBinding true
2424
}
2525

2626
defaultConfig {
27-
minSdkVersion rootProject.minSdkVersion
28-
targetSdkVersion rootProject.targetSdkVersion
27+
minSdk = libs.versions.minSdk.get().toInteger()
28+
targetSdk = libs.versions.targetSdk.get().toInteger()
2929
}
3030

3131
buildTypes {
@@ -36,11 +36,11 @@ android {
3636
}
3737
}
3838
compileOptions {
39-
sourceCompatibility JavaVersion.VERSION_1_8
40-
targetCompatibility JavaVersion.VERSION_1_8
39+
sourceCompatibility = JavaVersion.toVersion(libs.versions.java.get())
40+
targetCompatibility = JavaVersion.toVersion(libs.versions.java.get())
4141
}
4242
kotlinOptions {
43-
jvmTarget = '1.8'
43+
jvmTarget = libs.versions.java.get()
4444
}
4545

4646
resourcePrefix 'pluto___'
@@ -51,18 +51,17 @@ android {
5151
}
5252

5353
dependencies {
54-
implementation "androidx.core:core-ktx:$androidXCoreVersion"
55-
implementation 'androidx.appcompat:appcompat:1.4.0'
54+
implementation(libs.androidx.core)
55+
implementation(libs.androidx.appcompat)
5656

57-
api 'androidx.constraintlayout:constraintlayout:2.1.2'
58-
api 'androidx.navigation:navigation-fragment-ktx:2.3.5'
59-
api 'androidx.recyclerview:recyclerview:1.2.1'
57+
api(libs.androidx.constraintlayout)
58+
api(libs.androidx.navigation.fragment)
59+
api(libs.androidx.recyclerview)
6060

61-
api 'com.google.android.material:material:1.6.1'
61+
api(libs.google.material)
6262

63-
api 'androidx.cardview:cardview:1.0.0'
63+
api(libs.androidx.cardview)
6464

65-
api 'androidx.lifecycle:lifecycle-common-java8:2.4.0'
66-
api 'androidx.lifecycle:lifecycle-runtime-ktx:2.4.0'
67-
api 'androidx.lifecycle:lifecycle-extensions:2.2.0'
65+
api(libs.androidx.lifecycle.common)
66+
api(libs.androidx.lifecycle.runtime)
6867
}

pluto-plugins/bundle/lib-no-op/build.gradle

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
plugins {
2-
id 'com.android.library'
2+
alias(libs.plugins.android.library)
33
}
44

55
apply from: "$rootDir/scripts/build/utils.gradle"
@@ -15,13 +15,13 @@ ext {
1515
}
1616

1717
android {
18-
compileSdkVersion rootProject.compileSdkVersion
19-
buildToolsVersion rootProject.buildToolsVersion
18+
compileSdk = libs.versions.compileSdk.get().toInteger()
19+
buildToolsVersion = libs.versions.buildTools.get()
2020

2121

2222
defaultConfig {
23-
minSdkVersion rootProject.minSdkVersion
24-
targetSdkVersion rootProject.targetSdkVersion
23+
minSdk = libs.versions.minSdk.get().toInteger()
24+
targetSdk = libs.versions.targetSdk.get().toInteger()
2525
}
2626

2727
buildTypes {
@@ -32,8 +32,8 @@ android {
3232
}
3333
}
3434
compileOptions {
35-
sourceCompatibility JavaVersion.VERSION_1_8
36-
targetCompatibility JavaVersion.VERSION_1_8
35+
sourceCompatibility = JavaVersion.toVersion(libs.versions.java.get())
36+
targetCompatibility = JavaVersion.toVersion(libs.versions.java.get())
3737
}
3838
namespace 'com.pluto.plugins.bundle.core'
3939
lint {

pluto-plugins/bundle/lib/build.gradle

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
plugins {
2-
id 'com.android.library'
2+
alias(libs.plugins.android.library)
33
}
44

55
apply from: "$rootDir/scripts/build/utils.gradle"
@@ -15,13 +15,13 @@ ext {
1515
}
1616

1717
android {
18-
compileSdkVersion rootProject.compileSdkVersion
19-
buildToolsVersion rootProject.buildToolsVersion
18+
compileSdk = libs.versions.compileSdk.get().toInteger()
19+
buildToolsVersion = libs.versions.buildTools.get()
2020

2121

2222
defaultConfig {
23-
minSdkVersion rootProject.minSdkVersion
24-
targetSdkVersion rootProject.targetSdkVersion
23+
minSdk = libs.versions.minSdk.get().toInteger()
24+
targetSdk = libs.versions.targetSdk.get().toInteger()
2525
}
2626

2727
buildTypes {
@@ -32,8 +32,8 @@ android {
3232
}
3333
}
3434
compileOptions {
35-
sourceCompatibility JavaVersion.VERSION_1_8
36-
targetCompatibility JavaVersion.VERSION_1_8
35+
sourceCompatibility = JavaVersion.toVersion(libs.versions.java.get())
36+
targetCompatibility = JavaVersion.toVersion(libs.versions.java.get())
3737
}
3838
namespace 'com.pluto.plugins.bundle.core'
3939
lint {

pluto-plugins/plugins/datastore/lib-no-op/build.gradle

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
plugins {
2-
id 'com.android.library'
3-
id 'org.jetbrains.kotlin.android'
2+
alias(libs.plugins.android.library)
3+
alias(libs.plugins.kotlin.android)
44
}
55

66
apply from: "$rootDir/scripts/build/utils.gradle"
@@ -16,17 +16,17 @@ ext {
1616
}
1717

1818
android {
19-
compileSdkVersion rootProject.compileSdkVersion
20-
buildToolsVersion rootProject.buildToolsVersion
19+
compileSdk = libs.versions.compileSdk.get().toInteger()
20+
buildToolsVersion = libs.versions.buildTools.get()
2121

2222
buildFeatures {
2323
viewBinding true
2424
}
2525

2626

2727
defaultConfig {
28-
minSdkVersion rootProject.minSdkVersion
29-
targetSdkVersion rootProject.targetSdkVersion
28+
minSdk = libs.versions.minSdk.get().toInteger()
29+
targetSdk = libs.versions.targetSdk.get().toInteger()
3030

3131
buildConfigField "String", "VERSION_NAME", "\"${verPublish}\""
3232
buildConfigField("long", "VERSION_CODE", "${verCode}")
@@ -41,12 +41,12 @@ android {
4141
}
4242
}
4343
compileOptions {
44-
sourceCompatibility JavaVersion.VERSION_1_8
45-
targetCompatibility JavaVersion.VERSION_1_8
44+
sourceCompatibility = JavaVersion.toVersion(libs.versions.java.get())
45+
targetCompatibility = JavaVersion.toVersion(libs.versions.java.get())
4646
}
4747

4848
kotlinOptions {
49-
jvmTarget = JavaVersion.VERSION_1_8.toString()
49+
jvmTarget = libs.versions.java.get()
5050
}
5151
namespace 'com.pluto.plugins.datastore.pref'
5252
lint {
@@ -55,6 +55,6 @@ android {
5555
}
5656

5757
dependencies {
58-
implementation "androidx.core:core-ktx:$androidXCoreVersion"
59-
implementation "androidx.datastore:datastore-preferences:1.0.0"
58+
implementation(libs.androidx.core)
59+
implementation(libs.datastore.preferences)
6060
}

0 commit comments

Comments
 (0)