ArchitectureLayerPolicy

First-class, declarative architectural-layer policy DSL.

A layer groups a set of modules and/or packages and declares which other layers it may (or may not) depend on, and which layers may (or may not) depend on it. The policy is compiled down to the primitive Konture module/package selectors and class dependency assertions.

Example Usage:

architecture {
layer("feature") {
selector {
modules(":feature:**")
}
mayDependOn("core", "domain")
mustNotDependOn("feature")
}

layer("domain") {
selector {
packages("com.acme.domain..")
}
mayDependOn("core")
}
}

Properties

Link copied to clipboard

The unique, human-readable name of this layer.

Functions

Link copied to clipboard
fun mayBeAccessedBy(vararg layers: String)

Restricts the layers that are allowed to depend on this layer (intra-layer dependencies are always allowed).

Restricts the layers that are allowed to depend on this layer.

Link copied to clipboard
fun mayDependOn(vararg layers: String)

Restricts the layers this layer is allowed to depend on (intra-layer dependencies are always allowed).

fun mayDependOn(layers: List<String>)

Restricts the layers this layer is allowed to depend on.

Link copied to clipboard
fun mustNotBeAccessedBy(vararg layers: String)

Forbids the given layers from depending on this layer.

Link copied to clipboard
fun mustNotDependOn(vararg layers: String)

Forbids this layer from depending on the given layers.

Link copied to clipboard
fun selector(block: LayerSelectorDsl.() -> Unit)

Declares which modules and/or packages belong to this layer.