Repository navigation
Expand file tree
/
Copy pathbuild.gradle
More file actions
207 lines (183 loc) · 7.35 KB
/
Copy pathbuild.gradle
File metadata and controls
207 lines (183 loc) · 7.35 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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
import com.github.spotbugs.snom.Effort
import com.github.spotbugs.snom.Confidence
plugins {
id 'application'
id 'jacoco'
id 'pmd'
id 'com.github.spotbugs' version '6.5.8'
id 'net.ltgt.errorprone' version '5.1.0'
}
group = 'se.deversity'
version = '0.1.0'
ext.vibetagsVersion = '1.3.2'
// code-karta renders the diagrams under docs/diagrams straight from this source tree.
ext.codekartaVersion = '0.2.0'
repositories {
mavenCentral()
}
configurations {
// Tool-only: the diagram renderer must never reach a compile or runtime classpath.
codekarta
}
dependencies {
implementation 'info.picocli:picocli:4.7.7'
implementation 'org.jsoup:jsoup:1.22.2'
implementation 'com.fasterxml.jackson.core:jackson-databind:2.22.0'
// Native Anthropic SDK for the optional hosted Claude synthesis provider. Local-first
// stays the default; this is only used with --llm-provider anthropic.
implementation 'com.anthropic:anthropic-java:2.43.0'
// JSpecify nullness annotations (@NullMarked on package-info, @Nullable on APIs).
// CLASS-retention, so compile-only is enough — nothing is needed at runtime.
compileOnly 'org.jspecify:jspecify:1.0.0'
// VibeTags: compile-time AI guardrail annotations + processor. SOURCE-retention,
// zero runtime footprint; the processor regenerates the AI config files on compile.
compileOnly "se.deversity.vibetags:vibetags-processor:${vibetagsVersion}"
annotationProcessor "se.deversity.vibetags:vibetags-processor:${vibetagsVersion}"
// Error Prone — bug-pattern checks woven into javac (main sources only).
errorprone 'com.google.errorprone:error_prone_core:2.50.0'
// JUnit Jupiter 6.0.3+ is required by async-test-lib; archunit-junit5 1.4.x is compatible.
testImplementation 'org.junit.jupiter:junit-jupiter:6.1.0'
testImplementation 'org.mockito:mockito-core:5.23.0'
testImplementation 'org.mockito:mockito-junit-jupiter:5.23.0'
testImplementation 'com.tngtech.archunit:archunit-junit5:1.4.2'
// async-test-lib: JUnit 5 extension that stress-tests concurrent code (@AsyncTest).
testImplementation 'se.deversity.async-test-lib:async-test-lib:1.12.0'
testRuntimeOnly 'org.junit.platform:junit-platform-launcher:6.1.0'
// code-karta CLI (shaded), used only by the `diagrams` task below.
codekarta "se.deversity.codekarta:code-karta-cli:${codekartaVersion}:all"
}
application {
mainClass = 'se.deversity.skill3.Skill3App'
}
// Build, test and run on JDK 25. The toolchain is provisioned by Gradle (auto-detected
// from installed JDKs, or downloaded via the Foojay resolver in settings.gradle), so the
// build no longer depends on JAVA_HOME — it works regardless of the JDK running Gradle.
java {
toolchain {
languageVersion = JavaLanguageVersion.of(25)
}
}
// Target Java 25 bytecode. Redundant with the toolchain above, but kept explicit so the
// bytecode floor is obvious and survives any future toolchain change.
tasks.withType(JavaCompile).configureEach {
options.release = 25
options.encoding = 'UTF-8'
// Point VibeTags at the project root (Gradle runs javac in a worker whose CWD differs)
// and set the project name used in generated llms.txt / llms-full.txt headers.
options.compilerArgs += ["-Avibetags.root=${rootDir}".toString(), '-Avibetags.project=Skill3']
}
// Error Prone: enabled on main sources, disabled on tests (mocks/fixtures trip checks
// that don't apply to production code).
tasks.named('compileJava') {
options.errorprone {
// SOURCE-retention guardrail annotations have no canonical javac home; silence
// the unrelated finalize() check that doesn't apply to this codebase.
disable('UnsafeFinalization')
}
}
tasks.named('compileTestJava') {
options.errorprone.enabled = false
}
tasks.named('test') {
useJUnitPlatform()
// async-test-lib (@AsyncTest) is PolyForm Noncommercial; run its license guard in mock
// mode for the test JVM (noncommercial development use).
jvmArgs '-Dlicense.mock.mode=true'
testLogging {
events 'passed', 'skipped', 'failed'
}
finalizedBy jacocoTestReport
}
jacocoTestReport {
dependsOn test
reports {
xml.required = true
html.required = true
}
}
// Coverage gate, set below current (~81% instruction / ~72% branch) to catch regressions
// without being brittle. Wired into `check`, so CI fails if coverage drops materially.
jacocoTestCoverageVerification {
dependsOn test
violationRules {
rule {
limit {
counter = 'INSTRUCTION'
minimum = 0.75
}
limit {
counter = 'BRANCH'
minimum = 0.65
}
}
}
}
tasks.named('check') {
dependsOn jacocoTestCoverageVerification
}
pmd {
consoleOutput = true
toolVersion = '7.25.0'
ignoreFailures = false
ruleSets = [] // use only our curated ruleset, not PMD's defaults
ruleSetFiles = files("$rootDir/config/pmd-ruleset.xml")
}
tasks.named('pmdTest') { enabled = false }
spotbugs {
toolVersion = '4.10.2' // pin a SpotBugs that understands Java 25 class files
effort = Effort.valueOf('MAX')
reportLevel = Confidence.valueOf('LOW')
ignoreFailures = false
excludeFilter = file("$rootDir/config/spotbugs-exclude.xml")
}
tasks.named('spotbugsTest') { enabled = false }
tasks.named('spotbugsMain') {
reports {
html { required = true }
xml { required = true }
}
}
// ---- Generated architecture diagrams (code-karta) ---------------------------
//
// The SVGs under docs/diagrams are parsed out of this source tree rather than drawn,
// so they cannot quietly disagree with the code the way a hand-maintained diagram
// does. The mermaid graph in docs/ARCHITECTURE.md is the complementary half: it shows
// the pipeline as *intended*, these show it as *written*.
//
// Regenerate with `./gradlew diagrams` and commit the result alongside the change.
def codekartaDiagrams = [
[task : 'diagramModelClasses',
input: 'src/main/java/se/deversity/skill3/model',
out : 'model-class-diagram.svg',
extra: []],
[task : 'diagramPipelineClasses',
input: 'src/main/java/se/deversity/skill3/pipeline',
out : 'pipeline-class-diagram.svg',
extra: []],
[task : 'diagramLlmClasses',
input: 'src/main/java/se/deversity/skill3/llm',
out : 'llm-class-diagram.svg',
extra: []],
[task : 'diagramPipelineSequence',
input: 'src/main/java/se/deversity/skill3/pipeline',
out : 'pipeline-sequence-diagram.svg',
extra: ['--sequence-only']],
]
def codekartaTasks = codekartaDiagrams.collect { d ->
tasks.register(d.task, JavaExec) {
group = 'documentation'
description = "Render docs/diagrams/${d.out} from ${d.input}"
classpath = configurations.codekarta
mainClass = 'se.deversity.codekarta.cli.KartaCli'
inputs.dir(file(d.input)).withPathSensitivity(PathSensitivity.RELATIVE)
outputs.file(layout.projectDirectory.file("docs/diagrams/${d.out}"))
args = ['--input', d.input,
'--output', 'docs/diagrams',
'--output-name', d.out] + d.extra
}
}
tasks.register('diagrams') {
group = 'documentation'
description = 'Regenerate every code-karta diagram under docs/diagrams'
dependsOn codekartaTasks
}