cross
cross copied to clipboard
cargo alias doesn't work on cross
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
toCargo.toml
- execute
cross dbr
rustls = "0.19"
see this relevant comment
https://github.com/rust-embedded/cross/pull/445#issuecomment-659931086
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.