diff --git a/.bazelci/presubmit.yml b/.bazelci/presubmit.yml index 856f2f0cbe..90428ca37f 100644 --- a/.bazelci/presubmit.yml +++ b/.bazelci/presubmit.yml @@ -12,7 +12,6 @@ default_windows_targets: &default_windows_targets - "--" # Allows negative patterns; hack for https://github.com/bazelbuild/continuous-integration/pull/245 - "//..." - "-//bindgen/..." - - "-//test/test_env/..." - "-//test/proto/..." - "-//tools/rust_analyzer/..." - "-//test/rustfmt/..." diff --git a/.bazelrc b/.bazelrc index c54ffa8be3..5b3cd4157e 100644 --- a/.bazelrc +++ b/.bazelrc @@ -8,3 +8,6 @@ build:rustfmt --output_groups=+rustfmt_checks # Enable clippy for all targets in the workspace build:clippy --aspects=//rust:defs.bzl%rust_clippy_aspect build:clippy --output_groups=+clippy_checks + +# https://bazel.googlesource.com/bazel/+/master/site/docs/windows.md#enable-symlink-support +startup --windows_enable_symlinks \ No newline at end of file diff --git a/rust/private/rustc.bzl b/rust/private/rustc.bzl index ef94a119f4..539a00a5c1 100644 --- a/rust/private/rustc.bzl +++ b/rust/private/rustc.bzl @@ -505,7 +505,9 @@ def construct_arguments( if rust_common.crate_info in data: dep_crate_info = data[rust_common.crate_info] if dep_crate_info.type == "bin": - env["CARGO_BIN_EXE_" + dep_crate_info.output.basename] = dep_crate_info.output.short_path + # Trying to make CARGO_BIN_EXE_{} canonical across platform by strip out extension if exists + env_basename = dep_crate_info.output.basename[:-(1 + len(dep_crate_info.output.extension))] if len(dep_crate_info.output.extension) > 0 else dep_crate_info.output.basename + env["CARGO_BIN_EXE_" + env_basename] = dep_crate_info.output.short_path # Update environment with user provided variables. env.update(expand_dict_value_locations( diff --git a/test/test_env/tests/run.rs b/test/test_env/tests/run.rs index 1abaa7ab09..0ee58ecf92 100644 --- a/test/test_env/tests/run.rs +++ b/test/test_env/tests/run.rs @@ -15,9 +15,14 @@ fn run() { // Test the behavior of `rootpath` and that a binary can be found relative to current_dir let hello_world_bin = std::path::PathBuf::from(std::env::var_os("HELLO_WORLD_BIN_ROOTPATH").unwrap()); + assert_eq!( hello_world_bin.as_path(), - std::path::Path::new("test/test_env/hello-world"), + std::path::Path::new(if std::env::consts::OS == "windows" { + "test/test_env/hello-world.exe" + } else { + "test/test_env/hello-world" + }) ); assert!(!hello_world_bin.is_absolute()); assert!(hello_world_bin.exists());