defs.bzl 889 B

123456789101112131415161718192021222324252627282930313233
  1. # Part of the Carbon Language project, under the Apache License v2.0 with LLVM
  2. # Exceptions. See /LICENSE for license information.
  3. # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  4. """Wraps standard cc rules with the `cc_env` addition.
  5. These should generally be used in place of `@rules_cc`.
  6. """
  7. load(
  8. "@rules_cc//cc:defs.bzl",
  9. actual_cc_binary = "cc_binary",
  10. actual_cc_library = "cc_library",
  11. actual_cc_test = "cc_test",
  12. )
  13. load("//bazel/cc_toolchains:defs.bzl", "cc_env")
  14. # Expose cc_library directly, for consistency.
  15. cc_library = actual_cc_library
  16. def cc_binary(env = {}, **kwargs):
  17. """Wraps `cc_binary`, adding `cc_env`."""
  18. actual_cc_binary(
  19. env = cc_env() | env,
  20. **kwargs
  21. )
  22. def cc_test(env = {}, **kwargs):
  23. """Wraps `cc_binary`, adding `cc_env`."""
  24. actual_cc_test(
  25. env = cc_env() | env,
  26. **kwargs
  27. )