-
Notifications
You must be signed in to change notification settings - Fork 38
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
Manually calculate location of objdump in gradle plugin #136
Conversation
Updates the NDK fixture project to use bugsnag-android-ndk v4+, and to build all the default supported abis, rather than just armeabi-v7a and x86. The scenarios have also been updated to check that the correct architecture is set.
Verifies that the calculated location of objdump follows a given pattern when the ABI, os name, and NDK directory differ.
Calculates the location of objdump manually. The location of the file depends on 3 factors: the ABI of the shared object file being processed, the operating system, and the installation location of the NDK bundle.
If the objdump location changes in future versions of the AGP, it would be helpful to override the objdump location on a per-ABI basis - which this property provides. A mazerunner scenario has been added to verify the behaviour.
return "windows-x86_64" | ||
} | ||
} else { | ||
return "unknown" |
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.
is there something better we can do here? such as raising an exception or logging a warning? Tell people to use the objdumpPaths
option? I think once you reach this branch and it builds a string that we know won't work, the error message will be confusing or missing enough detail to work out what went wrong
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 is a good suggestion - I've updated the function to return null if the osName can't be calculated. I've then added a null check for ABI + osName, which throws an exception that will ultimately be caught and logged to warn that objdump couldn't be found.
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.
Reviewed with @Pezzah.
…ather than creating a non-exist
Goal
The bugsnag gradle plugin relies on objdump to upload shared object mapping files, which deobfuscate stacktraces in NDK projects. The plugin relies on the
NdkHandler
andToolchain
classes to calculate the location of objdump on disk. These classes are internal APIs within the Android Gradle Plugin (AGP), and have been removed in v3.4.0-alpha.The bugsnag gradle plugin will throw an Error when attempting to load these classes, which will break the build for any NDK project depending on our plugin and AGP 3.4.0. This changeset alters the plugin to perform the calculation manually, and removes the dependency on these classes.
N.B. a design doc is available which covers the goal in more detail
Changeset
Toolchain
,NdkHandler
, andAbi
classes which were internal to the AGP.Abi
classes which contains pre-calculated information on the names of ABIs, and the expected location of objdump.objdumpPaths
property to the bugsnag plugin extension which allows users to override the calculation location on a per-ABI basisTests
objdumpPaths
property overrides the calculated objdump location.support.
Discussion
Linked issues
Fixes #134