From d045a8cdd4dd14a1c8bf3bcd92bc5f30cbf2832b Mon Sep 17 00:00:00 2001 From: Eric Cousineau Date: Thu, 25 Feb 2021 19:17:22 -0500 Subject: [PATCH] pkg_config: Add extra_deprecation option --- tools/workspace/pkg_config.BUILD.tpl | 1 + tools/workspace/pkg_config.bzl | 12 ++++++++++++ 2 files changed, 13 insertions(+) diff --git a/tools/workspace/pkg_config.BUILD.tpl b/tools/workspace/pkg_config.BUILD.tpl index b875ea09b33a..03e61402e615 100644 --- a/tools/workspace/pkg_config.BUILD.tpl +++ b/tools/workspace/pkg_config.BUILD.tpl @@ -15,6 +15,7 @@ cc_library( includes = %{includes}, linkopts = %{linkopts}, deps = %{deps}, + deprecation = %{extra_deprecation}, ) %{build_epilog} diff --git a/tools/workspace/pkg_config.bzl b/tools/workspace/pkg_config.bzl index b7d56d62a135..66892ad75178 100644 --- a/tools/workspace/pkg_config.bzl +++ b/tools/workspace/pkg_config.bzl @@ -221,6 +221,14 @@ def setup_pkg_config_repository(repository_ctx): includes += ["include/" + symlink_dest] hdrs_prologue = "glob([\"include/**\"]) + " + extra_deprecation = getattr( + repository_ctx.attr, + "extra_deprecation", + "", + ) + if extra_deprecation == "": + extra_deprecation = None + # Write out the BUILD.bazel file. substitutions = { "%{topcomment}": "DO NOT EDIT: generated by pkg_config_repository()", @@ -254,6 +262,7 @@ def setup_pkg_config_repository(repository_ctx): getattr(repository_ctx.attr, "extra_deps", []), ), "%{build_epilog}": getattr(repository_ctx.attr, "build_epilog", ""), + "%{extra_deprecation}": repr(extra_deprecation), } template = getattr( repository_ctx.attr, @@ -295,6 +304,7 @@ pkg_config_repository = repository_rule( "extra_deps": attr.string_list(), "build_epilog": attr.string(), "pkg_config_paths": attr.string_list(), + "extra_deprecation": attr.string(), }, local = True, configure = True, @@ -345,4 +355,6 @@ Args: pkg_config_paths: (Optional) Paths to find pkg-config files (.pc). Note that we ignore the environment variable PKG_CONFIG_PATH set by the user. + extra_deprecation: (Optional) Add a deprecation message to the library + BUILD target. """