secant-android-wallet/build.gradle.kts

126 lines
4.0 KiB
Plaintext
Raw Normal View History

buildscript {
dependencyLocking {
lockMode.set(LockMode.STRICT)
lockAllConfigurations()
}
}
plugins {
id("com.github.ben-manes.versions")
2022-01-26 12:13:19 -08:00
id("com.osacky.fulladle")
id("io.gitlab.arturbosch.detekt")
2021-09-17 05:33:27 -07:00
id("zcash.ktlint-conventions")
}
tasks {
register("detektAll", io.gitlab.arturbosch.detekt.Detekt::class) {
parallel = true
setSource(files(projectDir))
include("**/*.kt")
include("**/*.kts")
exclude("**/resources/**")
exclude("**/build/**")
exclude("**/commonTest/**")
exclude("**/jvmTest/**")
exclude("**/androidTest/**")
config.setFrom(files("${rootProject.projectDir}/tools/detekt.yml"))
buildUponDefaultConfig = true
}
withType<com.github.benmanes.gradle.versions.updates.DependencyUpdatesTask> {
gradleReleaseChannel = "current"
resolutionStrategy {
componentSelection {
all {
if (isNonStable(candidate.version) && !isNonStable(currentVersion)) {
reject("Unstable")
}
}
}
}
}
}
val unstableKeywords = listOf("alpha", "beta", "rc", "m", "ea", "build")
fun isNonStable(version: String): Boolean {
val versionLowerCase = version.toLowerCase()
return unstableKeywords.any { versionLowerCase.contains(it) }
}
2021-10-11 12:52:24 -07:00
2022-01-26 12:13:19 -08:00
// Firebase Test Lab has min and max values that might differ from our project's
// These are determined by `gcloud firebase test android models list`
@Suppress("MagicNumber", "PropertyName", "VariableNaming")
val FIREBASE_TEST_LAB_MIN_SDK = 23
2022-01-26 12:13:19 -08:00
@Suppress("MagicNumber", "PropertyName", "VariableNaming")
val FIREBASE_TEST_LAB_MAX_SDK = 30
2022-01-26 12:13:19 -08:00
val firebaseTestLabKeyPath = project.properties["ZCASH_FIREBASE_TEST_LAB_API_KEY_PATH"].toString()
if (firebaseTestLabKeyPath.isNotBlank()) {
val minSdkVersion = run {
val buildMinSdk = project.properties["ANDROID_LIB_MIN_SDK_VERSION"].toString().toInt()
buildMinSdk.coerceAtLeast(FIREBASE_TEST_LAB_MIN_SDK).toString()
2022-01-26 12:13:19 -08:00
}
val targetSdkVersion = run {
val buildTargetSdk = project.properties["ANDROID_TARGET_SDK_VERSION"].toString().toInt()
buildTargetSdk.coerceAtMost(FIREBASE_TEST_LAB_MAX_SDK).toString()
2022-01-26 12:13:19 -08:00
}
fladle {
serviceAccountCredentials.set(File(firebaseTestLabKeyPath))
// TODO [#282]: Replace this with NexusLowRes once tests pass on larger screen sizes
2022-01-26 12:13:19 -08:00
devices.addAll(
mapOf("model" to "Nexus6", "version" to minSdkVersion),
mapOf("model" to "Pixel2", "version" to targetSdkVersion)
2022-01-26 12:13:19 -08:00
)
@Suppress("MagicNumber")
flakyTestAttempts.set(2)
if (project.properties["IS_USE_TEST_ORCHESTRATOR"].toString().toBoolean()) {
useOrchestrator.set(true)
environmentVariables.set(mapOf("clearPackageData" to "true"))
} else {
useOrchestrator.set(false)
}
2022-04-04 06:37:00 -07:00
flankVersion.set(libs.versions.flank.get())
filesToDownload.set(listOf(
"*/matrix_*/*test_results_merged\\.xml"
))
2022-01-26 12:13:19 -08:00
}
}
2021-10-11 12:52:24 -07:00
// All of this should be refactored to build-conventions
subprojects {
pluginManager.withPlugin("com.android.library") {
project.the<com.android.build.gradle.LibraryExtension>().apply {
configureBaseExtension()
// TODO [#5]: Figure out how to move this into the build-conventions
testCoverage {
jacocoVersion = libs.versions.jacoco.get()
}
}
}
pluginManager.withPlugin("com.android.application") {
project.the<com.android.build.gradle.AppExtension>().apply {
configureBaseExtension()
}
}
}
fun com.android.build.gradle.BaseExtension.configureBaseExtension() {
// TODO [#22]: Figure out how to move this into build-conventions
testOptions {
animationsDisabled = true
if (project.property("IS_USE_TEST_ORCHESTRATOR").toString().toBoolean()) {
execution = "ANDROIDX_TEST_ORCHESTRATOR"
}
}
}