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

Add command sentry-cli debug-files bundle-jvm for bundling Java (and other JVM based languages) sources #1551

Merged
merged 32 commits into from
Apr 14, 2023

Conversation

adinauer
Copy link
Member

Takes a path of source files which is bundled up.

Required for fixing: getsentry/sentry-java#633

@adinauer adinauer marked this pull request as ready for review April 6, 2023 09:59
@adinauer adinauer changed the title Add command sentry-cli difutil create-source-bundle for bundling Java sources Add command sentry-cli debug-files create-jvm-based-bundle for bundling Java (and other JVM based languages) sources Apr 6, 2023
@adinauer
Copy link
Member Author

adinauer commented Apr 6, 2023

I assume changelog is written during release process. If not I can add something do it.

@adinauer
Copy link
Member Author

adinauer commented Apr 6, 2023

Not quite sure how to deal with output assertions on windows. Do we duplicate the tests and make them only run on certain environments? - added windows tests

Copy link
Contributor

@loewenheim loewenheim left a comment

Choose a reason for hiding this comment

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

This looks good, most of my suggestions are just stylistic. I'm not sure myself if we should have short options for debug-id and output; at least for output I don't think there's an obvious choice, given that o is not available.

src/commands/debug_files/create_jvm_based_bundle.rs Outdated Show resolved Hide resolved
src/commands/debug_files/create_jvm_based_bundle.rs Outdated Show resolved Hide resolved
src/commands/debug_files/create_jvm_based_bundle.rs Outdated Show resolved Hide resolved
src/commands/debug_files/create_jvm_based_bundle.rs Outdated Show resolved Hide resolved
src/commands/debug_files/create_jvm_based_bundle.rs Outdated Show resolved Hide resolved
src/utils/file_upload.rs Outdated Show resolved Hide resolved
tests/integration/debug_files/create_jvm_based_bundle.rs Outdated Show resolved Hide resolved
@adinauer
Copy link
Member Author

adinauer commented Apr 7, 2023

@loewenheim I could if there was a way to unify
caused by: Not a directory (os error 20) and caused by: The system cannot find the path specified. (os error 3)

The other test looks like I should be able to unify now that there's no more error message that differs. Will update. Any idea how to unify the one above?

@loewenheim
Copy link
Contributor

Ah, that's unfortunate :/ In that case I would just leave them separate.

let project = config.get_project(matches).ok();
let api = Api::current();
let chunk_upload_options = api.get_chunk_upload_options(&org)?;
let context = &UploadContext {
Copy link
Contributor

Choose a reason for hiding this comment

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

@loewenheim something that we should refactor soon (whole UploadContext should have a constructor or a Default implementation, or a builder.

@kamilogorek
Copy link
Contributor

You can write caused by: [..] in snapshot to match any characters in a given line. We dont really care about that detail here.

@@ -149,6 +149,7 @@ fn find_ids(
DifType::SourceBundle => find_ids_for_sourcebundle(&dirent, &remaining),
DifType::Breakpad => find_ids_for_breakpad(&dirent, &remaining),
DifType::Proguard => find_ids_for_proguard(&dirent, &proguard_uuids),
DifType::JvmBased => find_ids_for_sourcebundle(&dirent, &remaining),
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not sure about the whole jvmbased naming. We dont use PdbBased, ElfBased, ProguardBasd etc. Might use JvmBundle or just Jvm instead? wdyt @Swatinem

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah I guess there's little risk in people actually thinking they need to upload a JVM. Can rename it here and in other PRs as this was suggested before. Happy to rename and make it easier to use.

Copy link
Member

Choose a reason for hiding this comment

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

Well, naming is only one of the hardest things in software… :-D I’m okay with the naming. It clearly states that we have are dealing with any of the myriad of languages that compile to java bytecode and run on the jvm.

@adinauer adinauer changed the title Add command sentry-cli debug-files create-jvm-based-bundle for bundling Java (and other JVM based languages) sources Add command sentry-cli debug-files bundle-jvm for bundling Java (and other JVM based languages) sources Apr 11, 2023
@adinauer
Copy link
Member Author

I've updated the PR according to feedback. Can you please give it anohter pass to make sure it's as you expected 🙏

@kamilogorek
Copy link
Contributor

lgtm! well done :)

Copy link
Member

@Swatinem Swatinem left a comment

Choose a reason for hiding this comment

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

lgtm, though I would rather not make this a new DifType, and also not add it as an explicit filetype for the upload command. It is a normal SourceBundle after all.

@@ -21,6 +21,7 @@ pub enum DifType {
Pdb,
PortablePdb,
Wasm,
Jvm,
Copy link
Member

Choose a reason for hiding this comment

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

Do we really want this here? The file we create is just a SourceBundle, and no debug file on its own exists for JVM.

Copy link
Member Author

Choose a reason for hiding this comment

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

In an internal discussion we didn't decide whether we actually need the new type but it was suggested to err on the side of defining a new one. Do you want me to reopen that conversation internally? Handling of jvm bundles is different from others in that files are renamed while bundling and lookup constructs the file path from module and abs_path if available.

Copy link
Member

Choose a reason for hiding this comment

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

I guess it doesn’t hurt either :-)

Copy link
Member

@antonpirker antonpirker left a comment

Choose a reason for hiding this comment

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

@adinauer walked me through the changes and it seems that there are no obvious problems, so lgtm

@Swatinem Swatinem merged commit dc499b1 into master Apr 14, 2023
16 checks passed
@Swatinem Swatinem deleted the feat/java-source-bundling branch April 14, 2023 11:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants