ReaderForSelfoss-multiplatform/androidApp/build.gradle.kts

230 lines
7.3 KiB
Plaintext
Raw Normal View History

2022-03-22 14:35:23 +00:00
import java.io.ByteArrayOutputStream
2022-08-17 08:43:56 +00:00
val ignoreGitVersion: String by project
2022-11-30 19:53:11 +00:00
val acraVersion = "5.9.7"
2022-08-17 08:43:56 +00:00
2022-03-22 14:35:23 +00:00
plugins {
id("com.android.application")
kotlin("android")
2022-03-22 15:51:45 +00:00
kotlin("kapt")
2022-11-05 21:00:16 +00:00
id("com.mikepenz.aboutlibraries.plugin")
id("org.jetbrains.kotlinx.kover")
2022-03-22 14:35:23 +00:00
}
2022-03-22 15:51:45 +00:00
fun Project.execWithOutput(cmd: String, ignore: Boolean = false): String {
val result: String = ByteArrayOutputStream().use { outputStream ->
2022-03-22 15:51:45 +00:00
project.exec {
commandLine = cmd.split(" ")
standardOutput = outputStream
isIgnoreExitValue = ignore
2022-03-22 15:51:45 +00:00
}
outputStream.toString()
2022-03-22 14:35:23 +00:00
}
2022-03-22 15:51:45 +00:00
return result
2022-03-22 14:35:23 +00:00
}
fun gitVersion(): String {
2022-03-22 15:51:45 +00:00
val maybeTagOfCurrentCommit = execWithOutput("git -C ../ describe --contains HEAD", true)
val process = if (maybeTagOfCurrentCommit.isEmpty()) {
2022-03-22 14:35:23 +00:00
println("No tag on current commit. Will take the latest one.")
2023-03-05 20:02:03 +00:00
execWithOutput("git -C ../ for-each-ref refs/tags --sort=-refname --format='%(refname:short)' --count=1")
2022-03-22 14:35:23 +00:00
} else {
println("Tag found on current commit")
2022-03-22 15:51:45 +00:00
execWithOutput("git -C ../ describe --contains HEAD")
2022-03-22 14:35:23 +00:00
}
2022-09-25 19:39:57 +00:00
return process.replace("^0", "").replace("'", "").substring(1).replace("\\.", "").trim()
2022-03-22 14:35:23 +00:00
}
fun versionCodeFromGit(): Int {
2022-08-17 08:43:56 +00:00
if (ignoreGitVersion == "true") {
// don't care
return 1
}
2022-03-22 14:35:23 +00:00
println("version code " + gitVersion())
return gitVersion().toInt()
}
fun versionNameFromGit(): String {
2022-08-17 08:43:56 +00:00
if (ignoreGitVersion == "true") {
// don't care
return "1"
}
2022-03-22 14:35:23 +00:00
println("version name " + gitVersion())
return gitVersion()
}
android {
compileOptions {
isCoreLibraryDesugaringEnabled = true
2022-03-22 14:35:23 +00:00
// Flag to enable support for the new language APIs
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
2022-10-29 18:50:44 +00:00
}
// For Kotlin projects
kotlinOptions {
jvmTarget = "17"
2022-03-22 14:35:23 +00:00
}
compileSdk = 34
2022-03-22 14:35:23 +00:00
buildFeatures {
viewBinding = true
}
defaultConfig {
applicationId = "bou.amine.apps.readerforselfossv2.android"
minSdk = 25
targetSdk = 34
2022-03-22 14:35:23 +00:00
versionCode = versionCodeFromGit()
versionName = versionNameFromGit()
multiDexEnabled = true
lint {
abortOnError = true
}
vectorDrawables.useSupportLibrary = true
// tests
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
2024-12-22 20:05:47 +00:00
testInstrumentationRunnerArguments["clearPackageData"] = "true"
2022-03-22 14:35:23 +00:00
}
packaging {
2022-10-22 18:47:38 +00:00
resources {
excludes += "/META-INF/{AL2.0,LGPL2.1}"
}
}
2022-03-22 14:35:23 +00:00
buildTypes {
getByName("release") {
isMinifyEnabled = true
isShrinkResources = true
proguardFiles(getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro")
}
getByName("debug") {
}
}
flavorDimensions.add("build")
productFlavors {
2022-09-07 19:24:38 +00:00
create("githubConfig") {
2022-03-22 14:35:23 +00:00
versionNameSuffix = "-github"
dimension = "build"
}
}
2022-09-24 11:54:48 +00:00
namespace = "bou.amine.apps.readerforselfossv2.android"
2024-12-22 20:05:47 +00:00
testOptions {
animationsDisabled = true
execution = "ANDROIDX_TEST_ORCHESTRATOR"
}
2022-03-22 14:35:23 +00:00
}
dependencies {
coreLibraryDesugaring("com.android.tools:desugar_jdk_libs:2.0.3")
2022-03-22 14:35:23 +00:00
implementation(project(":shared"))
implementation("com.google.android.material:material:1.9.0")
implementation("androidx.appcompat:appcompat:1.6.1")
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-android:1.7.1")
2022-03-22 15:51:45 +00:00
implementation("androidx.preference:preference-ktx:1.2.1")
2022-03-22 15:51:45 +00:00
implementation(fileTree(mapOf("include" to listOf("*.jar"), "dir" to "libs")))
// Android Support
implementation("androidx.appcompat:appcompat:1.6.1")
implementation("com.google.android.material:material:1.9.0")
implementation("androidx.recyclerview:recyclerview:1.3.1")
2022-03-22 15:51:45 +00:00
implementation("androidx.legacy:legacy-support-v4:1.0.0")
implementation("androidx.vectordrawable:vectordrawable:1.2.0-beta01")
2022-03-22 15:51:45 +00:00
implementation("androidx.cardview:cardview:1.0.0")
implementation("androidx.annotation:annotation:1.7.0")
implementation("androidx.work:work-runtime-ktx:2.8.1")
implementation("androidx.constraintlayout:constraintlayout:2.1.4")
implementation("org.jsoup:jsoup:1.15.4")
2022-03-22 15:51:45 +00:00
//multidex
implementation("androidx.multidex:multidex:2.0.1")
// About
2022-11-05 21:00:16 +00:00
implementation("com.mikepenz:aboutlibraries-core:10.5.1")
implementation("com.mikepenz:aboutlibraries:10.5.1")
2022-03-22 15:51:45 +00:00
// Material-ish things
implementation("com.ashokvarma.android:bottom-navigation-bar:2.2.0")
// glide
2023-03-03 19:39:20 +00:00
kapt("com.github.bumptech.glide:compiler:4.15.0")
implementation("com.github.bumptech.glide:okhttp3-integration:4.15.0")
2022-03-22 15:51:45 +00:00
// Themes
implementation("com.github.rubensousa:floatingtoolbar:1.5.1")
// Pager
implementation("me.relex:circleindicator:2.1.6")
implementation("androidx.viewpager2:viewpager2:1.1.0-beta02")
2022-03-22 15:51:45 +00:00
//Dependency Injection
implementation("org.kodein.di:kodein-di:7.14.0")
implementation("org.kodein.di:kodein-di-framework-android-x:7.14.0")
implementation("org.kodein.di:kodein-di-framework-android-x-viewmodel:7.14.0")
2022-07-18 21:25:10 +00:00
//Settings
implementation("com.russhwolf:multiplatform-settings-no-arg:0.9")
//Logging
implementation("io.github.aakira:napier:2.6.1")
2022-03-22 15:51:45 +00:00
//PhotoView
implementation("com.github.chrisbanes:PhotoView:2.3.0")
implementation("androidx.core:core-ktx:1.12.0")
2022-03-22 15:51:45 +00:00
implementation("androidx.lifecycle:lifecycle-extensions:2.2.0")
2022-03-22 15:51:45 +00:00
// Network information
implementation("com.github.ln-12:multiplatform-connectivity-status:1.3.0")
// SQLDELIGHT
2022-10-30 21:02:07 +00:00
implementation("com.squareup.sqldelight:android-driver:1.5.4")
2022-10-29 11:37:46 +00:00
//test
testImplementation("junit:junit:4.13.2")
testImplementation("io.mockk:mockk:1.12.0")
testImplementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.7.1")
2022-10-30 20:12:01 +00:00
implementation("org.jetbrains.kotlinx:kotlinx-datetime:0.4.0")
2024-12-22 20:05:47 +00:00
androidTestImplementation("androidx.test:runner:1.6.2")
androidTestImplementation("androidx.test:rules:1.6.1")
androidTestImplementation("androidx.test.espresso:espresso-core:3.6.1")
implementation("androidx.test.espresso:espresso-idling-resource:3.6.1")
androidTestImplementation("androidx.test.ext:junit-ktx:1.2.1")
androidTestUtil("androidx.test:orchestrator:1.5.1")
2022-11-12 21:58:42 +00:00
2022-11-30 19:53:11 +00:00
implementation("ch.acra:acra-http:$acraVersion")
implementation("ch.acra:acra-toast:$acraVersion")
2022-10-29 11:37:46 +00:00
}
tasks.withType<Test> {
outputs.upToDateWhen { false }
useJUnit()
testLogging {
exceptionFormat = org.gradle.api.tasks.testing.logging.TestExceptionFormat.FULL
events = setOf(
org.gradle.api.tasks.testing.logging.TestLogEvent.PASSED,
org.gradle.api.tasks.testing.logging.TestLogEvent.FAILED,
org.gradle.api.tasks.testing.logging.TestLogEvent.STANDARD_ERROR
)
showStandardStreams = true
}
2022-11-05 21:00:16 +00:00
}
aboutLibraries {
offlineMode = true
fetchRemoteLicense = false
fetchRemoteFunding = false
includePlatform = false
strictMode = com.mikepenz.aboutlibraries.plugin.StrictMode.FAIL
duplicationMode = com.mikepenz.aboutlibraries.plugin.DuplicateMode.MERGE
duplicationRule = com.mikepenz.aboutlibraries.plugin.DuplicateRule.GROUP
2024-12-22 20:05:47 +00:00
}
tasks.withType<Test> {
systemProperty("ci", systemProperties["ci"] ?: "false")
2022-03-22 14:35:23 +00:00
}