Skip to content

Commit 699db1a

Browse files
authored
migrate to gradle versioning (#1166)
1 parent a0e1c23 commit 699db1a

File tree

3 files changed

+302
-108
lines changed

3 files changed

+302
-108
lines changed

app/build.gradle

Lines changed: 64 additions & 87 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ plugins {
33
id 'kotlin-android'
44
id 'kotlin-parcelize'
55
id 'kotlin-kapt'
6-
id "androidx.navigation.safeargs"
6+
id 'androidx.navigation.safeargs'
77
id 'com.google.firebase.crashlytics'
88
}
99

@@ -18,11 +18,11 @@ def loadExtraProperties(String fileName) {
1818
loadExtraProperties("treetracker.keys.properties")
1919

2020
android {
21-
compileSdkVersion 35
21+
compileSdk libs.versions.compileSdk.get().toInteger()
2222
defaultConfig {
2323
applicationId "org.greenstand.android.TreeTracker"
24-
minSdkVersion 21
25-
targetSdkVersion 35
24+
minSdk libs.versions.minSdk.get().toInteger()
25+
targetSdk libs.versions.targetSdk.get().toInteger()
2626
versionCode 197
2727
versionName "2.2.0"
2828
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
@@ -63,7 +63,7 @@ android {
6363
}
6464

6565
composeOptions {
66-
kotlinCompilerExtensionVersion "1.5.14"
66+
kotlinCompilerExtensionVersion libs.versions.composeCompiler.get()
6767
}
6868

6969
compileOptions {
@@ -187,99 +187,76 @@ repositories {
187187

188188
dependencies {
189189

190-
// 2.0: https://docs.aws.amazon.com/sdk-for-java/v2/developer-guide/setup-project-gradle.html
191-
// android s3 sdk does not support transfer acceleration
192-
implementation 'com.amazonaws:aws-android-sdk-core:2.16.8'
193-
implementation 'com.amazonaws:aws-android-sdk-s3:2.16.8'
190+
// AWS S3 SDK
191+
// Note: android s3 sdk does not support transfer acceleration
192+
implementation libs.aws.android.sdk.core
193+
implementation libs.aws.android.sdk.s3
194194

195-
//koin dependencies
196-
implementation "io.insert-koin:koin-android:$koin_version"
197-
implementation "io.insert-koin:koin-androidx-compose:$koin_version"
198-
testImplementation "io.insert-koin:koin-test:$koin_version"
195+
// Koin dependencies
196+
implementation libs.bundles.koin
197+
testImplementation libs.koin.test
199198

200-
implementation 'androidx.appcompat:appcompat:1.3.1'
201-
implementation 'androidx.multidex:multidex:2.0.1'
202-
implementation 'androidx.exifinterface:exifinterface:1.3.2'
203-
implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.3.1'
204-
implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.3.1'
205-
implementation "androidx.work:work-runtime-ktx:2.7.1"
199+
// AndroidX Core
200+
implementation libs.androidx.appcompat
201+
implementation libs.androidx.multidex
202+
implementation libs.androidx.exifinterface
203+
implementation libs.androidx.lifecycle.viewmodel.ktx
204+
implementation libs.androidx.lifecycle.runtime.ktx
205+
implementation libs.androidx.work.runtime.ktx
206206

207207
// Compose
208-
implementation "androidx.compose.runtime:runtime:$compose_version"
209-
implementation "androidx.compose.runtime:runtime-livedata:$compose_version"
210-
implementation "androidx.compose.foundation:foundation:$compose_version"
211-
implementation "androidx.compose.foundation:foundation-layout:$compose_version"
212-
implementation "androidx.compose.ui:ui:$compose_version"
213-
implementation "androidx.compose.ui:ui-tooling:$compose_version"
214-
implementation "androidx.compose.material:material:$compose_version"
215-
implementation "androidx.compose.animation:animation:$compose_version"
216-
implementation "androidx.activity:activity-compose:1.3.0"
217-
implementation "androidx.navigation:navigation-compose:2.5.0"
218-
219-
//Permissions management library for Jetpack Compose
220-
implementation "com.google.accompanist:accompanist-permissions:0.21.1-beta"
208+
implementation libs.bundles.compose
209+
implementation libs.accompanist.permissions
221210

222211
// Kotlin
223-
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
224-
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.5.0'
225-
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.5.0'
226-
implementation 'org.jetbrains.kotlinx:kotlinx-datetime:0.5.0'
227-
implementation("org.jetbrains.kotlinx:kotlinx-serialization-core:1.6.2")
228-
coreLibraryDesugaring("com.android.tools:desugar_jdk_libs:1.1.5")
229-
230-
//Database
231-
implementation 'androidx.room:room-runtime:2.6.1'
232-
implementation 'androidx.room:room-ktx:2.6.1'
233-
kapt "androidx.room:room-compiler:2.6.1"
234-
235-
devImplementation 'com.github.amitshekhariitbhu.Android-Debug-Database:debug-db:v1.0.6'
236-
237-
api "com.squareup.retrofit2:converter-gson:${retrofit2Version}"
238-
implementation "com.squareup.retrofit2:retrofit:${retrofit2Version}"
239-
implementation 'com.squareup.okhttp3:logging-interceptor:4.9.3'
240-
241-
// CameraX core library
242-
def camerax_version = "1.0.0"
243-
// CameraX view library
244-
def camerax_view_version = "1.0.0-alpha24"
245-
// CameraX extensions library
246-
def camerax_ext_version = "1.0.0-alpha24"
247-
implementation "androidx.camera:camera-core:$camerax_version"
248-
// If you want to use Camera2 extensions
249-
implementation "androidx.camera:camera-camera2:$camerax_version"
250-
// CameraX Lifecycle library
251-
implementation "androidx.camera:camera-lifecycle:$camerax_version"
252-
// If you to use the Camera View class
253-
implementation "androidx.camera:camera-view:$camerax_view_version"
254-
// If you to use Camera Extensions
255-
implementation "androidx.camera:camera-extensions:$camerax_ext_version"
256-
257-
api 'com.jakewharton.timber:timber:4.7.1'
258-
implementation "androidx.legacy:legacy-support-v4:${androidSupportVersion}"
259-
260-
implementation platform('com.google.firebase:firebase-bom:25.10.0')
261-
implementation 'com.google.firebase:firebase-analytics:18.0.2'
262-
implementation 'com.google.firebase:firebase-crashlytics-ktx:17.3.1'
263-
implementation 'com.google.firebase:firebase-iid:21.0.1'
264-
265-
testImplementation 'androidx.test:core-ktx:1.5.0'
266-
testImplementation "io.mockk:mockk:1.13.12"
267-
testImplementation "junit:junit:4.13.1"
268-
testImplementation "androidx.room:room-testing:2.2.6"
269-
testImplementation "org.jetbrains.kotlinx:kotlinx-coroutines-test:1.3.9"
270-
testImplementation "androidx.arch.core:core-testing:2.1.0"
271-
androidTestImplementation "com.android.support.test:runner:1.0.2"
272-
androidTestImplementation "com.android.support.test.espresso:espresso-core:3.0.2"
273-
testImplementation "org.robolectric:robolectric:4.8.1"
274-
androidTestImplementation "app.cash.turbine:turbine:0.12.1"
275-
testImplementation "app.cash.turbine:turbine:0.12.1"
276-
212+
implementation libs.kotlin.stdlib.jdk7
213+
implementation libs.kotlinx.coroutines.core
214+
implementation libs.kotlinx.coroutines.android
215+
implementation libs.kotlinx.datetime
216+
implementation libs.kotlinx.serialization.core
217+
coreLibraryDesugaring libs.desugar.jdk.libs
218+
219+
// Database
220+
implementation libs.androidx.room.runtime
221+
implementation libs.androidx.room.ktx
222+
kapt libs.androidx.room.compiler
223+
224+
// Debug database for dev builds
225+
devImplementation libs.debug.database
226+
227+
// Networking
228+
api libs.retrofit.converter.gson
229+
implementation libs.retrofit
230+
implementation libs.okhttp.logging.interceptor
231+
232+
// CameraX
233+
implementation libs.bundles.camerax
234+
235+
// Logging
236+
api libs.timber
237+
implementation libs.androidx.legacy.support.v4
238+
239+
// Firebase
240+
implementation platform(libs.firebase.bom)
241+
implementation libs.firebase.analytics
242+
implementation libs.firebase.crashlytics.ktx
243+
implementation libs.firebase.iid
244+
245+
// Testing
246+
testImplementation libs.bundles.testing
247+
testImplementation libs.androidx.room.testing
248+
testImplementation libs.kotlinx.coroutines.test
249+
testImplementation libs.androidx.arch.core.testing
250+
androidTestImplementation libs.androidx.test.runner
251+
androidTestImplementation libs.androidx.test.espresso.core
252+
androidTestImplementation libs.turbine
253+
testImplementation libs.turbine
277254
}
278255

279256
configurations.all {
280257
resolutionStrategy {
281258
preferProjectModules()
282-
force 'com.google.code.gson:gson:2.8.5'
259+
force libs.gson
283260
}
284261
}
285262

build.gradle

Lines changed: 14 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,23 @@
11
// Top-level build file where you can add configuration options common to all sub-projects/modules.
22

33
buildscript {
4-
ext.kotlin_version = '1.9.24'
54
repositories {
65
google()
7-
// jcenter()
86
mavenCentral()
9-
maven { url "https://plugins.gradle.org/m2/" }
10-
maven { url 'https://jitpack.io' }
7+
maven { url = "https://plugins.gradle.org/m2/" }
8+
maven { url = 'https://jitpack.io' }
119
}
1210

1311
dependencies {
14-
classpath 'com.android.tools.build:gradle:8.11.0'
15-
classpath 'com.google.gms:google-services:4.4.2'
16-
classpath 'com.google.firebase:firebase-crashlytics-gradle:2.9.9'
17-
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
18-
classpath "androidx.navigation:navigation-safe-args-gradle-plugin:2.5.0"
19-
20-
classpath 'org.jlleitschuh.gradle:ktlint-gradle:11.0.0'
21-
classpath 'com.diffplug.spotless:spotless-plugin-gradle:6.18.0'
22-
classpath 'io.gitlab.arturbosch.detekt:detekt-gradle-plugin:1.18.0-RC2'
12+
classpath libs.android.gradlePlugin
13+
classpath libs.google.services
14+
classpath libs.firebase.crashlytics.gradle
15+
classpath libs.kotlin.gradlePlugin
16+
classpath libs.navigation.safeargs.gradlePlugin
2317

18+
classpath libs.ktlint.gradle
19+
classpath libs.spotless.gradle
20+
classpath libs.detekt.gradlePlugin
2421

2522
// NOTE: Do not place your application dependencies here; they belong
2623
// in the individual module build.gradle files
@@ -38,20 +35,16 @@ allprojects {
3835
}
3936
repositories {
4037
google()
41-
// jcenter()
4238
mavenCentral()
4339
maven {
44-
url "https://maven.google.com" // Google's Maven repository
40+
url = "https://maven.google.com" // Google's Maven repository
4541
}
46-
maven { url "https://oss.sonatype.org/content/repositories/snapshots" }
47-
maven { url 'https://jitpack.io' }
42+
maven { url = "https://oss.sonatype.org/content/repositories/snapshots" }
43+
maven { url = 'https://jitpack.io' }
4844
}
4945

5046
ext {
51-
compose_version = "1.1.1"
52-
koin_version= "3.2.0-beta-1"
53-
androidSupportVersion = '1.0.0'
54-
retrofit2Version = '2.6.0'
47+
// Keys properties - these still need to be loaded from treetracker.keys.properties
5548
s3_production_identity_pool_id = "configure in treetracker.keys.properties"
5649
prod_treetracker_client_id = "configure in treetracker.keys.properties"
5750
prod_treetracker_client_secret = "configure in treetracker.keys.properties"

0 commit comments

Comments
 (0)