SlicesRuleBuilder

class SlicesRuleBuilder(graph: ProjectGraph = Konture.projectGraph, sourceSets: SourceSetSelector = SourceSets.production())

A builder for compiling and verifying architectural rules on slices — groups of packages derived from a package pattern with a capture group.

A slice pattern such as com.acme.(*).. partitions the matched packages into slices keyed by the captured segment, and the assertions on SlicesShould verify relationships between those slices (for example, that they are free of cyclic dependencies).

Constructors

Link copied to clipboard
constructor(graph: ProjectGraph = Konture.projectGraph, sourceSets: SourceSetSelector = SourceSets.production())

Functions

Link copied to clipboard

Configures this builder to allow empty selections (if no packages match the slice pattern the rule passes instead of throwing an AssertionError).

Link copied to clipboard

Logical AND operator for chaining filter conditions.

Link copied to clipboard

Logical AND operator for chaining assertion rules.

Link copied to clipboard
fun check(g: ProjectGraph = graph): ViolationReport

Executes the compiled slice rules against the provided project graph. Throws an AssertionError if any rule violations are detected.

Link copied to clipboard

Sets the slice pattern. It must contain exactly one capture group: (*) for one package segment or (**) for one or more segments. The captured text becomes the slice key.

Link copied to clipboard

Negates the next filter condition.

Link copied to clipboard

Negates the next assertion rule.

Link copied to clipboard
fun or(): SlicesThat

Logical OR operator for chaining filter conditions.

Link copied to clipboard

Logical OR operator for chaining assertion rules.

Link copied to clipboard
fun printAllSlices(logger: (Slice) -> Unit = { println(getMessage("debug.slices.derived", it.key, it.packages, it.classes.size)) }): SlicesRuleBuilder

Debugging helper that prints information about all derived slices in the project graph.

Link copied to clipboard
fun printMatchedSlices(logger: (Slice) -> Unit = { println(getMessage("debug.slices.derived", it.key, it.packages, it.classes.size)) }): SlicesRuleBuilder

Debugging helper that prints information about all slices derived from the slice pattern.

Link copied to clipboard

Starts adding assertion rules that the derived slices must satisfy.

Link copied to clipboard

Asserts rules on slices using a lambda block that provides a SliceShouldContext receiver.

Link copied to clipboard

Configures programmatic violation suppressions for this slice rule suite with mandatory audit rationale.

Link copied to clipboard

Starts filtering conditions to select which slices to verify.

Link copied to clipboard

Filters slices in this rule using a concise lambda predicate evaluated on each Slice.

Link copied to clipboard

Logical XOR operator for chaining filter conditions.

Link copied to clipboard

Logical XOR operator for chaining assertion rules.