Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add drake_cc_package_library and library_lint #8582

Merged

Conversation

jwnimmer-tri
Copy link
Collaborator

@jwnimmer-tri jwnimmer-tri commented Apr 12, 2018

This should be substantially easier to maintain correct lists, and document for authors the purpose of the package-level library without repeating identical comments everywhere.

This is also a step along the way to #6464, where libdrake will depend on just these package-summary libraries, instead of listing out each individual component.


This change is Reviewable

@jwnimmer-tri
Copy link
Collaborator Author

+@jamiesnape for design review (or as much code review as you wish also), please.
+@EricCousineau-TRI for feature review, please (waiting until Monday review day is fine).

@EricCousineau-TRI
Copy link
Contributor

:lgtm:


Reviewed 41 of 41 files at r1.
Review status: all files reviewed at latest revision, all discussions resolved.


tools/skylark/drake_cc.bzl, line 346 at r1 (raw file):

def _check_package_library_name(name):
    # Assert that :name is the default libarary for native.package_name().

BTW Spelling libarary should be library


tools/skylark/drake_cc.bzl, line 360 at r1 (raw file):

    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 convenient provides

BTW Grammar "convenient" should be "conveniently"


Comments from Reviewable

@jwnimmer-tri
Copy link
Collaborator Author

@jamiesnape any thoughts?

+@sammy-tri for platform review per schedule (tomorrow), please.
-(status: do not merge)


Review status: 39 of 41 files reviewed at latest revision, all discussions resolved.


Comments from Reviewable

@sammy-tri
Copy link
Contributor

:lgtm: modulo minor typo issue. I can't say I love the everything idiom for when you only have a single drake_cc_library which was already well formed, but it seems worth it for the lint check.


Reviewed 38 of 41 files at r1, 2 of 2 files at r2.
Review status: all files reviewed at latest revision, all discussions resolved.


automotive/maliput/api/BUILD.bazel, line 4 at r2 (raw file):

load(
    "@drake//tools/skylark:drake_cc.bzl",

BTW Why do we respell this load() to use @drake//tools but not the one below for `//tools/lint:lint.bzl"?


tools/lint/library_lint.bzl, line 15 at r2 (raw file):

    Note that //examples/... packages are excluded from some checks, because
    then should generally not use drake_cc_package_library.

typo "then" instead of "they"?


Comments from Reviewable

@jwnimmer-tri
Copy link
Collaborator Author

Review status: 40 of 41 files reviewed at latest revision, 2 unresolved discussions.


a discussion (no related file):

I can't say I love the everything idiom for when you only have a single drake_cc_library which was already well formed, but it seems worth it for the lint check.

FYI @sammy-tri In an earlier local draft of this change, I actually had a way to bless the existing cc_library into a cc_package_library without creating an :everything name. However, I felt like the UX of keeping the two ideas separate like I have it here now would be easier for developers to understand in the future. (Build system macros should be relatively more KISS than regular code, I think.)


automotive/maliput/api/BUILD.bazel, line 4 at r2 (raw file):

Previously, sammy-tri (Sam Creasey) wrote…

BTW Why do we respell this load() to use @drake//tools but not the one below for `//tools/lint:lint.bzl"?

The //tools:drake.bzl file is deprecated, and it does not offer a drake_cc_package_library forwarding macro. So we need to switch to using the bzl files that its forwarding to, which is //tools/skylark:drake_cc_bzl. That file uses the @drake// spelling to forward into, because unfortunately, due to bazelbuild/bazel#3115 we would get two different and incompatible providers using @drake//tools vs //tools, so we have to carefully use @drake// everywhere.

I don't change lint.bzl load path because there is no need in this PR, and it seems like something I should do globally if I do it.


tools/lint/library_lint.bzl, line 15 at r2 (raw file):

Previously, sammy-tri (Sam Creasey) wrote…

typo "then" instead of "they"?

Done.


Comments from Reviewable

@sammy-tri
Copy link
Contributor

Reviewed 1 of 41 files at r1, 1 of 1 files at r3.
Review status: all files reviewed at latest revision, all discussions resolved, some commit checks failed.


Comments from Reviewable

@jamiesnape
Copy link
Contributor

:lgtm:


Review status: all files reviewed at latest revision, all discussions resolved, some commit checks failed.


Comments from Reviewable

@jwnimmer-tri jwnimmer-tri merged commit 9c7040b into RobotLocomotion:master Apr 17, 2018
@jwnimmer-tri jwnimmer-tri deleted the build-libdrake-genquery branch April 17, 2018 11:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants