1
0
Fork 0
tt9/build.gradle
Dimo Karaivanov f1657a0285
Back to SQLite (#420)
* Deleted Objectbox and went back to SQLite. The database structure is entirely new and optimized for fast performance

* Added slow query stats + cache for even faster performance

* automatic language sorting script 

* legacy database management using SQLiteOpener

* simplified access to the constant settings
2024-02-05 13:56:26 +02:00

145 lines
3.7 KiB
Groovy

buildscript {
repositories {
mavenCentral()
google()
maven {
url "https://plugins.gradle.org/m2/"
}
}
dependencies {
classpath 'com.android.tools.build:gradle:8.0.2'
classpath 'gradle.plugin.at.zierler:yaml-validator-plugin:1.5.0'
}
}
apply plugin: 'com.android.application'
apply plugin: 'at.zierler.yamlvalidator'
apply from: 'gradle/scripts/constants.gradle'
apply from: 'gradle/scripts/dictionary-tools.gradle'
apply from: 'gradle/scripts/validate-languages.gradle'
apply from: 'gradle/scripts/version-tools.gradle'
configurations.configureEach {
yamlValidator {
searchPaths = ['languages/definitions']
}
}
dependencies {
implementation 'androidx.core:core:1.10.1'
implementation 'androidx.preference:preference:1.2.1'
// fixes 'duplicate class error' when using "androidx.core" > 1.9.0
// see: https://stackoverflow.com/a/77323424
implementation(platform("org.jetbrains.kotlin:kotlin-bom:1.8.0"))
}
repositories {
mavenCentral()
google()
maven {
url "https://plugins.gradle.org/m2/"
}
}
tasks.register('validateLanguages') {
mustRunAfter(validateYaml)
inputs.dir fileTree(dir: LANGUAGES_INPUT_DIR)
outputs.file "${project.buildDir}/lang.validation.txt"
doLast {
validateLanguageFiles(DEFINITIONS_INPUT_DIR, DICTIONARIES_INPUT_DIR, outputs.files.singleFile)
}
}
tasks.register('copyLanguages', Copy) {
from LANGUAGES_INPUT_DIR
include '**/*.csv'
include '**/*.txt'
include '**/*.yml'
into LANGUAGES_OUTPUT_DIR
}
tasks.register('calculateDictionarySizes') {
inputs.dir fileTree(dir: DICTIONARIES_INPUT_DIR)
outputs.dir DICTIONARIES_OUTPUT_DIR
doLast {
getDictionarySizes(DICTIONARIES_INPUT_DIR, DICTIONARIES_OUTPUT_DIR)
}
}
clean {
delete LANGUAGES_OUTPUT_DIR
}
// using the exported Closures directly causes weird values, hence the extra wrappers here
def getVerCode = { -> return getVersionCode() }
def getVerName = { -> return getVersionName() }
def getVersionString = { flavor -> return flavor == 'debug' ? getDebugVersion() : getReleaseVersion() }
android {
namespace "io.github.sspanak.tt9"
defaultConfig {
minSdkVersion 19
//noinspection ExpiredTargetSdkVersion
targetSdk 30
compileSdk 33
versionCode getVerCode()
versionName getVerName()
}
sourceSets {
main {
manifest.srcFile 'AndroidManifest.xml'
java.srcDirs = ['src']
resources.srcDirs = ['src']
aidl.srcDirs = ['src']
res.srcDirs = ['res']
assets.srcDirs = ['assets']
}
// Move the build types to build-types/<type>
// For instance, build-types/debug/java, build-types/debug/AndroidManifest.xml, ...
// This moves them out of them default location under src/<type>/... which would
// conflict with src/ being used by the main source set.
// Adding new build types or product flavors should be accompanied
// by a similar customization.
debug.setRoot('build-types/debug')
release.setRoot('build-types/release')
}
buildTypes {
debug { data ->
data.buildConfigField 'String', 'VERSION_FULL', "\"${getVersionString('debug')}\""
}
release { data ->
data.buildConfigField 'String', 'VERSION_FULL', "\"${getVersionString('release')}\""
debuggable false
jniDebuggable false
minifyEnabled true
shrinkResources true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-project.txt'
}
}
buildFeatures {
renderScript false
aidl true
}
applicationVariants.configureEach { variant ->
tasks["generate${variant.name.capitalize()}Assets"]
.dependsOn(validateLanguages)
.dependsOn(copyLanguages)
.dependsOn(calculateDictionarySizes)
tasks.findByName('lintVitalAnalyzeRelease')?.mustRunAfter(copyLanguages)?.mustRunAfter(calculateDictionarySizes)
tasks.findByName('lintAnalyzeDebug')?.mustRunAfter(copyLanguages)?.mustRunAfter(calculateDictionarySizes)
}
}