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

macOS platform hack does not pick up workspace cargo configuration #235

Closed
evnu opened this issue Sep 12, 2019 · 8 comments · Fixed by #439
Closed

macOS platform hack does not pick up workspace cargo configuration #235

evnu opened this issue Sep 12, 2019 · 8 comments · Fixed by #439

Comments

@evnu
Copy link
Member

evnu commented Sep 12, 2019

The platform hack for macOS does not consider a cargo configuration within a workspace, but only the configuration local to a crate. This results in unnecessary warnings when the correct arguments are already provided within the workspace-wide configuration.

@evnu
Copy link
Member Author

evnu commented Sep 12, 2019

To fix this, the check should be extended by also checking the workspace root for a configuration. The workspace root can be extracted from cargo metadata, but that command returns JSON.

@scrogson
Copy link
Member

@evnu would you be able to create a repo with this setup so I can tinker with a fix?

@evnu
Copy link
Member Author

evnu commented Sep 12, 2019

This should reproduce the problem: https://github.com/evnu/NifIo/tree/macos-platform-hack

git clone https://github.com/evnu/NifIo.git
git checkout macos-platform-hack
mix deps.get
mix compile

I added a Cargo.toml to the projects root directory with a single workspace member, and a dummy .cargo/config as well.

~/tools/NifIo(macos-platform-hack ✗) cargo metadata --format-version 1 | jq ".workspace_root"
"/home/mo/tools/NifIo"
~/tools/NifIo(macos-platform-hack ✗) cd native/io 
~/tools/NifIo/native/io(macos-platform-hack ✗) cargo metadata --format-version 1 | jq ".workspace_root"
"/home/mo/tools/NifIo"

@evnu
Copy link
Member Author

evnu commented Nov 14, 2019

@scrogson Any update here?

@scrogson
Copy link
Member

I haven't spent any time thinking about this. Do we want to pull in a JSON library to remove a warning? I think the answer is no.

Given that you have more experience with this setup, what do you think?

@scrogson
Copy link
Member

I guess we could just check the root first and then fallback to the crate_path: https://github.com/rusterlium/rustler/blob/master/rustler_mix/lib/mix/tasks/compile.rustler.ex#L120

@evnu
Copy link
Member Author

evnu commented Nov 14, 2019

I also don't think that we should use a json library just for this. To get the workspace root, we might don't need to parse json, a regex could suffice. I can give that a try.

@evnu
Copy link
Member Author

evnu commented Sep 8, 2021

See #381, we might need to parse the JSON produced by cargo metadata there. If so, maybe we can pick up this issue here again to find the proper configuration for a crate.

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