pkg_naming.bzl 991 B

123456789101112131415161718192021222324
  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. """Rule to create variables for package naming."""
  5. load("@rules_pkg//pkg:providers.bzl", "PackageVariablesInfo")
  6. load("//bazel/version:compute_version.bzl", "VERSION_ATTRS", "compute_version")
  7. def _pkg_naming_variables_impl(ctx):
  8. # TODO: Add support for digging the target CPU out of the toolchain here,
  9. # remapping it to a more canonical name, and add that to the variables. The
  10. # Bazel target CPU is already directly available, but it isn't likely
  11. # canonical.
  12. # TODO: Include the target OS as well as the target CPU. This likely needs
  13. # similar re-mapping as the CPU does.
  14. return PackageVariablesInfo(values = {
  15. "version": compute_version(ctx),
  16. })
  17. pkg_naming_variables = rule(
  18. implementation = _pkg_naming_variables_impl,
  19. attrs = VERSION_ATTRS,
  20. )