Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 426c93ce authored by Vincent Bourgmayer's avatar Vincent Bourgmayer
Browse files

setup sentry for eDrive

parent 57149b1f
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
image: "registry.gitlab.e.foundation/e/os/docker-android-apps-cicd:latest"

variables:
  SENTRY_DSN: "${SENTRY_DSN}"

stages:
  - test
  - build
+18 −7
Original line number Diff line number Diff line
@@ -7,8 +7,6 @@ def versionMajor = 1
def versionMinor = 3
def versionPatch = 2



def getTestProp(String propName) {
    def result = ""
    if (project.hasProperty(propName)) {
@@ -21,6 +19,20 @@ def getTestProp(String propName) {
    return result
}

def getSentryDsn = { ->

    def sentryDsnEnv = System.getenv("SENTRY_DSN")
    if (sentryDsnEnv != null) {
        return sentryDsnEnv
    }

    Properties properties = new Properties()
    def propertiesFile = project.rootProject.file('local.properties')
    if (propertiesFile.exists()) {
        properties.load(propertiesFile.newDataInputStream())
    }
    return properties.getProperty('SENTRY_DSN')
}

android {
    compileSdk 31
@@ -47,14 +59,15 @@ android {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            buildConfigField("String", "SENTRY_DSN", "\"${getSentryDsn()}\"")
        }

        debug {
            signingConfig signingConfigs.debugConfig
            buildConfigField("String", "SENTRY_DSN", "\"dummy\"")
        }
    }


    testOptions {
        unitTests {
            returnDefaultValues = true
@@ -73,10 +86,8 @@ android {
        sourceCompatibility JavaVersion.VERSION_11
        targetCompatibility JavaVersion.VERSION_11
    }

}


dependencies {
    implementation 'com.github.nextcloud:android-library:2.13.0'
    implementation "commons-httpclient:commons-httpclient:3.1@jar"
@@ -93,6 +104,7 @@ dependencies {
    implementation 'androidx.test:core:1.4.0'
    implementation 'com.jakewharton.timber:timber:5.0.1'
    implementation 'foundation.e:elib:0.0.1-alpha11'
    implementation 'foundation.e.lib:telemetry:0.0.4-alpha'

    androidTestImplementation 'androidx.test:runner:1.4.0'
    androidTestImplementation 'androidx.test:rules:1.4.0'
@@ -106,6 +118,5 @@ dependencies {
    testImplementation 'junit:junit:4.13.2'
    testImplementation 'org.robolectric:robolectric:4.4'
    testImplementation 'org.mockito:mockito-core:3.4.0'
    //testImplementation 'org.mockito:mockito-inline:3.4.0'
    testImplementation 'androidx.work:work-testing:2.7.1'
}
 No newline at end of file
+2 −1
Original line number Diff line number Diff line
@@ -23,6 +23,7 @@ import foundation.e.drive.services.SynchronizationService;
import foundation.e.drive.utils.AppConstants;
import foundation.e.drive.utils.CommonUtils;
import foundation.e.drive.utils.ReleaseTree;
import foundation.e.lib.telemetry.Telemetry;
import timber.log.Timber;
import static timber.log.Timber.DebugTree;

@@ -43,7 +44,7 @@ public class EdriveApplication extends Application {
        if (BuildConfig.DEBUG) {
            Timber.plant(new DebugTree());
        } else {
            //Not handled yet
            Telemetry.INSTANCE.init(BuildConfig.SENTRY_DSN, this);
            Timber.plant(new ReleaseTree());
        }
        Timber.tag("EdriveApplication");
+6 −0
Original line number Diff line number Diff line
@@ -12,6 +12,7 @@ import android.util.Log;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;

import foundation.e.lib.telemetry.Telemetry;
import timber.log.Timber;

/**
@@ -29,6 +30,11 @@ public class ReleaseTree extends Timber.DebugTree{
        if (!debugEnable && priority < Log.INFO ) {
            return;
        }

        if (priority >= Log.WARN) {
            Telemetry.INSTANCE.reportMessage(tag + " " + message);
        }

        super.log(priority, tag, message, throwable);
    }
}