blob: 95a18502068be2b99e865481b8f5a3325db18467 [file]
# 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")
exports_files([
"templates/template.host_py_test_wrapper.sh",
"templates/template.host_test_wrapper.sh",
])
# 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/rules/fidl:__subpackages__",
"//build/bazel/rules/idk/private:__subpackages__",
"//build/bazel/toolchains:__subpackages__",
],
)
# Configuration settings for each IDK buildable API level.
# These should only be used by IDK atom rules. In particular, theyy should not
# be used to condition IDK source files as these must be consistent for all
# API levels.
# TODO(https://fxbug.dev/490506836): Automatically generate these config_setting
# targets from the list of IDK buildable API levels.
_api_level_condition_visibility = [
# The location where `verify_public_symbols()` is defined - see
# https://fxbug.dev/491244314.
"//build/bazel/rules/cc:__subpackages__",
]
config_setting(
name = "is_api_level_PLATFORM",
flag_values = {"//build/bazel:fuchsia_api_level": "PLATFORM"},
visibility = ["//visibility:public"],
)
config_setting(
name = "is_api_level_27",
flag_values = {"//build/bazel:fuchsia_api_level": "27"},
visibility = _api_level_condition_visibility,
)
config_setting(
name = "is_api_level_28",
flag_values = {"//build/bazel:fuchsia_api_level": "28"},
visibility = _api_level_condition_visibility,
)
config_setting(
name = "is_api_level_29",
flag_values = {"//build/bazel:fuchsia_api_level": "29"},
visibility = _api_level_condition_visibility,
)
config_setting(
name = "is_api_level_30",
flag_values = {"//build/bazel:fuchsia_api_level": "30"},
visibility = _api_level_condition_visibility,
)
config_setting(
name = "is_api_level_31",
flag_values = {"//build/bazel:fuchsia_api_level": "31"},
visibility = _api_level_condition_visibility,
)
config_setting(
name = "is_api_level_NEXT",
flag_values = {"//build/bazel:fuchsia_api_level": "NEXT"},
visibility = _api_level_condition_visibility,
)