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-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-03-22 14:35:23 +00:00
|
|
|
}
|
|
|
|
|
2022-03-22 15:51:45 +00:00
|
|
|
fun Project.execWithOutput(cmd: String, ignore: Boolean = false): String {
|
|
|
|
var result: String = ByteArrayOutputStream().use { outputStream ->
|
|
|
|
project.exec {
|
|
|
|
commandLine = cmd.split(" ")
|
|
|
|
standardOutput = outputStream
|
|
|
|
isIgnoreExitValue = ignore ?: false
|
|
|
|
}
|
|
|
|
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 {
|
|
|
|
var process = ""
|
2022-03-22 15:51:45 +00:00
|
|
|
val maybeTagOfCurrentCommit = execWithOutput("git -C ../ describe --contains HEAD", true)
|
2022-03-22 14:35:23 +00:00
|
|
|
process = if (maybeTagOfCurrentCommit.isEmpty()) {
|
|
|
|
println("No tag on current commit. Will take the latest one.")
|
2022-03-22 15:51:45 +00:00
|
|
|
execWithOutput("git -C ../ for-each-ref refs/tags --sort=-authordate --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
|
|
|
}
|
|
|
|
return process.replace("'", "").substring(1).replace("\\.", "").trim()
|
|
|
|
}
|
|
|
|
|
|
|
|
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 {
|
|
|
|
// Flag to enable support for the new language APIs
|
|
|
|
isCoreLibraryDesugaringEnabled = true
|
|
|
|
sourceCompatibility = JavaVersion.VERSION_1_8
|
|
|
|
targetCompatibility = JavaVersion.VERSION_1_8
|
|
|
|
}
|
|
|
|
compileSdk = 31
|
|
|
|
buildToolsVersion = "31.0.0"
|
|
|
|
buildFeatures {
|
|
|
|
viewBinding = true
|
|
|
|
}
|
|
|
|
defaultConfig {
|
|
|
|
applicationId = "bou.amine.apps.readerforselfossv2.android"
|
|
|
|
minSdk = 21
|
|
|
|
targetSdk = 31
|
|
|
|
versionCode = versionCodeFromGit()
|
|
|
|
versionName = versionNameFromGit()
|
|
|
|
|
|
|
|
multiDexEnabled = true
|
|
|
|
lint {
|
|
|
|
abortOnError = true
|
|
|
|
}
|
|
|
|
vectorDrawables.useSupportLibrary = true
|
|
|
|
|
|
|
|
// tests
|
|
|
|
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
|
|
|
|
|
|
|
|
javaCompileOptions {
|
|
|
|
annotationProcessorOptions {
|
|
|
|
arguments += mapOf("room.schemaLocation" to "$projectDir/schemas")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
buildTypes {
|
|
|
|
getByName("release") {
|
|
|
|
isMinifyEnabled = true
|
|
|
|
isShrinkResources = true
|
|
|
|
proguardFiles(getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro")
|
|
|
|
}
|
|
|
|
getByName("debug") {
|
|
|
|
buildConfigField("String", "LOGIN_URL", properties["appLoginUrl"] as String)
|
|
|
|
buildConfigField("String", "LOGIN_PASSWORD", properties["appLoginPassword"] as String)
|
|
|
|
buildConfigField("String", "LOGIN_USERNAME", properties["appLoginUsername"] as String)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
flavorDimensions.add("build")
|
|
|
|
productFlavors {
|
|
|
|
create("github") {
|
|
|
|
versionNameSuffix = "-github"
|
|
|
|
dimension = "build"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
kotlinOptions {
|
|
|
|
jvmTarget = "1.8"
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
dependencies {
|
|
|
|
implementation(project(":shared"))
|
2022-03-22 15:51:45 +00:00
|
|
|
implementation("com.google.android.material:material:1.5.0")
|
|
|
|
implementation("androidx.appcompat:appcompat:1.4.1")
|
|
|
|
implementation("androidx.constraintlayout:constraintlayout:2.1.3")
|
|
|
|
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-android:1.6.0")
|
|
|
|
|
|
|
|
implementation("androidx.preference:preference-ktx:1.1.1")
|
|
|
|
|
|
|
|
// Testing
|
|
|
|
androidTestImplementation("androidx.test.espresso:espresso-core:3.4.0-alpha02")
|
|
|
|
androidTestImplementation("androidx.test:runner:1.3.1-alpha02")
|
|
|
|
// Espresso-contrib for DatePicker, RecyclerView, Drawer actions, Accessibility checks, CountingIdlingResource
|
|
|
|
androidTestImplementation("androidx.test.espresso:espresso-contrib:3.4.0-alpha02")
|
|
|
|
// Espresso-intents for validation and stubbing of Intents
|
|
|
|
androidTestImplementation("androidx.test.espresso:espresso-intents:3.4.0-alpha02")
|
|
|
|
implementation(fileTree(mapOf("include" to listOf("*.jar"), "dir" to "libs")))
|
|
|
|
|
|
|
|
// Android Support
|
|
|
|
implementation("androidx.appcompat:appcompat:1.4.1")
|
|
|
|
implementation("com.google.android.material:material:1.5.0")
|
|
|
|
implementation("androidx.recyclerview:recyclerview:1.3.0-alpha01")
|
|
|
|
implementation("androidx.legacy:legacy-support-v4:1.0.0")
|
|
|
|
implementation("androidx.vectordrawable:vectordrawable:1.2.0-alpha02")
|
|
|
|
implementation("androidx.browser:browser:1.4.0")
|
|
|
|
implementation("androidx.cardview:cardview:1.0.0")
|
|
|
|
implementation("androidx.annotation:annotation:1.3.0")
|
|
|
|
implementation("androidx.work:work-runtime-ktx:2.7.1")
|
|
|
|
implementation("androidx.constraintlayout:constraintlayout:2.1.3")
|
|
|
|
implementation("org.jsoup:jsoup:1.14.3")
|
|
|
|
|
|
|
|
coreLibraryDesugaring("com.android.tools:desugar_jdk_libs:1.1.5")
|
|
|
|
|
|
|
|
//multidex
|
|
|
|
implementation("androidx.multidex:multidex:2.0.1")
|
|
|
|
|
|
|
|
// About
|
|
|
|
implementation("com.mikepenz:aboutlibraries-core:8.9.4")
|
|
|
|
implementation("com.mikepenz:aboutlibraries:8.9.4")
|
|
|
|
implementation("com.mikepenz:aboutlibraries-definitions:8.9.4")
|
|
|
|
|
|
|
|
// Async
|
2022-03-22 14:35:23 +00:00
|
|
|
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-android:1.6.0")
|
2022-03-22 15:51:45 +00:00
|
|
|
|
|
|
|
// Retrofit + http logging + okhttp
|
|
|
|
implementation("com.squareup.retrofit2:retrofit:2.9.0")
|
|
|
|
implementation("com.squareup.okhttp3:logging-interceptor:5.0.0-alpha.3")
|
|
|
|
implementation("com.squareup.retrofit2:converter-gson:2.9.0")
|
|
|
|
implementation("com.burgstaller:okhttp-digest:2.5")
|
|
|
|
|
|
|
|
// Material-ish things
|
|
|
|
implementation("com.ashokvarma.android:bottom-navigation-bar:2.2.0")
|
|
|
|
implementation("com.amulyakhare:com.amulyakhare.textdrawable:1.0.1")
|
|
|
|
|
|
|
|
// glide
|
|
|
|
kapt("com.github.bumptech.glide:compiler:4.11.0")
|
|
|
|
implementation("com.github.bumptech.glide:okhttp3-integration:4.1.1")
|
|
|
|
|
|
|
|
// Drawer
|
|
|
|
implementation("com.mikepenz:materialdrawer:8.4.5")
|
|
|
|
|
|
|
|
// Themes
|
|
|
|
implementation("com.52inc:scoops:1.0.0")
|
|
|
|
implementation("com.jaredrummler:colorpicker:1.1.0")
|
|
|
|
implementation("com.github.rubensousa:floatingtoolbar:1.5.1")
|
|
|
|
|
|
|
|
// Pager
|
|
|
|
implementation("me.relex:circleindicator:2.1.6")
|
|
|
|
implementation("androidx.viewpager2:viewpager2:1.1.0-beta01")
|
|
|
|
|
2022-07-17 23:28:56 +00:00
|
|
|
//Dependency Injection
|
2022-08-21 12:11:28 +00:00
|
|
|
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-17 23:28:56 +00:00
|
|
|
|
2022-07-18 21:25:10 +00:00
|
|
|
//Settings
|
|
|
|
implementation("com.russhwolf:multiplatform-settings-no-arg:0.9")
|
|
|
|
|
2022-03-22 15:51:45 +00:00
|
|
|
//PhotoView
|
|
|
|
implementation("com.github.chrisbanes:PhotoView:2.3.0")
|
|
|
|
|
2022-08-20 10:15:36 +00:00
|
|
|
implementation("androidx.core:core-ktx:1.8.0")
|
2022-03-22 15:51:45 +00:00
|
|
|
|
2022-08-20 10:15:36 +00:00
|
|
|
implementation("androidx.lifecycle:lifecycle-livedata-ktx:2.5.1")
|
|
|
|
implementation("androidx.lifecycle:lifecycle-common-java8:2.5.1")
|
|
|
|
implementation("androidx.lifecycle:lifecycle-runtime:2.5.1")
|
|
|
|
implementation("androidx.lifecycle:lifecycle-extensions:2.2.0")
|
2022-03-22 15:51:45 +00:00
|
|
|
|
|
|
|
implementation("androidx.room:room-ktx:2.4.0-beta01")
|
|
|
|
kapt("androidx.room:room-compiler:2.4.0-beta01")
|
|
|
|
|
|
|
|
implementation("android.arch.work:work-runtime-ktx:1.0.1")
|
2022-08-17 17:56:24 +00:00
|
|
|
|
|
|
|
// Network information
|
2022-08-20 19:28:21 +00:00
|
|
|
// TODO: When updating this library, check if the todo in RepositoryImpl.startNetwork can be resolved
|
2022-08-21 17:47:24 +00:00
|
|
|
// TODO: Include this library once this is merged https://github.com/ln-12/multiplatform-connectivity-status/pull/4
|
|
|
|
// implementation("com.github.ln-12:multiplatform-connectivity-status:1.1.0")
|
|
|
|
implementation(project(":connectionstatus"))
|
2022-03-22 14:35:23 +00:00
|
|
|
}
|