BUILD 3.2 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. 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. python_version = "PY3",
  11. )
  12. # Several flags are provided for customizing the exact version used for the
  13. # build of Carbon. Each of these is documented here, but rather than using the
  14. # label-based names in Bazel invocations (`bazel build --//bazel/version:flag`)
  15. # we suggest using the flag aliases provided in the project's `.bazelrc` and we
  16. # document the flags using those aliases. The aliases match the local flag names
  17. # here.
  18. #
  19. # For more details on the versioning scheme used by Carbon, see:
  20. # - https://docs.google.com/document/d/11S5VAPe5Pm_BZPlajWrqDDVr9qc7-7tS2VshqO0wWkk/edit?resourcekey=0-2YFC9Uvl4puuDnWlr2MmYw
  21. # TODO: Replace with path to the markdown once this lands.
  22. #
  23. # First, we provide a flag to enable a release version: `--release`. It is
  24. # disabled by default, and if enabled it must be the only version flag used.
  25. bool_flag(
  26. name = "release",
  27. build_setting_default = False,
  28. )
  29. # A `--pre_release=KIND` flag where `KIND` must be one of:
  30. # - `rc` -- a release candidate version.
  31. # Example: `--pre_release=rc --rc_number=2`
  32. # - `beta` -- a beta version.
  33. # Example: `--pre_release=beta --beta_number=2`
  34. # - `alpha` -- an alpha version.
  35. # Example: `--pre_release=alpha --alpha_number=2`
  36. # - `nightly -- a nightly version.
  37. # Example: `--pre_release=nightly --nightly_date=2024.06.17`
  38. # - `dev` -- the default, a development build.
  39. # Example: `--pre_release=dev`
  40. #
  41. # This flag cannot be used along with `--release`, and for all but the `dev`
  42. # kind must be combined with one of the below flags to specify further details
  43. # of the version.
  44. string_flag(
  45. name = "pre_release",
  46. build_setting_default = "dev",
  47. values = [
  48. "rc",
  49. "beta",
  50. "alpha",
  51. "nightly",
  52. "dev",
  53. ],
  54. )
  55. # `--rc_number=N` sets the release candidate number to `N`. Requires
  56. # `--pre_release=rc`.
  57. int_flag(
  58. name = "rc_number",
  59. build_setting_default = -1,
  60. )
  61. # `--beta_number=N` sets the beta pre-release number to `N`. Requires
  62. # `--pre_release=beta`.
  63. int_flag(
  64. name = "beta_number",
  65. build_setting_default = -1,
  66. )
  67. # `--alpha_number=N` sets the alpha pre-release number to `N`. Requires
  68. # `--pre_release=alpha`.
  69. int_flag(
  70. name = "alpha_number",
  71. build_setting_default = -1,
  72. )
  73. # `--nigthly_date=YYYY.MM.DD` sets the nightly pre-release date. Requires
  74. # `--pre_release=nightly`. The value for this flag must be a string with the
  75. # exact format of `YYYY.MM.DD`.
  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. )