2019-10-22 20:19:05 +02:00
|
|
|
import org.jetbrains.kotlin.konan.properties.hasProperty
|
2019-10-21 23:26:06 +02:00
|
|
|
import java.io.FileInputStream
|
2021-07-01 13:25:09 +02:00
|
|
|
import java.util.Properties
|
2019-10-21 23:26:06 +02:00
|
|
|
|
|
|
|
plugins {
|
|
|
|
id("com.android.application")
|
|
|
|
id("kotlin-android")
|
|
|
|
|
2022-05-03 19:01:36 +02:00
|
|
|
id("org.jlleitschuh.gradle.ktlint") version "10.3.0"
|
2021-06-26 13:36:32 +02:00
|
|
|
id("com.gladed.androidgitversion") version "0.4.14"
|
2021-12-12 17:34:50 +01:00
|
|
|
id("com.github.triplet.play") version "3.7.0"
|
2021-08-02 13:24:12 +02:00
|
|
|
id("de.mobilej.unmock")
|
2021-08-06 09:34:09 +02:00
|
|
|
id("com.github.ben-manes.versions")
|
2021-07-30 10:57:49 +02:00
|
|
|
jacoco
|
2019-10-21 23:26:06 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
val props = Properties().apply {
|
2020-06-25 22:29:33 +02:00
|
|
|
try {
|
|
|
|
load(FileInputStream(rootProject.file("local.properties")))
|
|
|
|
} catch (e: Exception) {
|
|
|
|
}
|
2019-10-21 23:26:06 +02:00
|
|
|
}
|
|
|
|
|
2021-08-02 13:24:12 +02:00
|
|
|
unMock {
|
|
|
|
keep = listOf("android.net.Uri")
|
2021-07-30 10:57:49 +02:00
|
|
|
}
|
|
|
|
|
2019-11-06 09:01:17 +01:00
|
|
|
androidGitVersion {
|
2021-09-17 08:50:19 +02:00
|
|
|
codeFormat = "MMNNPPBBB" // Keep in sync with version_code() in dist/create_release.sh
|
2019-11-06 09:01:17 +01:00
|
|
|
format = "%tag%%-count%%-commit%%-branch%"
|
|
|
|
}
|
|
|
|
|
2019-10-21 23:26:06 +02:00
|
|
|
android {
|
|
|
|
compileOptions {
|
|
|
|
sourceCompatibility = JavaVersion.VERSION_1_8
|
|
|
|
targetCompatibility = JavaVersion.VERSION_1_8
|
|
|
|
}
|
|
|
|
|
2021-08-06 21:16:46 +02:00
|
|
|
testCoverage {
|
|
|
|
version = Versions.jacoco
|
|
|
|
}
|
|
|
|
|
2019-10-21 23:26:06 +02:00
|
|
|
kotlinOptions {
|
2020-06-25 22:29:33 +02:00
|
|
|
jvmTarget = JavaVersion.VERSION_1_8.toString()
|
2019-10-21 23:26:06 +02:00
|
|
|
}
|
|
|
|
|
2021-07-16 10:03:52 +02:00
|
|
|
buildFeatures {
|
|
|
|
viewBinding = true
|
|
|
|
}
|
|
|
|
|
2021-08-06 09:34:09 +02:00
|
|
|
lint {
|
2021-08-06 21:16:46 +02:00
|
|
|
disable += listOf("MissingTranslation", "ExtraTranslation")
|
2021-07-20 09:01:52 +02:00
|
|
|
}
|
|
|
|
|
2022-01-03 09:40:32 +01:00
|
|
|
compileSdk = 31
|
2019-10-21 23:26:06 +02:00
|
|
|
|
|
|
|
defaultConfig {
|
|
|
|
|
2021-08-06 09:34:09 +02:00
|
|
|
applicationId = "audio.funkwhale.ffa"
|
2020-05-30 21:44:41 +02:00
|
|
|
|
2021-07-01 13:11:11 +02:00
|
|
|
versionCode = androidGitVersion.code()
|
2019-10-21 23:26:06 +02:00
|
|
|
versionName = androidGitVersion.name()
|
2021-07-23 14:10:13 +02:00
|
|
|
|
2021-08-06 09:34:09 +02:00
|
|
|
minSdk = 24
|
|
|
|
targetSdk = 30
|
|
|
|
|
|
|
|
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
|
|
|
|
|
2021-07-23 14:10:13 +02:00
|
|
|
manifestPlaceholders["appAuthRedirectScheme"] = "urn"
|
2019-10-21 23:26:06 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
signingConfigs {
|
2021-07-13 10:30:33 +02:00
|
|
|
|
2019-10-21 23:26:06 +02:00
|
|
|
create("release") {
|
2021-07-13 10:30:33 +02:00
|
|
|
if (project.hasProperty("signing.store")) {
|
|
|
|
storeFile = file(project.findProperty("signing.store")!!)
|
|
|
|
storePassword = project.findProperty("signing.store_passphrase")!!.toString()
|
|
|
|
keyAlias = "ffa"
|
|
|
|
keyPassword = project.findProperty("signing.key_passphrase")!!.toString()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
getByName("debug") {
|
|
|
|
if (project.hasProperty("signing.store")) {
|
|
|
|
storeFile = file(project.findProperty("signing.store")!!)
|
|
|
|
storePassword = project.findProperty("signing.store_passphrase")!!.toString()
|
|
|
|
keyAlias = "ffa"
|
|
|
|
keyPassword = project.findProperty("signing.key_passphrase")!!.toString()
|
2019-10-21 23:26:06 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-07-30 10:57:49 +02:00
|
|
|
testOptions {
|
2021-08-04 10:41:42 +02:00
|
|
|
execution = "ANDROID_TEST_ORCHESTRATOR"
|
|
|
|
animationsDisabled = true
|
|
|
|
unitTests {
|
|
|
|
isReturnDefaultValues = true
|
|
|
|
isIncludeAndroidResources = true
|
|
|
|
}
|
2021-07-30 10:57:49 +02:00
|
|
|
}
|
|
|
|
|
2019-10-21 23:26:06 +02:00
|
|
|
buildTypes {
|
2020-05-29 01:10:12 +02:00
|
|
|
getByName("debug") {
|
|
|
|
isDebuggable = true
|
2020-07-10 17:23:02 +02:00
|
|
|
applicationIdSuffix = ".dev"
|
2020-06-25 22:29:33 +02:00
|
|
|
|
2021-08-06 21:16:46 +02:00
|
|
|
isTestCoverageEnabled = true
|
|
|
|
|
2021-07-13 10:30:33 +02:00
|
|
|
if (project.hasProperty("signing.store")) {
|
|
|
|
signingConfig = signingConfigs.getByName("debug")
|
|
|
|
}
|
|
|
|
|
2020-06-25 22:29:33 +02:00
|
|
|
resValue("string", "debug.hostname", props.getProperty("debug.hostname", ""))
|
|
|
|
resValue("string", "debug.username", props.getProperty("debug.username", ""))
|
|
|
|
resValue("string", "debug.password", props.getProperty("debug.password", ""))
|
2020-05-29 01:10:12 +02:00
|
|
|
}
|
|
|
|
|
2019-10-21 23:26:06 +02:00
|
|
|
getByName("release") {
|
2020-07-10 17:23:02 +02:00
|
|
|
|
2021-07-13 10:30:33 +02:00
|
|
|
if (project.hasProperty("signing.store")) {
|
2019-11-06 01:08:30 +01:00
|
|
|
signingConfig = signingConfigs.getByName("release")
|
|
|
|
}
|
2019-10-21 23:26:06 +02:00
|
|
|
|
2020-07-07 21:04:24 +02:00
|
|
|
resValue("string", "debug.hostname", "")
|
|
|
|
resValue("string", "debug.username", "")
|
|
|
|
resValue("string", "debug.password", "")
|
|
|
|
|
2020-06-25 22:29:33 +02:00
|
|
|
isMinifyEnabled = true
|
|
|
|
isShrinkResources = true
|
2019-10-21 23:26:06 +02:00
|
|
|
|
2020-06-25 22:29:33 +02:00
|
|
|
proguardFiles(
|
|
|
|
getDefaultProguardFile("proguard-android-optimize.txt"),
|
|
|
|
"proguard-rules.pro"
|
|
|
|
)
|
2019-10-21 23:26:06 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
ktlint {
|
|
|
|
debug.set(false)
|
|
|
|
verbose.set(false)
|
|
|
|
}
|
|
|
|
|
|
|
|
play {
|
2021-09-08 15:04:59 +02:00
|
|
|
enabled.set(props.hasProperty("play.credentials"))
|
2019-10-21 23:26:06 +02:00
|
|
|
|
2021-09-08 15:04:59 +02:00
|
|
|
if (enabled.get()) {
|
|
|
|
serviceAccountCredentials.set(file(props.getProperty("play.credentials")))
|
|
|
|
defaultToAppBundles.set(true)
|
|
|
|
track.set("beta")
|
2019-10-21 23:26:06 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
dependencies {
|
2020-06-13 22:24:35 +02:00
|
|
|
implementation(fileTree(mapOf("dir" to "libs", "include" to listOf("*.jar", "*.aar"))))
|
2019-10-21 23:26:06 +02:00
|
|
|
|
2021-08-04 10:41:42 +02:00
|
|
|
implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk7:${Versions.kotlin}")
|
2022-06-01 11:30:43 +02:00
|
|
|
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.2")
|
2022-05-27 21:30:48 +02:00
|
|
|
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-android:1.6.2")
|
2019-10-21 23:26:06 +02:00
|
|
|
|
2022-06-04 08:01:18 +02:00
|
|
|
implementation("androidx.appcompat:appcompat:1.4.2")
|
2022-06-01 19:00:34 +02:00
|
|
|
implementation("androidx.core:core-ktx:1.8.0")
|
2022-03-03 10:01:20 +01:00
|
|
|
implementation("androidx.lifecycle:lifecycle-runtime-ktx:2.4.1")
|
2022-03-03 11:03:18 +01:00
|
|
|
implementation("androidx.coordinatorlayout:coordinatorlayout:1.2.0")
|
2022-03-07 09:32:52 +01:00
|
|
|
implementation("androidx.preference:preference-ktx:1.2.0")
|
2021-07-01 13:25:09 +02:00
|
|
|
implementation("androidx.recyclerview:recyclerview:1.2.1")
|
2020-06-25 22:29:33 +02:00
|
|
|
implementation("androidx.swiperefreshlayout:swiperefreshlayout:1.1.0")
|
2022-06-01 11:00:46 +02:00
|
|
|
implementation("com.google.android.material:material:1.6.1")
|
2021-07-01 13:25:09 +02:00
|
|
|
implementation("com.android.support.constraint:constraint-layout:2.0.4")
|
2019-10-21 23:26:06 +02:00
|
|
|
|
2021-08-04 10:41:42 +02:00
|
|
|
implementation("com.google.android.exoplayer:exoplayer-core:${Versions.exoPlayer}")
|
|
|
|
implementation("com.google.android.exoplayer:exoplayer-ui:${Versions.exoPlayer}")
|
|
|
|
implementation("com.google.android.exoplayer:extension-mediasession:${Versions.exoPlayer}")
|
2021-08-06 09:34:09 +02:00
|
|
|
|
2021-08-09 06:50:46 +02:00
|
|
|
implementation("io.insert-koin:koin-core:${Versions.koin}")
|
|
|
|
implementation("io.insert-koin:koin-android:${Versions.koin}")
|
|
|
|
testImplementation("io.insert-koin:koin-test:${Versions.koin}")
|
|
|
|
|
2021-08-04 10:41:42 +02:00
|
|
|
implementation("com.github.PaulWoitaschek.ExoPlayer-Extensions:extension-opus:${Versions.exoPlayerExtensions}") {
|
2020-09-07 09:58:57 +02:00
|
|
|
isTransitive = false
|
|
|
|
}
|
2021-08-04 10:41:42 +02:00
|
|
|
implementation("com.github.PaulWoitaschek.ExoPlayer-Extensions:extension-flac:${Versions.exoPlayerExtensions}") {
|
2020-09-07 09:58:57 +02:00
|
|
|
isTransitive = false
|
|
|
|
}
|
2020-06-13 22:24:35 +02:00
|
|
|
|
2021-08-04 10:41:42 +02:00
|
|
|
implementation("com.aliassadi:power-preference-lib:${Versions.powerPreference}")
|
|
|
|
implementation("com.github.kittinunf.fuel:fuel:${Versions.fuel}")
|
|
|
|
implementation("com.github.kittinunf.fuel:fuel-coroutines:${Versions.fuel}")
|
|
|
|
implementation("com.github.kittinunf.fuel:fuel-android:${Versions.fuel}")
|
|
|
|
implementation("com.github.kittinunf.fuel:fuel-gson:${Versions.fuel}")
|
|
|
|
implementation("com.google.code.gson:gson:${Versions.gson}")
|
2019-10-21 23:26:06 +02:00
|
|
|
implementation("com.squareup.picasso:picasso:2.71828")
|
2021-07-01 13:25:09 +02:00
|
|
|
implementation("jp.wasabeef:picasso-transformations:2.4.0")
|
2021-08-04 10:41:42 +02:00
|
|
|
implementation("net.openid:appauth:${Versions.openIdAppAuth}")
|
2021-08-06 09:34:09 +02:00
|
|
|
|
2021-07-30 10:57:49 +02:00
|
|
|
testImplementation("junit:junit:4.13.2")
|
2022-05-11 11:01:28 +02:00
|
|
|
testImplementation("io.mockk:mockk:1.12.4")
|
2021-07-30 10:57:49 +02:00
|
|
|
testImplementation("androidx.test:core:1.4.0")
|
2021-08-04 10:41:42 +02:00
|
|
|
testImplementation("io.strikt:strikt-core:${Versions.strikt}")
|
2021-08-06 21:16:46 +02:00
|
|
|
testImplementation("org.robolectric:robolectric:${Versions.robolectric}")
|
2021-08-06 09:34:09 +02:00
|
|
|
|
|
|
|
androidTestImplementation("io.mockk:mockk-android:${Versions.mockk}")
|
2021-07-30 10:57:49 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
project.afterEvaluate {
|
|
|
|
|
2021-08-06 21:16:46 +02:00
|
|
|
tasks.withType<Test> {
|
|
|
|
|
|
|
|
configure<JacocoTaskExtension> {
|
|
|
|
isIncludeNoLocationClasses = true
|
|
|
|
excludes = listOf("jdk.internal.*")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
tasks.create("jacocoTestReport", type = JacocoReport::class) {
|
|
|
|
dependsOn("testDebugUnitTest", "createDebugCoverageReport")
|
|
|
|
|
|
|
|
group = "Verification"
|
|
|
|
description = "Creates a Jacoco Coverage report"
|
|
|
|
|
2021-08-04 10:41:42 +02:00
|
|
|
reports {
|
|
|
|
xml.required.set(true)
|
|
|
|
csv.required.set(true)
|
|
|
|
html.required.set(true)
|
2021-07-30 10:57:49 +02:00
|
|
|
}
|
2021-08-06 21:16:46 +02:00
|
|
|
|
|
|
|
val fileFilter = listOf(
|
|
|
|
"**/R.class",
|
|
|
|
"**/R$*.class",
|
|
|
|
"**/BuildConfig.*",
|
|
|
|
"**/Manifest*.*",
|
|
|
|
"**/*Test*.*",
|
|
|
|
"android/**/*.*",
|
|
|
|
"**/*$[0-9].*"
|
|
|
|
)
|
|
|
|
|
|
|
|
val debugTree = fileTree("${project.buildDir}/tmp/kotlin-classes/debug") {
|
|
|
|
setExcludes(fileFilter)
|
|
|
|
}
|
|
|
|
val mainSrc = "${project.projectDir}/src/main/java"
|
|
|
|
|
|
|
|
sourceDirectories.setFrom(files(listOf(mainSrc)))
|
|
|
|
classDirectories.setFrom(files(listOf(debugTree)))
|
|
|
|
|
2021-09-09 09:56:15 +02:00
|
|
|
executionData.setFrom(
|
|
|
|
fileTree(project.buildDir) {
|
|
|
|
setIncludes(
|
|
|
|
listOf(
|
|
|
|
"outputs/unit_test_code_coverage/debugUnitTest/*.exec",
|
|
|
|
"outputs/code_coverage/debugAndroidTest/connected/**/*.ec"
|
|
|
|
)
|
2021-08-06 21:16:46 +02:00
|
|
|
)
|
2021-09-09 09:56:15 +02:00
|
|
|
}
|
|
|
|
)
|
2021-07-30 10:57:49 +02:00
|
|
|
}
|
2019-10-21 23:26:06 +02:00
|
|
|
}
|