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

wasm_bindgen: allow target name with directory #2758

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

matt-duch
Copy link
Contributor

@matt-duch matt-duch commented Jul 22, 2024

Looking at the current logic for setting --out-dir and --out-name, it seems that the intention is to infer those from the target name. However, if a prefix is specified for the name (pkg/custom), out-dir is set as expected (pkg), but that directory prefix is also set in out-name (pkg/custom). causing the build command to fail when it appends the two and ends up with pkg/pkg/custom).

This approach sets out-name to be the last path segment only.

@matt-duch
Copy link
Contributor Author

I ended up needing to add the snippets directory, similar to #1343 (except that PR changes paths to include the name twice, not sure why). Adding the snippets is actually related to this change, so I could fold that in if that is of interest as well.

@matt-duch matt-duch force-pushed the wasm_bindgen-directory-prefix-fix branch from 52e9b60 to ec0f0f9 Compare July 24, 2024 13:55
Copy link
Collaborator

@illicitonion illicitonion left a comment

Choose a reason for hiding this comment

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

This generally LGTM, but two questions:

  1. Can you do a string replacement of / -> _ rather than taking the basename, as it's more documenting and less likely to lead to conflicts?
  2. Can you add a test (i.e. a target which didn't build without this change, and does with)?

Thanks!

@matt-duch matt-duch force-pushed the wasm_bindgen-directory-prefix-fix branch from ec0f0f9 to 5e6e2a7 Compare November 13, 2024 16:15
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