-
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
Enable drake to be consumed as a bazel external (as a local and remote repository) #6193
Comments
I guess I'm not entirely sure how much of a priority this is. For example, I've never needed to do any of this, and I use Drake regularly from a TRI-internal project that pulls in Drake as a Bazel dependency / repository. Most users will want to stick with CMake, so it seems like making the CMake conops work first would be more important. Sure, Bazel is fun and this should be part of our roadmap, but why now? There are lots of other build system problems that are ripe for improvement. |
To complete every last item, I would say it is much lower priority than CMake. However, for the second item (and possibly the last), to just move stuff from I believe that I've checked the repo that you mentioned, and I believed you had most of I have updated the prototype just a tad more to try and encapsulate as much of the dependencies as possible, such that all dependency versions are incorporated directly into drake: The external workspace(name = "drake_external")
drake_relative_path = "externals/drake-distro"
drake_cmake_install_path = "{}/{}/{}".format(__workspace_dir__,
drake_relative_path, "build/install") # #5621
local_repository(
name = "drake",
path = drake_relative_path,
)
load("@drake//tools:externals_rules.bzl", "drake_external_rule_repositories")
drake_external_rule_repositories(
drake_relative_path = drake_relative_path,
)
load("@drake//tools:externals.bzl", "drake_external_repositories")
drake_external_repositories(
cmake_install_path = drake_cmake_install_path,
) The This then allows me to use the entirety of NOTE: I'm gonna go ahead and submit a PR on the second item, just to move the discussion of that stuff there and see if I can sneak that in :P |
Please explain this more. In my workflow, for example, I cut a dev branch of Drake (which could involve adding a new, temporary subdir), and then prototype code within Drake's WORKSPACE directly. What is the advantage of having a separate project, where Bazel things like crosstool and Not to say there aren't reasons. But even if the 6195 change is already written (sunk cost), it's still going to be something we have to maintain (future cost) and I'm not yet convinced on the development-spike use case. I am more convinced on "example for users", but that is a different beast. |
Given that Bazel 0.5 is going to change a few things about |
I would like to test integration with other external / downstream projects (in my case, research code that was built on an older version of This also permits me to more easily track and make smaller PR chunks, such that I don't have as large of discrepancies between rebased PR branches under review and what I am actually using in my dev branch.
This setup actually does use
At least from my perspective, the future maintenance cost seems minimal / negligible.
I saw the mention of this in the slack convo (posting a snippet from the release log for context):
To follow up on @soonho-tri's test with pure $ {
cur="${HOME}/tmp/$(date -Im | sed 's#:#-#g')"
mkdir -p $cur && cd $cur
git clone https://github.com/EricCousineau-TRI/drake_external.git
cd drake_external
git submodule update --init
}
$ git log -n1 --oneline
6450519 Update branch
$ which bazel && bazel version
/home/eacousineau/.local/bazel/0.5.0/usr/bin/bazel
Build label: 0.5.0
...
$ bazel run //example
...
Trivial Solution: 0 |
Looks like recursive |
All issues must have owners. I'm assigning one arbitrarily. (Fix it up if I'm wrong.) |
Now that #7259 has made some progress, I wonder if this issue still has any remaining fixups or requests? |
This feels done to me... |
Nope, no requests atm, will close. Thanks! |
As part of #3129, we should be able to use Daniels' shambhala example for making a bazel project that consumes
drake
as an external. There are different ways thatdrake
could be consumed:bazelbuild
, this can be done for the most part by separating all rule-dependent externals (which must be copy/pasta'd) from other externals, which can be placed in a*.bzl
file* Nesting workspaces in Bazel is not supported (Recursive WORKSPACE file loading bazelbuild/bazel#1943)
* We have to symlink
tools/CROSSTOOL
,tools/bazel.rc
, and scrape some stuff fromtools/BUILD
to make sure compiler / config settings are passed through properly.Implementation stage suggestions to support this (not necessarily in order):
drake
's label references use@drake//
instead of@//
when possible, and ensure thatdrake
files are referred via@drake//*
rather than relative via*
WORKSPACE
into something like@drake//tools:externals.bzl
, which can be incorporated into a macro such asdrake_external_repositories()
externals.bzl
drake
in both CMake and Bazel.shambhala
into CI, with whatever configurations we think are most relevant.drake
usesThis is a draft; please let me know what other thoughts y'all have.
\cc @stonier @jwnimmer-tri @jamiesnape @mwoehlke-kitware
The text was updated successfully, but these errors were encountered: