Refactor build scripts and workflows (#52)

* Refactor build scripts and workflows

* Add a unit test sample

* chore: bump @halo-dev/ui-plugin-bundler-kit version

Signed-off-by: Ryan Wang <i@ryanc.cc>

---------

Signed-off-by: Ryan Wang <i@ryanc.cc>
Co-authored-by: Ryan Wang <i@ryanc.cc>
This commit is contained in:
John Niang
2025-06-19 16:50:31 +08:00
committed by GitHub
parent d7629caa1f
commit e31b994a7f
12 changed files with 1114 additions and 95 deletions

View File

@@ -1,56 +1,48 @@
plugins {
id 'java'
id "com.github.node-gradle.node" version "7.0.2"
id "io.freefair.lombok" version "8.0.1"
id "run.halo.plugin.devtools" version "0.2.0"
id "io.freefair.lombok" version "8.13"
id "run.halo.plugin.devtools" version "0.6.0"
}
group 'run.halo.starter'
sourceCompatibility = JavaVersion.VERSION_17
repositories {
mavenCentral()
maven { url 'https://s01.oss.sonatype.org/content/repositories/releases' }
maven { url 'https://s01.oss.sonatype.org/content/repositories/snapshots/' }
maven { url 'https://repo.spring.io/milestone' }
}
dependencies {
implementation platform('run.halo.tools.platform:plugin:2.20.0-SNAPSHOT')
implementation platform('run.halo.tools.platform:plugin:2.21.0')
compileOnly 'run.halo.app:api'
testImplementation 'run.halo.app:api'
testImplementation 'org.springframework.boot:spring-boot-starter-test'
testRuntimeOnly 'org.junit.platform:junit-platform-launcher'
}
test {
useJUnitPlatform()
}
tasks.withType(JavaCompile).configureEach {
options.encoding = "UTF-8"
}
node {
nodeProjectDir = file("${project.projectDir}/ui")
}
tasks.register('buildFrontend', PnpmTask) {
args = ['build']
dependsOn('installDepsForUI')
}
tasks.register('installDepsForUI', PnpmTask) {
args = ['install']
}
build {
// build frontend before build
tasks.named('compileJava').configure {
dependsOn('buildFrontend')
java {
toolchain {
languageVersion = JavaLanguageVersion.of(21)
}
}
halo {
version = '2.20'
tasks.withType(JavaCompile).configureEach {
options.encoding = "UTF-8"
options.release = 21
}
tasks.register('processUiResources', Copy) {
from project(':ui').tasks.named('buildFrontend')
into layout.buildDirectory.dir('resources/main/console')
}
tasks.named('processResources', ProcessResources) {
dependsOn tasks.named('processUiResources')
}
halo {
version = '2.21'
}