blob: 8ed258feb2bee11f44b2dd9d6a0ea700f4d83d56 [file] [log] [blame]
# Copyright 2024 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.
import("//build/config/fuchsia/platform_version.gni")
import("//build/config/fuchsia/target_api_level.gni")
# This target exist solely to ensure that the test file builds without error.
# It is never actually linked into anything or included in the IDK.
# To improve test coverage, the IDK builds it at both PLATFORM and supported
# API levels with different expected results based on a preprocessor define.
# It cannot be marked testonly for the reasons described in //sdk:fuchsia_idk_atoms.
static_library("availability_test") {
visibility = [ "//sdk/*" ]
# `current_build_target_api_level` may be a string or integer. The following only
# applies to integers.
if (current_build_target_api_level != "$current_build_target_api_level") {
# Define values used by the test.
# Due to the way the macros are defined, only literals can be specified.
# Therefore, separate literal values must be provided for relative levels.
_current_build_target_api_level_minus_one =
current_build_target_api_level - 1
_current_build_target_api_level_plus_one =
current_build_target_api_level + 1
_highest_known_numbered_api_level = 0
foreach(level, platform_version.all_numbered_api_levels) {
if (level > _highest_known_numbered_api_level) {
_highest_known_numbered_api_level = level
}
}
_highest_numbered_api_level_plus_one = _highest_known_numbered_api_level + 1
defines = [
"BUILT_AT_NUMBERED_API_LEVEL=$current_build_target_api_level",
"BUILT_AT_NUMBERED_API_LEVEL_MINUS_ONE=$_current_build_target_api_level_minus_one",
"BUILT_AT_NUMBERED_API_LEVEL_PLUS_ONE=$_current_build_target_api_level_plus_one",
"FUCHSIA_INTERNAL_LEVEL_${_highest_numbered_api_level_plus_one}_()=${_highest_numbered_api_level_plus_one}",
]
}
sources = [ "availability_test.c" ]
}