bazelize plugin

Bazelize element plugin

An element that creates a Bazel project from its build dependencies.

It creates BUILD.bazel files calling bazel rules.

For each element, it creates a filegroup target with the files belonging to that element, plus potentially a cc_library and py_library when C/C++ libraries and python packages are detected.

As an example considering an element makelib.bst producing an artifact containing: * usr/include/hdr.h * usr/lib/lib.so

An element of this kind (‘bazelize.bst’) declaring a build-depends: makelib.bst will produce a full Bazel project including an empty WORKSPACE file, the artifact from the dependency element, and a BUILD.bazel file containing:

load("@rules_cc//cc:defs.bzl", "cc_library")

package(default_visibility = ["//visibility:public"])

filegroup(
    name = "makelib",
    srcs = ['usr/include/hdr.h', 'usr/lib/lib.so'],
)

cc_library(
    name = "makelib_cc",
    hdrs = ['usr/include/hdr.h'],
    srcs = ['usr/lib/lib.so'],
)

You can influence the files included in the output of the plugin by setting the configuration values for this plugin. It supports the standard include, exclude and include-orphans to include or exclude files based on their split domains.

You can also set some configuration in the dependency elements’ public data, under the bazelize-data key, which this plugin will pick up and add to the generated BUILD.bazel file for targets generated from that element. Currently, only includes is supported.