From cd3dc22c3ab7d75e79fd95799fcccac36e09729c Mon Sep 17 00:00:00 2001 From: Jeremy Nimmer Date: Tue, 17 Apr 2018 09:57:49 -0400 Subject: [PATCH] Revert "Add drake_cc_package_library and library_lint" This reverts commit f942383ac50417a7842deb75657a05247b82eb28. --- automotive/maliput/api/BUILD.bazel | 17 +-- .../maliput/api/test_utilities/BUILD.bazel | 10 +- automotive/maliput/dragway/BUILD.bazel | 13 +- automotive/maliput/monolane/BUILD.bazel | 7 +- automotive/maliput/multilane/BUILD.bazel | 7 +- .../multilane/test_utilities/BUILD.bazel | 9 +- automotive/maliput/rndf/BUILD.bazel | 7 +- .../maliput/rndf/test_utilities/BUILD.bazel | 9 +- automotive/maliput/simplerulebook/BUILD.bazel | 7 +- automotive/maliput/utility/BUILD.bazel | 15 +- common/BUILD.bazel | 22 ++- common/test_utilities/BUILD.bazel | 16 +-- examples/rod2d/BUILD.bazel | 3 +- lcm/BUILD.bazel | 6 +- multibody/benchmarks/acrobot/BUILD.bazel | 6 +- multibody/benchmarks/free_body/BUILD.bazel | 17 +-- multibody/collision/BUILD.bazel | 22 +-- multibody/constraint/BUILD.bazel | 17 +-- multibody/joints/BUILD.bazel | 17 +-- multibody/multibody_tree/BUILD.bazel | 23 +--- .../multibody_plant/BUILD.bazel | 13 +- multibody/parsers/BUILD.bazel | 15 +- multibody/rigid_body_plant/BUILD.bazel | 3 - multibody/shapes/BUILD.bazel | 17 +-- systems/analysis/BUILD.bazel | 16 +-- systems/analysis/test_utilities/BUILD.bazel | 9 +- systems/controllers/plan_eval/BUILD.bazel | 2 +- .../qp_inverse_dynamics/BUILD.bazel | 21 ++- systems/framework/BUILD.bazel | 13 +- systems/framework/test_utilities/BUILD.bazel | 11 +- systems/lcm/BUILD.bazel | 6 +- systems/plants/spring_mass_system/BUILD.bazel | 17 +-- systems/primitives/BUILD.bazel | 14 +- systems/sensors/BUILD.bazel | 15 +- tools/install/libdrake/build_components.bzl | 3 +- tools/lint/BUILD.bazel | 6 - tools/lint/library_lint.bzl | 129 ------------------ tools/lint/library_lint_reporter.py | 82 ----------- tools/lint/lint.bzl | 7 +- tools/skylark/drake_cc.bzl | 36 ----- util/BUILD.bazel | 23 +--- 41 files changed, 110 insertions(+), 598 deletions(-) delete mode 100644 tools/lint/library_lint.bzl delete mode 100644 tools/lint/library_lint_reporter.py diff --git a/automotive/maliput/api/BUILD.bazel b/automotive/maliput/api/BUILD.bazel index c3235984c6d4..905cdd4f657a 100644 --- a/automotive/maliput/api/BUILD.bazel +++ b/automotive/maliput/api/BUILD.bazel @@ -1,24 +1,12 @@ # -*- python -*- -load( - "@drake//tools/skylark:drake_cc.bzl", - "drake_cc_googletest", - "drake_cc_library", - "drake_cc_package_library", -) +load("//tools:drake.bzl", "drake_cc_googletest", "drake_cc_library") load("//tools/lint:lint.bzl", "add_lint_tests") package(default_visibility = ["//visibility:public"]) -drake_cc_package_library( - name = "api", - deps = [ - ":everything", - ], -) - drake_cc_library( - name = "everything", + name = "api", srcs = [ "lane.cc", "lane_data.cc", @@ -37,7 +25,6 @@ drake_cc_library( "segment.h", "type_specific_identifier.h", ], - visibility = ["//visibility:private"], deps = [ "//common:default_scalars", "//common:essential", diff --git a/automotive/maliput/api/test_utilities/BUILD.bazel b/automotive/maliput/api/test_utilities/BUILD.bazel index 98f4e6a6503d..89c83304b3bd 100644 --- a/automotive/maliput/api/test_utilities/BUILD.bazel +++ b/automotive/maliput/api/test_utilities/BUILD.bazel @@ -1,20 +1,16 @@ # -*- python -*- -load( - "@drake//tools/skylark:drake_cc.bzl", - "drake_cc_library", - "drake_cc_package_library", -) +load("//tools:drake.bzl", "drake_cc_library") load("//tools/lint:lint.bzl", "add_lint_tests") package(default_visibility = ["//visibility:public"]) -drake_cc_package_library( +# This should encompass every cc_library in this package. +drake_cc_library( name = "test_utilities", testonly = 1, deps = [ ":maliput_types_compare", - ":rules_test_utilities", ], ) diff --git a/automotive/maliput/dragway/BUILD.bazel b/automotive/maliput/dragway/BUILD.bazel index a70ee7414e1a..9ef82c50d73a 100644 --- a/automotive/maliput/dragway/BUILD.bazel +++ b/automotive/maliput/dragway/BUILD.bazel @@ -1,25 +1,17 @@ # -*- python -*- load( - "@drake//tools/skylark:drake_cc.bzl", + "//tools:drake.bzl", "drake_cc_binary", "drake_cc_googletest", "drake_cc_library", - "drake_cc_package_library", ) load("//tools/lint:lint.bzl", "add_lint_tests") package(default_visibility = ["//visibility:public"]) -drake_cc_package_library( - name = "dragway", - deps = [ - ":everything", - ], -) - drake_cc_library( - name = "everything", + name = "dragway", srcs = [ "branch_point.cc", "junction.cc", @@ -34,7 +26,6 @@ drake_cc_library( "road_geometry.h", "segment.h", ], - visibility = ["//visibility:private"], deps = [ "//automotive/maliput/api", "//common:essential", diff --git a/automotive/maliput/monolane/BUILD.bazel b/automotive/maliput/monolane/BUILD.bazel index 9b003bd4d536..6b6c452af771 100644 --- a/automotive/maliput/monolane/BUILD.bazel +++ b/automotive/maliput/monolane/BUILD.bazel @@ -1,11 +1,10 @@ # -*- python -*- load( - "@drake//tools/skylark:drake_cc.bzl", + "//tools:drake.bzl", "drake_cc_binary", "drake_cc_googletest", "drake_cc_library", - "drake_cc_package_library", ) load( "@drake//tools/skylark:drake_py.bzl", @@ -15,8 +14,10 @@ load("//tools/lint:lint.bzl", "add_lint_tests") package(default_visibility = ["//visibility:public"]) -drake_cc_package_library( +drake_cc_library( name = "monolane", + srcs = [], + hdrs = [], deps = [ ":builder", ":lanes", diff --git a/automotive/maliput/multilane/BUILD.bazel b/automotive/maliput/multilane/BUILD.bazel index c9e012c556bd..520242551c17 100644 --- a/automotive/maliput/multilane/BUILD.bazel +++ b/automotive/maliput/multilane/BUILD.bazel @@ -1,11 +1,10 @@ # -*- python -*- load( - "@drake//tools/skylark:drake_cc.bzl", + "//tools:drake.bzl", "drake_cc_binary", "drake_cc_googletest", "drake_cc_library", - "drake_cc_package_library", ) load( "@drake//tools/skylark:drake_py.bzl", @@ -15,8 +14,10 @@ load("//tools/lint:lint.bzl", "add_lint_tests") package(default_visibility = ["//visibility:public"]) -drake_cc_package_library( +drake_cc_library( name = "multilane", + srcs = [], + hdrs = [], deps = [ ":builder", ":lanes", diff --git a/automotive/maliput/multilane/test_utilities/BUILD.bazel b/automotive/maliput/multilane/test_utilities/BUILD.bazel index 588e3dcda036..b7f990977520 100644 --- a/automotive/maliput/multilane/test_utilities/BUILD.bazel +++ b/automotive/maliput/multilane/test_utilities/BUILD.bazel @@ -1,16 +1,13 @@ # -*- python -*- # This file contains rules for Bazel; see drake/doc/bazel.rst. -load( - "@drake//tools/skylark:drake_cc.bzl", - "drake_cc_library", - "drake_cc_package_library", -) +load("//tools:drake.bzl", "drake_cc_library") load("//tools/lint:lint.bzl", "add_lint_tests") package(default_visibility = ["//visibility:public"]) -drake_cc_package_library( +# This should encompass every cc_library in this package. +drake_cc_library( name = "test_utilities", testonly = 1, deps = [ diff --git a/automotive/maliput/rndf/BUILD.bazel b/automotive/maliput/rndf/BUILD.bazel index 031ae46b6bd1..d8ebb3b51e4b 100644 --- a/automotive/maliput/rndf/BUILD.bazel +++ b/automotive/maliput/rndf/BUILD.bazel @@ -1,18 +1,19 @@ # -*- python -*- load( - "@drake//tools/skylark:drake_cc.bzl", + "//tools:drake.bzl", "drake_cc_binary", "drake_cc_googletest", "drake_cc_library", - "drake_cc_package_library", ) load("//tools/lint:lint.bzl", "add_lint_tests") package(default_visibility = ["//visibility:public"]) -drake_cc_package_library( +drake_cc_library( name = "rndf", + srcs = [], + hdrs = [], deps = [ ":builder", ":lanes", diff --git a/automotive/maliput/rndf/test_utilities/BUILD.bazel b/automotive/maliput/rndf/test_utilities/BUILD.bazel index 18f0638a266f..22ed04f55106 100644 --- a/automotive/maliput/rndf/test_utilities/BUILD.bazel +++ b/automotive/maliput/rndf/test_utilities/BUILD.bazel @@ -1,15 +1,12 @@ # -*- python -*- -load( - "@drake//tools/skylark:drake_cc.bzl", - "drake_cc_library", - "drake_cc_package_library", -) +load("//tools:drake.bzl", "drake_cc_library") load("//tools/lint:lint.bzl", "add_lint_tests") package(default_visibility = ["//visibility:public"]) -drake_cc_package_library( +# This should encompass every cc_library in this package. +drake_cc_library( name = "test_utilities", testonly = 1, deps = [ diff --git a/automotive/maliput/simplerulebook/BUILD.bazel b/automotive/maliput/simplerulebook/BUILD.bazel index a2a3585784c7..b7094682ea01 100644 --- a/automotive/maliput/simplerulebook/BUILD.bazel +++ b/automotive/maliput/simplerulebook/BUILD.bazel @@ -1,17 +1,18 @@ # -*- python -*- load( - "@drake//tools/skylark:drake_cc.bzl", + "//tools:drake.bzl", "drake_cc_googletest", "drake_cc_library", - "drake_cc_package_library", ) load("//tools/lint:lint.bzl", "add_lint_tests") package(default_visibility = ["//visibility:public"]) -drake_cc_package_library( +drake_cc_library( name = "simplerulebook", + srcs = [], + hdrs = [], deps = [ ":simple_rulebook", ":yaml_io", diff --git a/automotive/maliput/utility/BUILD.bazel b/automotive/maliput/utility/BUILD.bazel index 9120ea3bd3ff..52e6d5aeaa7d 100644 --- a/automotive/maliput/utility/BUILD.bazel +++ b/automotive/maliput/utility/BUILD.bazel @@ -1,11 +1,10 @@ # -*- python -*- load( - "@drake//tools/skylark:drake_cc.bzl", - "drake_cc_binary", + "//tools:drake.bzl", "drake_cc_googletest", "drake_cc_library", - "drake_cc_package_library", + "drake_cc_binary", ) load( "@drake//tools/skylark:drake_py.bzl", @@ -15,15 +14,8 @@ load("//tools/lint:lint.bzl", "add_lint_tests") package(default_visibility = ["//visibility:public"]) -drake_cc_package_library( - name = "utility", - deps = [ - ":everything", - ], -) - drake_cc_library( - name = "everything", + name = "utility", srcs = [ "generate_obj.cc", "generate_urdf.cc", @@ -32,7 +24,6 @@ drake_cc_library( "generate_obj.h", "generate_urdf.h", ], - visibility = ["//visibility:private"], deps = [ "//automotive/maliput/api", "//math:geometric_transform", diff --git a/common/BUILD.bazel b/common/BUILD.bazel index 58826cca1cd2..ba391c592cf6 100644 --- a/common/BUILD.bazel +++ b/common/BUILD.bazel @@ -1,11 +1,10 @@ # -*- python -*- load( - "@drake//tools/skylark:drake_cc.bzl", + "//tools:drake.bzl", "drake_cc_binary", "drake_cc_googletest", "drake_cc_library", - "drake_cc_package_library", ) load( "@drake//tools/skylark:drake_py.bzl", @@ -17,8 +16,11 @@ load("//tools/lint:lint.bzl", "add_lint_tests") package(default_visibility = ["//visibility:public"]) -drake_cc_package_library( +# This should encompass every non-testonly cc_library in this package, +# except for items that should only ever be linked into main() programs. +drake_cc_library( name = "common", + srcs = [], deps = [ ":autodiff", ":autodiffxd_make_coherent", @@ -50,6 +52,9 @@ drake_cc_package_library( ":type_safe_index", ":unused", ], + # Intentionally excluded items: + # - text_logging_gflags + # - text_logging_gflags_h ) # A library of things that EVERYONE should want and MUST EAT. @@ -374,11 +379,6 @@ drake_cc_library( "//tools/cc_toolchain:linux": ["-pthread"], "//conditions:default": [], }), - tags = [ - # Don't add this library into the ":common" package library. - # Only programs with a main() function should ever use this header. - "exclude_from_package", - ], deps = [ ":essential", "@gflags", @@ -391,12 +391,6 @@ drake_cc_library( drake_cc_library( name = "text_logging_gflags_h", hdrs = ["text_logging_gflags.h"], - tags = [ - # Don't add this library into the ":common" package library. - # This rule should only be used for install purposes. - "exclude_from_package", - ], - # This rule should only be used for install purposes. visibility = ["//tools/install/libdrake:__pkg__"], ) diff --git a/common/test_utilities/BUILD.bazel b/common/test_utilities/BUILD.bazel index 8a5f2cf237d7..7b379ab016eb 100644 --- a/common/test_utilities/BUILD.bazel +++ b/common/test_utilities/BUILD.bazel @@ -1,10 +1,9 @@ # -*- python -*- load( - "@drake//tools/skylark:drake_cc.bzl", + "//tools:drake.bzl", "drake_cc_googletest", "drake_cc_library", - "drake_cc_package_library", ) load( "@drake//tools/skylark:drake_py.bzl", @@ -20,9 +19,11 @@ exports_files([ # This should encompass every cc_library in this package, except for items that # should only ever be linked into main() programs. -drake_cc_package_library( +drake_cc_library( name = "test_utilities", testonly = 1, + srcs = [], + hdrs = [], deps = [ ":eigen_geometry_compare", ":eigen_matrix_compare", @@ -33,6 +34,8 @@ drake_cc_package_library( ":random_polynomial_matrix", ":symbolic_test_util", ], + # Intentionally excluded items: + # - drake_cc_googletest_main ) drake_cc_library( @@ -102,15 +105,12 @@ drake_cc_library( ], ) +# This is only intended to be used by the drake_cc_googletest() macro. +# Do not add it to ":test_utilities". drake_cc_library( name = "drake_cc_googletest_main", testonly = 1, srcs = ["drake_cc_googletest_main.cc"], - tags = [ - # This is only intended to be used by the drake_cc_googletest() macro. - # Don't add this library into the ":test_utilities" package library. - "exclude_from_package", - ], deps = [ "//common:text_logging_gflags", "@gtest//:without_main", diff --git a/examples/rod2d/BUILD.bazel b/examples/rod2d/BUILD.bazel index c49ac68be6b4..43aff0ade06b 100644 --- a/examples/rod2d/BUILD.bazel +++ b/examples/rod2d/BUILD.bazel @@ -51,6 +51,7 @@ drake_cc_library( ":rod2d_state_vector", "//common:essential", "//multibody/constraint", + "//multibody/constraint:constraint_solver", "//solvers:mathematical_program", "//systems/framework:leaf_system", "//systems/rendering:pose_vector", @@ -65,7 +66,7 @@ drake_cc_googletest( ":rod2d", "//common:essential", "//common/test_utilities:eigen_matrix_compare", - "//multibody/constraint", + "//multibody/constraint:constraint_solver", "//systems/analysis", ], ) diff --git a/lcm/BUILD.bazel b/lcm/BUILD.bazel index 9cd1ebb53908..3efa61c0a4af 100644 --- a/lcm/BUILD.bazel +++ b/lcm/BUILD.bazel @@ -133,8 +133,4 @@ drake_py_test( deps = ["@lcm//:lcm-python"], ) -add_lint_tests( - # We need to more seriously refactor and deprecate some names here before - # we can start following package_library conventions. - enable_library_lint = False, -) +add_lint_tests() diff --git a/multibody/benchmarks/acrobot/BUILD.bazel b/multibody/benchmarks/acrobot/BUILD.bazel index 8a83653eefb4..4b517f2eae19 100644 --- a/multibody/benchmarks/acrobot/BUILD.bazel +++ b/multibody/benchmarks/acrobot/BUILD.bazel @@ -40,8 +40,4 @@ drake_cc_library( ], ) -add_lint_tests( - # We need to more seriously refactor and deprecate some names here before - # we can start following package_library conventions. - enable_library_lint = False, -) +add_lint_tests() diff --git a/multibody/benchmarks/free_body/BUILD.bazel b/multibody/benchmarks/free_body/BUILD.bazel index 2f3090c94859..b1b8f1a3bff0 100644 --- a/multibody/benchmarks/free_body/BUILD.bazel +++ b/multibody/benchmarks/free_body/BUILD.bazel @@ -1,11 +1,6 @@ # -*- python -*- -load( - "@drake//tools/skylark:drake_cc.bzl", - "drake_cc_googletest", - "drake_cc_library", - "drake_cc_package_library", -) +load("//tools:drake.bzl", "drake_cc_googletest", "drake_cc_library") load("//tools/lint:lint.bzl", "add_lint_tests") package(default_visibility = ["//visibility:public"]) @@ -21,22 +16,14 @@ filegroup( ]), ) -drake_cc_package_library( - name = "free_body", - deps = [ - ":everything", - ], -) - drake_cc_library( - name = "everything", + name = "free_body", srcs = [ "free_body.cc", ], hdrs = [ "free_body.h", ], - visibility = ["//visibility:private"], deps = [ "//common", "//math:geometric_transform", diff --git a/multibody/collision/BUILD.bazel b/multibody/collision/BUILD.bazel index 34842786f41e..4eb99cda3463 100644 --- a/multibody/collision/BUILD.bazel +++ b/multibody/collision/BUILD.bazel @@ -1,27 +1,10 @@ # -*- python -*- -load( - "@drake//tools/skylark:drake_cc.bzl", - "drake_cc_googletest", - "drake_cc_library", - "drake_cc_package_library", -) +load("//tools:drake.bzl", "drake_cc_googletest", "drake_cc_library") load("//tools/lint:lint.bzl", "add_lint_tests") package(default_visibility = ["//visibility:public"]) -drake_cc_package_library( - name = "collision", - deps = [ - ":bullet_collision", - ":collision_api", - ":drake_collision", - ":fcl_collision", - ":model", - ":unusable_collision", - ], -) - drake_cc_library( name = "model", srcs = [ @@ -97,12 +80,11 @@ drake_cc_library( # By default, supply a bullet-only model. As we gain more collision library # choices, we may want to be more subtle here. drake_cc_library( - name = "drake_collision", + name = "collision", srcs = [ "drake_collision.cc", ], defines = ["BULLET_COLLISION"], - visibility = ["//visibility:private"], deps = [ ":bullet_collision", ":collision_api", diff --git a/multibody/constraint/BUILD.bazel b/multibody/constraint/BUILD.bazel index 7d2df532a9dc..7c3c80e0dbb9 100644 --- a/multibody/constraint/BUILD.bazel +++ b/multibody/constraint/BUILD.bazel @@ -1,26 +1,17 @@ # -*- python -*- load( - "@drake//tools/skylark:drake_cc.bzl", - "drake_cc_binary", + "//tools:drake.bzl", "drake_cc_googletest", "drake_cc_library", - "drake_cc_package_library", + "drake_cc_binary", ) load("//tools/lint:lint.bzl", "add_lint_tests") package(default_visibility = ["//visibility:public"]) -drake_cc_package_library( - name = "constraint", - deps = [ - ":constraint_problem_data", - ":constraint_solver", - ], -) - drake_cc_library( - name = "constraint_problem_data", + name = "constraint", hdrs = [ "constraint_problem_data.h", ], @@ -36,7 +27,7 @@ drake_cc_library( "constraint_solver.h", ], deps = [ - ":constraint_problem_data", + ":constraint", "//solvers:mathematical_program", ], ) diff --git a/multibody/joints/BUILD.bazel b/multibody/joints/BUILD.bazel index a8fd62f43dd6..ecf4c24c16cf 100644 --- a/multibody/joints/BUILD.bazel +++ b/multibody/joints/BUILD.bazel @@ -1,24 +1,12 @@ # -*- python -*- -load( - "@drake//tools/skylark:drake_cc.bzl", - "drake_cc_googletest", - "drake_cc_library", - "drake_cc_package_library", -) +load("//tools:drake.bzl", "drake_cc_googletest", "drake_cc_library") load("//tools/lint:lint.bzl", "add_lint_tests") package(default_visibility = ["//visibility:public"]) -drake_cc_package_library( - name = "joints", - deps = [ - ":everything", - ], -) - drake_cc_library( - name = "everything", + name = "joints", srcs = [ "drake_joint.cc", "fixed_joint.cc", @@ -43,7 +31,6 @@ drake_cc_library( "revolute_joint.h", "roll_pitch_yaw_floating_joint.h", ], - visibility = ["//visibility:private"], deps = [ "//common:essential", "//common:unused", diff --git a/multibody/multibody_tree/BUILD.bazel b/multibody/multibody_tree/BUILD.bazel index 42e94b083609..29996298a421 100755 --- a/multibody/multibody_tree/BUILD.bazel +++ b/multibody/multibody_tree/BUILD.bazel @@ -1,10 +1,9 @@ # -*- python -*- load( - "@drake//tools/skylark:drake_cc.bzl", + "//tools:drake.bzl", "drake_cc_googletest", "drake_cc_library", - "drake_cc_package_library", ) load("//tools/lint:lint.bzl", "add_lint_tests") @@ -12,21 +11,6 @@ package( default_visibility = ["//visibility:public"], ) -drake_cc_package_library( - name = "multibody_tree", - deps = [ - ":articulated_body_inertia", - ":multibody_tree_context", - ":multibody_tree_core", - ":multibody_tree_element", - ":multibody_tree_indexes", - ":multibody_tree_topology", - ":rotational_inertia", - ":spatial_inertia", - ":unit_inertia", - ], -) - drake_cc_library( name = "multibody_tree_indexes", srcs = [], @@ -85,7 +69,7 @@ drake_cc_library( ) drake_cc_library( - name = "multibody_tree_core", + name = "multibody_tree", srcs = [ "body.cc", "body_node_impl.cc", @@ -123,9 +107,6 @@ drake_cc_library( "space_xyz_mobilizer.h", "uniform_gravity_field_element.h", ], - # Hide this library outside of this package; users shoud depend on - # ":multibody_tree" broadly, not just ":multibody_tree_core". - visibility = ["//visibility:private"], deps = [ ":multibody_tree_context", ":multibody_tree_element", diff --git a/multibody/multibody_tree/multibody_plant/BUILD.bazel b/multibody/multibody_tree/multibody_plant/BUILD.bazel index b27cf5677d22..5654f62b62c5 100644 --- a/multibody/multibody_tree/multibody_plant/BUILD.bazel +++ b/multibody/multibody_tree/multibody_plant/BUILD.bazel @@ -2,10 +2,9 @@ # This file contains rules for Bazel; see drake/doc/bazel.rst. load( - "@drake//tools/skylark:drake_cc.bzl", + "//tools:drake.bzl", "drake_cc_googletest", "drake_cc_library", - "drake_cc_package_library", ) load("//tools/lint:lint.bzl", "add_lint_tests") @@ -13,22 +12,14 @@ package( default_visibility = ["//visibility:public"], ) -drake_cc_package_library( - name = "multibody_plant", - deps = [ - ":everything", - ], -) - drake_cc_library( - name = "everything", + name = "multibody_plant", srcs = [ "multibody_plant.cc", ], hdrs = [ "multibody_plant.h", ], - visibility = ["//visibility:private"], deps = [ ":coulomb_friction", "//common:default_scalars", diff --git a/multibody/parsers/BUILD.bazel b/multibody/parsers/BUILD.bazel index 823fc5736fb0..ed99db71cf12 100644 --- a/multibody/parsers/BUILD.bazel +++ b/multibody/parsers/BUILD.bazel @@ -1,25 +1,17 @@ # -*- python -*- load( - "@drake//tools/skylark:drake_cc.bzl", - "drake_cc_binary", + "//tools:drake.bzl", "drake_cc_googletest", "drake_cc_library", - "drake_cc_package_library", + "drake_cc_binary", ) load("//tools/lint:lint.bzl", "add_lint_tests") package(default_visibility = ["//visibility:public"]) -drake_cc_package_library( - name = "parsers", - deps = [ - ":everything", - ], -) - drake_cc_library( - name = "everything", + name = "parsers", srcs = [ "model_instance_id_table.cc", "package_map.cc", @@ -36,7 +28,6 @@ drake_cc_library( "urdf_parser.h", "xml_util.h", ], - visibility = ["//visibility:private"], deps = [ "//multibody:rigid_body_tree", "//multibody/rigid_body_plant:compliant_material", diff --git a/multibody/rigid_body_plant/BUILD.bazel b/multibody/rigid_body_plant/BUILD.bazel index f8ab6ae483df..3d4fd3346ef2 100644 --- a/multibody/rigid_body_plant/BUILD.bazel +++ b/multibody/rigid_body_plant/BUILD.bazel @@ -291,9 +291,6 @@ filegroup( ) add_lint_tests( - # We need to more seriously refactor and deprecate some names here before - # we can start following package_library conventions. - enable_library_lint = False, python_lint_extra_srcs = glob([ "visualization/*.py", ]), diff --git a/multibody/shapes/BUILD.bazel b/multibody/shapes/BUILD.bazel index 8974d0c54626..bec4afc2291b 100644 --- a/multibody/shapes/BUILD.bazel +++ b/multibody/shapes/BUILD.bazel @@ -1,24 +1,12 @@ # -*- python -*- -load( - "@drake//tools/skylark:drake_cc.bzl", - "drake_cc_googletest", - "drake_cc_library", - "drake_cc_package_library", -) +load("//tools:drake.bzl", "drake_cc_googletest", "drake_cc_library") load("//tools/lint:lint.bzl", "add_lint_tests") package(default_visibility = ["//visibility:public"]) -drake_cc_package_library( - name = "shapes", - deps = [ - ":everything", - ], -) - drake_cc_library( - name = "everything", + name = "shapes", srcs = [ "element.cc", "geometry.cc", @@ -30,7 +18,6 @@ drake_cc_library( "geometry.h", "visual_element.h", ], - visibility = ["//visibility:private"], deps = [ "//common:essential", "//common:unused", diff --git a/systems/analysis/BUILD.bazel b/systems/analysis/BUILD.bazel index 65d7c6786ac9..b8baca45ab2e 100644 --- a/systems/analysis/BUILD.bazel +++ b/systems/analysis/BUILD.bazel @@ -1,27 +1,19 @@ # -*- python -*- -load( - "@drake//tools/skylark:drake_cc.bzl", - "drake_cc_googletest", - "drake_cc_library", - "drake_cc_package_library", -) +load("//tools:drake.bzl", "drake_cc_googletest", "drake_cc_library") load("//tools/lint:lint.bzl", "add_lint_tests") package(default_visibility = ["//visibility:public"]) -drake_cc_package_library( +drake_cc_library( name = "analysis", + srcs = [], + hdrs = [], deps = [ - ":antiderivative_function", ":explicit_euler_integrator", ":implicit_euler_integrator", - ":initial_value_problem", - ":integrator_base", - ":lyapunov", ":runge_kutta2_integrator", ":runge_kutta3_integrator", - ":scalar_initial_value_problem", ":semi_explicit_euler_integrator", ":simulator", ], diff --git a/systems/analysis/test_utilities/BUILD.bazel b/systems/analysis/test_utilities/BUILD.bazel index 18cd1b7cbf3d..58a99af821e9 100644 --- a/systems/analysis/test_utilities/BUILD.bazel +++ b/systems/analysis/test_utilities/BUILD.bazel @@ -1,16 +1,11 @@ # -*- python -*- -load( - "@drake//tools/skylark:drake_cc.bzl", - "drake_cc_googletest", - "drake_cc_library", - "drake_cc_package_library", -) +load("//tools:drake.bzl", "drake_cc_googletest", "drake_cc_library") load("//tools/lint:lint.bzl", "add_lint_tests") package(default_visibility = ["//visibility:public"]) -drake_cc_package_library( +drake_cc_library( name = "test_utilities", testonly = 1, deps = [ diff --git a/systems/controllers/plan_eval/BUILD.bazel b/systems/controllers/plan_eval/BUILD.bazel index 7a94a650bc06..93b94288e055 100644 --- a/systems/controllers/plan_eval/BUILD.bazel +++ b/systems/controllers/plan_eval/BUILD.bazel @@ -23,7 +23,7 @@ drake_cc_library( "//manipulation/util:trajectory_utils", "//multibody:rigid_body_tree_alias_groups", "//systems/controllers:setpoint", - "//systems/controllers/qp_inverse_dynamics:control", + "//systems/controllers/qp_inverse_dynamics", "//systems/controllers/qp_inverse_dynamics:param_parser", "//systems/framework:value", ], diff --git a/systems/controllers/qp_inverse_dynamics/BUILD.bazel b/systems/controllers/qp_inverse_dynamics/BUILD.bazel index 3ed6f5a5fe72..871966043ac5 100644 --- a/systems/controllers/qp_inverse_dynamics/BUILD.bazel +++ b/systems/controllers/qp_inverse_dynamics/BUILD.bazel @@ -34,8 +34,8 @@ drake_cc_library( "param_parser.h", ], deps = [ - ":control", ":id_controller_config", + ":qp_inverse_dynamics", "//common/proto:protobuf", "//multibody:rigid_body_tree_alias_groups", ], @@ -55,12 +55,7 @@ drake_cc_library( ) drake_cc_library( - # We use the label name ":control" (even though the files are not named - # that way) because the name ":qp_inverse_dynamics" is reserved for the - # drake_cc_package_library that provides all of the code from this package - # in a single library. Since our package has more code than just this - # controller, we need to use a name that implies a smaller scope. - name = "control", + name = "qp_inverse_dynamics", srcs = [ "qp_inverse_dynamics.cc", "qp_inverse_dynamics_common.cc", @@ -83,9 +78,9 @@ drake_cc_library( srcs = ["qp_inverse_dynamics_system.cc"], hdrs = ["qp_inverse_dynamics_system.h"], deps = [ - ":control", "//lcmtypes:inverse_dynamics_debug_info", "//multibody:rigid_body_tree", + "//systems/controllers/qp_inverse_dynamics", "//systems/framework:leaf_system", ], ) @@ -95,7 +90,7 @@ drake_cc_library( srcs = ["lcm_utils.cc"], hdrs = ["lcm_utils.h"], deps = [ - ":control", + ":qp_inverse_dynamics", "//lcmtypes:body_acceleration", "//lcmtypes:constrained_values", "//lcmtypes:contact_information", @@ -113,8 +108,8 @@ drake_cc_library( srcs = ["qp_output_translator_system.cc"], hdrs = ["qp_output_translator_system.h"], deps = [ - ":control", "//multibody:rigid_body_tree", + "//systems/controllers/qp_inverse_dynamics", "//systems/framework:leaf_system", "@lcmtypes_bot2_core", ], @@ -173,8 +168,8 @@ drake_cc_googletest( ], tags = gurobi_test_tags(), deps = [ - ":control", ":param_parser", + ":qp_inverse_dynamics", "//common:find_resource", "//common/test_utilities:eigen_matrix_compare", "//multibody/parsers", @@ -230,13 +225,13 @@ drake_cc_googletest( ], tags = gurobi_test_tags(), deps = [ - ":control", - ":param_parser", "//common:find_resource", "//common/test_utilities:eigen_matrix_compare", "//examples/valkyrie:valkyrie_constants", "//multibody/parsers", "//systems/controllers:setpoint", + "//systems/controllers/qp_inverse_dynamics", + "//systems/controllers/qp_inverse_dynamics:param_parser", ], ) diff --git a/systems/framework/BUILD.bazel b/systems/framework/BUILD.bazel index cdac208ad5f8..1c4c87eb9fab 100644 --- a/systems/framework/BUILD.bazel +++ b/systems/framework/BUILD.bazel @@ -1,21 +1,17 @@ # -*- python -*- -load( - "@drake//tools/skylark:drake_cc.bzl", - "drake_cc_googletest", - "drake_cc_library", - "drake_cc_package_library", -) +load("//tools:drake.bzl", "drake_cc_googletest", "drake_cc_library") load("//tools/lint:lint.bzl", "add_lint_tests") package(default_visibility = ["//visibility:public"]) -drake_cc_package_library( +# This should encompass every non-testonly cc_library in this package. +drake_cc_library( name = "framework", + srcs = [], deps = [ ":abstract_values", ":cache_and_dependency_tracker", - ":cache_entry", ":context", ":context_base", ":continuous_state", @@ -44,7 +40,6 @@ drake_cc_package_library( ":system_scalar_converter", ":system_symbolic_inspector", ":value", - ":value_checker", ":vector", ":vector_system", ], diff --git a/systems/framework/test_utilities/BUILD.bazel b/systems/framework/test_utilities/BUILD.bazel index e2133e4aed0a..984cd33b8e1b 100644 --- a/systems/framework/test_utilities/BUILD.bazel +++ b/systems/framework/test_utilities/BUILD.bazel @@ -1,18 +1,15 @@ # -*- python -*- -load( - "@drake//tools/skylark:drake_cc.bzl", - "drake_cc_googletest", - "drake_cc_library", - "drake_cc_package_library", -) +load("//tools:drake.bzl", "drake_cc_googletest", "drake_cc_library") load("//tools/lint:lint.bzl", "add_lint_tests") package(default_visibility = ["//visibility:public"]) -drake_cc_package_library( +drake_cc_library( name = "test_utilities", testonly = 1, + srcs = [], + hdrs = [], deps = [ ":my_vector", ":pack_value", diff --git a/systems/lcm/BUILD.bazel b/systems/lcm/BUILD.bazel index fe7afdb31a62..b9ea781ae90b 100644 --- a/systems/lcm/BUILD.bazel +++ b/systems/lcm/BUILD.bazel @@ -171,8 +171,4 @@ drake_cc_googletest( ], ) -add_lint_tests( - # We need to more seriously refactor and deprecate some names here before - # we can start following package_library conventions. - enable_library_lint = False, -) +add_lint_tests() diff --git a/systems/plants/spring_mass_system/BUILD.bazel b/systems/plants/spring_mass_system/BUILD.bazel index 9a62ef281ad0..1dbeb54f21f9 100644 --- a/systems/plants/spring_mass_system/BUILD.bazel +++ b/systems/plants/spring_mass_system/BUILD.bazel @@ -1,27 +1,14 @@ # -*- python -*- -load( - "@drake//tools/skylark:drake_cc.bzl", - "drake_cc_googletest", - "drake_cc_library", - "drake_cc_package_library", -) +load("//tools:drake.bzl", "drake_cc_googletest", "drake_cc_library") load("//tools/lint:lint.bzl", "add_lint_tests") package(default_visibility = ["//visibility:public"]) -drake_cc_package_library( - name = "spring_mass_system", - deps = [ - ":everything", - ], -) - drake_cc_library( - name = "everything", + name = "spring_mass_system", srcs = ["spring_mass_system.cc"], hdrs = ["spring_mass_system.h"], - visibility = ["//visibility:private"], deps = [ "//systems/framework", ], diff --git a/systems/primitives/BUILD.bazel b/systems/primitives/BUILD.bazel index 2020c0cf0307..34f84eb8a85b 100644 --- a/systems/primitives/BUILD.bazel +++ b/systems/primitives/BUILD.bazel @@ -1,21 +1,17 @@ # -*- python -*- -load( - "@drake//tools/skylark:drake_cc.bzl", - "drake_cc_googletest", - "drake_cc_library", - "drake_cc_package_library", -) +load("//tools:drake.bzl", "drake_cc_googletest", "drake_cc_library") load("//tools/lint:lint.bzl", "add_lint_tests") package(default_visibility = ["//visibility:public"]) -drake_cc_package_library( +drake_cc_library( name = "primitives", + srcs = [], + hdrs = [], deps = [ ":adder", ":affine_system", - ":barycentric_system", ":constant_value_source", ":constant_vector_source", ":demultiplexer", @@ -32,10 +28,8 @@ drake_cc_package_library( ":saturation", ":signal_log", ":signal_logger", - ":sine", ":time_varying_data", ":trajectory_source", - ":wrap_to_system", ":zero_order_hold", ], ) diff --git a/systems/sensors/BUILD.bazel b/systems/sensors/BUILD.bazel index 9750161b5e4a..e866b3ae7b1a 100644 --- a/systems/sensors/BUILD.bazel +++ b/systems/sensors/BUILD.bazel @@ -1,11 +1,10 @@ # -*- python -*- load( - "@drake//tools/skylark:drake_cc.bzl", + "//tools:drake.bzl", "drake_cc_binary", "drake_cc_googletest", "drake_cc_library", - "drake_cc_package_library", ) load( "@drake//tools/vector_gen:vector_gen.bzl", @@ -15,24 +14,18 @@ load("//tools/lint:lint.bzl", "add_lint_tests") package(default_visibility = ["//visibility:public"]) -drake_cc_package_library( +drake_cc_library( name = "sensors", + srcs = [], + hdrs = [], deps = [ ":accelerometer", ":beam_model", - ":beam_model_params", ":camera_info", ":depth_sensor", - ":depth_sensor_to_lcm_point_cloud_message", - ":gyroscope", - ":image", - ":image_to_lcm_image_array_t", - ":optitrack_encoder", - ":optitrack_sender", ":rgbd_camera", ":rgbd_renderer", ":rotary_encoders", - ":vtk_util", ], ) diff --git a/tools/install/libdrake/build_components.bzl b/tools/install/libdrake/build_components.bzl index 8f3cfd94f112..78637021c70b 100644 --- a/tools/install/libdrake/build_components.bzl +++ b/tools/install/libdrake/build_components.bzl @@ -155,7 +155,6 @@ LIBDRAKE_COMPONENTS = [ "//multibody/collision:collision_api", "//multibody/collision:model", "//multibody/constraint:constraint", - "//multibody/constraint:constraint_problem_data", "//multibody/constraint:constraint_solver", "//multibody/joints:joints", "//multibody/multibody_tree/math:spatial_acceleration", @@ -254,10 +253,10 @@ LIBDRAKE_COMPONENTS = [ "//systems/analysis:simulator", "//systems/controllers/plan_eval:generic_plan", "//systems/controllers/plan_eval:plan_eval_base_system", - "//systems/controllers/qp_inverse_dynamics:control", "//systems/controllers/qp_inverse_dynamics:id_controller_config", "//systems/controllers/qp_inverse_dynamics:lcm_utils", "//systems/controllers/qp_inverse_dynamics:param_parser", + "//systems/controllers/qp_inverse_dynamics:qp_inverse_dynamics", "//systems/controllers/qp_inverse_dynamics:qp_inverse_dynamics_system", "//systems/controllers/qp_inverse_dynamics:qp_output_translator_system", "//systems/controllers/qp_inverse_dynamics:robot_kinematic_state", diff --git a/tools/lint/BUILD.bazel b/tools/lint/BUILD.bazel index ed0636065acf..529de9c3a173 100644 --- a/tools/lint/BUILD.bazel +++ b/tools/lint/BUILD.bazel @@ -76,12 +76,6 @@ drake_py_binary( deps = [":formatter"], ) -drake_py_binary( - name = "library_lint_reporter", - testonly = 1, - srcs = ["library_lint_reporter.py"], -) - # === test === drake_py_unittest( diff --git a/tools/lint/library_lint.bzl b/tools/lint/library_lint.bzl deleted file mode 100644 index 5b3d276ceca4..000000000000 --- a/tools/lint/library_lint.bzl +++ /dev/null @@ -1,129 +0,0 @@ -# -*- python -*- - -load("//tools/skylark:drake_py.bzl", "py_test_isolated") - -# Keep this constant in sync with library_lint_reporter.py. -_TAG_EXCLUDE_FROM_PACKAGE = "exclude_from_package" - -def library_lint( - existing_rules = None): - """Within the current package, checks that drake_cc_package_library has been - used correctly, reports a lint (test) error if not. (To understand proper - use of drake_cc_package_library, consult its API documentation.) - - Note that //examples/... packages are excluded from some checks, because - they should generally not use drake_cc_package_library. - """ - if existing_rules == None: - existing_rules = native.existing_rules().values() - package_name = "//" + native.package_name() # e.g., "//systems/framework" - short_package_name = package_name.split("/")[-1] # e.g., "framework" - - # We use a python helper script to report lint errors. As we find possible - # lint problems, we will append arguments here that will be passed along to - # the helper. - library_lint_reporter_args = [ - "--package-name", package_name, - ] - library_lint_reporter_data = [] - - # Within the current package, find all cc_library rules, and the (at most) - # one package_library rule. - cc_library_rules = [] - package_library_rule = None - for one_rule in existing_rules: - # We only want cc_library. - if one_rule["kind"] != "cc_library": - continue - # Ignore magic private libraries. - if one_rule["name"].startswith("_"): - continue - # Found a cc_library. - cc_library_rules.append(one_rule) - # Is it a package_library? - if "drake_cc_package_library" in one_rule["tags"]: - not package_library_rule or fail("Two package libraries?") - package_library_rule = one_rule - elif one_rule["name"] == short_package_name: - # Failure to use drake_cc_package_library is a lint error, except - # in examples folders because their libraryes are never installed. - if not package_name.startswith("//examples"): - library_lint_reporter_args += ["--untagged-package-library"] - - # If there is no C++ code in this package, then we're done. - if not cc_library_rules: - return - - # Sanity check the package_library_rule name. - if package_library_rule and ( - package_library_rule["name"] != short_package_name): - fail("drake_cc_package_library should not allow wrong-names?!") - - # Unless the package_library rule exists and is testonly, then we should - # exclude testonly cc_library targets from the scope we're going to insist - # that it covers. - exclude_testonly = not (package_library_rule or {}).get("testonly", False) - - # We are going to run genquery over all of this package's cc_library rules. - scope = [ - package_name + ":" + one_rule["name"] - for one_rule in cc_library_rules - ] - all_libraries = " + ".join(scope) - - # This expression computes the exact result for what we want the deps of - # the drake_cc_package_library to be. - correct_deps_expression = " ".join([ - # Start with all this package's cc_library rules. - "({})".format(all_libraries), - # Remove items that have opted-out of the package_library. - "except attr(tags, '{}', {})".format( - _TAG_EXCLUDE_FROM_PACKAGE, all_libraries), - # Maybe remove libraries tagged testonly = 1. - "except attr(testonly, 1, {})".format( - all_libraries) if exclude_testonly else "", - ]) - - # Find libraries that are deps of the package_library but shouldn't be. - extra_deps_expression = "deps({}, 1) except ({})".format( - package_name, correct_deps_expression) - # Find libraries that should be deps of the package_library but aren't. - # Note that our library_lint_reporter.py tool filters out some false - # positives from this report. - missing_deps_expression = "({}) except deps({}, 1) ".format( - correct_deps_expression, package_name) - - # If there was a package_library rule, ensure its deps are comprehensive. - if package_library_rule: - native.genquery( - name = "library_lint_missing_deps", - expression = missing_deps_expression, - scope = scope, - testonly = 1, - visibility = ["//visibility:private"], - ) - native.genquery( - name = "library_lint_extra_deps", - expression = extra_deps_expression, - scope = scope, - testonly = 1, - visibility = ["//visibility:private"], - ) - library_lint_reporter_data += [ - ":library_lint_missing_deps", - ":library_lint_extra_deps", - ] - library_lint_reporter_args += [ - "--missing-deps", "$(location :library_lint_missing_deps)", - "--extra-deps", "$(location :library_lint_extra_deps)", - ] - - # Report all of the library_lint results. - py_test_isolated( - name = "library_lint", - srcs = ["@drake//tools/lint:library_lint_reporter.py"], - main = "@drake//tools/lint:library_lint_reporter.py", - args = library_lint_reporter_args, - data = library_lint_reporter_data, - tags = ["lint", "library_lint"], - ) diff --git a/tools/lint/library_lint_reporter.py b/tools/lint/library_lint_reporter.py deleted file mode 100644 index 3702656185c6..000000000000 --- a/tools/lint/library_lint_reporter.py +++ /dev/null @@ -1,82 +0,0 @@ -"""A helper program for library_lint.bzl that reports lint errors in a -human-readable way, with suggested fixes, etc. -""" - -import argparse -import sys - -# Keep this constant in sync with library_lint.bzl. -_TAG_EXCLUDE_FROM_PACKAGE = "exclude_from_package" - - -def main(): - parser = argparse.ArgumentParser( - prog='library_lint', - description=__doc__) - parser.add_argument( - '--package-name', metavar='LABEL', type=str, required=True, - help='Required name of package, e.g., //common/test_utilities') - parser.add_argument( - '--missing-deps', metavar='FILE', type=str, - help=('Filename containing list of labels that are missing. ' - 'It is a lint error when this file is non-empty.')) - parser.add_argument( - '--extra-deps', metavar='FILE', type=str, - help=('Filename containing list of labels that are extra. ' - 'It is a lint error when this file is non-empty.')) - parser.add_argument( - '--untagged-package-library', action='store_true', default=False, - help=('A cc_library exists with the short_package_name but it ' - 'does not use drake_cc_package_library')) - args = parser.parse_args() - build_file_name = args.package_name[2:] + "/BUILD.bazel" - short_package_name = args.package_name.split("/")[-1] - - return_code = 0 - - if args.untagged_package_library: - print(("error: The package {} has a cc_library(name = \":{}\") " - "declared without using drake_cc_package_library().").format( - args.package_name, - short_package_name)) - return_code = 1 - - with open(args.missing_deps or '/dev/null') as opened: - missing_deps = opened.readlines() - if missing_deps: - print(("error: Missing deps in {}'s drake_cc_package_library.").format( - args.package_name)) - print(("note: In the {} rule for drake_cc_package_library, " - "add the following lines to the deps:").format( - build_file_name)) - for dep in sorted(missing_deps): - print(" \":{}\",".format(dep.strip().split(":")[-1])) - print(("note: Alternatively, if some of these libraries should not be " - "added to the drake_cc_package_library, you may tag them with " - "\"{}\" in order to explicitly exclude them.").format( - _TAG_EXCLUDE_FROM_PACKAGE)) - return_code = 1 - - with open(args.extra_deps or '/dev/null') as opened: - extra_deps = opened.readlines() - extra_deps = [ - # Filter out false positives. All C++ code is OK to depend on these. - item for item in extra_deps - if not (item.startswith("//tools/cc_toolchain:") or - item.startswith("@bazel_tools//")) - ] - if extra_deps: - print(("error: Extra deps in {}'s drake_cc_package_library.").format( - args.package_name)) - print(("note: In the {} rule for drake_cc_package_library, " - "remove the following lines from the deps:").format( - build_file_name)) - for dep in sorted(extra_deps): - print(" \"{}\",".format(dep.strip())) - return_code = 1 - - return return_code - - -if __name__ == "__main__": - sys.exit(main()) diff --git a/tools/lint/lint.bzl b/tools/lint/lint.bzl index 82555c3cdb7f..0444e24c2ae2 100644 --- a/tools/lint/lint.bzl +++ b/tools/lint/lint.bzl @@ -2,7 +2,6 @@ load("//tools/lint:bazel_lint.bzl", "bazel_lint") load("//tools/lint:cpplint.bzl", "cpplint") -load("//tools/lint:library_lint.bzl", "library_lint") load("//tools/lint:python_lint.bzl", "python_lint") def add_lint_tests( @@ -12,8 +11,7 @@ def add_lint_tests( python_lint_exclude = None, python_lint_extra_srcs = None, bazel_lint_ignore = None, - bazel_lint_extra_srcs = None, - enable_library_lint = True): + bazel_lint_extra_srcs = None): """For every rule in the BUILD file so far, and for all Bazel files in this directory, adds test rules that run Drake's standard lint suite over the sources. Thus, BUILD file authors should call this function at the *end* @@ -38,6 +36,3 @@ def add_lint_tests( bazel_lint( ignore = bazel_lint_ignore, extra_srcs = bazel_lint_extra_srcs) - if enable_library_lint: - library_lint( - existing_rules = existing_rules) diff --git a/tools/skylark/drake_cc.bzl b/tools/skylark/drake_cc.bzl index 1afa3febe153..84e8864bb463 100644 --- a/tools/skylark/drake_cc.bzl +++ b/tools/skylark/drake_cc.bzl @@ -342,42 +342,6 @@ def drake_cc_library( install_hdrs_exclude = install_hdrs_exclude, **kwargs) -def _check_package_library_name(name): - # Assert that :name is the default library for native.package_name(). - expected_name = native.package_name().split("/")[-1] - if name != expected_name: - fail(("The drake_cc_package_library(name = \"{}\", ...) " + - "should be named \"{}\"").format(name, expected_name)) - -def drake_cc_package_library( - name, - deps = [], - testonly = 0, - visibility = ["//visibility:public"]): - """Creates a rule to declare a C++ "package" library -- a library whose - target name matches the current package and whose dependencies are - (usually) all of the other drake_cc_library targets in the current package. - In short, a library named //foo/bar (short for //foo/bar:bar) that - conveniently provides all of the C++ code from the //foo/bar package in one - place. - - Using this macro documents the intent that the library is a summation of - everything in the current package and enables Drake's linter rules to - confirm that all of the drake_cc_library targets have been listed as deps. - - The name must be the same as the final element of the current package. - This rule does not accept srcs, hdrs, etc. -- only deps. - The testonly argument has the same meaning as the native cc_library. - By default, this target has public visibility, but that may be overridden. - """ - _check_package_library_name(name) - drake_cc_library( - name = name, - testonly = testonly, - tags = ["drake_cc_package_library"], - visibility = visibility, - deps = deps) - def drake_cc_binary( name, srcs = [], diff --git a/util/BUILD.bazel b/util/BUILD.bazel index c5e5f246d028..ec198da49c14 100644 --- a/util/BUILD.bazel +++ b/util/BUILD.bazel @@ -1,32 +1,20 @@ # -*- python -*- -load( - "@drake//tools/skylark:drake_cc.bzl", - "drake_cc_googletest", - "drake_cc_library", - "drake_cc_package_library", -) +load("//tools:drake.bzl", "drake_cc_googletest", "drake_cc_library") load("//tools/lint:lint.bzl", "add_lint_tests") package(default_visibility = ["//visibility:public"]) -drake_cc_package_library( - name = "util", - deps = [ - ":everything", - ], -) - drake_cc_library( - name = "everything", + name = "util", srcs = [ "drakeGeometryUtil.cpp", ], hdrs = [ "drakeGeometryUtil.h", "drakeUtil.h", + "lcmUtil.h", ], - visibility = ["//visibility:private"], deps = [ "//common:essential", "//math:geometric_transform", @@ -38,11 +26,6 @@ drake_cc_library( drake_cc_library( name = "lcm_util", hdrs = ["lcmUtil.h"], - tags = [ - # Don't add this library into the ":util" package library, since its a - # deprecated forwarding convenience and should not be used in batch. - "exclude_from_package", - ], deps = [ "//manipulation/util:bot_core_lcm_encode_decode", ],