Skip to content

Commit

Permalink
Add and use exclude_from_libdrake tag (RobotLocomotion#8815)
Browse files Browse the repository at this point in the history
This allows us to customize what ends up in libdrake.
  • Loading branch information
jwnimmer-tri authored May 15, 2018
1 parent d91e3ca commit 49ce4ea
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 3 deletions.
10 changes: 9 additions & 1 deletion common/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -381,6 +381,13 @@ drake_cc_library(
# Don't add this library into the ":common" package library.
# Only programs with a main() function should ever use this header.
"exclude_from_package",
# Don't install this header via this cc_library, because that would
# introduce a dependency from libdrake onto gflags. Similarly, we
# can't use `install_hdrs_exclude` for this because the @gflags
# dependency should not be part of the install. Instead, we exclude
# this cc_library entirely, and use a separate rule below for the
# installation.
"exclude_from_libdrake",
],
deps = [
":essential",
Expand All @@ -399,7 +406,8 @@ drake_cc_library(
# This rule should only be used for install purposes.
"exclude_from_package",
],
# This rule should only be used for install purposes.
# This rule should only be used for install purposes, not within the
# in-source bazel build. We limit its visibility to enforce that.
visibility = ["//tools/install/libdrake:__pkg__"],
)

Expand Down
4 changes: 4 additions & 0 deletions common/proto/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,11 @@ cc_library(
include_prefix = "drake/common/proto",
strip_include_prefix = "/third_party/com_github_google_protobuf",
tags = [
# Developers should not use this directly.
"exclude_from_package",
# Don't install via cc_library; instead, rely on the :install rule
# below to handle the install path correctly.
"exclude_from_libdrake",
],
)

Expand Down
3 changes: 1 addition & 2 deletions tools/install/libdrake/build_components_refresh.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,10 @@ def _find_libdrake_components():
kind("cc_library", visible("//tools/install/libdrake:libdrake.so", "//..."))
except(attr("testonly", "1", "//..."))
except("//:*")
except("//common:text_logging_gflags")
except("//common/proto:protobuf_ubsan_fixup")
except("//examples/...")
except("//lcmtypes/...")
except("//tools/install/libdrake:*")
except(attr(tags, "exclude_from_libdrake", //...))
"""
# First, find the drake_cc_package_library targets within that query.
package_libs = []
Expand Down

0 comments on commit 49ce4ea

Please sign in to comment.