secant-android-wallet/build.gradle.kts

127 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")
id("org.jetbrains.kotlinx.kover")
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-05-24 06:39:56 -07:00
fladle {
// 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
@Suppress("MagicNumber", "PropertyName", "VariableNaming")
val FIREBASE_TEST_LAB_MAX_SDK = 30
2022-01-26 12:13:19 -08:00
val minSdkVersion = run {
2022-05-24 06:39:56 -07:00
// Fladle will use the app APK as the additional APK, so we have to
// use the app's minSdkVersion here.
val buildMinSdk = project.properties["ANDROID_APP_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
}
2022-04-04 06:37:00 -07:00
2022-05-24 06:39:56 -07:00
val firebaseTestLabKeyPath = project.properties["ZCASH_FIREBASE_TEST_LAB_API_KEY_PATH"].toString()
val firebaseProject = project.properties["ZCASH_FIREBASE_TEST_LAB_PROJECT"].toString()
2022-05-24 06:39:56 -07:00
if (firebaseTestLabKeyPath.isNotEmpty()) {
serviceAccountCredentials.set(File(firebaseTestLabKeyPath))
} else if (firebaseProject.isNotEmpty()) {
projectId.set(firebaseProject)
2022-01-26 12:13:19 -08:00
}
2022-05-24 06:39:56 -07:00
devices.addAll(
mapOf("model" to "Pixel2", "version" to minSdkVersion),
mapOf("model" to "Pixel2", "version" to targetSdkVersion)
)
@Suppress("MagicNumber")
flakyTestAttempts.set(2)
// Always use orchestrator for Firebase Test Lab.
// Some submodules don't need it, but it is difficult to configure on a per-module basis from here
// since this configuration applies to all modules.
useOrchestrator.set(true)
environmentVariables.set(mapOf("clearPackageData" to "true"))
flankVersion.set(libs.versions.flank.get())
filesToDownload.set(listOf(
"*/matrix_*/*test_results_merged\\.xml",
"*/matrix_*/*/artifacts/sdcard/googletest/test_outputfiles/*\\.png"
2022-05-24 06:39:56 -07:00
))
directoriesToPull.set(listOf(
"/sdcard/googletest/test_outputfiles"
2022-05-24 06:39:56 -07:00
))
2022-01-26 12:13:19 -08:00
}
2021-10-11 12:52:24 -07:00
kover {
isDisabled = !project.property("IS_KOTLIN_TEST_COVERAGE_ENABLED").toString().toBoolean()
// Don't run on the Android projects, as they have coverage generated in a different way
// through Android's instrumented tests
disabledProjects = setOf(
"app",
"crash-android-lib",
"preference-impl-android-lib",
"sdk-ext-lib",
"sdk-ext-ui-lib",
"spackle-android-lib",
"test-lib",
"ui-design-lib",
"ui-integration-test-lib",
"ui-lib",
)
}