-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.gradle.kts
More file actions
203 lines (172 loc) · 5.09 KB
/
build.gradle.kts
File metadata and controls
203 lines (172 loc) · 5.09 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
import org.gradle.api.tasks.testing.logging.TestExceptionFormat
import org.jreleaser.model.Active
import org.jreleaser.model.Signing.Mode
plugins {
`java-library`
application
`maven-publish`
jacoco
id("org.jreleaser") version "1.21.0"
id("com.gradleup.shadow") version "9.2.2"
}
group = "tanin.ejwf"
version = "1.0.0"
description = "Embeddable Java Web Framework (EJWF)"
java {
toolchain {
languageVersion.set(JavaLanguageVersion.of(21))
}
withSourcesJar()
withJavadocJar()
sourceSets {
main {
resources {
srcDir("build/compiled-frontend-resources")
}
}
}
}
tasks.jacocoTestReport {
dependsOn(tasks.test) // tests are required to run before generating the report
reports {
xml.required = true
csv.required = false
html.outputLocation = layout.buildDirectory.dir("jacocoHtml")
}
}
repositories {
mavenCentral()
}
dependencies {
implementation("com.renomad:minum:8.3.2")
testImplementation("org.junit.jupiter:junit-jupiter:5.7.1")
testRuntimeOnly("org.junit.platform:junit-platform-launcher")
testImplementation("org.seleniumhq.selenium:selenium-java:4.36.0")
}
tasks.named<Test>("test") {
useJUnitPlatform()
maxHeapSize = "1G"
testLogging {
events("started", "passed", "skipped", "failed")
showStandardStreams = true
showStackTraces = true
showExceptions = true
showCauses = true
exceptionFormat = TestExceptionFormat.FULL
}
}
application {
mainClass.set("tanin.ejwf.Main")
}
publishing {
publications {
create<MavenPublication>("maven") {
groupId = "io.github.tanin47"
artifactId = "embeddable-java-web-framework"
version = project.version.toString()
artifact(tasks.shadowJar)
artifact(tasks["sourcesJar"])
artifact(tasks["javadocJar"])
pom {
name.set("Embeddable Java Web Framework")
description.set("An example of Embeddable Java Web Framework that you can embed into your larger application.")
url.set("https://github.com/tanin47/embeddable-java-web-framework")
inceptionYear.set("2025")
licenses {
license {
name.set("MIT")
url.set("https://spdx.org/licenses/MIT.html")
}
}
developers {
developer {
id.set("tanin47")
name.set("Tanin Na Nakorn")
}
}
scm {
connection.set("scm:git:https://github.com/tanin47/embeddable-java-web-framework.git")
developerConnection.set("scm:git:ssh://github.com/tanin47/embeddable-java-web-framework.git")
url.set("http://github.com/tanin47/embeddable-java-web-framework")
}
}
}
}
repositories {
maven {
url = uri(layout.buildDirectory.dir("staging-deploy"))
}
}
}
jreleaser {
signing {
active = Active.ALWAYS
armored = true
mode = if (System.getenv("CI") != null) Mode.MEMORY else Mode.COMMAND
command {
executable = "/opt/homebrew/bin/gpg"
}
}
deploy {
maven {
mavenCentral {
create("sonatype") {
setActive("ALWAYS")
url = "https://central.sonatype.com/api/v1/publisher"
stagingRepository("build/staging-deploy")
}
}
}
}
}
tasks.register<Exec>("compileTailwind") {
inputs.files(fileTree("frontend"))
outputs.dir("build/compiled-frontend-resources")
environment("NODE_ENV", "production")
commandLine(
"./node_modules/.bin/postcss",
"./frontend/stylesheets/tailwindbase.css",
"--config",
".",
"--output",
"./build/compiled-frontend-resources/assets/stylesheets/tailwindbase.css"
)
}
tasks.register<Exec>("compileSvelte") {
inputs.files(fileTree("frontend"))
outputs.dir("build/compiled-frontend-resources")
environment("NODE_ENV", "production")
environment("ENABLE_SVELTE_CHECK", "true")
commandLine(
"./node_modules/webpack/bin/webpack.js",
"--config",
"./webpack.config.js",
"--output-path",
"./build/compiled-frontend-resources/assets",
"--mode",
"production"
)
}
tasks.processResources {
dependsOn("compileTailwind")
dependsOn("compileSvelte")
}
tasks.named("sourcesJar") {
dependsOn("compileTailwind")
dependsOn("compileSvelte")
}
tasks.shadowJar {
archiveClassifier.set("") // Remove the suffix -all.
relocate("com", "tanin.ejwf.com")
exclude("META-INF/MANIFEST.MF")
exclude("local_dev_marker.ejwf")
}
tasks.jar {
manifest.attributes["Main-Class"] = "tanin.ejwf.Main"
}
// For CI validation.
tasks.register("printVersion") {
doLast {
print("$version")
}
}