Skip to content

Commit 009dcc2

Browse files
authored
Use version catalog for plugins (recloudstream#2206)
1 parent 3be3962 commit 009dcc2

File tree

6 files changed

+49
-39
lines changed

6 files changed

+49
-39
lines changed

app/build.gradle.kts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ import org.jetbrains.kotlin.gradle.dsl.JvmTarget
66
import org.jetbrains.kotlin.gradle.tasks.KotlinJvmCompile
77

88
plugins {
9-
id("com.android.application")
10-
id("kotlin-android")
11-
id("org.jetbrains.dokka")
9+
alias(libs.plugins.android.application)
10+
alias(libs.plugins.dokka)
11+
alias(libs.plugins.kotlin.android)
1212
}
1313

1414
val javaTarget = JvmTarget.fromTarget(libs.versions.jvmTarget.get())

build.gradle.kts

Lines changed: 8 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,14 @@
1-
buildscript {
2-
repositories {
3-
google()
4-
mavenCentral()
5-
}
6-
7-
dependencies {
8-
classpath(libs.android.gradle.plugin)
9-
classpath(libs.buildkonfig.gradle.plugin) // Universal build config
10-
classpath(libs.dokka.gradle.plugin)
11-
classpath(libs.kotlin.gradle.plugin)
12-
}
1+
plugins {
2+
alias(libs.plugins.android.application) apply false
3+
alias(libs.plugins.android.library) apply false
4+
alias(libs.plugins.buildkonfig) apply false // Universal build config
5+
alias(libs.plugins.dokka) apply false
6+
alias(libs.plugins.kotlin.android) apply false
7+
alias(libs.plugins.kotlin.jvm) apply false
8+
alias(libs.plugins.kotlin.multiplatform) apply false
139
}
1410

1511
allprojects {
16-
repositories {
17-
google()
18-
mavenCentral()
19-
mavenLocal()
20-
maven("https://jitpack.io")
21-
}
22-
2312
// https://docs.gradle.org/current/userguide/upgrading_major_version_9.html#test_task_fails_when_no_tests_are_discovered
2413
tasks.withType<AbstractTestTask>().configureEach {
2514
failOnNoDiscoveredTests = false

docs/build.gradle.kts

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

66
dependencies {
@@ -10,4 +10,4 @@ dependencies {
1010

1111
dokka {
1212
moduleName = "Cloudstream"
13-
}
13+
}

gradle/libs.versions.toml

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# https://docs.gradle.org/current/userguide/plugins.html#sec:version_catalog_plugin_application
2+
# https://docs.gradle.org/current/userguide/dependency_versions.html#sec:strict-version
13
[versions]
24
activityKtx = "1.11.0"
35
androidGradlePlugin = "8.13.1"
@@ -54,10 +56,8 @@ targetSdk = "36"
5456

5557
[libraries]
5658
activity-ktx = { module = "androidx.activity:activity-ktx", version.ref = "activityKtx" }
57-
android-gradle-plugin = { module = "com.android.tools.build:gradle", version.ref = "androidGradlePlugin" }
5859
appcompat = { module = "androidx.appcompat:appcompat", version.ref = "appcompat" }
5960
biometric = { module = "androidx.biometric:biometric", version.ref = "biometric" }
60-
buildkonfig-gradle-plugin = { module = "com.codingfeline.buildkonfig:buildkonfig-gradle-plugin", version.ref = "buildkonfigGradlePlugin" }
6161
coil = { module = "io.coil-kt.coil3:coil", version.ref = "coil" }
6262
coil-network-okhttp = { module = "io.coil-kt.coil3:coil-network-okhttp", version.ref = "coil" }
6363
colorpicker = { module = "com.github.recloudstream:color-picker-android", version.ref = "colorpicker" }
@@ -67,7 +67,6 @@ core = { module = "androidx.test:core" }
6767
core-ktx = { module = "androidx.core:core-ktx", version.ref = "coreKtx" }
6868
databinding = { module = "androidx.databinding:viewbinding", version.ref = "androidGradlePlugin" }
6969
desugar_jdk_libs_nio = { module = "com.android.tools:desugar_jdk_libs_nio", version.ref = "desugar_jdk_libs_nio" }
70-
dokka-gradle-plugin = { module = "org.jetbrains.dokka:dokka-gradle-plugin", version.ref = "dokkaGradlePlugin" }
7170
espresso-core = { module = "androidx.test.espresso:espresso-core", version.ref = "espressoCore" }
7271
ext-junit = { module = "androidx.test.ext:junit", version.ref = "junitVersion" }
7372
fuzzywuzzy = { module = "me.xdrop:fuzzywuzzy", version.ref = "fuzzywuzzy" }
@@ -77,7 +76,6 @@ jsoup = { module = "org.jsoup:jsoup", version.ref = "jsoup" }
7776
junit = { module = "junit:junit", version.ref = "junit" }
7877
junit-ktx = { module = "androidx.test.ext:junit-ktx", version.ref = "junitKtx" }
7978
juniversalchardet = { module = "com.github.albfernandez:juniversalchardet", version.ref = "juniversalchardet" }
80-
kotlin-gradle-plugin = { module = "org.jetbrains.kotlin:kotlin-gradle-plugin", version.ref = "kotlinGradlePlugin" }
8179
kotlinx-coroutines-core = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-core", version.ref = "kotlinxCoroutinesCore" }
8280
lifecycle-livedata-ktx = { module = "androidx.lifecycle:lifecycle-livedata-ktx", version.ref = "lifecycleLivedataKtx" }
8381
lifecycle-viewmodel-ktx = { module = "androidx.lifecycle:lifecycle-viewmodel-ktx", version.ref = "lifecycleViewmodelKtx" }
@@ -116,6 +114,13 @@ work-runtime = { module = "androidx.work:work-runtime", version.ref = "workRunti
116114
work-runtime-ktx = { module = "androidx.work:work-runtime-ktx", version.ref = "workRuntimeKtx" }
117115

118116
[plugins]
117+
android-application = { id = "com.android.application", version.ref = "androidGradlePlugin" }
118+
android-library = { id = "com.android.library", version.ref = "androidGradlePlugin" }
119+
buildkonfig = { id = "com.codingfeline.buildkonfig", version.ref = "buildkonfigGradlePlugin" }
120+
dokka = { id = "org.jetbrains.dokka", version.ref = "dokkaGradlePlugin" }
121+
kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlinGradlePlugin" }
122+
kotlin-jvm = { id = "org.jetbrains.kotlin.jvm" , version.ref = "kotlinGradlePlugin" }
123+
kotlin-multiplatform = { id = "org.jetbrains.kotlin.multiplatform", version.ref = "kotlinGradlePlugin" }
119124

120125
[bundles]
121126
media3 = ["media3-cast", "media3-common", "media3-container", "media3-datasource-cronet", "media3-datasource-okhttp", "media3-exoplayer", "media3-exoplayer-dash", "media3-exoplayer-hls", "media3-session", "media3-ui"]

library/build.gradle.kts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@ import org.jetbrains.kotlin.gradle.dsl.JvmTarget
66
import org.jetbrains.kotlin.gradle.tasks.KotlinJvmCompile
77

88
plugins {
9-
kotlin("multiplatform")
10-
id("maven-publish")
11-
id("com.android.library")
12-
id("com.codingfeline.buildkonfig")
13-
id("org.jetbrains.dokka")
9+
id("maven-publish") // Gradle core plugin
10+
alias(libs.plugins.kotlin.multiplatform)
11+
alias(libs.plugins.android.library)
12+
alias(libs.plugins.buildkonfig)
13+
alias(libs.plugins.dokka)
1414
}
1515

1616
val javaTarget = JvmTarget.fromTarget(libs.versions.jvmTarget.get())
@@ -125,4 +125,4 @@ dokka {
125125
}
126126
}
127127
}
128-
}
128+
}

settings.gradle.kts

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,21 @@
1-
rootProject.name = "CloudStream"
1+
// https://developer.android.com/build#settings-file
2+
pluginManagement {
3+
repositories {
4+
gradlePluginPortal()
5+
google()
6+
mavenCentral()
7+
}
8+
}
9+
10+
dependencyResolutionManagement {
11+
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
12+
repositories {
13+
google()
14+
mavenCentral()
15+
mavenLocal()
16+
maven("https://jitpack.io")
17+
}
18+
}
219

3-
include(":app")
4-
include(":library")
5-
include(":docs")
20+
rootProject.name = "CloudStream"
21+
include(":app", ":library", ":docs")

0 commit comments

Comments
 (0)