BUILD 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  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. load("@bazel_skylib//rules:common_settings.bzl", "bool_flag", "int_flag", "string_flag")
  5. load("@rules_python//python:defs.bzl", "py_binary")
  6. package(default_visibility = ["//toolchain/install:__pkg__"])
  7. py_binary(
  8. name = "gen_tmpl",
  9. srcs = ["gen_tmpl.py"],
  10. )
  11. # Several flags are provided for customizing the exact version used for the
  12. # build of Carbon. Each of these is documented here, but rather than using the
  13. # label-based names in Bazel invocations (`bazel build --//bazel/version:flag`)
  14. # we suggest using the flag aliases provided in the project's `.bazelrc` and we
  15. # document the flags using those aliases. The aliases match the local flag names
  16. # here.
  17. #
  18. # For more details on the versioning scheme used by Carbon, see:
  19. # - https://docs.google.com/document/d/11S5VAPe5Pm_BZPlajWrqDDVr9qc7-7tS2VshqO0wWkk/edit?resourcekey=0-2YFC9Uvl4puuDnWlr2MmYw
  20. # TODO: Replace with path to the markdown once this lands.
  21. #
  22. # First, we provide a flag to enable a release version: `--release`. It is
  23. # disabled by default, and if enabled it must be the only version flag used.
  24. bool_flag(
  25. name = "release",
  26. build_setting_default = False,
  27. )
  28. # A `--pre_release=KIND` flag where `KIND` must be one of:
  29. # - `rc` -- a release candidate version.
  30. # Example: `--pre_release=rc --rc_number=2`
  31. # - `nightly -- a nightly version.
  32. # Example: `--pre_release=nightly --nightly_date=2024.06.17`
  33. # - `dev` -- the default, a development build.
  34. # Example: `--pre_release=dev`
  35. #
  36. # This flag cannot be used along with `--release`, and for all but the `dev`
  37. # kind must be combined with one of the below flags to specify further details
  38. # of the version.
  39. string_flag(
  40. name = "pre_release",
  41. build_setting_default = "dev",
  42. values = [
  43. "rc",
  44. "nightly",
  45. "dev",
  46. ],
  47. )
  48. # `--rc_number=N` sets the release candidate number to `N`. Requires
  49. # `--pre_release=rc`.
  50. int_flag(
  51. name = "rc_number",
  52. build_setting_default = -1,
  53. )
  54. # `--nigthly_date=YYYY.MM.DD` sets the nightly pre-release date. Requires
  55. # `--pre_release=nightly`. The value for this flag must be a string with the
  56. # exact format of `YYYY.MM.DD`.
  57. string_flag(
  58. name = "nightly_date",
  59. build_setting_default = "",
  60. )
  61. # A config setting to observe the value of the `--stamp` command line flag
  62. # within starlark with a macro and `select`. This is a workaround suggested for
  63. # a Bazel issue: https://github.com/bazelbuild/bazel/issues/11164
  64. config_setting(
  65. name = "internal_stamp_flag_detect",
  66. values = {"stamp": "1"},
  67. visibility = ["//visibility:public"],
  68. )