build.gradle.kts
2.49 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
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 rule (CLAUDE.md guardrail #9):
//
// • PBCs may NEVER depend on other PBCs.
// Cross-PBC interaction goes through api.v1 service interfaces or the
// event bus.
//
// • Plug-ins (and the reference plug-in) may ONLY depend on :api:api-v1.
// They never see :platform:* or :pbc:* internals.
//
// The build fails at configuration time if either rule is violated.
gradle.projectsEvaluated {
rootProject.allprojects.forEach { p ->
val ownPath: String = p.path
val checkedConfigs = listOf("api", "implementation", "compileOnly", "compileClasspath")
val projectDeps = p.configurations
.matching { it.name in checkedConfigs }
.flatMap { cfg ->
cfg.dependencies.filterIsInstance<org.gradle.api.artifacts.ProjectDependency>()
}
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.<pbc>) or the event bus."
)
}
}
}
val isPlugin = ownPath.startsWith(":reference-customer:") ||
ownPath.contains("plugin-")
if (isPlugin) {
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."
)
}
}
}
}
}