Fix sentry implementation.

pull/213/head
Fox2Code 2 years ago
parent 5f44892c46
commit 8b121e9eb3

2
.gitignore vendored

@ -1,6 +1,5 @@
*.iml
.gradle
/sentry.properties
/local.properties
/.idea/
.DS_Store
@ -9,3 +8,4 @@
.externalNativeBuild
.cxx
local.properties
sentry.properties

@ -93,7 +93,7 @@ sentry {
// If disabled the plugin will run a dry-run and just generate a UUID.
// The mapping file has to be uploaded manually via sentry-cli in this case.
// Default is enabled.
autoUploadProguardMapping = true
autoUploadProguardMapping = hasSentryConfig
// Experimental flag to turn on support for GuardSquare's tools integration (Dexguard and External Proguard).
// If enabled, the plugin will try to consume and upload the mapping file produced by Dexguard and External Proguard.
@ -104,7 +104,7 @@ sentry {
// for Sentry. This executes sentry-cli automatically so
// you don't need to do it manually.
// Default is disabled.
uploadNativeSymbols = true
uploadNativeSymbols = hasSentryConfig
// Does or doesn't include the source code of native code for Sentry.
// This executes sentry-cli with the --include-sources param. automatically so
@ -116,7 +116,7 @@ sentry {
// Does auto instrumentation for specified features through bytecode manipulation.
// Default is enabled.
tracingInstrumentation {
enabled = true
enabled = false
}
// Enable auto-installation of Sentry components (sentry-android SDK and okhttp, timber and fragment integrations).
@ -188,3 +188,16 @@ dependencies {
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
}
if (hasSentryConfig) {
Properties properties = new Properties();
try (FileInputStream fis = new FileInputStream(sentryConfigFile)) {
properties.load(fis)
}
tasks.withType(Exec) {
environment "SENTRY_PROJECT", properties.getProperty("defaults.project")
environment "SENTRY_ORG", properties.getProperty("defaults.org")
environment "SENTRY_URL", properties.getProperty("defaults.url")
environment "SENTRY_AUTH_TOKEN", properties.getProperty("auth.token")
}
}

@ -20,9 +20,9 @@ public class SentryBreadcrumb {
breadcrumb.setType(type);
}
public void setData(@NotNull String key, @NotNull Object value) {
public void setData(@NotNull String key, @Nullable Object value) {
if (value == null) value = "null";
Objects.requireNonNull(key);
Objects.requireNonNull(value);
breadcrumb.setData(key, value);
}

@ -10,9 +10,8 @@ public class SentryBreadcrumb {
public void setType(@Nullable String type) {}
public void setData(@NotNull String key, @NotNull Object value) {
public void setData(@NotNull String key, @Nullable Object value) {
Objects.requireNonNull(key);
Objects.requireNonNull(value);
}
public void setCategory(@Nullable String category) {}

@ -36,6 +36,7 @@ import java.util.List;
import java.util.Objects;
import java.util.concurrent.TimeUnit;
import io.sentry.android.okhttp.SentryOkHttpInterceptor;
import okhttp3.Cache;
import okhttp3.Cookie;
import okhttp3.CookieJar;

@ -6,7 +6,8 @@ buildscript {
gradlePluginPortal()
}
project.ext.latestAboutLibsRelease = "10.5.0"
project.ext.hasSentryConfig = false
project.ext.sentryConfigFile = new File(rootDir, "sentry.properties").getAbsoluteFile()
project.ext.hasSentryConfig = sentryConfigFile.exists()
dependencies {
classpath 'com.android.tools.build:gradle:7.3.0'
classpath "com.mikepenz.aboutlibraries.plugin:aboutlibraries-plugin:${latestAboutLibsRelease}"

Loading…
Cancel
Save