| # Copyright 2025 The Fuchsia Authors. All rights reserved. |
| # Use of this source code is governed by a BSD-style license that can be |
| # found in the LICENSE file. |
| |
| load("@bazel_skylib//rules:common_settings.bzl", "string_flag") |
| load("//build/bazel/rules:current_platform_info.bzl", "define_current_platform_info") |
| |
| # Expose current build configuration's info through a CurrentPlatformInfo provider. |
| define_current_platform_info(name = "current_platform") |
| |
| # The target API level of the current build. |
| # |
| # For the default platform build, the API level is "PLATFORM". |
| # |
| # If this is _not_ set to "PLATFORM", then it must be set to "NEXT", "HEAD", |
| # or a positive integer corresponding to a currently Supported (not Sunset) |
| # API level. In that case, the build will target the given API level. |
| # |
| # This is intended for use with code that is included in IDK sub-builds. Not |
| # all targets support the non-default value, and other uses are unsupported. |
| # |
| # Note: This flag is distinct from similar concepts in the Bazel SDK, including |
| # the flags (`@fuchsia_sdk//flags:fuchsia_api_level` and |
| # `@fuchsia_sdk//flags:repository_default_fuchsia_api_level`) and |
| # the private `fuchsia_api_level` rule and `get_fuchsia_api_level()` function. |
| # It should not be necessary to reference these and this flag in the same file |
| # or build. If you encounter such a situation, please contact the build team. |
| string_flag( |
| name = "fuchsia_api_level", |
| build_setting_default = "PLATFORM", |
| visibility = [ |
| "//build/bazel/bazel_idk:__subpackages__", |
| "//build/bazel/rules/fidl:__subpackages__", |
| ], |
| ) |