Skip to content

Commit

Permalink
chore: Add support for Sentry proguard (#262)
Browse files Browse the repository at this point in the history
  • Loading branch information
LouisCAD authored Dec 17, 2024
2 parents 011ed7c + 315406d commit 17c27b3
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 9 deletions.
5 changes: 5 additions & 0 deletions .github/workflows/android.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,11 @@ jobs:
token: ${{ github.token }}
submodules: recursive

- name: Create test env.properties
run: |
touch env.properties
echo "sentryAuthToken=DummyToken" > env.properties
# Setup Gradle and Run tests
- name: Grant execute permission for gradlew
run: chmod +x gradlew
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@ build/
local.properties
*.apk
*.aab
env.properties
20 changes: 12 additions & 8 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import org.jetbrains.kotlin.konan.properties.loadProperties

plugins {
alias(libs.plugins.android.application)
alias(libs.plugins.kotlin.android)
Expand All @@ -13,6 +15,10 @@ val sharedCompileSdk: Int by rootProject.extra
val sharedMinSdk: Int by rootProject.extra
val sharedJavaVersion: JavaVersion by rootProject.extra

val envProperties = loadProperties("env.properties")
val sentryAuthToken = envProperties.getProperty("sentryAuthToken").takeIf { it.isNotEmpty() }
?: error("The property must be defined and not empty")

android {
namespace = "com.infomaniak.swisstransfer"
compileSdk = sharedCompileSdk
Expand Down Expand Up @@ -79,15 +85,13 @@ kapt {
}

sentry {
// Enables or disables the automatic upload of mapping files during a build.
// If you disable this, you'll need to manually upload the mapping files with sentry-cli when you do a release.
// Default is enabled.
autoUploadProguardMapping = true

// Does or doesn't include the source code of native code for Sentry.
// This executes sentry-cli with the --include-sources param. automatically so you don't need to do it manually.
// Default is disabled.
org = "sentry"
projectName = "swisstransfer-android"
authToken = sentryAuthToken
url = "https://sentry-mobile.infomaniak.com"
uploadNativeSymbols = true
includeNativeSources = true
includeSourceContext = true
}

dependencies {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ import androidx.compose.foundation.layout.Column
import androidx.compose.material3.HorizontalDivider
import androidx.compose.material3.adaptive.WindowAdaptiveInfo
import androidx.compose.material3.adaptive.navigationsuite.NavigationSuiteType
import androidx.compose.runtime.*
import androidx.compose.runtime.Composable
import androidx.compose.runtime.remember
import androidx.compose.ui.Modifier
import androidx.navigation.NavController
import androidx.navigation.NavGraph.Companion.findStartDestination
Expand Down
21 changes: 21 additions & 0 deletions env.example.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#
# Infomaniak SwissTransfer - Android
# Copyright (C) 2024 Infomaniak Network SA
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
#
# This is a sample file, create your own, named `env.properties`.
# You can create your token here: https://sentry-mobile.infomaniak.com/settings/sentry/auth-tokens
sentryAuthToken=YOUR_SENTRY_AUTH_TOKEN_HERE

0 comments on commit 17c27b3

Please sign in to comment.