diff --git a/build.gradle.kts b/build.gradle.kts index 63f5c03..dd1b9a3 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -7,7 +7,7 @@ buildscript { } dependencies { - classpath("com.android.tools.build:gradle:8.5.0") + classpath(libs.gradle) // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files @@ -23,8 +23,6 @@ allprojects { } } -val tesseract4AndroidVersion by ext("4.7.0") - tasks.register("clean") { delete(rootProject.buildDir) } diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml new file mode 100644 index 0000000..92bc473 --- /dev/null +++ b/gradle/libs.versions.toml @@ -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] \ No newline at end of file diff --git a/sample/build.gradle.kts b/sample/build.gradle.kts index bd52d06..28d59ca 100644 --- a/sample/build.gradle.kts +++ b/sample/build.gradle.kts @@ -46,31 +46,26 @@ android { flavorDimensions = ["parallelization"] }*/ -val tesseract4AndroidVersion: String by rootProject.extra - dependencies { // To use library from JitPack - // 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. - implementation("cz.adaptech.tesseract4android:tesseract4android:$tesseract4AndroidVersion") - // standard flavor -// implementation "cz.adaptech.tesseract4android:tesseract4android-openmp:$tesseract4AndroidVersion" // openmp flavor + implementation(libs.tesseract4android.jitpack) // standard flavor + //implementation(libs.tesseract4android.jitpack.openmp) // openmp flavor // To use library from local maven repository // Don't forget to specify mavenLocal() in repositories block in project's build.gradle file -// implementation "cz.adaptech:tesseract4android:$tesseract4AndroidVersion" // standard flavor -// implementation "cz.adaptech:tesseract4android-openmp:$tesseract4AndroidVersion" // openmp flavor + //implementation(libs.tesseract4android.local) // standard flavor + //implementation(libs.tesseract4android.local.openmp) // openmp flavor // To use library compiled locally // Which flavor to use is determined by missingDimensionStrategy parameter above. -// implementation project(":tesseract4android") + //implementation(project(":tesseract4android")) - implementation("androidx.appcompat:appcompat:1.6.1") - implementation("com.google.android.material:material:1.11.0") - implementation("androidx.constraintlayout:constraintlayout:2.1.4") - implementation("androidx.lifecycle:lifecycle-livedata:2.7.0") - implementation("androidx.lifecycle:lifecycle-viewmodel:2.7.0") - testImplementation("junit:junit:4.13.2") - androidTestImplementation("androidx.test.ext:junit:1.1.5") - androidTestImplementation("androidx.test.espresso:espresso-core:3.5.1") + implementation(libs.androidx.appcompat) + implementation(libs.material) + implementation(libs.androidx.constraintlayout) + implementation(libs.androidx.lifecycle.livedata) + implementation(libs.androidx.lifecycle.viewmodel) + testImplementation(libs.junit) + androidTestImplementation(libs.androidx.junit) + androidTestImplementation(libs.androidx.espresso.core) } \ No newline at end of file diff --git a/tesseract4android/build.gradle.kts b/tesseract4android/build.gradle.kts index 82a3fc8..0a0b376 100644 --- a/tesseract4android/build.gradle.kts +++ b/tesseract4android/build.gradle.kts @@ -91,21 +91,15 @@ android { } dependencies { - // 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 - implementation("androidx.annotation:annotation:1.3.0") + implementation(libs.androidx.annotation) - testImplementation("junit:junit:4.13.2") - androidTestImplementation("androidx.test:runner:1.5.2") - androidTestImplementation("androidx.test:rules:1.5.0") - androidTestImplementation("androidx.test.ext:junit:1.1.5") - androidTestImplementation("androidx.test.espresso:espresso-core:3.5.1") + testImplementation(libs.junit) + androidTestImplementation(libs.androidx.runner) + androidTestImplementation(libs.androidx.rules) + androidTestImplementation(libs.androidx.junit) + androidTestImplementation(libs.androidx.espresso.core) } -val tesseract4AndroidVersion: String by rootProject.extra - afterEvaluate { publishing { publications { @@ -114,14 +108,14 @@ afterEvaluate { groupId = "cz.adaptech" artifactId = "tesseract4android" - version = tesseract4AndroidVersion + version = libs.versions.tesseract4android.get() } create("openmp") { from(components.findByName("openmpRelease")) groupId = "cz.adaptech" artifactId = "tesseract4android-openmp" - version = tesseract4AndroidVersion + version = libs.versions.tesseract4android.get() } } }