BUILD 3.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  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. package(default_visibility = ["//toolchain/install:__pkg__"])
  6. exports_files(["gen_tmpl.py"])
  7. # Several flags are provided for customizing the exact version used for the
  8. # build of Carbon. Each of these is documented here, but rather than using the
  9. # label-based names in Bazel invocations (`bazel build --//bazel/version:flag`)
  10. # we suggest using the flag aliases provided in the project's `.bazelrc` and we
  11. # document the flags using those aliases. The aliases match the local flag names
  12. # here.
  13. #
  14. # For more details on the versioning scheme used by Carbon, see:
  15. # - https://docs.google.com/document/d/11S5VAPe5Pm_BZPlajWrqDDVr9qc7-7tS2VshqO0wWkk/edit?resourcekey=0-2YFC9Uvl4puuDnWlr2MmYw
  16. # TODO: Replace with path to the markdown once this lands.
  17. #
  18. # First, we provide a flag to enable a release version: `--release`. It is
  19. # disabled by default, and if enabled it must be the only version flag used.
  20. bool_flag(
  21. name = "release",
  22. build_setting_default = False,
  23. )
  24. # A `--pre_release=KIND` flag where `KIND` must be one of:
  25. # - `rc` -- a release candidate version.
  26. # Example: `--pre_release=rc --rc_number=2`
  27. # - `beta` -- a beta version.
  28. # Example: `--pre_release=beta --beta_number=2`
  29. # - `alpha` -- an alpha version.
  30. # Example: `--pre_release=alpha --alpha_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. "beta",
  45. "alpha",
  46. "nightly",
  47. "dev",
  48. ],
  49. )
  50. # `--rc_number=N` sets the release candidate number to `N`. Requires `--pre_release=rc`.
  51. int_flag(
  52. name = "rc_number",
  53. build_setting_default = -1,
  54. )
  55. # When `--pre_release=beta` is used, `--beta_number=N` set's the beta
  56. # pre-release number to `N`.
  57. #
  58. # An error if used without `--pre_release=beta`.
  59. int_flag(
  60. name = "beta_number",
  61. build_setting_default = -1,
  62. )
  63. # When `--pre_release=alpha` is used, `--alpha_number=N` set's the alpha
  64. # pre-release number to `N`.
  65. #
  66. # An error if used without `--pre_release=alpha`.
  67. int_flag(
  68. name = "alpha_number",
  69. build_setting_default = -1,
  70. )
  71. # When `--pre_release=nightly` is used, `--nightly_date=YYYY.MM.DD` set's the
  72. # nightly build date. The value for this flag must be a string with the exact
  73. # format of `YYYY.MM.DD`.
  74. #
  75. # An error if used without `--pre_release=nightly`.
  76. string_flag(
  77. name = "nightly_date",
  78. build_setting_default = "",
  79. )
  80. # A config setting to observe the value of the `--stamp` command line flag
  81. # within starlark with a macro and `select`. This is a workaround suggested for
  82. # a Bazel issue: https://github.com/bazelbuild/bazel/issues/11164
  83. config_setting(
  84. name = "internal_stamp_flag_detect",
  85. values = {"stamp": "1"},
  86. visibility = ["//visibility:public"],
  87. )