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

fix: fix a bug where '.' strip prefixes were not extracted correctly #30

Closed
wants to merge 1 commit into from

Conversation

kormide
Copy link
Collaborator

@kormide kormide commented Nov 14, 2022

This addresses the case where people use pkg_tar to produce their release archive, which creates a . prefix by default: bazelbuild/rules_pkg#50

@@ -53,13 +53,22 @@ export class ReleaseArchive {
const stripComponents = this.stripPrefix
? this.stripPrefix.split("/").length
: 0;

let modulePath = path.join(this.stripPrefix, "MODULE.bazel");
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: seems like this assignment should be in an else case so modulePath could be const?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

For modulePath to be const I think have to use a condition ? a : b clause since const variables can't be undefined. But yeah I agree an if else block would be cleaner. Will fix.

@kormide
Copy link
Collaborator Author

kormide commented Nov 14, 2022

I'm having second thoughts on this solution. It's an issue with rules_java but that ruleset can already be consumed by Bazel without setting a strip_prefix of ".". If that's the case, then I don't think we should ask people to add that prefix and have it committed in the BCR entry.

I think the better approach would just be to silently handle this case and make it equivalent to having an empty strip prefix.

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.

2 participants