Migrate to version catalogs

This commit is contained in:
clocks 2024-07-22 14:14:39 -04:00
parent 7ee345e6de
commit c2c8de65ee
No known key found for this signature in database
GPG Key ID: DF550F49A97F8A4B
4 changed files with 61 additions and 35 deletions

View File

@ -7,7 +7,7 @@ buildscript {
} }
dependencies { dependencies {
classpath("com.android.tools.build:gradle:8.5.0") classpath(libs.gradle)
// NOTE: Do not place your application dependencies here; they belong // NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files // in the individual module build.gradle files
@ -23,8 +23,6 @@ allprojects {
} }
} }
val tesseract4AndroidVersion by ext("4.7.0")
tasks.register<Delete>("clean") { tasks.register<Delete>("clean") {
delete(rootProject.buildDir) delete(rootProject.buildDir)
} }

39
gradle/libs.versions.toml Normal file
View File

@ -0,0 +1,39 @@
[versions]
# Intentionally use old version of annotation library which doesn"t depend on kotlin-stdlib
# to not unnecessarily complicate client projects due to potential duplicate class build errors
# caused by https://kotlinlang.org/docs/whatsnew18.html#updated-jvm-compilation-target
#noinspection GradleDependency
annotation = "1.3.0"
appcompat = "1.6.1"
espressoCore = "3.5.1"
gradle = "8.5.0"
junit = "4.13.2"
androidJUnit = "1.1.5"
lifecycleLivedata = "2.7.0"
material = "1.11.0"
constraintlayout = "2.1.4"
test = "1.6.1"
tesseract4android = "4.7.0"
[libraries]
androidx-annotation = { module = "androidx.annotation:annotation", version.ref = "annotation" }
androidx-appcompat = { group = "androidx.appcompat", name = "appcompat", version.ref = "appcompat" }
androidx-constraintlayout = { module = "androidx.constraintlayout:constraintlayout", version.ref = "constraintlayout" }
androidx-espresso-core = { module = "androidx.test.espresso:espresso-core", version.ref = "espressoCore" }
androidx-junit = { module = "androidx.test.ext:junit", version.ref = "androidJUnit" }
androidx-lifecycle-livedata = { module = "androidx.lifecycle:lifecycle-livedata", version.ref = "lifecycleLivedata" }
androidx-lifecycle-viewmodel = { module = "androidx.lifecycle:lifecycle-viewmodel", version.ref = "lifecycleLivedata" }
androidx-rules = { module = "androidx.test:rules", version.ref = "test" }
androidx-runner = { module = "androidx.test:runner", version.ref = "test" }
gradle = { module = "com.android.tools.build:gradle", version.ref = "gradle" }
junit = { module = "junit:junit", version.ref = "junit" }
material = { module = "com.google.android.material:material", version.ref = "material" }
# Note that since we have 2 artifacts, we must use cz.adaptech.tesseract4android groupId,
# instead of just cz.adaptech groupId we use when using local maven repository.
tesseract4android-jitpack = { group = "cz.adaptech.tesseract4android", name = "tesseract4android", version.ref = "tesseract4android" }
tesseract4android-jitpack-openmp = { group = "cz.adaptech.tesseract4android", name = "tesseract4android-openmp", version.ref = "tesseract4android" }
tesseract4android-local = { group = "cz.adaptech", name = "tesseract4android", version.ref = "tesseract4android" }
tesseract4android-local-openmp = { group = "cz.adaptech", name = "tesseract4android-openmp", version.ref = "tesseract4android" }
[plugins]

View File

@ -46,31 +46,26 @@ android {
flavorDimensions = ["parallelization"] flavorDimensions = ["parallelization"]
}*/ }*/
val tesseract4AndroidVersion: String by rootProject.extra
dependencies { dependencies {
// To use library from JitPack // To use library from JitPack
// Note that since we have 2 artifacts, we must use cz.adaptech.tesseract4android groupId, implementation(libs.tesseract4android.jitpack) // standard flavor
// instead of just cz.adaptech groupId we use when using local maven repository. //implementation(libs.tesseract4android.jitpack.openmp) // openmp flavor
implementation("cz.adaptech.tesseract4android:tesseract4android:$tesseract4AndroidVersion")
// standard flavor
// implementation "cz.adaptech.tesseract4android:tesseract4android-openmp:$tesseract4AndroidVersion" // openmp flavor
// To use library from local maven repository // To use library from local maven repository
// Don't forget to specify mavenLocal() in repositories block in project's build.gradle file // Don't forget to specify mavenLocal() in repositories block in project's build.gradle file
// implementation "cz.adaptech:tesseract4android:$tesseract4AndroidVersion" // standard flavor //implementation(libs.tesseract4android.local) // standard flavor
// implementation "cz.adaptech:tesseract4android-openmp:$tesseract4AndroidVersion" // openmp flavor //implementation(libs.tesseract4android.local.openmp) // openmp flavor
// To use library compiled locally // To use library compiled locally
// Which flavor to use is determined by missingDimensionStrategy parameter above. // Which flavor to use is determined by missingDimensionStrategy parameter above.
// implementation project(":tesseract4android") //implementation(project(":tesseract4android"))
implementation("androidx.appcompat:appcompat:1.6.1") implementation(libs.androidx.appcompat)
implementation("com.google.android.material:material:1.11.0") implementation(libs.material)
implementation("androidx.constraintlayout:constraintlayout:2.1.4") implementation(libs.androidx.constraintlayout)
implementation("androidx.lifecycle:lifecycle-livedata:2.7.0") implementation(libs.androidx.lifecycle.livedata)
implementation("androidx.lifecycle:lifecycle-viewmodel:2.7.0") implementation(libs.androidx.lifecycle.viewmodel)
testImplementation("junit:junit:4.13.2") testImplementation(libs.junit)
androidTestImplementation("androidx.test.ext:junit:1.1.5") androidTestImplementation(libs.androidx.junit)
androidTestImplementation("androidx.test.espresso:espresso-core:3.5.1") androidTestImplementation(libs.androidx.espresso.core)
} }

View File

@ -91,21 +91,15 @@ android {
} }
dependencies { dependencies {
// Intentionally use old version of annotation library which doesn"t depend on kotlin-stdlib implementation(libs.androidx.annotation)
// to not unnecessarily complicate client projects due to potential duplicate class build errors
// caused by https://kotlinlang.org/docs/whatsnew18.html#updated-jvm-compilation-target
//noinspection GradleDependency
implementation("androidx.annotation:annotation:1.3.0")
testImplementation("junit:junit:4.13.2") testImplementation(libs.junit)
androidTestImplementation("androidx.test:runner:1.5.2") androidTestImplementation(libs.androidx.runner)
androidTestImplementation("androidx.test:rules:1.5.0") androidTestImplementation(libs.androidx.rules)
androidTestImplementation("androidx.test.ext:junit:1.1.5") androidTestImplementation(libs.androidx.junit)
androidTestImplementation("androidx.test.espresso:espresso-core:3.5.1") androidTestImplementation(libs.androidx.espresso.core)
} }
val tesseract4AndroidVersion: String by rootProject.extra
afterEvaluate { afterEvaluate {
publishing { publishing {
publications { publications {
@ -114,14 +108,14 @@ afterEvaluate {
groupId = "cz.adaptech" groupId = "cz.adaptech"
artifactId = "tesseract4android" artifactId = "tesseract4android"
version = tesseract4AndroidVersion version = libs.versions.tesseract4android.get()
} }
create<MavenPublication>("openmp") { create<MavenPublication>("openmp") {
from(components.findByName("openmpRelease")) from(components.findByName("openmpRelease"))
groupId = "cz.adaptech" groupId = "cz.adaptech"
artifactId = "tesseract4android-openmp" artifactId = "tesseract4android-openmp"
version = tesseract4AndroidVersion version = libs.versions.tesseract4android.get()
} }
} }
} }