-
-
Notifications
You must be signed in to change notification settings - Fork 452
Read build tool info from sentry-debug-meta.properties
and attach it to events
#4314
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
package io.sentry.util; | ||
|
||
import io.sentry.SentryIntegrationPackageStorage; | ||
import io.sentry.SentryLevel; | ||
import io.sentry.SentryOptions; | ||
import java.util.List; | ||
|
@@ -11,6 +12,14 @@ public final class DebugMetaPropertiesApplier { | |
|
||
public static @NotNull String DEBUG_META_PROPERTIES_FILENAME = "sentry-debug-meta.properties"; | ||
|
||
public static void apply( | ||
final @NotNull SentryOptions options, final @Nullable List<Properties> debugMetaProperties) { | ||
if (debugMetaProperties != null) { | ||
applyToOptions(options, debugMetaProperties); | ||
applyBuildTool(options, debugMetaProperties); | ||
} | ||
} | ||
|
||
public static void applyToOptions( | ||
final @NotNull SentryOptions options, final @Nullable List<Properties> debugMetaProperties) { | ||
if (debugMetaProperties != null) { | ||
|
@@ -49,7 +58,35 @@ private static void applyProguardUuid( | |
} | ||
} | ||
|
||
private static void applyBuildTool( | ||
final @NotNull SentryOptions options, @NotNull List<Properties> debugMetaProperties) { | ||
for (Properties properties : debugMetaProperties) { | ||
final @Nullable String buildTool = getBuildTool(properties); | ||
if (buildTool != null) { | ||
@Nullable String buildToolVersion = getBuildToolVersion(properties); | ||
if (buildToolVersion == null) { | ||
buildToolVersion = "unknown"; | ||
} | ||
options | ||
.getLogger() | ||
.log( | ||
SentryLevel.DEBUG, "Build tool found: %s, version %s", buildTool, buildToolVersion); | ||
SentryIntegrationPackageStorage.getInstance().addPackage(buildTool, buildToolVersion); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't like that we're abusing the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. After gaining some wisdom I feel that using a non-standard special field like this is a bad idea. Any suggestions? |
||
break; | ||
} | ||
} | ||
} | ||
|
||
public static @Nullable String getProguardUuid(final @NotNull Properties debugMetaProperties) { | ||
return debugMetaProperties.getProperty("io.sentry.ProguardUuids"); | ||
} | ||
|
||
public static @Nullable String getBuildTool(final @NotNull Properties debugMetaProperties) { | ||
return debugMetaProperties.getProperty("io.sentry.build-tool"); | ||
} | ||
|
||
public static @Nullable String getBuildToolVersion( | ||
final @NotNull Properties debugMetaProperties) { | ||
return debugMetaProperties.getProperty("io.sentry.build-tool-version"); | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This class and method are public and not marked as internal so I've created a new method to implement the new behavior