Skip to content

Commit

Permalink
feature: add crashlytics
Browse files Browse the repository at this point in the history
  • Loading branch information
joaooab committed Mar 26, 2024
1 parent 3179296 commit 5ba3ea9
Show file tree
Hide file tree
Showing 6 changed files with 138 additions and 3 deletions.
1 change: 1 addition & 0 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import com.br.weightcontrol.WeiBuildType
plugins {
alias(libs.plugins.weightcontrol.android.application)
alias(libs.plugins.weightcontrol.android.application.compose)
alias(libs.plugins.weightcontrol.android.application.firebase)
id("com.google.android.libraries.mapsplatform.secrets-gradle-plugin")
}

Expand Down
67 changes: 67 additions & 0 deletions app/google-services.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
{
"project_info": {
"project_number": "389953825500",
"project_id": "weightcontrol-dd344",
"storage_bucket": "weightcontrol-dd344.appspot.com"
},
"client": [
{
"client_info": {
"mobilesdk_app_id": "1:389953825500:android:6a7dc615fcfdff28426219",
"android_client_info": {
"package_name": "br.com.weightcontrol"
}
},
"oauth_client": [],
"api_key": [
{
"current_key": "AIzaSyDuNi2IPv0SdbjTyLZPWdgAD1vY2QoN8kw"
}
],
"services": {
"appinvite_service": {
"other_platform_oauth_client": []
}
}
},
{
"client_info": {
"mobilesdk_app_id": "1:389953825500:android:50008286cc4fcd96426219",
"android_client_info": {
"package_name": "com.br.weightcontrol"
}
},
"oauth_client": [],
"api_key": [
{
"current_key": "AIzaSyDuNi2IPv0SdbjTyLZPWdgAD1vY2QoN8kw"
}
],
"services": {
"appinvite_service": {
"other_platform_oauth_client": []
}
}
},
{
"client_info": {
"mobilesdk_app_id": "1:389953825500:android:8c9be728ed134302426219",
"android_client_info": {
"package_name": "com.br.weightcontrol.debug"
}
},
"oauth_client": [],
"api_key": [
{
"current_key": "AIzaSyDuNi2IPv0SdbjTyLZPWdgAD1vY2QoN8kw"
}
],
"services": {
"appinvite_service": {
"other_platform_oauth_client": []
}
}
}
],
"configuration_version": "1"
}
5 changes: 5 additions & 0 deletions build-logic/convention/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ repositories {

dependencies {
compileOnly(libs.android.gradlePlugin)
compileOnly(libs.firebase.crashlytics.gradlePlugin)
compileOnly(libs.kotlin.gradlePlugin)
compileOnly(libs.ksp.gradlePlugin)
}
Expand Down Expand Up @@ -54,5 +55,9 @@ gradlePlugin {
id = "weightcontrol.jvm.library"
implementationClass = "JvmLibraryConventionPlugin"
}
register("androidFirebase") {
id = "weightcontrol.android.application.firebase"
implementationClass = "AndroidApplicationFirebaseConventionPlugin"
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
/*
* Copyright 2022 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

import com.android.build.api.dsl.ApplicationExtension
import com.br.weightcontrol.libs
import com.google.firebase.crashlytics.buildtools.gradle.CrashlyticsExtension

import org.gradle.api.Plugin
import org.gradle.api.Project
import org.gradle.kotlin.dsl.configure
import org.gradle.kotlin.dsl.dependencies

class AndroidApplicationFirebaseConventionPlugin : Plugin<Project> {
override fun apply(target: Project) {
with(target) {
with(pluginManager) {
apply("com.google.gms.google-services")
apply("com.google.firebase.crashlytics")
}

dependencies {
val bom = libs.findLibrary("firebase-bom").get()
add("implementation", platform(bom))
"implementation"(libs.findLibrary("firebase.crashlytics").get())
}

extensions.configure<ApplicationExtension> {
buildTypes.configureEach {
// Disable the Crashlytics mapping file upload. This feature should only be
// enabled if a Firebase backend is available and configured in
// google-services.json.
configure<CrashlyticsExtension> {
mappingFileUploadEnabled = false
}
}
}
}
}
}
5 changes: 3 additions & 2 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,11 @@ buildscript {

plugins {
alias(libs.plugins.android.application) apply false
alias(libs.plugins.android.library) apply false
alias(libs.plugins.firebase.crashlytics) apply false
alias(libs.plugins.gms) apply false
alias(libs.plugins.kotlin.jvm) apply false
alias(libs.plugins.kotlin.serialization) apply false
alias(libs.plugins.ksp) apply false
alias(libs.plugins.secrets) apply false
id("com.android.library") version "7.4.1" apply false
id("org.jetbrains.kotlin.android") version "1.8.20" apply false
}
11 changes: 10 additions & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ androidxLifecycle = "2.7.0"
androidxNavigation = "2.7.4"
androidxTestCore = "1.5.0"
chart = "1.6.4"
firebaseBom = "32.4.0"
firebaseCrashlyticsPlugin = "2.9.9"
gmsPlugin = "4.4.0"
junit4 = "4.13.2"
kotlin = "1.9.21"
koinAndroid = "3.5.3"
Expand Down Expand Up @@ -59,6 +62,8 @@ androidx-test-core = { group = "androidx.test", name = "core", version.ref = "an
chart-core = { group = "com.patrykandpatrick.vico", name = "core", version.ref = "chart" }
chart-compose = { group = "com.patrykandpatrick.vico", name = "compose", version.ref = "chart" }
chart-compose-m3 = { group = "com.patrykandpatrick.vico", name = "compose-m3", version.ref = "chart" }
firebase-bom = { group = "com.google.firebase", name = "firebase-bom", version.ref = "firebaseBom" }
firebase-crashlytics = { group = "com.google.firebase", name = "firebase-crashlytics-ktx" }
junit4 = { group = "junit", name = "junit", version.ref = "junit4" }
koin-android = { group = "io.insert-koin", name = "koin-android", version.ref = "koinAndroid" }
koin-compose = { group = "io.insert-koin", name = "koin-androidx-compose", version.ref = "koinCompose" }
Expand All @@ -71,7 +76,9 @@ room-compiler = { group = "androidx.room", name = "room-compiler", version.ref =
room-ktx = { group = "androidx.room", name = "room-ktx", version.ref = "room" }
room-runtime = { group = "androidx.room", name = "room-runtime", version.ref = "room" }

# Dependencies of the included build-logic
android-gradlePlugin = { group = "com.android.tools.build", name = "gradle", version.ref = "androidGradlePlugin" }
firebase-crashlytics-gradlePlugin = { group = "com.google.firebase", name = "firebase-crashlytics-gradle", version.ref = "firebaseCrashlyticsPlugin" }
kotlin-gradlePlugin = { group = "org.jetbrains.kotlin", name = "kotlin-gradle-plugin", version.ref = "kotlin" }
ksp-gradlePlugin = { group = "com.google.devtools.ksp", name = "com.google.devtools.ksp.gradle.plugin", version.ref = "ksp" }
junit = { group = "androidx.test.ext", name = "junit", version.ref = "junit" }
Expand All @@ -81,16 +88,18 @@ espresso-core = { group = "androidx.test.espresso", name = "espresso-core", vers
android-application = { id = "com.android.application", version.ref = "androidGradlePlugin" }
android-library = { id = "com.android.library", version.ref = "androidGradlePlugin" }
android-test = { id = "com.android.test", version.ref = "androidGradlePlugin" }
firebase-crashlytics = { id = "com.google.firebase.crashlytics", version.ref = "firebaseCrashlyticsPlugin" }
gms = { id = "com.google.gms.google-services", version.ref = "gmsPlugin" }
kotlin-jvm = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" }
kotlin-serialization = { id = "org.jetbrains.kotlin.plugin.serialization", version.ref = "kotlin" }
ksp = { id = "com.google.devtools.ksp", version.ref = "ksp" }
org-jetbrains-kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "org-jetbrains-kotlin-android" }
protobuf = { id = "com.google.protobuf", version.ref = "protobufPlugin" }
secrets = { id = "com.google.android.libraries.mapsplatform.secrets-gradle-plugin", version.ref = "secrets" }

# Plugins defined by this project
weightcontrol-android-application = { id = "weightcontrol.android.application", version = "unspecified" }
weightcontrol-android-application-compose = { id = "weightcontrol.android.application.compose", version = "unspecified" }
weightcontrol-android-application-firebase = { id = "weightcontrol.android.application.firebase", version = "unspecified" }
weightcontrol-android-feature = { id = "weightcontrol.android.feature", version = "unspecified" }
weightcontrol-android-library = { id = "weightcontrol.android.library", version = "unspecified" }
weightcontrol-android-library-compose = { id = "weightcontrol.android.library.compose", version = "unspecified" }
Expand Down

0 comments on commit 5ba3ea9

Please sign in to comment.