AalekhExtension

abstract class AalekhExtension @Inject constructor(objects: ObjectFactory)(source)

DSL extension for configuring Aalekh in the root project's build.gradle.kts.

aalekh {
outputDir.set("reports/aalekh")
openBrowserAfterReport.set(false)

layers {
layer("domain") {
modules(":core:domain", ":feature:*:domain")
}
layer("data") {
modules(":core:data", ":feature:*:data")
canOnlyDependOn("domain")
}
layer("presentation") {
modules(":feature:*:ui", ":app")
canOnlyDependOn("domain", "data")
}
}

featureIsolation {
featurePattern = ":feature:**"
allow(from = ":feature:shared", to = ":feature:*")
}

rules {
rule("layer-dependency") {
severity = Severity.WARNING
suppressFor(":legacy:**")
}
}
}

Constructors

Link copied to clipboard
@Inject
constructor(objects: ObjectFactory)

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard

Configures the affected-graph analysis run by aalekhAffected - the git refs to diff for the "what does this change rebuild?" pull-request artefact.

Link copied to clipboard
val baselineFile: Property<String>

Path (relative to the root project) of the committed violation baseline file. Default: "aalekh-baseline.json".

Link copied to clipboard
val exportMetrics: Property<Boolean>

When true, aalekhReport writes aalekh-metrics.csv alongside index.html. The CSV contains one row per module with timestamp, fan-in/out, instability, transitive dep count, and health score. Default: false.

Link copied to clipboard

Fail aalekhDiff when the change makes the architecture structurally worse - a new dependency cycle, or a structural metric that regressed against the snapshot. Default: false.

Link copied to clipboard

Configures the feature isolation rule. Feature modules matching the declared pattern must not depend on each other unless explicitly allowed.

Link copied to clipboard

Include compileOnly configurations in the dependency graph. Default: false.

Link copied to clipboard

Capture external (third-party) dependencies - their group:name:version coordinates and declaration type - so they appear in the module inspector of the HTML report. Default: true.

Link copied to clipboard

Include test configurations in the dependency graph. Default: true.

Link copied to clipboard
val layerContainer: NamedDomainObjectContainer<LayerConfig>

Named container of LayerConfig objects. Each entry declares one architectural layer and optionally restricts which other layers it may depend on.

Link copied to clipboard

Configures the graph export run by aalekhMermaid - the focus/exclude filters that keep a large graph's Mermaid and DOT diagrams readable.

Link copied to clipboard

Open the HTML report in the default browser after aalekhReport completes. Default: true.

Link copied to clipboard
val outputDir: Property<String>

Output directory for report files, relative to build/. Default: "reports/aalekh".

Link copied to clipboard

Configures metric-delta quality gates that fail aalekhCheck when a structural metric regressed versus the committed baseline (aalekh-baseline.json).

Link copied to clipboard

Configures per-rule severity overrides and module-level suppressions.

Link copied to clipboard
val snapshotFile: Property<String>

Path (relative to the root project) of the committed architecture snapshot. Default: "aalekh-snapshot.json".

Link copied to clipboard

Declares which teams own which modules using glob patterns.

Link copied to clipboard

Configures the git temporal-coupling analysis run by aalekhTemporal - the commit window and the thresholds for reporting co-change and flagging hidden coupling.

Functions

Link copied to clipboard
fun affected(configure: AffectedGraphConfig.() -> Unit)

Configures the affected-graph diff range via the AffectedGraphConfig DSL.

Link copied to clipboard
Link copied to clipboard
fun forbid(configure: ForbiddenDependencySpec.() -> Unit)

Declares a one-off structural rule inline: modules matching from must not depend on modules matching to. A lightweight alternative to a custom com.aalekh.aalekh.analysis.rules.ArchRule jar for the common "X must not depend on Y" case.

Link copied to clipboard
fun NamedDomainObjectContainer<LayerConfig>.layer(name: String, configure: LayerConfig.() -> Unit)

Adds a named layer and configures it. Shorthand for use inside the layers { } block.

Link copied to clipboard
fun layers(configure: NamedDomainObjectContainer<LayerConfig>.() -> Unit)

Convenience for Kotlin lambda syntax: layers { layer("domain") { ... } }.

fun layers(configure: Action<NamedDomainObjectContainer<LayerConfig>>)

Declares architectural layers and their permitted dependency directions.

Link copied to clipboard
fun mermaid(configure: MermaidConfig.() -> Unit)

Configures the Mermaid/DOT export focus and exclude filters via the MermaidConfig DSL.

Link copied to clipboard
fun qualityGates(configure: QualityGatesConfig.() -> Unit)

Configures metric-delta quality gates via the QualityGatesConfig DSL.

Link copied to clipboard
fun rules(configure: RulesConfig.() -> Unit)
Link copied to clipboard
fun teams(configure: TeamOwnershipConfig.() -> Unit)

Configures team ownership mappings via the TeamOwnershipConfig DSL.

Link copied to clipboard

Configures git temporal-coupling analysis via the TemporalCouplingConfig DSL.