| # Copyright 2019 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/clang/clang.gni") |
| import("//build/sdk/config.gni") |
| |
| # Verifies the list of imported symbols from a prebuilt library against an |
| # allowlist. Additionally, checks that none of the symbols is a C++ symbol. |
| # |
| # Parameters |
| # |
| # current |
| # Location of generated symbols file from the extract_imported_symbols action. |
| # |
| # allowlist |
| # Location of checked in list of allowed symbols. |
| # |
| # library_name |
| # A human-readable library name for debugging purposes. |
| |
| template("verify_imported_symbols") { |
| assert(defined(invoker.current), "current must be provided") |
| assert(defined(invoker.allowlist), "allowlist must be provided") |
| assert(defined(invoker.library_name), "library_name must be provided") |
| |
| stamp_file = "$target_gen_dir/$target_name.imported_symbols.verified.stamp" |
| |
| action(target_name) { |
| script = "//build/cpp/verify_imported_symbols.sh" |
| |
| forward_variables_from(invoker, [ "deps" ]) |
| |
| inputs = [ |
| invoker.current, |
| invoker.allowlist, |
| "$clang_prefix/llvm-cxxfilt", |
| ] |
| |
| outputs = [ stamp_file ] |
| |
| args = [ |
| "$rebased_clang_prefix/llvm-cxxfilt", |
| invoker.library_name, |
| rebase_path(invoker.current, root_build_dir), |
| rebase_path(invoker.allowlist, root_build_dir), |
| rebase_path(stamp_file, root_build_dir), |
| ] |
| |
| if (warn_on_sdk_changes) { |
| args += [ "--warn" ] |
| } |
| } |
| } |