tree: 37c6a40c71793bc7755eeb01b6c4d65af23d40ee [path history] [tgz]
  1. overlay/
  2. patches/
  3. scripts/
  4. MODULE.bazel
  5. presubmit.yml
  6. README.md
  7. source.json
modules/folly/2025.01.13.00.bcr.3/README.md

Steps to Bazelfying a Folly release

  1. Clone the Folly repo:

    git clone https://github.com/facebook/folly.git
    
  2. Create a Git branch at the release you want to Bazelfy. For example:

    git checkout -b bazel v2025.01.13.00
    
  3. Create a new BCR Folly version.

  4. Run the bcr_to_folly.sh script, which will bootstrap your Folly repo by copying all the BUILD files from the BCR Folly to your repo. This script is only meant to be run once on a clean Folly repo. For example:

    cd /path/to/your/bazel-central-registry/modules/folly/2025.01.13.00.bcr.3/scripts
    ./bcr_to_folly.sh /path/to/your/folly/repo
    
  5. Update and/or add BUILD files in your Folly repo as needed. Updated any source files as needed.

  6. Because of the way the includes work for Folly BCR, you won‘t actually be able to build/test targets correctly from inside the Folly repo. The Folly repo must be tested as an external dep. The easiest way to do this is to create another folder with its own Bazel module, use local_path_override to depend on Folly, and run all Bazel commands from that module. For example in another folder’s MODULE.bazel file:

    bazel_dep(name = "folly")
    local_path_override(
        module_name = "folly",
        path = "../folly",  # assuming this folder is beside the Folly repo
    )
    

    Then build/test Folly with @folly. E.g., bazel build @folly//...

  7. Run the folly_to_bcr.sh script to copy the BUILD files back into your new BCR Folly version. You can run this script as many times as needed while iterating. For example:

    cd /path/to/your/bazel-central-registry/modules/folly/2025.01.13.00.bcr.3/scripts
    ./folly_to_bcr.sh /path/to/your/folly/repo
    
  8. Generate Git patch files for any changes you made to Folly patch files and ensure they are added to the patches directory in BCR Folly.

  9. Update integrity as needed (must be run from the bazel-central-registry module). For example:

    bazel run -- //tools:update_integrity folly
    

Tips and other notes

  • For Folly BUILD files, use our Bazel cpp_library macro instead of the Folly cpp_library macro.
  • Add any custom bzl files under a directory called bzl in the Folly source tree.
  • Folly uses a build system called Buck2 which is very similar to Bazel. The BUCK files in the folly source tree can be mostly copied to a file in the same directory called BUILD.bazel, and then modified from there to support Bazel.