Skip to content

Commit

Permalink
Add drake_cc_package_library and library_lint
Browse files Browse the repository at this point in the history
  • Loading branch information
jwnimmer-tri committed Apr 17, 2018
1 parent 87ed4b3 commit f942383
Show file tree
Hide file tree
Showing 41 changed files with 598 additions and 110 deletions.
17 changes: 15 additions & 2 deletions automotive/maliput/api/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,12 +1,24 @@
# -*- python -*-

load("//tools:drake.bzl", "drake_cc_googletest", "drake_cc_library")
load(
"@drake//tools/skylark:drake_cc.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_library(
drake_cc_package_library(
name = "api",
deps = [
":everything",
],
)

drake_cc_library(
name = "everything",
srcs = [
"lane.cc",
"lane_data.cc",
Expand All @@ -25,6 +37,7 @@ drake_cc_library(
"segment.h",
"type_specific_identifier.h",
],
visibility = ["//visibility:private"],
deps = [
"//common:default_scalars",
"//common:essential",
Expand Down
10 changes: 7 additions & 3 deletions automotive/maliput/api/test_utilities/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,16 +1,20 @@
# -*- python -*-

load("//tools:drake.bzl", "drake_cc_library")
load(
"@drake//tools/skylark:drake_cc.bzl",
"drake_cc_library",
"drake_cc_package_library",
)
load("//tools/lint:lint.bzl", "add_lint_tests")

package(default_visibility = ["//visibility:public"])

# This should encompass every cc_library in this package.
drake_cc_library(
drake_cc_package_library(
name = "test_utilities",
testonly = 1,
deps = [
":maliput_types_compare",
":rules_test_utilities",
],
)

Expand Down
13 changes: 11 additions & 2 deletions automotive/maliput/dragway/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,17 +1,25 @@
# -*- python -*-

load(
"//tools:drake.bzl",
"@drake//tools/skylark:drake_cc.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_library(
drake_cc_package_library(
name = "dragway",
deps = [
":everything",
],
)

drake_cc_library(
name = "everything",
srcs = [
"branch_point.cc",
"junction.cc",
Expand All @@ -26,6 +34,7 @@ drake_cc_library(
"road_geometry.h",
"segment.h",
],
visibility = ["//visibility:private"],
deps = [
"//automotive/maliput/api",
"//common:essential",
Expand Down
7 changes: 3 additions & 4 deletions automotive/maliput/monolane/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
# -*- python -*-

load(
"//tools:drake.bzl",
"@drake//tools/skylark:drake_cc.bzl",
"drake_cc_binary",
"drake_cc_googletest",
"drake_cc_library",
"drake_cc_package_library",
)
load(
"@drake//tools/skylark:drake_py.bzl",
Expand All @@ -14,10 +15,8 @@ load("//tools/lint:lint.bzl", "add_lint_tests")

package(default_visibility = ["//visibility:public"])

drake_cc_library(
drake_cc_package_library(
name = "monolane",
srcs = [],
hdrs = [],
deps = [
":builder",
":lanes",
Expand Down
7 changes: 3 additions & 4 deletions automotive/maliput/multilane/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
# -*- python -*-

load(
"//tools:drake.bzl",
"@drake//tools/skylark:drake_cc.bzl",
"drake_cc_binary",
"drake_cc_googletest",
"drake_cc_library",
"drake_cc_package_library",
)
load(
"@drake//tools/skylark:drake_py.bzl",
Expand All @@ -14,10 +15,8 @@ load("//tools/lint:lint.bzl", "add_lint_tests")

package(default_visibility = ["//visibility:public"])

drake_cc_library(
drake_cc_package_library(
name = "multilane",
srcs = [],
hdrs = [],
deps = [
":builder",
":lanes",
Expand Down
9 changes: 6 additions & 3 deletions automotive/maliput/multilane/test_utilities/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
# -*- python -*-
# This file contains rules for Bazel; see drake/doc/bazel.rst.

load("//tools:drake.bzl", "drake_cc_library")
load(
"@drake//tools/skylark:drake_cc.bzl",
"drake_cc_library",
"drake_cc_package_library",
)
load("//tools/lint:lint.bzl", "add_lint_tests")

package(default_visibility = ["//visibility:public"])

# This should encompass every cc_library in this package.
drake_cc_library(
drake_cc_package_library(
name = "test_utilities",
testonly = 1,
deps = [
Expand Down
7 changes: 3 additions & 4 deletions automotive/maliput/rndf/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,19 +1,18 @@
# -*- python -*-

load(
"//tools:drake.bzl",
"@drake//tools/skylark:drake_cc.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_library(
drake_cc_package_library(
name = "rndf",
srcs = [],
hdrs = [],
deps = [
":builder",
":lanes",
Expand Down
9 changes: 6 additions & 3 deletions automotive/maliput/rndf/test_utilities/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
# -*- python -*-

load("//tools:drake.bzl", "drake_cc_library")
load(
"@drake//tools/skylark:drake_cc.bzl",
"drake_cc_library",
"drake_cc_package_library",
)
load("//tools/lint:lint.bzl", "add_lint_tests")

package(default_visibility = ["//visibility:public"])

# This should encompass every cc_library in this package.
drake_cc_library(
drake_cc_package_library(
name = "test_utilities",
testonly = 1,
deps = [
Expand Down
7 changes: 3 additions & 4 deletions automotive/maliput/simplerulebook/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@
# -*- python -*-

load(
"//tools:drake.bzl",
"@drake//tools/skylark:drake_cc.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_library(
drake_cc_package_library(
name = "simplerulebook",
srcs = [],
hdrs = [],
deps = [
":simple_rulebook",
":yaml_io",
Expand Down
15 changes: 12 additions & 3 deletions automotive/maliput/utility/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
# -*- python -*-

load(
"//tools:drake.bzl",
"@drake//tools/skylark:drake_cc.bzl",
"drake_cc_binary",
"drake_cc_googletest",
"drake_cc_library",
"drake_cc_binary",
"drake_cc_package_library",
)
load(
"@drake//tools/skylark:drake_py.bzl",
Expand All @@ -14,8 +15,15 @@ load("//tools/lint:lint.bzl", "add_lint_tests")

package(default_visibility = ["//visibility:public"])

drake_cc_library(
drake_cc_package_library(
name = "utility",
deps = [
":everything",
],
)

drake_cc_library(
name = "everything",
srcs = [
"generate_obj.cc",
"generate_urdf.cc",
Expand All @@ -24,6 +32,7 @@ drake_cc_library(
"generate_obj.h",
"generate_urdf.h",
],
visibility = ["//visibility:private"],
deps = [
"//automotive/maliput/api",
"//math:geometric_transform",
Expand Down
22 changes: 14 additions & 8 deletions common/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
# -*- python -*-

load(
"//tools:drake.bzl",
"@drake//tools/skylark:drake_cc.bzl",
"drake_cc_binary",
"drake_cc_googletest",
"drake_cc_library",
"drake_cc_package_library",
)
load(
"@drake//tools/skylark:drake_py.bzl",
Expand All @@ -16,11 +17,8 @@ load("//tools/lint:lint.bzl", "add_lint_tests")

package(default_visibility = ["//visibility:public"])

# 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(
drake_cc_package_library(
name = "common",
srcs = [],
deps = [
":autodiff",
":autodiffxd_make_coherent",
Expand Down Expand Up @@ -52,9 +50,6 @@ drake_cc_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.
Expand Down Expand Up @@ -379,6 +374,11 @@ 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",
Expand All @@ -391,6 +391,12 @@ 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__"],
)

Expand Down
16 changes: 8 additions & 8 deletions common/test_utilities/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
# -*- python -*-

load(
"//tools:drake.bzl",
"@drake//tools/skylark:drake_cc.bzl",
"drake_cc_googletest",
"drake_cc_library",
"drake_cc_package_library",
)
load(
"@drake//tools/skylark:drake_py.bzl",
Expand All @@ -19,11 +20,9 @@ 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_library(
drake_cc_package_library(
name = "test_utilities",
testonly = 1,
srcs = [],
hdrs = [],
deps = [
":eigen_geometry_compare",
":eigen_matrix_compare",
Expand All @@ -34,8 +33,6 @@ drake_cc_library(
":random_polynomial_matrix",
":symbolic_test_util",
],
# Intentionally excluded items:
# - drake_cc_googletest_main
)

drake_cc_library(
Expand Down Expand Up @@ -105,12 +102,15 @@ 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",
Expand Down
3 changes: 1 addition & 2 deletions examples/rod2d/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ 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",
Expand All @@ -66,7 +65,7 @@ drake_cc_googletest(
":rod2d",
"//common:essential",
"//common/test_utilities:eigen_matrix_compare",
"//multibody/constraint:constraint_solver",
"//multibody/constraint",
"//systems/analysis",
],
)
Expand Down
Loading

0 comments on commit f942383

Please sign in to comment.