Skip to content

Commit

Permalink
[tools] Switch to bazel's deps vs implementation_deps semantics (Robo…
Browse files Browse the repository at this point in the history
…tLocomotion#21701)

At some point Bazel said that interface_deps vs deps was going to
be the way and the light for cc_library in the future, and then later
they changed their mind. As of today, deps are the interface deps and
implementation_deps are the implementation deps. Rewrite all of our
BUILD files and macros to match the new spelling.

Update buildifier hints for better precision.
  • Loading branch information
jwnimmer-tri authored Jul 10, 2024
1 parent 410bf9c commit cf3d933
Show file tree
Hide file tree
Showing 32 changed files with 322 additions and 344 deletions.
28 changes: 12 additions & 16 deletions common/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -287,8 +287,7 @@ drake_cc_library(
hdrs = ["find_cache.h"],
internal = True,
visibility = ["//:__subpackages__"],
interface_deps = [],
deps = [
implementation_deps = [
":essential",
],
)
Expand All @@ -297,8 +296,7 @@ drake_cc_library(
name = "find_runfiles",
srcs = ["find_runfiles.cc"],
hdrs = ["find_runfiles.h"],
interface_deps = [],
deps = [
implementation_deps = [
":essential",
"@bazel_tools//tools/cpp/runfiles",
],
Expand All @@ -322,10 +320,10 @@ drake_cc_library(
"//tools/cc_toolchain:linux": ["-ldl"],
"//conditions:default": [],
}),
interface_deps = [
deps = [
":essential",
],
deps = [
implementation_deps = [
":drake_marker_shared_library",
":find_runfiles",
],
Expand All @@ -339,8 +337,7 @@ drake_cc_library(
DRAKE_RESOURCE_SENTINEL,
],
visibility = ["//tools/install/libdrake:__pkg__"],
interface_deps = [],
deps = [
implementation_deps = [
":find_resource",
],
)
Expand Down Expand Up @@ -442,10 +439,10 @@ drake_cc_library(
hdrs = [
"nice_type_name.h",
],
interface_deps = [
deps = [
":essential",
],
deps = [
implementation_deps = [
":nice_type_name_override_header",
],
)
Expand Down Expand Up @@ -479,12 +476,12 @@ drake_cc_library(
name = "random",
srcs = ["random.cc"],
hdrs = ["random.h"],
interface_deps = [
deps = [
":copyable_unique_ptr",
":essential",
":extract_double",
],
deps = [
implementation_deps = [
":autodiff",
],
)
Expand All @@ -503,10 +500,10 @@ drake_cc_library(
name = "sha256",
srcs = ["sha256.cc"],
hdrs = ["sha256.h"],
interface_deps = [
deps = [
":essential",
],
deps = [
implementation_deps = [
"@picosha2_internal//:picosha2",
],
)
Expand All @@ -524,10 +521,9 @@ drake_cc_library(
name = "temp_directory",
srcs = ["temp_directory.cc"],
hdrs = ["temp_directory.h"],
interface_deps = [
deps = [
":essential",
],
deps = [],
)

# This is a Drake-internal utility for use only as a direct dependency
Expand Down
3 changes: 1 addition & 2 deletions common/proto/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,7 @@ drake_cc_library(
srcs = ["rpc_pipe_temp_directory.cc"],
hdrs = ["rpc_pipe_temp_directory.h"],
visibility = ["//visibility:private"],
interface_deps = [],
deps = [
implementation_deps = [
"//common:essential",
],
)
Expand Down
8 changes: 4 additions & 4 deletions common/symbolic/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -181,10 +181,10 @@ drake_cc_library(
"monomial.h",
"polynomial.h",
],
interface_deps = [
deps = [
":expression",
],
deps = [
implementation_deps = [
"//math:quadratic_form",
],
)
Expand Down Expand Up @@ -276,11 +276,11 @@ drake_cc_library(
name = "replace_bilinear_terms",
srcs = ["replace_bilinear_terms.cc"],
hdrs = ["replace_bilinear_terms.h"],
interface_deps = [
deps = [
"//common:essential",
"//common/symbolic:expression",
],
deps = [
implementation_deps = [
"//common/symbolic:polynomial",
],
)
Expand Down
4 changes: 2 additions & 2 deletions common/symbolic/expression/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,14 @@ drake_cc_library(
"variable.h",
"variables.h",
],
interface_deps = [
deps = [
"//common:drake_bool",
"//common:essential",
"//common:hash",
"//common:random",
"//common:reset_after_move",
],
deps = [
implementation_deps = [
"@abseil_cpp_internal//absl/container:flat_hash_set",
"@abseil_cpp_internal//absl/container:inlined_vector",
"@fmt",
Expand Down
6 changes: 3 additions & 3 deletions examples/hardware_sim/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -30,19 +30,19 @@ drake_cc_library(
name = "scenario",
srcs = ["scenario.cc"],
hdrs = ["scenario.h"],
interface_deps = [
deps = [
"//common:name_value",
"//lcm:drake_lcm_params",
"//manipulation/kuka_iiwa:iiwa_driver",
"//manipulation/schunk_wsg:schunk_wsg_driver",
"//manipulation/util:zero_force_driver",
"//multibody/plant:multibody_plant_config",
"//multibody/parsing:model_directives",
"//multibody/plant:multibody_plant_config",
"//systems/analysis:simulator_config",
"//systems/sensors:camera_config",
"//visualization:visualization_config",
],
deps = [
implementation_deps = [
"//common/yaml",
],
)
Expand Down
32 changes: 16 additions & 16 deletions geometry/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,11 @@ drake_cc_library(
hdrs = [
"proximity_engine.h",
],
interface_deps = [
deps = [
":geometry_ids",
":geometry_roles",
":internal_geometry",
":shape_specification",
"//common:default_scalars",
"//common:sorted_pair",
"//geometry/proximity:collision_filter",
Expand All @@ -71,12 +75,8 @@ drake_cc_library(
"//geometry/proximity:make_mesh_from_vtk",
"//geometry/query_results",
"//math",
":geometry_ids",
":geometry_roles",
":shape_specification",
":internal_geometry",
],
deps = [
implementation_deps = [
":read_obj",
":utilities",
"//geometry/proximity",
Expand Down Expand Up @@ -130,7 +130,7 @@ drake_cc_library(
name = "drake_visualizer",
srcs = ["drake_visualizer.cc"],
hdrs = ["drake_visualizer.h"],
interface_deps = [
deps = [
":drake_visualizer_params",
":geometry_roles",
":geometry_version",
Expand All @@ -140,7 +140,7 @@ drake_cc_library(
"//systems/framework:context",
"//systems/framework:leaf_system",
],
deps = [
implementation_deps = [
"//lcm:drake_lcm",
"//lcmtypes:viewer",
"//systems/lcm:lcm_system_graphviz",
Expand All @@ -165,12 +165,12 @@ drake_cc_library(
hdrs = [
"kinematics_vector.h",
],
interface_deps = [
deps = [
":geometry_ids",
"//common:essential",
"//math:geometric_transform",
],
deps = [
implementation_deps = [
"//common:default_scalars",
"//common:nice_type_name",
],
Expand Down Expand Up @@ -378,10 +378,10 @@ drake_cc_library(
name = "read_obj",
srcs = ["read_obj.cc"],
hdrs = ["read_obj.h"],
interface_deps = [
deps = [
"@eigen",
],
deps = [
implementation_deps = [
"//common:essential",
"@fmt",
"@tinyobjloader_internal//:tinyobjloader",
Expand All @@ -392,12 +392,12 @@ drake_cc_library(
name = "shape_specification",
srcs = ["shape_specification.cc"],
hdrs = ["shape_specification.h"],
interface_deps = [
deps = [
"//common:essential",
"//geometry/proximity:polygon_surface_mesh",
"//math:geometric_transform",
],
deps = [
implementation_deps = [
"//common:nice_type_name",
"//common:overloaded",
"//geometry/proximity:make_convex_hull_mesh_impl",
Expand Down Expand Up @@ -508,7 +508,7 @@ drake_cc_library(
"meshcat_recording_internal.h",
"meshcat_types_internal.h",
],
interface_deps = [
deps = [
":geometry_ids",
":meshcat_animation",
":rgba",
Expand All @@ -520,7 +520,7 @@ drake_cc_library(
"//math:geometric_transform",
"//perception:point_cloud",
],
deps = [
implementation_deps = [
"//common:drake_export",
"//common:find_resource",
"//common:network_policy",
Expand Down
10 changes: 5 additions & 5 deletions geometry/optimization/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,11 @@ drake_cc_library(
name = "geodesic_convexity",
srcs = ["geodesic_convexity.cc"],
hdrs = ["geodesic_convexity.h"],
interface_deps = [
deps = [
"//solvers:mathematical_program",
"//solvers:mathematical_program_result",
],
deps = [
implementation_deps = [
"//geometry/optimization:convex_set",
"//solvers:solve",
],
Expand Down Expand Up @@ -75,13 +75,13 @@ drake_cc_library(
"spectrahedron.h",
"vpolytope.h",
],
interface_deps = [
deps = [
"//geometry:scene_graph",
"//math:matrix_util",
"//solvers:mathematical_program",
"//solvers:mathematical_program_result",
"//math:matrix_util",
],
deps = [
implementation_deps = [
"//geometry:read_obj",
"//solvers:aggregate_costs_constraints",
"//solvers:choose_best_solver",
Expand Down
Loading

0 comments on commit cf3d933

Please sign in to comment.