DataDog / datadog-ci

Use Datadog from your CI.
https://datadoghq.com
Apache License 2.0
127 stars 54 forks source link

Add a command to upload Android mapping.txt #1477

Open brunck opened 4 days ago

brunck commented 4 days ago

Feature request description

There is a Gradle task to upload the Android symbols (mapping.txt) to Datadog. Not all Android apps use Gradle to build, however, such as .NET for Android. Decoupling the upload of symbol files from Gradle and providing that here for use in the CLI makes it easy to distribute them via automated builds.

It would be helpful to have a command to upload Android symbols as the Gradle task does. It wouldn't need to generate the file(s), just send them to the server.

Solution

A command to upload Android symbols, more or less like the commands that upload symbols now.

Additional context

No response

Command

None

xgouchet commented 15 hours ago

Hi @brunck , thanks a lot for bringing our attention to this, we added this suggestion to our backlog.

As of now, we do not offer an official support to mobile apps built with Xamarin/Maui (which I guess is the framework you use since you mentioned .Net), so I can't confirm when we will get to write though.

Also note that the Gradle plugin not only uploads the mapping files, but also embeds a unique Build identifier to match the mapping file with a specific build. Performing the upload outside of that workflow might lead to errors matching an error at runtime with the relevant mapping file.

fuzzybinary commented 8 hours ago

Hi @brunck ,

There is a possible work around for you by utilizing the flutter-symbols upload command (docs). The command is tailored to find all of the files in locations Flutter puts them but it allows you to override almost all of them.

So the following command might work:

datadog-ci flutter-symbols upload --service-name [your-service] --flavor [your-flavor] --version [your-version] --android-mapping --android-mapping-location [location-of-mapping.txt]

Because this command can't determine anything about your application automatically, you'll need to make sure the service, flavor, and version exactly match what you're sending to Datadog in your events, otherwise we won't be able to locate the mapping file you've uploaded.

brunck commented 5 hours ago

@xgouchet .NET MAUI is the cross-platform mobile library/framework, and it sits on top of .NET for Android and .NET for iOS, as 2 examples. It can also work with other platforms in addition to this.

Any native functionality is "down a level" from any cross-platform concerns. That native functionality isn't .NET MAUI, per se. In other words, you can have a native Android application that uses .NET for Android and does not use any .NET MAUI (or only uses some, but that's a different story). In other words, this context is platform-specific to .NET for Android which may or may not involve cross-platform concerns. Another way to look at it is a .NET for Android app is an Android app.

@fuzzybinary this is great news. On the surface it does sound like this might work.

In light of the lack of official support here, are community contributions accepted? It seems that if the flutter-symbols command workaround is successful, this could be adapted to add a command that provides somewhat less friction, perhaps focused only on the uploading of mapping.txt (and anything closely related, such as shrinking it) piece.