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

cargo alias doesn't work on cross #562

Open
XyLyXyRR opened this issue Jun 2, 2021 · 2 comments · May be fixed by #931
Open

cargo alias doesn't work on cross #562

XyLyXyRR opened this issue Jun 2, 2021 · 2 comments · May be fixed by #931

Comments

@XyLyXyRR
Copy link

XyLyXyRR commented Jun 2, 2021

Environment

  • Rust toolchain version: rustc 1.52.1 (9bc8c42bb 2021-05-09)
  • IDE name and version: intellij-idea-community-edition 4:2021.1.1-1
  • Operating system: arch linux

Problem description

Cargo alias doesn't work on cross.

~/.cargo/config.toml

[alias]
dbr = "build --target aarch64-linux-android --release"

cross dbr complie failed, but cross build --target aarch64-linux-android --release worked.

Steps to reproduce

  • cargo new one && cd one
  • add rustls to Cargo.toml
  • execute cross dbr
rustls = "0.19"
@Emilgardis
Copy link
Member

see this relevant comment

#445 (comment)

@Alexhuszagh
Copy link
Contributor

Alexhuszagh commented Jul 2, 2022

This might be somewhat difficult, due to the number of config options and paths we'd need to support, ensuring we merge to options.

For example:

Cargo allows local configuration for a particular package as well as global configuration. It looks for configuration files in the current directory and all parent directories. If, for example, Cargo were invoked in /projects/foo/bar/baz, then the following configuration files would be probed for and unified in this order:

  • /projects/foo/bar/baz/.cargo/config.toml
  • /projects/foo/bar/.cargo/config.toml
  • /projects/foo/.cargo/config.toml
  • /projects/.cargo/config.toml
  • /.cargo/config.toml
  • $CARGO_HOME/config.toml which defaults to:
    • Windows: %USERPROFILE%.cargo\config.toml
    • Unix: $HOME/.cargo/config.toml

We would then need to recursively merge them, and make them available inside the container. It's quite possible we could merge them and then make them available to the container in a custom directory. The issue is we can't overwrite any mount points, so it would have to be the /.cargo/config.toml directory. We also need to process any aliases, parse them along with our CLI flags, determine if the alias is a supported command, and if so run it in the container. We could probably write this directory to our target directory and then make it available at that mount point.

It's definitely doable, just work.

Also, all of these need to support with or without the .toml extension.

@Alexhuszagh Alexhuszagh linked a pull request Jul 10, 2022 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants