IMPORTANT: The Bazel docs have moved! Please update your bookmark to https://bazel.build/rules/lib/fragments

You can read about the migration, and let us know what you think.

Extensions > API reference > fragments

fragments

A collection of configuration fragments available in the current rule implementation context. Access a specific fragment by its field name. For example, ctx.fragments.java

Only configuration fragments which are declared in the rule definition may be accessed in this collection.

See rules documentation for details.