Skip to content

Commit

Permalink
pkg_config: Add extra_deprecation option
Browse files Browse the repository at this point in the history
  • Loading branch information
EricCousineau-TRI committed Mar 2, 2021
1 parent f47387b commit d045a8c
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
1 change: 1 addition & 0 deletions tools/workspace/pkg_config.BUILD.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ cc_library(
includes = %{includes},
linkopts = %{linkopts},
deps = %{deps},
deprecation = %{extra_deprecation},
)

%{build_epilog}
12 changes: 12 additions & 0 deletions tools/workspace/pkg_config.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -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()",
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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.
"""

0 comments on commit d045a8c

Please sign in to comment.