bazelbuild / rules_rust

Rust rules for Bazel
https://bazelbuild.github.io/rules_rust/
Apache License 2.0
670 stars 432 forks source link

Build `rust_test` targets using a crate name different from the underlying lib #2828

Closed felipeamp closed 2 months ago

felipeamp commented 2 months ago

This is a rollforward of https://github.com/bazelbuild/rules_rust/pull/2803, but behind the incompatible_change_rust_test_compilation_output_directory incompatible flag.

This PR also makes rust_test put its compilation outputs in the same directory as the rust_library rule (i.e. not in a test-{hash} subdirectory anymore).

After this change both the rust_library and rust_test rules will put all its compilation outputs in the same directory, but there won't be any name collisions in non-sandboxed environments (see https://github.com/bazelbuild/rules_rust/pull/1427 for more context).

Issue with context: https://github.com/bazelbuild/rules_rust/issues/2827

felipeamp commented 2 months ago

I have filed an issue for this, see https://github.com/bazelbuild/rules_rust/issues/2827. Is there anything specific that's missing there?

felipeamp commented 2 months ago

I've also fixed the windows tests (that weren't working due to the toolchain binary extension) and added an assert on the directory name as well.

UebelAndre commented 2 months ago

Just gotta resolve the conflicts!

felipeamp commented 2 months ago

All done.