Skip to content

Commit

Permalink
[tools] Add internal=True sugar for non-installed internal headers (#…
Browse files Browse the repository at this point in the history
…17211)

* [tools] Add internal=True sugar for non-installed internal headers
  • Loading branch information
jwnimmer-tri authored May 18, 2022
1 parent cf87340 commit d8af4d1
Show file tree
Hide file tree
Showing 9 changed files with 118 additions and 241 deletions.
9 changes: 2 additions & 7 deletions common/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -372,18 +372,13 @@ drake_cc_library(

# The drake::filesystem support is intended ONLY for use within Drake's *.cc
# files -- it is not a public dependency of Drake. As such, we compile it with
# hidden visibility, exclude its header file from the install, and exclude it
# from the //common:common package_library shortcut.
# hidden visibility and mark it internal.
drake_cc_library(
name = "filesystem",
srcs = ["filesystem.cc"],
hdrs = ["filesystem.h"],
copts = ["-fvisibility=hidden"],
install_hdrs_exclude = ["filesystem.h"],
tags = [
"exclude_from_libdrake",
"exclude_from_package",
],
internal = True,
visibility = ["//:__subpackages__"],
deps = [
"@ghc_filesystem",
Expand Down
81 changes: 8 additions & 73 deletions geometry/proximity/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -120,16 +120,7 @@ drake_cc_library(
name = "collisions_exist_callback",
srcs = ["collisions_exist_callback.cc"],
hdrs = ["collisions_exist_callback.h"],
install_hdrs_exclude = [
# This header includes `fcl` directly, which we do not want to
# expose externally.
"collisions_exist_callback.h",
],
tags = [
# This header includes `fcl` directly, which we do not want to
# expose externally.
"exclude_from_package",
],
internal = True,
visibility = [
"//geometry:__pkg__",
],
Expand Down Expand Up @@ -185,16 +176,7 @@ drake_cc_library(
name = "distance_to_point_callback",
srcs = ["distance_to_point_callback.cc"],
hdrs = ["distance_to_point_callback.h"],
install_hdrs_exclude = [
# This header includes `fcl` directly, which we do not want to
# expose externally.
"distance_to_point_callback.h",
],
tags = [
# This header includes `fcl` directly, which we do not want to
# expose externally.
"exclude_from_package",
],
internal = True,
visibility = [
"//geometry:__pkg__",
],
Expand All @@ -213,16 +195,7 @@ drake_cc_library(
name = "distance_to_shape_callback",
srcs = ["distance_to_shape_callback.cc"],
hdrs = ["distance_to_shape_callback.h"],
install_hdrs_exclude = [
# This header includes `fcl` directly, which we do not want to
# expose externally.
"distance_to_shape_callback.h",
],
tags = [
# This header includes `fcl` directly, which we do not want to
# expose externally.
"exclude_from_package",
],
internal = True,
visibility = [
"//geometry:__pkg__",
],
Expand Down Expand Up @@ -257,16 +230,7 @@ drake_cc_library(
name = "find_collision_candidates_callback",
srcs = ["find_collision_candidates_callback.cc"],
hdrs = ["find_collision_candidates_callback.h"],
install_hdrs_exclude = [
# This header includes `fcl` directly, which we do not want to
# expose externally.
"find_collision_candidates_callback.h",
],
tags = [
# This header includes `fcl` directly, which we do not want to
# expose externally.
"exclude_from_package",
],
internal = True,
visibility = [
"//geometry:__pkg__",
],
Expand All @@ -281,19 +245,8 @@ drake_cc_library(

drake_cc_library(
name = "hydroelastic_callback",
hdrs = [
"hydroelastic_callback.h",
],
install_hdrs_exclude = [
# This header includes `fcl` directly, which we do not want to
# expose externally.
"hydroelastic_callback.h",
],
tags = [
# This header includes `fcl` directly, which we do not want to
# expose externally.
"exclude_from_package",
],
hdrs = ["hydroelastic_callback.h"],
internal = True,
visibility = [
"//geometry:__pkg__",
],
Expand Down Expand Up @@ -637,16 +590,7 @@ drake_cc_library(
name = "penetration_as_point_pair_callback",
srcs = ["penetration_as_point_pair_callback.cc"],
hdrs = ["penetration_as_point_pair_callback.h"],
install_hdrs_exclude = [
# This header includes `fcl` directly, which we do not want to
# expose externally.
"penetration_as_point_pair_callback.h",
],
tags = [
# This header includes `fcl` directly, which we do not want to
# expose externally.
"exclude_from_package",
],
internal = True,
visibility = [
"//geometry:__pkg__",
],
Expand Down Expand Up @@ -683,16 +627,7 @@ drake_cc_library(
name = "proximity_utilities",
srcs = ["proximity_utilities.cc"],
hdrs = ["proximity_utilities.h"],
install_hdrs_exclude = [
# This header includes `fcl` directly, which we do not want to
# expose externally.
"proximity_utilities.h",
],
tags = [
# This header includes `fcl` directly, which we do not want to
# expose externally.
"exclude_from_package",
],
internal = True,
visibility = [
"//geometry:__pkg__",
# TODO(jwnimmer-tri) As with **every single file ever** that is named
Expand Down
11 changes: 8 additions & 3 deletions geometry/render/dev/render_gltf_client/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ drake_cc_library(
name = "internal_http_service_curl",
srcs = ["internal_http_service_curl.cc"],
hdrs = ["internal_http_service_curl.h"],
internal = True,
visibility = ["//visibility:private"],
deps = [
"//common:filesystem",
"//common:unused",
Expand All @@ -37,6 +39,8 @@ drake_cc_library(
"internal_render_client.h",
"render_gltf_client_params.h",
],
internal = True,
visibility = ["//visibility:private"],
deps = [
":internal_http_service_curl",
"//common:filesystem",
Expand All @@ -58,12 +62,13 @@ drake_cc_library(
"internal_render_engine_gltf_client.cc",
],
hdrs = [
# TODO(jwnimmer-tri) The factory should be its own separate cc_library,
# not to be marked with "internal".
"factory.h",
"internal_render_engine_gltf_client.h",
],
# internal_render_engine_gltf_client.h directly pulls in VTK headers; leave
# it out of the install.
install_hdrs_exclude = ["internal_render_engine_gltf_client.h"],
internal = True,
visibility = ["//visibility:private"],
deps = [
":internal_render_client",
"//common:filesystem",
Expand Down
9 changes: 2 additions & 7 deletions geometry/render/gl_renderer/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -138,13 +138,8 @@ drake_cc_library(
hdrs = [
"render_engine_gl_factory.h",
],
install_hdrs_exclude = [
"render_engine_gl_factory.h",
],
tags = [
# We should only ever _link_ it on macOS.
"exclude_from_package",
],
internal = True,
visibility = ["//visibility:private"],
deps = [
":render_engine_gl_params",
"//geometry/render:render_engine",
Expand Down
10 changes: 8 additions & 2 deletions geometry/render_gltf_client/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,26 @@ load(
)
load("//tools/lint:lint.bzl", "add_lint_tests")

package(default_visibility = ["//visibility:public"])
# TODO(jwnimmer-tri) Replace with "//visibility:private" once dev code is gone.
_VISIBILITY = [
"//geometry/render/dev/render_gltf_client:__pkg__",
]

package(default_visibility = _VISIBILITY)

drake_cc_package_library(
name = "render_gltf_client",
visibility = ["//visibility:public"],
deps = [
":internal_http_service",
],
)

drake_cc_library(
name = "internal_http_service",
srcs = ["internal_http_service.cc"],
hdrs = ["internal_http_service.h"],
internal = True,
visibility = _VISIBILITY,
interface_deps = [
"//common:essential",
],
Expand Down
16 changes: 5 additions & 11 deletions geometry/render_vtk/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,7 @@ drake_cc_library(
name = "internal_render_engine_vtk",
srcs = ["internal_render_engine_vtk.cc"],
hdrs = ["internal_render_engine_vtk.h"],
# Since we directly use VTK headers, leave us out of the install.
install_hdrs_exclude = ["internal_render_engine_vtk.h"],
tags = ["exclude_from_package"],
internal = True,
visibility = [
"//geometry/render_client_gltf:__pkg__",
# TODO(jwnimmer-tri) Remove this once the dev package is gone.
Expand Down Expand Up @@ -82,11 +80,9 @@ drake_cc_library(
name = "internal_render_engine_vtk_base",
srcs = ["internal_render_engine_vtk_base.cc"],
hdrs = ["internal_render_engine_vtk_base.h"],
# Since we directly use VTK headers, leave us out of the install.
install_hdrs_exclude = ["internal_render_engine_vtk_base.h"],
tags = ["exclude_from_package"],
internal = True,
visibility = [
# TODO(jwnimmer-tri) Remove this after deprecation 2022-09-01.
# TODO(jwnimmer-tri) Switch to private after deprecation 2022-09-01.
"//geometry/render:__pkg__",
],
deps = [
Expand All @@ -102,11 +98,9 @@ drake_cc_library(
name = "internal_vtk_util",
srcs = ["internal_vtk_util.cc"],
hdrs = ["internal_vtk_util.h"],
# Since we directly use VTK headers, leave us out of the install.
install_hdrs_exclude = ["internal_vtk_util.h"],
tags = ["exclude_from_package"],
internal = True,
visibility = [
# TODO(jwnimmer-tri) Remove this after deprecation 2022-09-01.
# TODO(jwnimmer-tri) Switch to private after deprecation 2022-09-01.
"//geometry/render:__pkg__",
],
deps = [
Expand Down
Loading

0 comments on commit d8af4d1

Please sign in to comment.