Skip to content
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

Set Java/Android SDK options #1694

Merged
merged 10 commits into from
Jun 9, 2022
Merged

Set Java/Android SDK options #1694

merged 10 commits into from
Jun 9, 2022

Conversation

mattjohnsonpint
Copy link
Contributor

@mattjohnsonpint mattjohnsonpint commented Jun 7, 2022

This sets most of the Java/Android SDK options when using the net6.0-android target from the .NET SDK.

  • Many options are shared between both SDKs, and are simply copied across.
  • A few Java SDK options are hard-coded because they don't make sense any other way in this context.
  • Several options available on the Java SentryOptions and SentryAndroidOptions are not available on ours at all, so I have exposed them on SentryOptions.Android and mirrored the defaults.
  • Some to/from mapping functions are added where needed. Some map directly, others go through JSON serialization.
  • I also refactored quite a bit, and fixed several TODOs (and added a few more)

This is also relevant for MAUI.

Note, #1692 and #1693 need to be in place before this works.
Also, we currently have no way to write unit tests for this code, but it's all been run manually several times on my box.

Copy link
Member

@bruno-garcia bruno-garcia left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking great

src/Sentry/Android/JavaExtensions.cs Outdated Show resolved Hide resolved
src/Sentry/Android/SentryOptions.cs Show resolved Hide resolved
src/Sentry/Android/SentrySdk.cs Show resolved Hide resolved
src/Sentry/Android/SentrySdk.cs Show resolved Hide resolved
@mattjohnsonpint mattjohnsonpint marked this pull request as draft June 8, 2022 16:49
@mattjohnsonpint
Copy link
Contributor Author

I had to revert the last commit. I was attempting to map Java enums to C# enums using the recommended approach documented here. The library compiled fine, but generated the wrong method signature in the Android Callable Wrapper, so failed when building one of the sample apps. I hunted for a workaround but found none.

I need to raise this as an upstream issue to Microsoft, but in the meantime we can just keep things as they were.

@mattjohnsonpint mattjohnsonpint marked this pull request as ready for review June 9, 2022 04:00
@mattjohnsonpint
Copy link
Contributor Author

FYI - the enum issue is reported here: dotnet/java-interop#991

@mattjohnsonpint mattjohnsonpint merged commit d39477c into main Jun 9, 2022
@mattjohnsonpint mattjohnsonpint deleted the android-options branch June 9, 2022 16:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants