1
0
mirror of https://github.com/dzeiocom/OpenHealth.git synced 2025-04-22 10:52:13 +00:00
OpenHealth/app/build.gradle.kts
dependabot[bot] ddb5906a1f
build: bump org.jetbrains.kotlinx:kotlinx-coroutines-android
Bumps [org.jetbrains.kotlinx:kotlinx-coroutines-android](https://github.com/Kotlin/kotlinx.coroutines) from 1.6.4 to 1.7.3.
- [Release notes](https://github.com/Kotlin/kotlinx.coroutines/releases)
- [Changelog](https://github.com/Kotlin/kotlinx.coroutines/blob/master/CHANGES.md)
- [Commits](https://github.com/Kotlin/kotlinx.coroutines/compare/1.6.4...1.7.3)

---
updated-dependencies:
- dependency-name: org.jetbrains.kotlinx:kotlinx-coroutines-android
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-07-26 11:06:58 +00:00

237 lines
6.6 KiB
Plaintext

import java.util.Properties
plugins {
// Android Application?
id("com.android.application")
// Support for kotlin in Android
kotlin("android")
// Data Injection
id("dagger.hilt.android.plugin")
// Safe Navigation
id("androidx.navigation.safeargs")
// OSS Licenses
id("com.google.android.gms.oss-licenses-plugin")
// KSP
id("com.google.devtools.ksp")
// keep at bottom
kotlin("kapt")
}
// from: https://discuss.kotlinlang.org/t/use-git-hash-as-version-number-in-build-gradle-kts/19818/8
fun String.runCommand(
workingDir: File = File("."),
timeoutAmount: Long = 60,
timeoutUnit: TimeUnit = TimeUnit.SECONDS
): String = ProcessBuilder(split("\\s(?=(?:[^'\"`]*(['\"`])[^'\"`]*\\1)*[^'\"`]*$)".toRegex()))
.directory(workingDir)
.redirectOutput(ProcessBuilder.Redirect.PIPE)
.redirectError(ProcessBuilder.Redirect.PIPE)
.start()
.apply { waitFor(timeoutAmount, timeoutUnit) }
.run {
val error = errorStream.bufferedReader().readText().trim()
if (error.isNotEmpty()) {
return@run ""
}
inputStream.bufferedReader().readText().trim()
}
// The application ID
val appID = "com.dzeio.openhealth"
// the application supported languages
val locales = listOf("en", "fr")
// minimum application required SDK version to run
val sdkMin = 21
// target SDK version
val sdkTarget = 33
val branch = "git rev-parse --abbrev-ref HEAD".runCommand(workingDir = rootDir)
var tag = "git tag -l --points-at HEAD".runCommand(workingDir = rootDir)
if (tag == "") {
tag = "not tagged"
}
val commitId = "git rev-parse HEAD".runCommand(workingDir = rootDir)
.subSequence(0, 7)
android {
signingConfigs {
create("release") {
try {
val keystoreProperties = Properties().apply {
load(rootProject.file("./keystore.properties").reader())
}
if (keystoreProperties.isNotEmpty()) {
storePassword = keystoreProperties["storePassword"] as String
keyPassword = keystoreProperties["keyPassword"] as String
keyAlias = keystoreProperties["keyAlias"] as String
storeFile = file(keystoreProperties["storeFile"] as String)
}
} catch (_: Exception) {}
}
}
compileSdk = sdkTarget
defaultConfig {
// App ID
applicationId = appID
// Android 5 Lollipop
minSdk = sdkMin
// Android 12
targetSdk = sdkTarget
// Semantic Versioning
versionName = "0.1.0"
versionCode = 1
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
buildConfigField(
"String[]",
"LOCALES",
"new String[]{\"" + locales.joinToString("\",\"") + "\"}"
)
resourceConfigurations += locales
buildConfigField("String", "BRANCH", "\"$branch\"")
buildConfigField("String", "TAG", "\"$tag\"")
buildConfigField("String", "COMMIT", "\"$commitId\"")
}
buildTypes {
getByName("release") {
// Slimmer version
isMinifyEnabled = true
isShrinkResources = true
isDebuggable = false
proguardFiles(
getDefaultProguardFile("proguard-android-optimize.txt"),
"proguard-rules.pro"
)
signingConfig = signingConfigs.getByName("release")
}
getByName("debug") {
applicationIdSuffix = ".dev"
versionNameSuffix = "-dev"
isDebuggable = true
// make it debuggable
isRenderscriptDebuggable = true
// Optimization Level
renderscriptOptimLevel = 0
}
}
// Compile using JAVA 11
compileOptions {
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
}
kotlinOptions {
jvmTarget = JavaVersion.VERSION_11.toString()
}
// Enable View Binding and Data Binding
buildFeatures {
viewBinding = true
dataBinding = true
}
namespace = appID
}
kapt {
correctErrorTypes = true
useBuildCache = true
}
ksp {
arg("room.schemaLocation", "$projectDir/schemas")
}
dependencies {
// Dzeio Charts
implementation("com.dzeio:charts:0.1.7")
// Dzeio Crash Handler
implementation("com.dzeio:crashhandler:1.0.2")
// Core dependencies
implementation("androidx.core:core-ktx:1.9.0")
implementation("androidx.appcompat:appcompat:1.7.0-alpha02")
implementation("javax.inject:javax.inject:1")
implementation("com.google.android.material:material:1.9.0-alpha02")
implementation("androidx.constraintlayout:constraintlayout:2.1.4")
implementation("androidx.lifecycle:lifecycle-livedata-ktx:2.6.0")
implementation("androidx.lifecycle:lifecycle-viewmodel-ktx:2.6.0")
// Coroutines
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-android:1.7.3")
// Settings
implementation("androidx.preference:preference-ktx:1.2.0")
// DataStore
implementation("androidx.datastore:datastore:1.0.0")
// Navigation
implementation("androidx.navigation:navigation-fragment-ktx:2.5.3")
implementation("androidx.navigation:navigation-ui-ktx:2.5.3")
// Paging
implementation("androidx.paging:paging-runtime:3.1.1")
implementation("androidx.paging:paging-runtime-ktx:3.1.1")
// Services
implementation("androidx.work:work-runtime-ktx:2.8.0")
implementation("androidx.core:core-ktx:1.9.0")
// Tests
testImplementation("junit:junit:4.13.2")
androidTestImplementation("androidx.test.ext:junit:1.1.5")
androidTestImplementation("androidx.test.espresso:espresso-core:3.5.1")
// Hilt
implementation("com.google.dagger:hilt-android:2.44.2")
kapt("com.google.dagger:hilt-compiler:2.45")
// ROOM
implementation("androidx.room:room-runtime:2.5.0")
ksp("androidx.room:room-compiler:2.5.0")
implementation("androidx.room:room-ktx:2.5.0")
testImplementation("androidx.room:room-testing:2.5.0")
// Futures
implementation("com.google.guava:guava:31.1-jre")
implementation("androidx.concurrent:concurrent-futures:1.1.0")
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-guava:1.6.4")
// OSS Licenses
implementation("com.google.android.gms:play-services-oss-licenses:17.0.0")
// Retrofit (Open Food Fact)
implementation("com.squareup.retrofit2:retrofit:2.9.0")
implementation("com.squareup.retrofit2:converter-gson:2.9.0")
implementation("com.squareup.okhttp3:logging-interceptor:4.10.0")
}