fix missing crashlytics plugin

This commit is contained in:
Adam Brown 2022-12-11 13:10:00 +00:00
parent f1077efc17
commit 7e1ff25968
3 changed files with 14 additions and 24 deletions

View File

@ -1,8 +1,9 @@
plugins { plugins {
id "st-application-conventions" id "st-application-conventions"
alias libs.plugins.firebase.crashlytics apply false
} }
applyCrashlyticsIfRelease(project) applyCrashlyticsIfRelease()
android { android {
ndkVersion "25.0.8141415" ndkVersion "25.0.8141415"
@ -104,3 +105,14 @@ dependencies {
implementation libs.kotlin.serialization implementation libs.kotlin.serialization
debugImplementation libs.leakcanary debugImplementation libs.leakcanary
} }
def applyCrashlyticsIfRelease() {
if (isReleaseBuild && !isFoss()) {
project.apply plugin: libs.plugins.firebase.crashlytics.get().pluginId
project.afterEvaluate {
project.tasks.withType(com.google.firebase.crashlytics.buildtools.gradle.tasks.UploadMappingFileTask).configureEach {
it.googleServicesResourceRoot.set(project.file("src/release/res/"))
}
}
}
}

View File

@ -1,35 +1,15 @@
plugins {
// alias(libs.plugins.android.application) apply false
// alias(libs.plugins.android.library) apply false
}
def launchTask = getGradle() def launchTask = getGradle()
.getStartParameter() .getStartParameter()
.getTaskRequests() .getTaskRequests()
.toString() .toString()
.toLowerCase() .toLowerCase()
def isReleaseBuild = launchTask.contains("bundleRelease") || launchTask.contains("assembleRelease") ext.isReleaseBuild = launchTask.contains("bundlerelease") || launchTask.contains("assemblerelease")
ext.isDebugBuild = !isReleaseBuild ext.isDebugBuild = !isReleaseBuild
task clean(type: Delete) { task clean(type: Delete) {
delete rootProject.buildDir delete rootProject.buildDir
} }
ext.applyCrashlyticsIfRelease = { project ->
println("is release $isReleaseBuild")
println("is foss ${isFoss()}")
if (isReleaseBuild && !isFoss()) {
println("run craslytics")
project.apply plugin: 'com.google.firebase.crashlytics'
project.afterEvaluate {
project.tasks.withType(com.google.firebase.crashlytics.buildtools.gradle.tasks.UploadMappingFileTask).configureEach {
it.googleServicesResourceRoot.set(project.file("src/release/res/"))
}
}
}
}
ext.kotlinTest = { dependencies -> ext.kotlinTest = { dependencies ->
dependencies.testImplementation libs.kluent dependencies.testImplementation libs.kluent
dependencies.testImplementation libs.kotlin.test dependencies.testImplementation libs.kotlin.test

View File

@ -14,8 +14,6 @@ android-library = { id = "com.android.library", version.ref = "android-gp" }
android-kotlin = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" } android-kotlin = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" }
kotlin = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" } kotlin = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" }
kotlin-parcelize = { id = "org.jetbrains.kotlin.plugin.parcelize", version.ref = "kotlin" } kotlin-parcelize = { id = "org.jetbrains.kotlin.plugin.parcelize", version.ref = "kotlin" }
crashlytics = { id = "org.jetbrains.kotlin.plugin.parcelize", version = "1.8.0-RC" }
firebase-crashlytics = { id = "com.google.firebase.crashlytics", version = "2.9.2" } firebase-crashlytics = { id = "com.google.firebase.crashlytics", version = "2.9.2" }
kotlin-serialization = { id = "org.jetbrains.kotlin.plugin.serialization", version.ref = "kotlin" } kotlin-serialization = { id = "org.jetbrains.kotlin.plugin.serialization", version.ref = "kotlin" }