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

feat: Migrate from Groovy to Kotlin Build configuration #82

Merged
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
156 changes: 0 additions & 156 deletions app/build.gradle

This file was deleted.

147 changes: 147 additions & 0 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,147 @@
import java.util.Properties
import java.io.FileInputStream

val keystorePropertiesFile = rootProject.file("keystore.properties")
val keystoreProperties = Properties().apply {
if (keystorePropertiesFile.exists()) {
load(FileInputStream(keystorePropertiesFile))
}
}

plugins {
id("com.android.application")
id("kotlin-android")
id("org.jmailen.kotlinter")
id("io.gitlab.arturbosch.detekt")
id("com.google.devtools.ksp") version "2.0.0-1.0.22" apply true
}
val kotlin_version by extra("2.0.0")

android {
compileSdk = 34

defaultConfig {
applicationId = "be.scri"
minSdk = 26
targetSdk = 34
versionCode = 7
versionName = "1.0.0"
multiDexEnabled = true
vectorDrawables.useSupportLibrary = true
}

compileOptions {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}

kotlinOptions{
jvmTarget = "1.8"
}

buildFeatures {
viewBinding = true
buildConfig = true
}

signingConfigs {
create("release") {
if (keystorePropertiesFile.exists()) {
keyAlias = keystoreProperties["keyAlias"].toString()
keyPassword = keystoreProperties["keyPassword"].toString()
storeFile = keystoreProperties["storeFile"]?.let { file(it) }
storePassword = keystoreProperties["storePassword"].toString()
}
}
}

buildTypes {
getByName("debug") {
applicationIdSuffix = ".debug"
}
getByName("release") {
isMinifyEnabled = true
proguardFiles(getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro")
signingConfig = signingConfigs.getByName("release")
}
}

flavorDimensions.add("variants")
productFlavors {
create("core")
create("fdroid")
}

sourceSets {
getByName("main").java.srcDirs("src/main/kotlin")
}

lint {
abortOnError = false
checkReleaseBuilds = false
}

detekt {
toolVersion = "1.23.6"
buildUponDefaultConfig = true
allRules = false
config = rootProject.files("detekt.yml")
}

kotlinter {
failBuildWhenCannotAutoFormat = false
ignoreFailures = false
}

namespace = "be.scri"
}

dependencies {
implementation("androidx.appcompat:appcompat:1.7.0")
implementation("androidx.activity:activity-ktx:1.9.2")
implementation("androidx.navigation:navigation-fragment-ktx:2.8.0")
implementation("androidx.navigation:navigation-ui-ktx:2.8.0")
ksp("androidx.room:room-compiler:2.6.1")
implementation("androidx.room:room-runtime:2.6.1")
implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk7:2.0.0")
implementation("androidx.constraintlayout:constraintlayout:2.1.4")
implementation("androidx.documentfile:documentfile:1.0.1")
implementation("androidx.swiperefreshlayout:swiperefreshlayout:1.1.0")
implementation("androidx.exifinterface:exifinterface:1.3.7")
implementation("androidx.biometric:biometric-ktx:1.2.0-alpha05")
implementation("com.google.android.material:material:1.12.0")
implementation("androidx.recyclerview:recyclerview:1.3.2")
implementation("androidx.cardview:cardview:1.0.0")
implementation("androidx.viewpager2:viewpager2:1.1.0")

api("joda-time:joda-time:2.10.13")
api("com.github.tibbi:RecyclerView-FastScroller:e7d3e150c4")
api("com.github.tibbi:reprint:2cb206415d")
api("androidx.core:core-ktx:1.13.1")
api("com.google.code.gson:gson:2.10.1")
api("com.github.bumptech.glide:glide:4.14.2")
ksp("com.github.bumptech.glide:ksp:4.14.2")
}

tasks.register<Copy>("moveFromi18n") {
val locales = listOf("de", "es", "sv", "en-US")

locales.forEach { locale ->
val fromDir = "src/main/assets/i18n/Scribe-i18n/values/$locale/"
val toDir = if (locale == "en-US") "src/main/res/values/" else "src/main/res/values-$locale/"
val sourceDir = file(fromDir)

if (sourceDir.exists()) {
println("Preparing to move from $fromDir to $toDir")
from(fileTree(fromDir))
into(toDir)
duplicatesStrategy = DuplicatesStrategy.INCLUDE
} else {
println("Source directory does not exist: $fromDir")
}
}
}

tasks.named("preBuild").configure {
dependsOn(tasks.named("moveFromi18n"))
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.Button
import android.widget.Toast
import androidx.activity.OnBackPressedCallback
import androidx.activity.addCallback
import androidx.fragment.app.Fragment
Expand Down Expand Up @@ -119,13 +120,15 @@ class LanguageSettingsFragment : Fragment() {
val editor = sharedPref.edit()
editor.putBoolean("period_on_double_tap_$language", true)
editor.apply()
Toast.makeText(requireContext(), "$language Period on Double Tap of Space Bar on ", Toast.LENGTH_SHORT).show()
}

private fun disablePeriodOnSpaceBarDoubleTap(language: String) {
val sharedPref = requireActivity().getSharedPreferences("app_preferences", Context.MODE_PRIVATE)
val editor = sharedPref.edit()
editor.putBoolean("period_on_double_tap_$language", false)
editor.apply()
Toast.makeText(requireContext(), "$language Period on Double Tap of Space Bar on ", Toast.LENGTH_SHORT).show()
}

override fun onDestroyView() {
Expand Down
42 changes: 0 additions & 42 deletions build.gradle

This file was deleted.

Loading