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

Allow manually specifying android mapping-uuid #80

Conversation

mateuszkwiecinski
Copy link

@mateuszkwiecinski mateuszkwiecinski commented Mar 26, 2021

#79

I gave it a try and tried adding uuid support to the plugin. I basically allow passing almost all sentry-cli parameters, leaving the validation up to sentry-cli.

Please note I'm not familiar with Ruby so I havily relied on other parts of the codebase + code hints and Rubocop offenses that were highlithed. I also didn't know how to write proper tests, I only found ones relying on mocks so I don't actually know if the feature works now.

@mateuszkwiecinski mateuszkwiecinski changed the title Allow manually specifying mapping-uuid Allow manually specifying android mapping-uuid Mar 26, 2021
@mateuszkwiecinski mateuszkwiecinski force-pushed the add_proguard_mapping_uuid branch 2 times, most recently from ed50c2b to cc6a7b6 Compare March 27, 2021 09:01
@mateuszkwiecinski mateuszkwiecinski marked this pull request as ready for review March 27, 2021 09:03
@mateuszkwiecinski mateuszkwiecinski marked this pull request as draft March 27, 2021 09:04
# Verify files
UI.user_error!("Mapping file does not exist at path: #{mapping_path}") unless File.exist? mapping_path
UI.user_error!("AndroidManifest.xml file does not exist at path: #{android_manifest_path}") unless File.exist? android_manifest_path
Copy link
Author

Choose a reason for hiding this comment

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

AFAIU This validation was never invoked, as the framework checks its valie using ConfigItem's verify_block block

@@ -9,17 +9,24 @@ def self.run(params)
mapping_path = params[:mapping_path]
android_manifest_path = params[:android_manifest_path]

has_manifest = !android_manifest_path.nil? && File.file?(android_manifest_path.to_s)
Copy link
Author

Choose a reason for hiding this comment

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

I'm using File.file? as I understood we don't support passing a directory

@mateuszkwiecinski mateuszkwiecinski marked this pull request as ready for review March 27, 2021 09:07
@github-actions
Copy link
Contributor

This pull request has gone three weeks without activity. In another week, I will close it.

But! If you comment or otherwise update it, I will reset the clock, and if you label it Status: Backlog or Status: In Progress, I will leave it alone ... forever!


"A weed is but an unloved flower." ― Ella Wheeler Wilcox 🥀

@mateuszkwiecinski
Copy link
Author

Wow! You've ignored this PR for more than a year, and now you're sending an automated bot to close it with a dummy quote that doesn't explain anything except "hey, this PR will be closed". That's... not nice


"Sometimes when I close my eyes, I can’t see." ― _ Anonymous_ 🥀

@philipphofmann
Copy link
Member

Hey @mateuszkwiecinski,

Thanks for opening up this PR a year ago. We added a stale bot not to close issues but to remind us when a PR is stale. We did this to stop ignoring PRs. The bot explains this:

This pull request has gone three weeks without activity. In another week, I will close it.

I apologize for not reviewing it. If you still are motivated to finish this PR, please reopen it, ping me, and you will get a review.

@posativ
Copy link

posativ commented Nov 9, 2022

The PR has a lot of code, if you just want to upload a mapping with a pre-generated UUID already present in AndroidManifest.xml using <meta-data android:name="io.sentry.proguard-uuid" android:value="A_VALID_UUID" /> you can use the following private lane:

#!/usr/bin/env ruby

require "rexml/document"

# […]

KEY_FLAVOR = "FLAVOR"

KEY_SENTRY_ORG_SLUG = "SENTRY_ORG_SLUG"
KEY_SENTRY_PROJECT_SLUG = "SENTRY_PROJECT_SLUG"

# […]

platform :android do

  # […]

  # Retrieve UUID and upload mapping.txt to Sentry: https://docs.sentry.io/product/cli/dif/
  private_lane :upload_mapping do
    Dir.chdir("..") do
      flavor = ENV[KEY_FLAVOR]  # or lane_context[SharedValues::ENVIRONMENT] or just "live" etc.
      xml = REXML::Document.new(File.new("app/build/intermediates/merged_manifest/#{flavor}Release/AndroidManifest.xml"))
      uuid = REXML::XPath.first(xml, '//manifest/application/meta-data[@android:name="io.sentry.proguard-uuid"]/@android:value').value

      command = ["sentry-cli"]
      command << "upload-proguard"
      command << "app/build/outputs/mapping/#{flavor}Release/mapping.txt"
      command << "--uuid" << uuid
      command << "--org" << ENV[KEY_SENTRY_ORG_SLUG]
      command << "--project" << ENV[KEY_SENTRY_PROJECT_SLUG]
      sh command
    end
  end

along with some environment variables

FLAVOR = live

SENTRY_ORG_SLUG = your-org
SENTRY_PROJECT_SLUG = your-project

@philipphofmann
Copy link
Member

Thanks for sharing the workaround @posativ 😊

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants