Advertisement
Guest User

Untitled

a guest
Mar 25th, 2019
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.99 KB | None | 0 0
  1. diff --git a/rust/private/rust.bzl b/rust/private/rust.bzl
  2. index d14b761..9d5b070 100644
  3. --- a/rust/private/rust.bzl
  4. +++ b/rust/private/rust.bzl
  5. @@ -281,10 +281,27 @@ _rust_library_attrs = {
  6. ),
  7. }
  8.  
  9. +def _platform_to_host_transition(settings, attr):
  10. + if attr.crate_type == "proc-macro":
  11. + return {
  12. + "//command_line_option:platforms": "@bazel_tools//platforms:host_platform",
  13. + }
  14. + else:
  15. + return {
  16. + "//command_line_option:platforms": "@bazel_tools//platforms:target_platform",
  17. + }
  18. +
  19. +platform_to_host_transition = transition(
  20. + implementation = _platform_to_host_transition,
  21. + inputs = [],
  22. + outputs = ["//command_line_option:platforms"],
  23. +)
  24. +
  25. rust_library = rule(
  26. _rust_library_impl,
  27. attrs = dict(_rust_common_attrs.items() +
  28. _rust_library_attrs.items()),
  29. + cfg = platform_to_host_transition,
  30. fragments = ["cpp"],
  31. host_fragments = ["cpp"],
  32. toolchains = ["@io_bazel_rules_rust//rust:toolchain"],
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement