Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.aspect.build/llms.txt

Use this file to discover all available pages before exploring further.

Write extensions that subscribe to Bazel’s Build Events Service (BES). Set the events parameter to True in the ctx.bazel.build function to access build events through an iterator interface. Starlark delivers build events synchronously via this iterator, since it operates in a single-threaded environment. Each event includes a kind field that matches the event types defined in Bazel’s build_event_stream.proto protocol specification.
Build Event Stream ProtocolBuild events follow Bazel’s Build Event Stream (BES) protocol. For detailed specifications, access the following resources:
Events also have a payload field, whose type depends on which kind of event is produced. Access the build_event kinds documentation to learn more about the available event kinds and their corresponding payload types. For example:
    build = ctx.bazel.build(
        events = True,
        ...
    )
    for event in build.build_events():
        # conditional logic on event.kind
        if event.kind == 'named_set_of_files':
            for file in event.payload.files:
                pass
        elif event.kind == 'target_complete':
            pass
        else:
            pass