diff --git a/app/build.gradle.kts b/app/build.gradle.kts index 332487742..258f78ca7 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -1,9 +1,6 @@ -val vCode: Int by rootProject.extra -val vName: String by rootProject.extra - plugins { - id("com.android.application") - id("org.jetbrains.kotlin.android") + alias(libs.plugins.android.application) + alias(libs.plugins.jetbrains.kotlin) } android { @@ -14,8 +11,8 @@ android { applicationId = "com.pedro.streamer" minSdk = 16 targetSdk = 34 - versionCode = vCode - versionName = vName + versionCode = libs.versions.versionCode.get().toInt() + versionName = libs.versions.versionName.get() multiDexEnabled = true } buildTypes { @@ -38,13 +35,8 @@ android { dependencies { implementation(project(":library")) - implementation("androidx.constraintlayout:constraintlayout:2.1.4") - //noinspection GradleDependency, version 1.7.0 need min sdk 21 - implementation("androidx.appcompat:appcompat:1.6.1") - implementation("androidx.multidex:multidex:2.0.1") - - val cameraxVersion = "1.3.4" - implementation("androidx.camera:camera-core:$cameraxVersion") - implementation("androidx.camera:camera-camera2:$cameraxVersion") - implementation("androidx.camera:camera-lifecycle:$cameraxVersion") + implementation(libs.androidx.constraintlayout) + implementation(libs.androidx.appcompat) + implementation(libs.androidx.multidex) + implementation(libs.bundles.androidx.camera) } diff --git a/build.gradle.kts b/build.gradle.kts index dd7ce88db..9ded8a5f3 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,15 +1,10 @@ // Top-level build file where you can add configuration options common to all sub-projects/modules. -val libraryGroup by rootProject.extra { "com.github.pedroSG94" } -val vCode by rootProject.extra { 245 } -val vName by rootProject.extra { "2.4.5" } -val coroutinesVersion by rootProject.extra { "1.7.3" } -val junitVersion by rootProject.extra { "4.13.2" } -val mockitoVersion by rootProject.extra { "5.2.1" } plugins { - id("com.android.application") version "8.5.0" apply false - id("org.jetbrains.kotlin.android") version "2.0.0" apply false - id("org.jetbrains.dokka") version "1.9.20" apply true + alias(libs.plugins.android.application) apply false + alias(libs.plugins.android.library) apply false + alias(libs.plugins.jetbrains.kotlin) apply false + alias(libs.plugins.jetbrains.dokka) apply true } tasks.register("clean") { diff --git a/common/build.gradle.kts b/common/build.gradle.kts index eb3b78288..2e1484c2f 100644 --- a/common/build.gradle.kts +++ b/common/build.gradle.kts @@ -1,14 +1,8 @@ -val libraryGroup: String by rootProject.extra -val vName: String by rootProject.extra -val coroutinesVersion: String by rootProject.extra -val junitVersion: String by rootProject.extra -val mockitoVersion: String by rootProject.extra - plugins { - id("com.android.library") - id("org.jetbrains.kotlin.android") - id("maven-publish") - id("org.jetbrains.dokka") + alias(libs.plugins.android.library) + alias(libs.plugins.jetbrains.kotlin) + id(libs.plugins.maven.publish.get().pluginId) + alias(libs.plugins.jetbrains.dokka) } android { @@ -47,17 +41,17 @@ afterEvaluate { from(components["release"]) // You can then customize attributes of the publication as shown below. - groupId = libraryGroup + groupId = libs.versions.libraryGroup.get() artifactId = "common" - version = vName + version = libs.versions.versionName.get() } } } } dependencies { - implementation("org.jetbrains.kotlinx:kotlinx-coroutines-android:$coroutinesVersion") - testImplementation("org.jetbrains.kotlinx:kotlinx-coroutines-test:$coroutinesVersion") - testImplementation("junit:junit:$junitVersion") - testImplementation("org.mockito.kotlin:mockito-kotlin:$mockitoVersion") + implementation(libs.kotlinx.coroutines.android) + testImplementation(libs.kotlinx.coroutines.test) + testImplementation(libs.junit) + testImplementation(libs.mockito.kotlin) } \ No newline at end of file diff --git a/encoder/build.gradle.kts b/encoder/build.gradle.kts index 133b12868..d3179cb18 100644 --- a/encoder/build.gradle.kts +++ b/encoder/build.gradle.kts @@ -1,12 +1,8 @@ -val libraryGroup: String by rootProject.extra -val vName: String by rootProject.extra -val junitVersion: String by rootProject.extra - plugins { - id("com.android.library") - id("org.jetbrains.kotlin.android") - id("maven-publish") - id("org.jetbrains.dokka") + alias(libs.plugins.android.library) + alias(libs.plugins.jetbrains.kotlin) + id(libs.plugins.maven.publish.get().pluginId) + alias(libs.plugins.jetbrains.dokka) } android { @@ -44,16 +40,16 @@ afterEvaluate { from(components["release"]) // You can then customize attributes of the publication as shown below. - groupId = libraryGroup + groupId = libs.versions.libraryGroup.get() artifactId = "encoder" - version = vName + version = libs.versions.versionName.get() } } } } dependencies { - testImplementation("junit:junit:$junitVersion") - api("androidx.annotation:annotation:1.8.0") + testImplementation(libs.junit) + api(libs.androidx.annotation) api(project(":common")) } diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml new file mode 100644 index 000000000..a0f399c7e --- /dev/null +++ b/gradle/libs.versions.toml @@ -0,0 +1,43 @@ +[versions] +libraryGroup = "com.github.pedroSG94" +versionCode = "245" +versionName = "2.4.5" + +#plugins versions +agp = "8.5.0" +kotlin = "2.0.0" +dokka = "1.9.20" + +#dependencies versions +#noinspection GradleDependency, version 1.7.0 need min sdk 21 +appcompat = "1.6.1" +constraintlayout = "2.1.4" +camerax = "1.3.4" +multidex = "2.0.1" +annotation = "1.8.0" +coroutines = "1.7.3" +junit = "4.13.2" +mockito = "5.2.1" + +[libraries] +androidx-annotation = { module = "androidx.annotation:annotation", version.ref = "annotation" } +androidx-appcompat = { module = "androidx.appcompat:appcompat", version.ref = "appcompat" } +androidx-camera-core = { module = "androidx.camera:camera-core", version.ref = "camerax" } +androidx-camera-camera2 = { module = "androidx.camera:camera-camera2", version.ref = "camerax" } +androidx-camera-lifecycle = { module = "androidx.camera:camera-lifecycle", version.ref = "camerax" } +androidx-constraintlayout = { module = "androidx.constraintlayout:constraintlayout", version.ref = "constraintlayout" } +androidx-multidex = { module = "androidx.multidex:multidex", version.ref = "multidex" } +junit = { module = "junit:junit", version.ref = "junit" } +kotlinx-coroutines-android = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-android", version.ref = "coroutines" } +kotlinx-coroutines-test = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-test", version.ref = "coroutines" } +mockito-kotlin = { module = "org.mockito.kotlin:mockito-kotlin", version.ref = "mockito" } + +[plugins] +android-application = { id = "com.android.application", version.ref = "agp" } +android-library = { id = "com.android.library", version.ref = "agp" } +maven-publish = { id = "maven-publish", version.ref = "agp" } +jetbrains-kotlin = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" } +jetbrains-dokka = { id = "org.jetbrains.dokka", version.ref = "dokka" } + +[bundles] +androidx-camera = ["androidx-camera-core", "androidx-camera-camera2", "androidx-camera-lifecycle"] \ No newline at end of file diff --git a/library/build.gradle.kts b/library/build.gradle.kts index a1a3970fe..e614591a4 100644 --- a/library/build.gradle.kts +++ b/library/build.gradle.kts @@ -1,12 +1,8 @@ -val libraryGroup: String by rootProject.extra -val vName: String by rootProject.extra -val coroutinesVersion: String by rootProject.extra - plugins { - id("com.android.library") - id("org.jetbrains.kotlin.android") - id("maven-publish") - id("org.jetbrains.dokka") + alias(libs.plugins.android.library) + alias(libs.plugins.jetbrains.kotlin) + id(libs.plugins.maven.publish.get().pluginId) + alias(libs.plugins.jetbrains.dokka) } android { @@ -44,16 +40,16 @@ afterEvaluate { from(components["release"]) // You can then customize attributes of the publication as shown below. - groupId = libraryGroup + groupId = libs.versions.libraryGroup.get() artifactId = "library" - version = vName + version = libs.versions.versionName.get() } } } } dependencies { - implementation("org.jetbrains.kotlinx:kotlinx-coroutines-android:$coroutinesVersion") + implementation(libs.kotlinx.coroutines.android) api(project(":encoder")) api(project(":rtmp")) api(project(":rtsp")) diff --git a/rtmp/build.gradle.kts b/rtmp/build.gradle.kts index ed82affd2..0804051ba 100644 --- a/rtmp/build.gradle.kts +++ b/rtmp/build.gradle.kts @@ -1,14 +1,8 @@ -val libraryGroup: String by rootProject.extra -val vName: String by rootProject.extra -val coroutinesVersion: String by rootProject.extra -val junitVersion: String by rootProject.extra -val mockitoVersion: String by rootProject.extra - plugins { - id("com.android.library") - id("org.jetbrains.kotlin.android") - id("maven-publish") - id("org.jetbrains.dokka") + alias(libs.plugins.android.library) + alias(libs.plugins.jetbrains.kotlin) + id(libs.plugins.maven.publish.get().pluginId) + alias(libs.plugins.jetbrains.dokka) } android { @@ -46,18 +40,18 @@ afterEvaluate { from(components["release"]) // You can then customize attributes of the publication as shown below. - groupId = libraryGroup + groupId = libs.versions.libraryGroup.get() artifactId = "rtmp" - version = vName + version = libs.versions.versionName.get() } } } } dependencies { - implementation("org.jetbrains.kotlinx:kotlinx-coroutines-android:$coroutinesVersion") - testImplementation("org.jetbrains.kotlinx:kotlinx-coroutines-test:$coroutinesVersion") - testImplementation("junit:junit:$junitVersion") - testImplementation("org.mockito.kotlin:mockito-kotlin:$mockitoVersion") + implementation(libs.kotlinx.coroutines.android) + testImplementation(libs.kotlinx.coroutines.test) + testImplementation(libs.junit) + testImplementation(libs.mockito.kotlin) api(project(":common")) } diff --git a/rtsp/build.gradle.kts b/rtsp/build.gradle.kts index 384b96a49..4341ab1e7 100644 --- a/rtsp/build.gradle.kts +++ b/rtsp/build.gradle.kts @@ -1,14 +1,8 @@ -val libraryGroup: String by rootProject.extra -val vName: String by rootProject.extra -val coroutinesVersion: String by rootProject.extra -val junitVersion: String by rootProject.extra -val mockitoVersion: String by rootProject.extra - plugins { - id("com.android.library") - id("org.jetbrains.kotlin.android") - id("maven-publish") - id("org.jetbrains.dokka") + alias(libs.plugins.android.library) + alias(libs.plugins.jetbrains.kotlin) + id(libs.plugins.maven.publish.get().pluginId) + alias(libs.plugins.jetbrains.dokka) } android { @@ -49,18 +43,18 @@ afterEvaluate { from(components["release"]) // You can then customize attributes of the publication as shown below. - groupId = libraryGroup + groupId = libs.versions.libraryGroup.get() artifactId = "rtsp" - version = vName + version = libs.versions.versionName.get() } } } } dependencies { - implementation("org.jetbrains.kotlinx:kotlinx-coroutines-android:$coroutinesVersion") - testImplementation("org.jetbrains.kotlinx:kotlinx-coroutines-test:$coroutinesVersion") - testImplementation("junit:junit:$junitVersion") - testImplementation("org.mockito.kotlin:mockito-kotlin:$mockitoVersion") + implementation(libs.kotlinx.coroutines.android) + testImplementation(libs.kotlinx.coroutines.test) + testImplementation(libs.junit) + testImplementation(libs.mockito.kotlin) api(project(":common")) } diff --git a/srt/build.gradle.kts b/srt/build.gradle.kts index b9c1ce65a..459df9740 100644 --- a/srt/build.gradle.kts +++ b/srt/build.gradle.kts @@ -1,14 +1,8 @@ -val libraryGroup: String by rootProject.extra -val vName: String by rootProject.extra -val coroutinesVersion: String by rootProject.extra -val junitVersion: String by rootProject.extra -val mockitoVersion: String by rootProject.extra - plugins { - id("com.android.library") - id("org.jetbrains.kotlin.android") - id("maven-publish") - id("org.jetbrains.dokka") + alias(libs.plugins.android.library) + alias(libs.plugins.jetbrains.kotlin) + id(libs.plugins.maven.publish.get().pluginId) + alias(libs.plugins.jetbrains.dokka) } android { @@ -46,18 +40,18 @@ afterEvaluate { from(components["release"]) // You can then customize attributes of the publication as shown below. - groupId = libraryGroup + groupId = libs.versions.libraryGroup.get() artifactId = "srt" - version = vName + version = libs.versions.versionName.get() } } } } dependencies { - implementation("org.jetbrains.kotlinx:kotlinx-coroutines-android:$coroutinesVersion") - testImplementation("org.jetbrains.kotlinx:kotlinx-coroutines-test:$coroutinesVersion") - testImplementation("junit:junit:$junitVersion") - testImplementation("org.mockito.kotlin:mockito-kotlin:$mockitoVersion") + implementation(libs.kotlinx.coroutines.android) + testImplementation(libs.kotlinx.coroutines.test) + testImplementation(libs.junit) + testImplementation(libs.mockito.kotlin) api(project(":common")) } diff --git a/udp/build.gradle.kts b/udp/build.gradle.kts index 9f8c73085..7b066719d 100644 --- a/udp/build.gradle.kts +++ b/udp/build.gradle.kts @@ -1,14 +1,8 @@ -val libraryGroup: String by rootProject.extra -val vName: String by rootProject.extra -val coroutinesVersion: String by rootProject.extra -val junitVersion: String by rootProject.extra -val mockitoVersion: String by rootProject.extra - plugins { - id("com.android.library") - id("org.jetbrains.kotlin.android") - id("maven-publish") - id("org.jetbrains.dokka") + alias(libs.plugins.android.library) + alias(libs.plugins.jetbrains.kotlin) + id(libs.plugins.maven.publish.get().pluginId) + alias(libs.plugins.jetbrains.dokka) } android { @@ -46,19 +40,19 @@ afterEvaluate { from(components["release"]) // You can then customize attributes of the publication as shown below. - groupId = libraryGroup + groupId = libs.versions.libraryGroup.get() artifactId = "udp" - version = vName + version = libs.versions.versionName.get() } } } } dependencies { - implementation("org.jetbrains.kotlinx:kotlinx-coroutines-android:$coroutinesVersion") - testImplementation("org.jetbrains.kotlinx:kotlinx-coroutines-test:$coroutinesVersion") - testImplementation("junit:junit:$junitVersion") - testImplementation("org.mockito.kotlin:mockito-kotlin:$mockitoVersion") + implementation(libs.kotlinx.coroutines.android) + testImplementation(libs.kotlinx.coroutines.test) + testImplementation(libs.junit) + testImplementation(libs.mockito.kotlin) implementation(project(":srt")) api(project(":common")) }