-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Description
Describe the problem you are trying to solve
I'm building some custom tooling to enable writing UI tests for iOS and Android in Rust. In both cases, I can't use the built-in test harness because it can only generate binaries, and both iOS and Android don't accept regular / "unwrapped" binaries.
I'm currently using this to build a library with --cfg test
:
cargo rustc --message-format=json --target=x86_64-apple-ios --lib -- \
--cfg=test --crate-type=staticlib
This works, but it doesn't include the dev-dependencies
.
Alternatively, I can include --profile=test
, but this doesn't work very well:
- This will include the test harness unless
harness = false
in the manifest (for the lib target). - The Cargo JSON output is incorrect when using
--profile test
on a library target: the library (lib___.a
) is built, but the JSON output contains the binary path (___
), not the library path.
Describe the solution you'd like
The easiest solution would be to have a profile that acts in every way like --profile dev
, but includes the dev-dependencies
(in commands::rustc and CompileFilter::need_dev_ops).
cargo rustc --message-format=json --target=x86_64-apple-ios --lib --profile=dev-dev -- \
--cfg test --crate-type staticlib
For example, we might want:
- Some("dev") | None => CompileMode::Build,
+ Some("dev") | None => CompileMode::Build { dev_dependencies: false },
+ Some("dev-dev") => CompileMode::Build { dev_dependencies: true },
Alternatively, a separate flag could also work for me:
cargo rustc --message-format=json --target=x86_64-apple-ios --lib --dev -- \
--cfg test --crate-type staticlib
Notes
I expected --profile=dev
to already include the dev-dependencies
(because of the prefix). This makes it a bit difficult to think of a better name for a profile that does include the dev-dependencies
.