2021-09-25 05:13:14 -07:00
|
|
|
buildscript {
|
|
|
|
repositories {
|
|
|
|
google()
|
|
|
|
gradlePluginPortal()
|
|
|
|
}
|
|
|
|
dependencies {
|
2022-01-04 12:00:51 -08:00
|
|
|
classpath(kotlin("gradle-plugin", version = libs.versions.kotlin.get()))
|
2021-09-25 06:44:31 -07:00
|
|
|
classpath(libs.gradle.plugin.rust)
|
|
|
|
classpath(libs.gradle.plugin.publish)
|
|
|
|
classpath(libs.gradle.plugin.navigation)
|
2021-09-25 05:13:14 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
plugins {
|
2022-01-11 05:11:15 -08:00
|
|
|
id("com.github.ben-manes.versions")
|
|
|
|
id("com.osacky.fulladle")
|
|
|
|
id("io.gitlab.arturbosch.detekt")
|
2021-09-25 05:13:14 -07:00
|
|
|
id("org.jetbrains.dokka")
|
|
|
|
id("org.owasp.dependencycheck")
|
|
|
|
id("zcash.ktlint-conventions")
|
|
|
|
}
|
|
|
|
|
2022-02-05 05:45:52 -08:00
|
|
|
apply(plugin = "com.vanniktech.maven.publish")
|
|
|
|
|
2021-09-25 05:13:14 -07:00
|
|
|
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"))
|
2022-01-14 05:05:55 -08:00
|
|
|
baseline.set(file("$rootDir/tools/detekt-baseline.xml"))
|
2021-09-25 05:13:14 -07:00
|
|
|
buildUponDefaultConfig = true
|
|
|
|
}
|
2021-09-25 07:55:02 -07:00
|
|
|
|
|
|
|
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) }
|
|
|
|
}
|
2022-01-11 05:11:15 -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_API = 23
|
|
|
|
@Suppress("MagicNumber", "PropertyName", "VariableNaming")
|
|
|
|
val FIREBASE_TEST_LAB_MAX_API = 30
|
|
|
|
|
|
|
|
val firebaseTestLabKeyPath = project.properties["ZCASH_FIREBASE_TEST_LAB_API_KEY_PATH"].toString()
|
|
|
|
if (firebaseTestLabKeyPath.isNotBlank()) {
|
|
|
|
val minSdkVersion = run {
|
|
|
|
val buildMinSdk = project.properties["ANDROID_MIN_SDK_VERSION"].toString().toInt()
|
|
|
|
buildMinSdk.coerceAtLeast(FIREBASE_TEST_LAB_MIN_API).toString()
|
|
|
|
}
|
|
|
|
val targetSdkVersion = run {
|
|
|
|
val buildTargetSdk = project.properties["ANDROID_TARGET_SDK_VERSION"].toString().toInt()
|
|
|
|
buildTargetSdk.coerceAtMost(FIREBASE_TEST_LAB_MAX_API).toString()
|
|
|
|
}
|
|
|
|
fladle {
|
|
|
|
serviceAccountCredentials.set(File(firebaseTestLabKeyPath))
|
|
|
|
devices.addAll(
|
|
|
|
mapOf("model" to "NexusLowRes", "version" to minSdkVersion),
|
|
|
|
mapOf("model" to "NexusLowRes", "version" to targetSdkVersion)
|
|
|
|
)
|
|
|
|
|
|
|
|
@Suppress("MagicNumber")
|
|
|
|
flakyTestAttempts.set(2)
|
|
|
|
}
|
|
|
|
}
|