-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Teach drake bazel rules to play nicely when drake is an external bazel project #6190
Teach drake bazel rules to play nicely when drake is an external bazel project #6190
Conversation
+@jwnimmer-tri for feature review, please. Comments from Reviewable |
Maybe in future for fundamental changes like this that are going to create a lot of conflicts, send out some advanced warning. |
a discussion (no related file): Can we trickle this in, maybe? Just do the Comments from Reviewable |
Review status: 0 of 16 files reviewed at latest revision, 2 unresolved discussions, some commit checks failed. a discussion (no related file): Comments from Reviewable |
f3f3c26
to
3997715
Compare
@jamiesnape Sorry about that, this seemed like a relatively small change that would enable devs / external users to easily consume drake as an external in Bazel. If this inhibits / conflicts with someone else's PR in flight, we could always block this one until the others go in, and let that serve as the warning. Are there any PRs in particular that you are concerned about? VTK and install script stuff? Review status: 0 of 16 files reviewed at latest revision, 2 unresolved discussions. a discussion (no related file): Previously, jwnimmer-tri (Jeremy Nimmer) wrote…
Yup, shall do. a discussion (no related file): Previously, jwnimmer-tri (Jeremy Nimmer) wrote…
Right now, I am thinking of my own projects for one-off prototypes to inform design decisions. Could we not use a dummy external in CI to get this workflow started as soon as possible? And this is not critical to be in Comments from Reviewable |
Sorry, @EricCousineau-TRI -- this is too far outside my area of expertise to be an effective platform reviewer for it. Review status: 0 of 16 files reviewed at latest revision, 2 unresolved discussions. Comments from Reviewable |
I will wear the platform hat; just fine a second for feature review too, please. Comments from Reviewable |
* Replace `@//` with `@drake//` * Replace `tools/*.BUILD` with `@drake//tools:*.BUILD`
3997715
to
9d16d99
Compare
@sherm1 @jwnimmer-tri sounds good! +@jamiesnape for feature review, if you are available? Comments from Reviewable |
I am. No need to block if this makes your life easier. Review status: 0 of 14 files reviewed at latest revision, 1 unresolved discussion. Comments from Reviewable |
a discussion (no related file): Previously, EricCousineau-TRI wrote…
I definitely agree this moves us toward a better long-term goal. I am fine for a small dummy in CI to prove this works. (I didn't mean to imply that Spartan or something big or difficult should go into our CI). I would just ask to see the dummy stood up soonish, secured onto this PR train. If it were prototyped such that I could test it locally outside of CI while reviewing the WORKSPACE part of the next PR, all the better. It sound like you have a small downstream project working locally; getting (a cut-down version of that) into Comments from Reviewable |
a discussion (no related file): Previously, jwnimmer-tri (Jeremy Nimmer) wrote…
Awesome. I actually have a simple external based here: It has a minimal set of bash commands to clone the repository, and build what is needed. Would that work? Comments from Reviewable |
Review status: 0 of 14 files reviewed at latest revision, 1 unresolved discussion. a discussion (no related file): Previously, EricCousineau-TRI wrote…
Using Matt's Comments from Reviewable |
Reviewed 14 of 14 files at r1. a discussion (no related file): Previously, EricCousineau-TRI wrote…
A Comments from Reviewable |
Similar - I started doing this (i.e. a bazel workspace chained drake) just to write some simple drake experiments to understand the code and learn a bit of bazel free of all the drake noise. That's turned into unofficially starting work on a canonical set of simple user projects (shambhala) that can be a template (and possibly a CI test later) for others. This use case should be both the simplest, and a very standard use case. I think it's a good baseline requirement to help drive conventions for our bazel layout in way that helps users (and that requirement won't change). i.e. it's not a parallel support case and better now than a major refactor later. Aside from the dependencies, be nice to also have access to some of the other bazel infra drake is building - e.g. github.bzl, bitbucket.bzl, install.bzl. Comments from Reviewable |
Reviewed 14 of 14 files at r1. a discussion (no related file): Previously, jamiesnape (Jamie Snape) wrote…
Yes, it has to be an RL repository not personal repo. We've talked about writing up canonical examples of how to integrate Drake into downstream projects. I think we should probably have one CMake example and one Bazel-only example, completely separate, and that this PR is towards the latter (Bazel-only). So I don't think it needs to do a discussion (no related file): tools/gtest.BUILD, line 34 at r1 (raw file):
Meta Could you explain why the Comments from Reviewable |
Looks cool. Just let me know if/when you want a Jenkins job setting up. Should be pretty easy. Review status: all files reviewed at latest revision, 3 unresolved discussions. Comments from Reviewable |
a discussion (no related file): Previously, jwnimmer-tri (Jeremy Nimmer) wrote…
I wasn't intending to drop shambhala into RobotLocomotion and CI just yet, but that was the goal. Comments from Reviewable |
a discussion (no related file): Previously, jwnimmer-tri (Jeremy Nimmer) wrote…
Looking at that now - I feel a little dirty dropping Comments from Reviewable |
a discussion (no related file): Previously, EricCousineau-TRI wrote…
If you Comments from Reviewable |
a discussion (no related file): Previously, jwnimmer-tri (Jeremy Nimmer) wrote…
Oh lol, well, then I'll add that in. However, it seems that we can provide an upstream update to Comments from Reviewable |
I've pulled and tested this locally with TRI-internal users of Drake, and all seems fine. Review status: all files reviewed at latest revision, 3 unresolved discussions. a discussion (no related file): Previously, EricCousineau-TRI wrote…
Fine by me. I was like "meh" at the time. Comments from Reviewable |
Review status: 11 of 19 files reviewed at latest revision, 3 unresolved discussions. a discussion (no related file): Previously, jwnimmer-tri (Jeremy Nimmer) wrote…
Hmm... Just successfully ported I've updated the example to consume tools/gtest.BUILD, line 34 at r1 (raw file): Previously, jwnimmer-tri (Jeremy Nimmer) wrote…
Done. Comments from Reviewable |
Reviewed 8 of 8 files at r2. a discussion (no related file): Previously, EricCousineau-TRI wrote…
OK The kythe thing is fine. FYI I think the Bazel example we end up putting in RobotLocomotion should not use WORKSPACE, line 19 at r2 (raw file):
BTW Is this two blank lines now? Seems excessive. Comments from Reviewable |
9b75766
to
22d163d
Compare
Review status: 18 of 19 files reviewed at latest revision, 3 unresolved discussions. a discussion (no related file): Previously, jwnimmer-tri (Jeremy Nimmer) wrote…
Sounds good! WORKSPACE, line 19 at r2 (raw file): Previously, jwnimmer-tri (Jeremy Nimmer) wrote…
Done. Comments from Reviewable |
Review status: 18 of 19 files reviewed at latest revision, 2 unresolved discussions. a discussion (no related file): Previously, jwnimmer-tri (Jeremy Nimmer) wrote…
A Comments from Reviewable |
a discussion (no related file): Previously, jamiesnape (Jamie Snape) wrote…
Seems like a good idea to me! Threw it in here for grins, but can defer that to some other PR. Comments from Reviewable |
Reviewed 1 of 1 files at r3. a discussion (no related file): Previously, jamiesnape (Jamie Snape) wrote…
FYI I think doing an example like this would be best: cc_binary(
....
deps = [
"@drake//drake/systems/analysis",
"@drake//drake/systems/framework",
"@drake//drake/systems/primitives:constant_value_source",
],
) So using per-directory rollup libraries where appropriate, and small libraries otherwise. drake/BUILD, line 27 at r4 (raw file):
Nope. The uberlibrary should only be for CMake export / binary installation. It should not be a public Bazel export. Comments from Reviewable |
Review status: 19 of 20 files reviewed at latest revision, 3 unresolved discussions. a discussion (no related file): Previously, jwnimmer-tri (Jeremy Nimmer) wrote…
True, for external projects, but for the test, would it be more useful to include the megalib? Added an example of Jamie's suggestion on the downstream thing (adding Comments from Reviewable |
drake/BUILD, line 27 at r4 (raw file): Previously, jwnimmer-tri (Jeremy Nimmer) wrote…
For external testing with Bazel, it'd still be nice to get to all of the projects, and not have to sync it. Mayhaps, in something like
Comments from Reviewable |
Review status: 19 of 20 files reviewed at latest revision, 3 unresolved discussions. a discussion (no related file): Previously, EricCousineau-TRI wrote…
We should be exposing the same interface regardless of the build system someone is using to consume it. Comments from Reviewable |
14029d5
to
22d163d
Compare
Review status: 19 of 20 files reviewed at latest revision, 2 unresolved discussions. a discussion (no related file): Previously, jamiesnape (Jamie Snape) wrote…
Let's have that debate somewhere else? Comments from Reviewable |
22d163d
to
13776ad
Compare
Review status: all files reviewed at latest revision, 3 unresolved discussions. a discussion (no related file): Previously, jwnimmer-tri (Jeremy Nimmer) wrote…
Ok. Comments from Reviewable |
Review status: all files reviewed at latest revision, 3 unresolved discussions. drake/BUILD, line 27 at r4 (raw file): Previously, EricCousineau-TRI wrote…
Reverted. Will create a separate issue on this. Comments from Reviewable |
Reviewed 1 of 1 files at r5. Comments from Reviewable |
Reviewed 7 of 8 files at r2, 1 of 1 files at r3. Comments from Reviewable |
"unstable due to git failures" flake |
FYI I just dismissed @stonier's blocking discussion comment, which I presume was accidental. Review status: all files reviewed at latest revision, all discussions resolved, all commit checks successful. Comments from Reviewable |
Awesome, thanks! |
This change would permit
drake
to be used as an external in a Bazel project, and would permitdrake
'stools/...
to be usable outside ofdrake
.This follows the workaround listed here.
Move all non-rule externals to@drake//tools:externals.bzl
@//
with@drake//
tools/*.BUILD
with@drake//tools:*.BUILD
Worked with @stonier to whip up an example project:
@drake//drake/automotive:curve2
@drake//drake/solvers:mathematical_program
externallyThis change is