forbidSourceSetDependency

fun forbidSourceSetDependency(sourceSet: String, to: String, because: String = "", severity: Severity = Severity.ERROR)(source)

Forbids dependencies declared in the sourceSet source set (e.g. "iosMain", "androidMain") from targeting modules matching to - the general form of noCommonMainPlatformDependencies. Every graph edge records its owning source set, so this enforces per-source-set direction with no compiler. Reports source-set-dependency at severity (default ERROR).

rules { forbidSourceSetDependency(sourceSet = "androidMain", to = ":platform:desktop:**") }