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

Migrate XLS to bzlmod #931

Open
cdleary opened this issue Apr 13, 2023 · 2 comments
Open

Migrate XLS to bzlmod #931

cdleary opened this issue Apr 13, 2023 · 2 comments
Labels
build Related to build flow, build system, or build macros long-term-enhancement Issues that are sensible enhancements but XLS devs expect may not be addressed in the near-term

Comments

@cdleary
Copy link
Collaborator

cdleary commented Apr 13, 2023

Bazel is moving to a new system for managing external dependencies called bzlmod. To conform to this future we'll need to migrate from using our WORKSPACE file to using a MODULE.bazel file, and presumably registering ourselves in the Bazel Central Registry: https://github.com/bazelbuild/bazel-central-registry

See also the bzlmod migration guide: https://docs.google.com/document/d/1JtXIVnXyFZ4bmbiBCr5gsTH4-opZAFf5DMMb-54kES0/edit

I'm not sure how challenging XLS is to migrate in the grand scheme of things -- I imagine we have at least a few complicating factors:

  • "Large" dependencies
    • rules_hdl
    • grpc
    • llvm, z3, ortools etc
    • we also want to start taking a dep on Verible for LSP utilities
  • pybind extensions
  • pip_install environment
  • clang-format pulled down via toolchain
  • an optional config that allows use of hermetic toolchain (clang/llvm)

If I'm understanding correctly we probably need to convert to bzlmod from leaves (of all transitive deps) up to the "root" of XLS's workspace. Because converting everything to bzlmod is not going to happen atomically it seems like generally folks would support two concurrent systems in the intermediate state, and the bzlmod would have a "more stripped down" sort of build configuration.

This new system will also have compatibility specifications, see https://docs.google.com/document/d/1ReuBBp4EHnsuvcpfXM6ITDmP2lrOu8DGlePMUKvDnXM/edit#heading=h.4lwo83a0dksg

This came up because of the discussion in #865 Henner pointed out we don't declare/pin our (direct) dependencies. The team had a discussion on the tradeoffs -- ISTM that specifying your leaf dependencies up front doesn't mitigate risk in the current WORKSPACE flow and can make more work to debug/update when you bump your dependencies vs just letting them float. If you assume the code you control can flex more easily than code in dependencies, or your requirements for the dependencies are looser, then you prefer that you do not pin. It may come up that you need to pin sometimes, but ISTM from the discussion that should be done only when necessary because of the work savings advantages of letting the dependencies float.

By contrast, with bzlmod we'd have explicit specifications of compatibility that were properly checked against transitive dependencies, so it seems like The Solution, but the migration work seems like it could be significant given the wrinkles listed above. This issue serves as the reminder we want to figure out the right time to do this / work through the wrinkles noted above.

cc @ted-xie who was helping me think through the tradeoffs / potential roadmap here

@cdleary cdleary added build Related to build flow, build system, or build macros long-term-enhancement Issues that are sensible enhancements but XLS devs expect may not be addressed in the near-term labels Apr 13, 2023
@cdleary
Copy link
Collaborator Author

cdleary commented Apr 14, 2023

I closed the wrong issue with that commit.

@cdleary cdleary reopened this Apr 14, 2023
hzeller pushed a commit to hzeller/xls that referenced this issue Apr 28, 2023
hzeller pushed a commit to hzeller/xls that referenced this issue May 19, 2023
proppy added a commit to proppy/xls that referenced this issue Dec 12, 2023
- bump bazelisk
- pin bazel version in environment

rational: bazel 7.0 is a major update that require some coordinated
update of some transitive external deps (see google#865) and
switching to bzlmod (see google#931); let's pin it first to
un-break the CI.
copybara-service bot pushed a commit that referenced this issue Dec 13, 2023
- add bazelversion
- bump bazelisk

rational: until #865 and #931 are addressed we can't really upgrade to 7.0
PiperOrigin-RevId: 590391115
hzeller added a commit to hzeller/xls that referenced this issue Aug 26, 2024
 o Move projects that are available already in https://registry.bazel.build/
   from from load_external to MODULE.bazel.
 o This is not complete: there are probably more steps to simplify after
   the first submit.

Issues: google#931
hzeller added a commit to hzeller/xls that referenced this issue Aug 27, 2024
 o Move projects that are available already in https://registry.bazel.build/
   from from load_external to MODULE.bazel.
 o This is not complete: there are probably more steps to simplify after
   the first submit.

Issues: google#931
hzeller added a commit to hzeller/xls that referenced this issue Aug 27, 2024
 o Move projects that are available already in https://registry.bazel.build/
   from from load_external to MODULE.bazel.
 o This is not complete: there are probably more steps to simplify after
   the first submit.
 o Looks like making the compilation DB broke as the action hooks don't seem
   to work anymore ( dev_utils/make-compilation-db.sh ).
   The used com_grail_bazel_compdb is not maintained anymore, so this needs
   to be updated to something more modern.
   Since this is not actively needed in daily development (and I am the only
   one really using it), postponed for later.

Issues: google#931

Also, needed to make Python rules to work well with
--incompatible_default_to_explicit_init_py
(bazelbuild/bazel#10076)
hzeller added a commit to hzeller/xls that referenced this issue Aug 27, 2024
 * Move projects that are available already in https://registry.bazel.build/
   from from load_external to MODULE.bazel.
 * This is not complete: there are probably more steps to simplify after
   the first submit.
 * Switching to bzlmod broke making the compilation-db as the action hooks
   don't seem to work anymore ( dev_utils/make-compilation-db.sh ).
   The used com_grail_bazel_compdb is not maintained anymore, so this needs
   to be updated to something more modern (hedronvision?).
   Since this is not actively needed in daily development (and I am the only
   one really using it), postponed for later.

Issues: google#931

Also, needed to make Python rules to work well with
--incompatible_default_to_explicit_init_py
(bazelbuild/bazel#10076)
hzeller added a commit to hzeller/xls that referenced this issue Aug 28, 2024
 * Move projects that are available already in https://registry.bazel.build/
  from from load_external to MODULE.bazel.
 * This is not complete: there are probably more steps to simplify and
   clean-up after the first submit.
 * Switching to bzlmod broke making the compilation-db as the action hooks
   don't seem to work anymore ( xls/dev_tools//make-compilation-db.sh ).
   The used com_grail_bazel_compdb is not maintained anymore, so this needs
   to be updated to something more modern (hedronvision?).
   Since this is not actively needed in daily development (and I am the only
   one really using it), postponed for later.

Issues: google#931

Also, needed to make Python rules to work well with
--incompatible_default_to_explicit_init_py (bazelbuild/bazel#10076)
hzeller added a commit to hzeller/xls that referenced this issue Aug 28, 2024
 * Move projects that are available already in https://registry.bazel.build/
  from from load_external to MODULE.bazel.
 * This is not complete: there are probably more steps to simplify and
   clean-up after the first submit.
 * Switching to bzlmod broke making the compilation-db as the action hooks
   don't seem to work anymore ( xls/dev_tools//make-compilation-db.sh ).
   The used com_grail_bazel_compdb is not maintained anymore, so this needs
   to be updated to something more modern (hedronvision?).
   Since this is not actively needed in daily development (and I am the only
   one really using it), postponed for later.

Issues: google#931

Also, needed to make Python rules to work well with
--incompatible_default_to_explicit_init_py (bazelbuild/bazel#10076)
hzeller added a commit to hzeller/xls that referenced this issue Aug 28, 2024
 * Move projects that are available already in https://registry.bazel.build/
  from from load_external to MODULE.bazel.
 * This is not complete: there are probably more steps to simplify and
   clean-up after the first submit.
 * Switching to bzlmod broke making the compilation-db as the action hooks
   don't seem to work anymore ( xls/dev_tools//make-compilation-db.sh ).
   The used com_grail_bazel_compdb is not maintained anymore, so this needs
   to be updated to something more modern (hedronvision?).
   Since this is not actively needed in daily development (and I am the only
   one really using it), postponed for later.

Issues: google#931

Also, needed to make Python rules to work well with
--incompatible_default_to_explicit_init_py (bazelbuild/bazel#10076)
hzeller added a commit to hzeller/xls that referenced this issue Aug 28, 2024
 * Move projects that are available already in https://registry.bazel.build/
  from from load_external to MODULE.bazel.
 * This is not complete: there are probably more steps to simplify and
   clean-up after the first submit.
 * Switching to bzlmod broke making the compilation-db as the action hooks
   don't seem to work anymore ( xls/dev_tools//make-compilation-db.sh ).
   The used com_grail_bazel_compdb is not maintained anymore, so this needs
   to be updated to something more modern (hedronvision?).
   Since this is not actively needed in daily development (and I am the only
   one really using it), postponed for later.

Issues: google#931

Also, needed to make Python rules to work well with
--incompatible_default_to_explicit_init_py (bazelbuild/bazel#10076)
hzeller added a commit to hzeller/xls that referenced this issue Aug 28, 2024
 * Move projects that are available already in https://registry.bazel.build/
  from from load_external to MODULE.bazel.
 * This is not complete: there are probably more steps to simplify and
   clean-up after the first submit.
 * Switching to bzlmod broke making the compilation-db as the action hooks
   don't seem to work anymore ( xls/dev_tools//make-compilation-db.sh ).
   The used com_grail_bazel_compdb is not maintained anymore, so this needs
   to be updated to something more modern (hedronvision?).
   Since this is not actively needed in daily development (and I am the only
   one really using it), postponed for later.

Issues: google#931

Also, needed to make Python rules to work well with
--incompatible_default_to_explicit_init_py (bazelbuild/bazel#10076)
hzeller added a commit to hzeller/xls that referenced this issue Aug 28, 2024
 * Move projects that are available already in https://registry.bazel.build/
   from from load_external to MODULE.bazel.
 * This is not complete: there are probably more steps to simplify and
   clean-up after the first submit.
 * Switching to bzlmod broke making the compilation-db as the action hooks
   don't seem to work anymore ( xls/dev_tools//make-compilation-db.sh ).
   The used com_grail_bazel_compdb is not maintained anymore, so this needs
   to be updated to something more modern (hedronvision?).
   Since this is not actively needed in daily development (and I am the only
   one really using it), postponed for later.
 * Clean out things not needed anymore in dependency_support/$(various-dirs)

Issues: google#931

Also, needed to make Python rules to work well with
--incompatible_default_to_explicit_init_py (bazelbuild/bazel#10076)
hzeller added a commit to hzeller/xls that referenced this issue Aug 28, 2024
 * Move projects that are available already in https://registry.bazel.build/
   from from load_external to MODULE.bazel.
 * This is not complete: there are probably more steps to simplify and
   clean-up after the first submit.
 * Switching to bzlmod broke making the compilation-db as the action hooks
   don't seem to work anymore ( xls/dev_tools//make-compilation-db.sh ).
   The used com_grail_bazel_compdb is not maintained anymore, so this needs
   to be updated to something more modern (hedronvision?).
   Since this is not actively needed in daily development (and I am the only
   one really using it), postponed for later.
 * Clean out things not needed anymore in dependency_support/$(various-dirs)

Issues: google#931

Also, needed to make Python rules to work well with
--incompatible_default_to_explicit_init_py (bazelbuild/bazel#10076)
hzeller added a commit to hzeller/xls that referenced this issue Aug 28, 2024
 * Move projects that are available already in https://registry.bazel.build/
   from from load_external to MODULE.bazel.
 * This is not complete: there are probably more steps to simplify and
   clean-up after the first submit.
 * Switching to bzlmod broke making the compilation-db as the action hooks
   don't seem to work anymore ( xls/dev_tools//make-compilation-db.sh ).
   The used com_grail_bazel_compdb is not maintained anymore, so this needs
   to be updated to something more modern (hedronvision?).
   Since this is not actively needed in daily development (and I am the only
   one really using it), postponed for later.
 * Clean out things not needed anymore in dependency_support/$(various-dirs)

Issues: google#931

Also, needed to make Python rules to work well with
--incompatible_default_to_explicit_init_py (bazelbuild/bazel#10076)
hzeller added a commit to hzeller/xls that referenced this issue Aug 28, 2024
 * Move projects that are available already in https://registry.bazel.build/
   from from load_external to MODULE.bazel.
 * This is not complete: there are probably more steps to simplify and
   clean-up after the first submit.
 * Switching to bzlmod broke making the compilation-db as the action hooks
   don't seem to work anymore ( xls/dev_tools//make-compilation-db.sh ).
   The used com_grail_bazel_compdb is not maintained anymore, so this needs
   to be updated to something more modern (hedronvision?).
   Since this is not actively needed in daily development (and I am the only
   one really using it), postponed for later.
 * Clean out things not needed anymore in dependency_support/$(various-dirs)

Issues: google#931

Also, needed to make Python rules to work well with
--incompatible_default_to_explicit_init_py (bazelbuild/bazel#10076)
hzeller added a commit to hzeller/xls that referenced this issue Aug 28, 2024
 * Move projects that are available already in https://registry.bazel.build/
   from from load_external to MODULE.bazel.
 * This is not complete: there are probably more steps to simplify and
   clean-up after the first submit.
 * Switching to bzlmod broke making the compilation-db as the action hooks
   don't seem to work anymore ( xls/dev_tools//make-compilation-db.sh ).
   The used com_grail_bazel_compdb is not maintained anymore, so this needs
   to be updated to something more modern (hedronvision?).
   Since this is not actively needed in daily development (and I am the only
   one really using it), postponed for later.
 * Clean out things not needed anymore in dependency_support/$(various-dirs)

Issues: google#931

Also, needed to make Python rules to work well with
--incompatible_default_to_explicit_init_py (bazelbuild/bazel#10076)
hzeller added a commit to hzeller/xls that referenced this issue Aug 31, 2024
 * Move projects that are available already in https://registry.bazel.build/
   from from load_external to MODULE.bazel.
 * This is not complete: there are probably more steps to simplify and
   clean-up after the first submit.
 * Switching to bzlmod broke making the compilation-db as the action hooks
   don't seem to work anymore ( xls/dev_tools//make-compilation-db.sh ).
   The used com_grail_bazel_compdb is not maintained anymore, so this needs
   to be updated to something more modern (hedronvision?).
   Since this is not actively needed in daily development (and I am the only
   one really using it), postponed for later.
 * Clean out things not needed anymore in dependency_support/$(various-dirs)

Issues: google#931

Also, needed to make Python rules to work well with
--incompatible_default_to_explicit_init_py (bazelbuild/bazel#10076)
hzeller added a commit to hzeller/xls that referenced this issue Aug 31, 2024
 * Move projects that are available already in https://registry.bazel.build/
   from from load_external to MODULE.bazel.
 * This is not complete: there are probably more steps to simplify and
   clean-up after the first submit.
 * Switching to bzlmod broke making the compilation-db as the action hooks
   don't seem to work anymore ( xls/dev_tools//make-compilation-db.sh ).
   The used com_grail_bazel_compdb is not maintained anymore, so this needs
   to be updated to something more modern (hedronvision?).
   Since this is not actively needed in daily development (and I am the only
   one really using it), postponed for later.
 * Clean out things not needed anymore in dependency_support/$(various-dirs)

Issues: google#931

Also, needed to make Python rules to work well with
--incompatible_default_to_explicit_init_py (bazelbuild/bazel#10076)
@hzeller
Copy link
Member

hzeller commented Sep 3, 2024

To prepare for bzlmod (see first proposal #1570, which not to be merged yet) ideally we get more projects that are not yet in Bazel Central Repository into there once we switch (typically by nudging the external project owners); it is not necessary, as it is possible to mix old and new ways, but the more MODULE.bazel the better :)

  • For fuzztest, filed Publish on Bazel Central Registry (BCR) ? fuzztest#1350 to be included in https://registry.bazel.build/. Fuzztest is responsible for a lot of additional projects that we have to import.
  • For Verible: I'll be talking the voluntary maintainer into adding it on some weekend :)
  • zstd: it is already in registry, but we need to use our own bazel file to include the testcorpus (maybe something to upstream for BCR ?)
  • There are others that might range from simple (linenoise) to harder (z3, ortools) to get into BCR

hzeller added a commit to hzeller/xls that referenced this issue Sep 3, 2024
 * Move projects that are available already in https://registry.bazel.build/
   from from load_external to MODULE.bazel.
 * This is not complete: there are probably more steps to simplify and
   clean-up after the first submit.
 * Switching to bzlmod broke making the compilation-db as the action hooks
   don't seem to work anymore ( xls/dev_tools//make-compilation-db.sh ).
   The used com_grail_bazel_compdb is not maintained anymore, so this needs
   to be updated to something more modern (hedronvision?).
   Since this is not actively needed in daily development (and I am the only
   one really using it), postponed for later.
 * Clean out things not needed anymore in dependency_support/$(various-dirs)

Issues: google#931

Also, needed to make Python rules to work well with
--incompatible_default_to_explicit_init_py (bazelbuild/bazel#10076)
hzeller added a commit to hzeller/xls that referenced this issue Sep 13, 2024
 * Move projects that are available already in https://registry.bazel.build/
   from from load_external to MODULE.bazel.
 * This is not complete: there are probably more steps to simplify and
   clean-up after the first submit.
 * Switching to bzlmod broke making the compilation-db as the action hooks
   don't seem to work anymore ( xls/dev_tools//make-compilation-db.sh ).
   The used com_grail_bazel_compdb is not maintained anymore, so this needs
   to be updated to something more modern (hedronvision?).
   Since this is not actively needed in daily development (and I am the only
   one really using it), postponed for later.
 * Clean out things not needed anymore in dependency_support/$(various-dirs)

Issues: google#931

Also, needed to make Python rules to work well with
--incompatible_default_to_explicit_init_py (bazelbuild/bazel#10076)
hzeller added a commit to hzeller/xls that referenced this issue Dec 10, 2024
 * Move projects that are available already in https://registry.bazel.build/
   from from load_external to MODULE.bazel.
 * This is not complete: there are probably more steps to simplify and
   clean-up after the first submit.
 * Switching to bzlmod broke making the compilation-db as the action hooks
   don't seem to work anymore ( xls/dev_tools//make-compilation-db.sh ).
   The used com_grail_bazel_compdb is not maintained anymore, so this needs
   to be updated to something more modern (hedronvision?).
   Since this is not actively needed in daily development (and I am the only
   one really using it), postponed for later.
 * Clean out things not needed anymore in dependency_support/$(various-dirs)

Issues: google#931

Also, needed to make Python rules to work well with
--incompatible_default_to_explicit_init_py (bazelbuild/bazel#10076)
hzeller added a commit to hzeller/xls that referenced this issue Dec 11, 2024
 * Move projects that are available already in https://registry.bazel.build/
   from from load_external to MODULE.bazel.
 * This is not complete: there are probably more steps to simplify and
   clean-up after the first submit.
 * Switching to bzlmod broke making the compilation-db as the action hooks
   don't seem to work anymore ( xls/dev_tools//make-compilation-db.sh ).
   The used com_grail_bazel_compdb is not maintained anymore, so this needs
   to be updated to something more modern (hedronvision?).
   Since this is not actively needed in daily development (and I am the only
   one really using it), postponed for later.
 * Clean out things not needed anymore in dependency_support/$(various-dirs)

Issues: google#931

Also, needed to make Python rules to work well with
--incompatible_default_to_explicit_init_py (bazelbuild/bazel#10076)
hzeller added a commit to hzeller/xls that referenced this issue Dec 11, 2024
 * Move projects that are available already in https://registry.bazel.build/
   from from load_external to MODULE.bazel.
 * This is not complete: there are probably more steps to simplify and
   clean-up after the first submit.
 * Switching to bzlmod broke making the compilation-db as the action hooks
   don't seem to work anymore ( xls/dev_tools//make-compilation-db.sh ).
   The used com_grail_bazel_compdb is not maintained anymore, so this needs
   to be updated to something more modern (hedronvision?).
   Since this is not actively needed in daily development (and I am the only
   one really using it), postponed for later.
 * Clean out things not needed anymore in dependency_support/$(various-dirs)

Issues: google#931

Also, needed to make Python rules to work well with
--incompatible_default_to_explicit_init_py (bazelbuild/bazel#10076)
hzeller added a commit to hzeller/xls that referenced this issue Dec 11, 2024
 * Move projects that are available already in https://registry.bazel.build/
   from from load_external to MODULE.bazel.
 * This is not complete: there are probably more steps to simplify and
   clean-up after the first submit.
 * Switching to bzlmod broke making the compilation-db as the action hooks
   don't seem to work anymore ( xls/dev_tools//make-compilation-db.sh ).
   The used com_grail_bazel_compdb is not maintained anymore, so this needs
   to be updated to something more modern (hedronvision?).
   Since this is not actively needed in daily development (and I am the only
   one really using it), postponed for later.
 * Clean out things not needed anymore in dependency_support/$(various-dirs)

Issues: google#931

Also, needed to make Python rules to work well with
--incompatible_default_to_explicit_init_py (bazelbuild/bazel#10076)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
build Related to build flow, build system, or build macros long-term-enhancement Issues that are sensible enhancements but XLS devs expect may not be addressed in the near-term
Projects
None yet
Development

No branches or pull requests

2 participants