Skip to content

Commit e53248f

Browse files
Merge pull request #15 from nisrulz/add/version-catalog
Setup version catalog to manage dependencies
2 parents e6ddc3b + 07b9f94 commit e53248f

File tree

6 files changed

+133
-43
lines changed

6 files changed

+133
-43
lines changed

app/build.gradle

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
plugins {
2-
id 'com.android.application'
3-
id 'org.jetbrains.kotlin.android'
4-
id "org.jetbrains.kotlin.plugin.compose"
2+
alias(libs.plugins.android.application)
3+
4+
alias(libs.plugins.kotlin.android)
5+
6+
alias(libs.plugins.compose.compiler)
57
}
68

79
apply from: file("../common-config.gradle")
@@ -18,36 +20,35 @@ android {
1820
}
1921

2022
dependencies {
21-
implementation project(':beforeafter')
23+
implementation projects.beforeafter
2224

2325
// Lifecycle
24-
implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.8.3'
26+
implementation libs.androidx.lifecycle.runtime.ktx
2527

2628
// Foundation (Border, Background, Box, Image, Scroll, shapes, animations, etc.)
27-
implementation 'androidx.compose.foundation:foundation'
29+
implementation libs.androidx.foundation
2830

2931
// Material design icons
30-
implementation 'androidx.compose.material:material-icons-core'
31-
implementation 'androidx.compose.material:material-icons-extended'
32+
implementation libs.androidx.material.icons.core
33+
implementation libs.androidx.material.icons.extended
3234

3335
// Optional - Add window size utils
34-
implementation 'androidx.compose.material3:material3-window-size-class'
36+
implementation libs.androidx.material3.window.size
3537
// Integration with activities
36-
implementation 'androidx.activity:activity-compose:1.9.0'
38+
implementation libs.androidx.activity.compose
3739
// Integration with ViewModels
38-
implementation 'androidx.lifecycle:lifecycle-viewmodel-compose:2.8.3'
40+
implementation libs.androidx.lifecycle.viewmodel.compose
3941

4042
// Material Design 3 for Compose
41-
implementation "androidx.compose.material3:material3"
43+
implementation libs.material3
4244

4345
// Photo Picker
44-
implementation("com.google.modernstorage:modernstorage-photopicker:1.0.0-alpha06")
46+
implementation(libs.modernstorage.photopicker)
4547

46-
final media3_version = "1.3.1"
4748
// For media playback using ExoPlayer
48-
implementation "androidx.media3:media3-exoplayer:$media3_version"
49+
implementation libs.androidx.media3.exoplayer
4950
// For building media playback UIs
50-
implementation "androidx.media3:media3-ui:$media3_version"
51+
implementation libs.androidx.media3.ui
5152
// Common functionality used across multiple media libraries
52-
implementation "androidx.media3:media3-common:$media3_version"
53+
implementation libs.androidx.media3.common
5354
}

beforeafter/build.gradle

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
plugins {
2-
id 'com.android.library'
3-
id 'org.jetbrains.kotlin.android'
4-
id "org.jetbrains.kotlin.plugin.compose"
2+
alias(libs.plugins.android.library)
3+
4+
alias(libs.plugins.kotlin.android)
5+
6+
alias(libs.plugins.compose.compiler)
57
}
68

79
apply from: file("../common-config.gradle")
@@ -15,8 +17,8 @@ android {
1517
}
1618

1719
dependencies {
18-
implementation 'com.github.SmartToolFactory:Compose-Extended-Gestures:4.0.0'
20+
implementation libs.compose.extended.gestures
1921

20-
implementation 'androidx.compose.ui:ui-tooling'
21-
implementation "androidx.compose.runtime:runtime"
22-
}
22+
implementation libs.androidx.compose.ui.ui.tooling
23+
implementation libs.androidx.runtime
24+
}

build.gradle

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
// Top-level build file where you can add configuration options common to all sub-projects/modules.
22
plugins {
3-
id 'com.android.application' version '8.5.0' apply false
4-
id 'com.android.library' version '8.6.0' apply false
3+
alias(libs.plugins.android.application) apply false
54

6-
id 'org.jetbrains.kotlin.android' version '2.0.0' apply false
7-
id "org.jetbrains.kotlin.plugin.compose" version "2.0.0" apply false
5+
alias(libs.plugins.android.library) apply false
6+
7+
alias(libs.plugins.kotlin.android) apply false
8+
9+
alias(libs.plugins.compose.compiler) apply false
810
}
911

1012
tasks.register('clean', Delete) {
1113
delete rootProject.getBuildTreePath()
12-
}
14+
}

common-config.gradle

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -35,30 +35,29 @@ composeCompiler {
3535
}
3636

3737
dependencies {
38-
implementation 'androidx.core:core-ktx:1.13.1'
38+
implementation libs.androidx.core.ktx
3939

4040
// Jetpack Compose
41-
def composeBom = platform('androidx.compose:compose-bom:2024.06.00')
42-
implementation composeBom
43-
androidTestImplementation composeBom
41+
implementation platform(libs.androidx.compose.bom)
42+
androidTestImplementation platform(libs.androidx.compose.bom)
4443

4544
// Tooling support (Previews, etc.)
46-
implementation 'androidx.compose.ui:ui-tooling-preview'
47-
debugImplementation 'androidx.compose.ui:ui-tooling'
45+
implementation libs.ui.tooling.preview
46+
debugImplementation libs.ui.tooling
4847

49-
implementation 'androidx.compose.ui:ui'
48+
implementation libs.ui
5049

5150
// Material Design
52-
implementation "androidx.compose.material:material"
51+
implementation libs.androidx.material
5352

5453
// Jetpack Compose - Testing
55-
androidTestImplementation 'androidx.compose.ui:ui-test-junit4'
56-
debugImplementation 'androidx.compose.ui:ui-test-manifest'
54+
androidTestImplementation libs.ui.test.junit4
55+
debugImplementation libs.ui.test.manifest
5756

5857
// Testing
59-
testImplementation 'junit:junit:4.13.2'
60-
androidTestImplementation 'androidx.test.ext:junit:1.1.5'
61-
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
58+
testImplementation libs.junit
59+
androidTestImplementation libs.androidx.junit
60+
androidTestImplementation libs.androidx.espresso.core
6261

6362

6463
}

gradle/libs.versions.toml

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
[versions]
2+
3+
#region ---- Kotlin version dependent
4+
# https://github.com/JetBrains/kotlin/releases
5+
composeExtendedGestures = "4.0.0"
6+
kotlin = "2.0.10"
7+
# https://github.com/google/ksp/releases
8+
ksp = "2.0.10-1.0.24"
9+
#endregion
10+
11+
#region ---- Android Core
12+
agp = "8.5.2"
13+
androidTools = "31.5.2"
14+
coreKtx = "1.13.1"
15+
junit = "4.13.2"
16+
junitVersion = "1.2.1"
17+
espressoCore = "3.6.1"
18+
lifecycleRuntimeKtx = "2.8.4"
19+
activityCompose = "1.9.1"
20+
composeBom = "2024.06.00"
21+
appcompat = "1.7.0"
22+
lifecycleViewmodelCompose = "2.8.4"
23+
material = "1.12.0"
24+
#endregion
25+
26+
media3Common = "1.4.0"
27+
media3Exoplayer = "1.4.0"
28+
media3Ui = "1.4.0"
29+
modernstoragePhotopicker = "1.0.0-alpha06"
30+
31+
[libraries]
32+
33+
# build-logic
34+
android-gradle-plugin = { module = "com.android.tools.build:gradle", version.ref = "agp" }
35+
android-tools-common = { module = "com.android.tools:common", version.ref = "androidTools" }
36+
androidx-compose-ui-ui-tooling = { module = "androidx.compose.ui:ui-tooling" }
37+
androidx-foundation = { module = "androidx.compose.foundation:foundation" }
38+
androidx-lifecycle-viewmodel-compose = { module = "androidx.lifecycle:lifecycle-viewmodel-compose", version.ref = "lifecycleViewmodelCompose" }
39+
androidx-material = { module = "androidx.compose.material:material" }
40+
androidx-material-icons-core = { module = "androidx.compose.material:material-icons-core" }
41+
androidx-material-icons-extended = { module = "androidx.compose.material:material-icons-extended" }
42+
androidx-material3-window-size = { module = "androidx.compose.material3:material3-window-size-class" }
43+
androidx-media3-common = { module = "androidx.media3:media3-common", version.ref = "media3Common" }
44+
androidx-media3-exoplayer = { module = "androidx.media3:media3-exoplayer", version.ref = "media3Exoplayer" }
45+
androidx-media3-ui = { module = "androidx.media3:media3-ui", version.ref = "media3Ui" }
46+
androidx-runtime = { module = "androidx.compose.runtime:runtime" }
47+
compose-extended-gestures = { module = "com.github.SmartToolFactory:Compose-Extended-Gestures", version.ref = "composeExtendedGestures" }
48+
compose-gradle-plugin = { module = "org.jetbrains.kotlin:compose-compiler-gradle-plugin", version.ref = "kotlin" }
49+
kotlin-gradle-plugin = { module = "org.jetbrains.kotlin:kotlin-gradle-plugin", version.ref = "kotlin" }
50+
material3 = { module = "androidx.compose.material3:material3" }
51+
modernstorage-photopicker = { module = "com.google.modernstorage:modernstorage-photopicker", version.ref = "modernstoragePhotopicker" }
52+
symbol-processing-gradle-plugin = { module = "com.google.devtools.ksp:symbol-processing-gradle-plugin", version.ref = "ksp" }
53+
#----- end
54+
55+
56+
androidx-core-ktx = { group = "androidx.core", name = "core-ktx", version.ref = "coreKtx" }
57+
junit = { group = "junit", name = "junit", version.ref = "junit" }
58+
androidx-junit = { group = "androidx.test.ext", name = "junit", version.ref = "junitVersion" }
59+
androidx-espresso-core = { group = "androidx.test.espresso", name = "espresso-core", version.ref = "espressoCore" }
60+
androidx-lifecycle-runtime-ktx = { group = "androidx.lifecycle", name = "lifecycle-runtime-ktx", version.ref = "lifecycleRuntimeKtx" }
61+
androidx-activity-compose = { group = "androidx.activity", name = "activity-compose", version.ref = "activityCompose" }
62+
androidx-compose-bom = { group = "androidx.compose", name = "compose-bom", version.ref = "composeBom" }
63+
androidx-ui = { group = "androidx.compose.ui", name = "ui" }
64+
androidx-ui-graphics = { group = "androidx.compose.ui", name = "ui-graphics" }
65+
androidx-ui-tooling = { group = "androidx.compose.ui", name = "ui-tooling" }
66+
androidx-ui-tooling-preview = { group = "androidx.compose.ui", name = "ui-tooling-preview" }
67+
androidx-ui-test-manifest = { group = "androidx.compose.ui", name = "ui-test-manifest" }
68+
androidx-ui-test-junit4 = { group = "androidx.compose.ui", name = "ui-test-junit4" }
69+
androidx-material3 = { group = "androidx.compose.material3", name = "material3" }
70+
androidx-appcompat = { group = "androidx.appcompat", name = "appcompat", version.ref = "appcompat" }
71+
material = { group = "com.google.android.material", name = "material", version.ref = "material" }
72+
73+
ui = { module = "androidx.compose.ui:ui" }
74+
ui-test-junit4 = { module = "androidx.compose.ui:ui-test-junit4" }
75+
ui-test-manifest = { module = "androidx.compose.ui:ui-test-manifest" }
76+
ui-tooling = { module = "androidx.compose.ui:ui-tooling" }
77+
ui-tooling-preview = { module = "androidx.compose.ui:ui-tooling-preview" }
78+
79+
[plugins]
80+
kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" }
81+
android-application = { id = "com.android.application", version.ref = "agp" }
82+
android-library = { id = "com.android.library", version.ref = "agp" }
83+
compose-compiler = { id = "org.jetbrains.kotlin.plugin.compose", version.ref = "kotlin" }

settings.gradle

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@ dependencyResolutionManagement {
2121
}
2222
}
2323

24-
rootProject.name = "Compose BeforeAfter"
24+
// For accessing modules as type safe values
25+
enableFeaturePreview("TYPESAFE_PROJECT_ACCESSORS")
26+
27+
rootProject.name = "Compose-BeforeAfter"
2528
include ':app'
2629
include ':beforeafter'

0 commit comments

Comments
 (0)