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.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")
|
2023-05-31 03:38:42 -07:00
|
|
|
id("zcash-sdk.detekt-conventions")
|
2022-06-06 13:46:59 -07:00
|
|
|
id("zcash-sdk.ktlint-conventions")
|
2022-06-15 10:56:17 -07:00
|
|
|
id("zcash-sdk.rosetta-conventions")
|
2021-09-25 05:13:14 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
tasks {
|
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")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2023-01-25 12:10:05 -08:00
|
|
|
|
|
|
|
register("checkProperties") {
|
|
|
|
doLast {
|
|
|
|
// Ensure that developers do not change default values of certain properties directly in the repo, but
|
|
|
|
// instead set them in their local ~/.gradle/gradle.properties file (or use command line arguments)
|
|
|
|
val expectedPropertyValues = mapOf(
|
|
|
|
"ZCASH_MAVEN_PUBLISH_USERNAME" to "",
|
|
|
|
"ZCASH_MAVEN_PUBLISH_PASSWORD" to "",
|
|
|
|
"ZCASH_ASCII_GPG_KEY" to "",
|
|
|
|
|
|
|
|
"IS_SNAPSHOT" to "true",
|
|
|
|
|
|
|
|
"ZCASH_IS_TREAT_WARNINGS_AS_ERRORS" to "true",
|
|
|
|
|
|
|
|
"IS_USE_TEST_ORCHESTRATOR" to "false",
|
|
|
|
|
|
|
|
"ZCASH_FIREBASE_TEST_LAB_API_KEY_PATH" to "",
|
|
|
|
"ZCASH_FIREBASE_TEST_LAB_PROJECT" to "",
|
|
|
|
|
|
|
|
"ZCASH_EMULATOR_WTF_API_KEY" to "",
|
|
|
|
|
|
|
|
"IS_MINIFY_SDK_ENABLED" to "false",
|
|
|
|
"IS_MINIFY_APP_ENABLED" to "true",
|
|
|
|
|
|
|
|
"ZCASH_DEBUG_KEYSTORE_PATH" to "",
|
|
|
|
"ZCASH_RELEASE_KEYSTORE_PATH" to "",
|
|
|
|
"ZCASH_RELEASE_KEYSTORE_PASSWORD" to "",
|
|
|
|
"ZCASH_RELEASE_KEY_ALIAS" to "",
|
|
|
|
"ZCASH_RELEASE_KEY_ALIAS_PASSWORD" to "",
|
|
|
|
|
|
|
|
"IS_SIGN_RELEASE_BUILD_WITH_DEBUG_KEY" to "false",
|
2023-03-08 07:04:04 -08:00
|
|
|
|
|
|
|
"IS_DEBUGGABLE_WHILE_BENCHMARKING" to "false"
|
2023-01-25 12:10:05 -08:00
|
|
|
)
|
|
|
|
|
|
|
|
val warnings = expectedPropertyValues.filter { (key, value) ->
|
|
|
|
project.properties[key].toString() != value
|
|
|
|
}.map { "Property ${it.key} does not have expected value \"${it.value}\"" }
|
|
|
|
|
|
|
|
if (warnings.isNotEmpty()) {
|
|
|
|
throw GradleException(warnings.joinToString(separator = "\n"))
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2021-09-25 07:55:02 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
val unstableKeywords = listOf("alpha", "beta", "rc", "m", "ea", "build")
|
|
|
|
|
|
|
|
fun isNonStable(version: String): Boolean {
|
2023-06-09 06:18:11 -07:00
|
|
|
val versionLowerCase = version.lowercase()
|
2021-09-25 07:55:02 -07:00
|
|
|
|
|
|
|
return unstableKeywords.any { versionLowerCase.contains(it) }
|
|
|
|
}
|
2022-01-11 05:11:15 -08:00
|
|
|
|
2022-06-21 04:57:04 -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`
|
2023-06-09 06:18:11 -07:00
|
|
|
@Suppress("MagicNumber", "VariableNaming")
|
2023-04-11 04:42:36 -07:00
|
|
|
val FIREBASE_TEST_LAB_MIN_API = 27 // Minimum for Pixel2.arm device
|
2022-06-21 04:57:04 -07:00
|
|
|
|
2023-06-09 06:18:11 -07:00
|
|
|
@Suppress("MagicNumber", "VariableNaming")
|
2022-08-31 08:17:47 -07:00
|
|
|
val FIREBASE_TEST_LAB_MAX_API = 33
|
2022-06-21 04:57:04 -07:00
|
|
|
|
2022-01-11 05:11:15 -08:00
|
|
|
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()
|
|
|
|
}
|
|
|
|
|
2022-06-21 04:57:04 -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-04-05 05:05:32 -07:00
|
|
|
|
2022-06-21 04:57:04 -07:00
|
|
|
if (firebaseTestLabKeyPath.isNotEmpty()) {
|
|
|
|
serviceAccountCredentials.set(File(firebaseTestLabKeyPath))
|
|
|
|
} else if (firebaseProject.isNotEmpty()) {
|
|
|
|
projectId.set(firebaseProject)
|
2022-01-11 05:11:15 -08:00
|
|
|
}
|
2022-06-21 04:57:04 -07:00
|
|
|
|
|
|
|
devices.addAll(
|
2023-04-11 04:42:36 -07:00
|
|
|
mapOf("model" to "Pixel2.arm", "version" to minSdkVersion),
|
2022-08-31 08:17:47 -07:00
|
|
|
mapOf("model" to "Pixel2.arm", "version" to targetSdkVersion)
|
2022-06-21 04:57:04 -07:00
|
|
|
)
|
|
|
|
|
|
|
|
@Suppress("MagicNumber")
|
|
|
|
flakyTestAttempts.set(2)
|
|
|
|
|
|
|
|
flankVersion.set(libs.versions.flank.get())
|
|
|
|
|
|
|
|
filesToDownload.set(listOf(
|
|
|
|
"*/matrix_*/*test_results_merged\\.xml",
|
|
|
|
"*/matrix_*/*/artifacts/sdcard/googletest/test_outputfiles/*\\.png"
|
|
|
|
))
|
|
|
|
|
|
|
|
directoriesToPull.set(listOf(
|
|
|
|
"/sdcard/googletest/test_outputfiles"
|
|
|
|
))
|
2022-06-15 10:56:17 -07:00
|
|
|
}
|