plugins { alias(libs.plugins.kotlin.jvm) apply false alias(libs.plugins.kotlin.spring) apply false alias(libs.plugins.kotlin.jpa) apply false alias(libs.plugins.spring.boot) apply false alias(libs.plugins.spring.dependency.management) apply false } allprojects { group = providers.gradleProperty("vibeerp.group").get() version = providers.gradleProperty("vibeerp.version").get() } // Enforce the architecture-level dependency rules (CLAUDE.md guardrail #9): // // 1. PBCs may NEVER depend on other PBCs. // Cross-PBC interaction goes through api.v1.ext. service // interfaces or the event bus. // // 2. PBCs may NEVER depend on `:platform:platform-bootstrap`. // Bootstrap is the application entry point that ASSEMBLES PBCs; // depending on it inverts the layering. PBCs depend on platform // runtime modules (persistence, plugins, i18n, etc.) only. // // 3. Plug-ins (modules carrying the `vibeerp.module-kind=plugin` ext // property) may ONLY depend on `:api:api-v1`. They never see // `:platform:*` or `:pbc:*` internals. // // All three rules fail the build at configuration time. // // We use an explicit `extra["vibeerp.module-kind"]` marker rather than a // pathname heuristic so that adding a plug-in under a different directory // (e.g. `customer-plugins/foo/`) does not silently bypass the rule, and // so that `:platform:platform-plugins` (which contains the substring // "plugin-" in its path) is correctly classified as a runtime module, not // a plug-in. gradle.projectsEvaluated { rootProject.allprojects.forEach { p -> val ownPath: String = p.path val moduleKind: String? = p.extra.properties["vibeerp.module-kind"] as String? val checkedConfigs = listOf("api", "implementation", "compileOnly", "compileClasspath") val projectDeps = p.configurations .matching { it.name in checkedConfigs } .flatMap { cfg -> cfg.dependencies.filterIsInstance() } // Rule 1 & 2 — PBC dependency hygiene if (ownPath.startsWith(":pbc:")) { projectDeps.forEach { dep -> @Suppress("DEPRECATION") val depPath = dep.dependencyProject.path if (depPath.startsWith(":pbc:") && depPath != ownPath) { throw GradleException( "Architectural violation in $ownPath: depends on $depPath. " + "PBCs MUST NOT depend on other PBCs. Use api.v1 service " + "interfaces (org.vibeerp.api.v1.ext.) or the event bus." ) } if (depPath == ":platform:platform-bootstrap") { throw GradleException( "Architectural violation in $ownPath: depends on $depPath. " + "PBCs MUST NOT depend on platform-bootstrap (the application " + "entry point). Depend on platform runtime modules only." ) } } } // Rule 3 — Plug-in dependency hygiene (driven by an explicit marker) if (moduleKind == "plugin") { projectDeps.forEach { dep -> @Suppress("DEPRECATION") val depPath = dep.dependencyProject.path if (depPath.startsWith(":platform:") || depPath.startsWith(":pbc:")) { throw GradleException( "Architectural violation in $ownPath: depends on internal module $depPath. " + "Plug-ins may only depend on :api:api-v1." ) } } } } }