forked from bazelbuild/rules_rust
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
process_wrapper: replace C++ implementation with rust. (bazelbuild#1159)
- Loading branch information
Showing
16 changed files
with
818 additions
and
987 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,45 @@ | ||
load("@rules_cc//cc:defs.bzl", "cc_binary") | ||
load("//rust:defs.bzl", "rust_binary", "rust_test") | ||
|
||
cc_binary( | ||
# buildifier: disable=bzl-visibility | ||
load("//rust/private:transitions.bzl", "without_process_wrapper") | ||
|
||
alias( | ||
name = "process_wrapper", | ||
srcs = [ | ||
"process_wrapper.cc", | ||
"system.h", | ||
"utils.h", | ||
"utils.cc", | ||
] + select({ | ||
"@bazel_tools//src/conditions:host_windows": [ | ||
"system_windows.cc", | ||
], | ||
"//conditions:default": [ | ||
"system_posix.cc", | ||
], | ||
}), | ||
defines = [] + select({ | ||
"@bazel_tools//src/conditions:host_windows": [ | ||
"UNICODE", | ||
"_UNICODE", | ||
], | ||
"//conditions:default": [], | ||
actual = select({ | ||
# This will never get used, it's only here to break the circular dependency to allow building process_wrapper | ||
":use_fake_process_wrapper": ":process_wrapper_fake", | ||
"//conditions:default": ":process_wrapper_impl", | ||
}), | ||
visibility = ["//visibility:public"], | ||
) | ||
|
||
cc_binary( | ||
name = "process_wrapper_fake", | ||
srcs = ["fake.cc"], | ||
) | ||
|
||
config_setting( | ||
name = "use_fake_process_wrapper", | ||
flag_values = { | ||
"//rust/settings:use_process_wrapper": "False", | ||
}, | ||
) | ||
|
||
# Changing the name of this rule requires a corresponding | ||
# change in //rust/private/rustc.bzl:925 | ||
without_process_wrapper( | ||
name = "process_wrapper_impl", | ||
target = ":process_wrapper_bin", | ||
visibility = ["//visibility:public"], | ||
) | ||
|
||
rust_binary( | ||
name = "process_wrapper_bin", | ||
srcs = glob(["*.rs"]), | ||
) | ||
|
||
rust_test( | ||
name = "process_wrapper_test", | ||
crate = ":process_wrapper_bin", | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
int main() { | ||
// Noop on purpose. | ||
return 0; | ||
} |
Oops, something went wrong.