-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.gradle.kts
More file actions
137 lines (116 loc) · 3.88 KB
/
Copy pathbuild.gradle.kts
File metadata and controls
137 lines (116 loc) · 3.88 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
// Spring Boot + Thymeleaf example host application with dynamic PF4J plugin pages.
plugins {
java
alias(libs.plugins.spring.boot)
alias(libs.plugins.spring.dependency.management)
alias(libs.plugins.spotless)
}
val lifecycleTasks = listOf("build", "clean", "assemble", "check")
lifecycleTasks.forEach { taskName ->
tasks.named(taskName) {
dependsOn(subprojects.mapNotNull { it.tasks.findByName(taskName) })
if (taskName == "build" || taskName == "assemble") {
dependsOn(copyClientPlugin)
}
}
}
val plugwerkClientPluginZip: Configuration by configurations.creating {
isTransitive = false
}
dependencies {
plugwerkClientPluginZip(
variantOf(libs.plugwerk.client.plugin) {
classifier("pf4j")
artifactType("zip")
},
)
}
val copyClientPlugin by tasks.registering(Copy::class) {
group = "build"
description = "Downloads the plugwerk-client-plugin PF4J ZIP into the plugins directory"
from(plugwerkClientPluginZip)
into(layout.projectDirectory.dir("plugins"))
}
val projectVersion = rootProject.file("../VERSION").readText().trim()
allprojects {
group = "io.plugwerk.examples"
version = projectVersion
repositories {
mavenCentral()
maven {
name = "GitHubPackages"
url = uri("https://maven.pkg.github.com/plugwerk/plugwerk")
credentials {
username = providers.gradleProperty("gpr.user")
.orElse(providers.environmentVariable("GITHUB_ACTOR"))
.getOrElse("")
password = providers.gradleProperty("gpr.key")
.orElse(providers.environmentVariable("GITHUB_TOKEN"))
.getOrElse("")
}
}
}
// While the SDK is on SNAPSHOTs, always re-resolve changing modules so CI
// and local builds pick up upstream fixes within minutes instead of waiting
// for Gradle's 24h default cache. Drop this once the examples pin to a
// stable plugwerk release.
configurations.all {
resolutionStrategy.cacheChangingModulesFor(0, "seconds")
}
}
subprojects {
apply(plugin = "java-library")
apply(plugin = "com.diffplug.spotless")
extensions.configure<JavaPluginExtension> {
toolchain {
languageVersion.set(JavaLanguageVersion.of(21))
}
}
extensions.configure<com.diffplug.gradle.spotless.SpotlessExtension> {
java {
target("src/**/*.java")
licenseHeaderFile(rootProject.file("../license-header.txt"))
googleJavaFormat()
}
}
tasks.withType<Test> {
useJUnitPlatform()
}
tasks.withType<JavaCompile> {
options.encoding = "UTF-8"
}
}
java {
toolchain {
languageVersion.set(JavaLanguageVersion.of(21))
}
}
spotless {
java {
target("src/**/*.java")
licenseHeaderFile(rootProject.file("../license-header.txt"))
googleJavaFormat()
}
}
dependencies {
// Extension-point API
implementation(project(":plugwerk-springboot-thymeleaf-example-api"))
// plugwerk-spi must be on the HOST classpath so PF4J can match the interface
// loaded by the parent classloader with the plugin's implementation.
// plugwerk-client-plugin itself is NOT a compile dependency —
// it is loaded at runtime as a PF4J plugin from the plugins directory.
implementation(libs.plugwerk.spi)
implementation(libs.pf4j)
implementation(libs.slf4j.api)
runtimeOnly(libs.logback.classic)
// Spring Boot + Thymeleaf
implementation("org.springframework.boot:spring-boot-starter-web")
implementation("org.springframework.boot:spring-boot-starter-thymeleaf")
implementation(libs.thymeleaf.layout.dialect)
}
tasks.withType<JavaCompile> {
options.encoding = "UTF-8"
}
springBoot {
mainClass.set("io.plugwerk.example.webapp.WebApp")
}