ocaml_library Last updated Mar 27, 2025
load("@rules_ocaml//build/_rules:ocaml_library.bzl", "ocaml_library")
Aggregates a collection of OCaml modules.
An ocaml_library
is a collection of modules packaged into an OBazl
target; it is not a single binary file. It is an OBazl convenience rule
that allows a target to depend on a collection of deps under a single
label, rather than having to list each individually.
By default, libraries are not archived unless the client explicitly requests archiving. If you build a library directly from the command line, you’ll get an archive. But if a rule depends on an ocaml_library
target, no archive will be produced. This default policy can be overridden. For example, an ocaml_binary
target can set force_archived_libdeps
to True.
This feature - context-dependent archiving - is still under development. |
Attributes
Name | Description | Type | Mandatory | Default |
---|---|---|---|---|
A unique name for this target. |
required |
|||
Name of generated archive file, without extension. If not provided, name will be derived from target 'name' attribute. |
String |
optional |
"" |
|
Env variables |
optional |
{} |
||
By default, libraries are not packaged as archives or cmxs files. "static": archive the library; "shared": build cmxs. |
String |
optional |
"" |
|
List of component modules for libraries. |
optional |
[] |
||
List of compile options; overrides configurable default options. Supports |
List of strings |
optional |
[] |