ppx_transform Last updated Mar 27, 2025

load("@rules_ppx//build:rules.bzl", "ppx_transform")

ppx_transform(name, src, data, args, env, opts, ppx, print)

Runs a ppx executable to transform a source file. Also propagates ppx_codeps from the provider of the ppx dependency.

Attributes

Name Description Type Mandatory Default

name

A unique name for this target.

Name

required

src

A single source file (struct or sig) label.

Label

required

data

Runtime data dependencies: list of labels of data files needed by ppx executable at runtime.

List of labels

optional

[]

args

List of args to pass to ppx executable at runtime.

List of strings

optional

[]

env

Env variables

Dictionary: String -> String

optional

{}

opts

List of compile options; overrides configurable default options. Supports -no- prefix for each option; for example, -no-linkall.

List of strings

optional

[]

ppx

Label of ppx_executable target to be used to transform source before compilation.

Label

optional

None

print

Format of output of PPX transform. Value must be one of @rules_ppx//print:text, @rules_ppx//print:text!. See PPX Support for more information

Label

optional

"@rules_ppx//print:text"