build.gradle.kts
2.16 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
plugins {
alias(libs.plugins.kotlin.jvm)
}
description = "vibe_erp reference plug-in: a hello-world printing-shop customer expressed entirely through api.v1."
// Marker that the root build.gradle.kts uses to apply the plug-in dependency
// rule (no `:platform:*`, no `:pbc:*`, only `:api:api-v1`).
extra["vibeerp.module-kind"] = "plugin"
java {
toolchain {
languageVersion.set(JavaLanguageVersion.of(21))
}
}
kotlin {
jvmToolchain(21)
}
// CRITICAL: this plug-in may depend on api/api-v1 ONLY. The root
// build.gradle.kts enforces this; adding `:platform:*` or `:pbc:*` here
// will fail the build with an architectural-violation error.
//
// This restriction is the entire point of having a "reference plug-in"
// in the repo: it is the executable proof that the framework can express
// a real customer's workflow using only the public plug-in API. If this
// plug-in needs more than api.v1 offers, the right answer is to grow
// api.v1 deliberately, NOT to reach into platform internals.
dependencies {
implementation(project(":api:api-v1"))
implementation(libs.kotlin.stdlib)
compileOnly(libs.pf4j) // for @Extension annotations; provided by host at runtime
}
// Package this as a "fat plug-in JAR" — PF4J expects a single JAR with the
// plug-in's manifest in META-INF and all of its (non-host) dependencies
// inside it. Since this plug-in only depends on api.v1 (which is provided by
// the host) and the Kotlin stdlib (also provided), the resulting JAR is tiny.
tasks.jar {
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
manifest {
attributes(
"Plugin-Id" to "printing-shop",
"Plugin-Version" to project.version,
"Plugin-Provider" to "vibe_erp reference",
"Plugin-Class" to "org.vibeerp.reference.printingshop.PrintingShopPlugin",
"Plugin-Description" to "Reference printing-shop customer plug-in",
"Plugin-Requires" to "1.x",
)
}
// src/main/resources is already on the resource path automatically; no
// need for an explicit `from(...)` block — that was causing the
// "duplicate plugin.yml" error because Gradle would try to copy it twice.
}