BUILD 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  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. # - `nightly -- a nightly version.
  33. # Example: `--pre_release=nightly --nightly_date=2024.06.17`
  34. # - `dev` -- the default, a development build.
  35. # Example: `--pre_release=dev`
  36. #
  37. # This flag cannot be used along with `--release`, and for all but the `dev`
  38. # kind must be combined with one of the below flags to specify further details
  39. # of the version.
  40. string_flag(
  41. name = "pre_release",
  42. build_setting_default = "dev",
  43. values = [
  44. "rc",
  45. "nightly",
  46. "dev",
  47. ],
  48. )
  49. # `--rc_number=N` sets the release candidate number to `N`. Requires
  50. # `--pre_release=rc`.
  51. int_flag(
  52. name = "rc_number",
  53. build_setting_default = -1,
  54. )
  55. # `--nigthly_date=YYYY.MM.DD` sets the nightly pre-release date. Requires
  56. # `--pre_release=nightly`. The value for this flag must be a string with the
  57. # exact format of `YYYY.MM.DD`.
  58. string_flag(
  59. name = "nightly_date",
  60. build_setting_default = "",
  61. )
  62. # A config setting to observe the value of the `--stamp` command line flag
  63. # within starlark with a macro and `select`. This is a workaround suggested for
  64. # a Bazel issue: https://github.com/bazelbuild/bazel/issues/11164
  65. config_setting(
  66. name = "internal_stamp_flag_detect",
  67. values = {"stamp": "1"},
  68. visibility = ["//visibility:public"],
  69. )