Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Kotlin Script, Version Catlogues, Kotlin Sample, Compose Sample #68

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 0 additions & 32 deletions build.gradle

This file was deleted.

29 changes: 29 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
repositories {
google()
mavenCentral()

}
dependencies {
classpath(libs.gradle)
classpath(libs.kotlin.gradle.plugin)

// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}

allprojects {
repositories {
mavenLocal()
google()
mavenCentral()
maven("https://jitpack.io")
}
}

tasks.register<Delete>("clean") {
delete(rootProject.buildDir)
}
63 changes: 63 additions & 0 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
[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"
coreKtx = "1.13.1"
kotlin = "2.0.0"
kotlinGradlePlugin = "1.9.0"
lifecycleRuntimeKtx = "2.8.3"
activityCompose = "1.9.0"
composeBom = "2024.06.00"
window = "1.3.0"
adaptiveAndroid = "1.0.0-beta04"

[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-lifecycle-viewmodel-compose = { module = "androidx.lifecycle:lifecycle-viewmodel-compose" }
androidx-rules = { module = "androidx.test:rules", version.ref = "test" }
androidx-runner = { module = "androidx.test:runner", version.ref = "test" }
androidx-window = { module = "androidx.window:window", version.ref = "window" }
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" }
androidx-core-ktx = { group = "androidx.core", name = "core-ktx", version.ref = "coreKtx" }
kotlin-gradle-plugin = { group = "org.jetbrains.kotlin", name = "kotlin-gradle-plugin", version.ref = "kotlinGradlePlugin" }
androidx-lifecycle-runtime-ktx = { group = "androidx.lifecycle", name = "lifecycle-runtime-ktx", version.ref = "lifecycleRuntimeKtx" }
androidx-activity-compose = { group = "androidx.activity", name = "activity-compose", version.ref = "activityCompose" }
androidx-compose-bom = { group = "androidx.compose", name = "compose-bom", version.ref = "composeBom" }
androidx-ui = { group = "androidx.compose.ui", name = "ui" }
androidx-ui-graphics = { group = "androidx.compose.ui", name = "ui-graphics" }
androidx-ui-tooling = { group = "androidx.compose.ui", name = "ui-tooling" }
androidx-ui-tooling-preview = { group = "androidx.compose.ui", name = "ui-tooling-preview" }
androidx-ui-test-manifest = { group = "androidx.compose.ui", name = "ui-test-manifest" }
androidx-ui-test-junit4 = { group = "androidx.compose.ui", name = "ui-test-junit4" }
androidx-material3 = { group = "androidx.compose.material3", name = "material3" }
androidx-adaptive-android = { group = "androidx.compose.material3.adaptive", name = "adaptive-android", version.ref = "adaptiveAndroid" }

[plugins]
jetbrains-kotlin-android = { id = "org.jetbrains.kotlin.android" }
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.2-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-all.zip
70 changes: 0 additions & 70 deletions sample/build.gradle

This file was deleted.

100 changes: 100 additions & 0 deletions sample/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
plugins {
id("com.android.application")
alias(libs.plugins.jetbrains.kotlin.android)
}

android {
namespace = "cz.adaptech.tesseract4android.sample"
compileSdk = 34

defaultConfig {
applicationId = "cz.adaptech.tesseract4android.sample"
minSdk = 21
targetSdk = 34
versionCode = 1
versionName = "1.0"

testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
vectorDrawables {
useSupportLibrary = true
}
}

buildTypes {
release {
proguardFiles(
getDefaultProguardFile("proguard-android-optimize.txt"),
"proguard-rules.pro"
)
}
}
compileOptions {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}
buildFeatures {
viewBinding = true
compose = true
}
kotlinOptions {
jvmTarget = "17"
}
composeOptions {
kotlinCompilerExtensionVersion = "1.5.1"
}
packaging {
resources {
excludes += "/META-INF/{AL2.0,LGPL2.1}"
}
}
}

// In case you are using dependency on local library (the project(":tesseract4android") below),
// uncomment this to specify which flavor you want to build.
// Or you can specify *same* flavors also for the app - then they will be matched automatically.
// See more: https://developer.android.com/studio/build/build-variants#variant_aware
/*android {
defaultConfig {
// Choose "standard" or "openmp" flavor of the library
missingDimensionStrategy "parallelization", "standard"
}
flavorDimensions = ["parallelization"]
}*/

dependencies {
// To use library from JitPack
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(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(libs.material)
implementation(libs.androidx.core.ktx)
implementation(libs.androidx.activity.compose)
implementation(platform(libs.androidx.compose.bom))
implementation(libs.androidx.ui)
implementation(libs.androidx.ui.graphics)
implementation(libs.androidx.ui.tooling.preview)
implementation(libs.androidx.material3)
implementation(libs.androidx.window)

implementation(libs.androidx.lifecycle.runtime.ktx)
implementation(libs.androidx.lifecycle.viewmodel)
implementation(libs.androidx.lifecycle.viewmodel.compose)
implementation(libs.androidx.adaptive.android)

testImplementation(libs.junit)
androidTestImplementation(libs.androidx.junit)
androidTestImplementation(libs.androidx.espresso.core)
androidTestImplementation(platform(libs.androidx.compose.bom))
androidTestImplementation(libs.androidx.ui.test.junit4)
debugImplementation(libs.androidx.ui.tooling)
debugImplementation(libs.androidx.ui.test.manifest)
}

This file was deleted.

Loading