79 lines
1.9 KiB
Groovy
79 lines
1.9 KiB
Groovy
plugins {
|
|
id 'java'
|
|
id 'org.springframework.boot' version '4.1.2'
|
|
id 'io.spring.dependency-management' version '1.1.7'
|
|
}
|
|
|
|
group = 'com.htop-web'
|
|
version = '0.0.1-SNAPSHOT'
|
|
|
|
java {
|
|
toolchain {
|
|
languageVersion = JavaLanguageVersion.of(21)
|
|
}
|
|
}
|
|
|
|
repositories {
|
|
mavenCentral()
|
|
}
|
|
|
|
dependencies {
|
|
implementation 'org.springframework.boot:spring-boot-starter-actuator'
|
|
implementation 'org.springframework.boot:spring-boot-starter-webflux'
|
|
|
|
testImplementation 'org.springframework.boot:spring-boot-starter-webflux-test'
|
|
testRuntimeOnly 'org.junit.platform:junit-platform-launcher'
|
|
|
|
implementation 'com.github.oshi:oshi-core:7.7.2'
|
|
}
|
|
|
|
tasks.named('test') {
|
|
useJUnitPlatform()
|
|
}
|
|
|
|
def frontendDir = file('../frontend')
|
|
def frontendDistDir = file('../frontend/dist/frontend/browser')
|
|
def springStaticDir = file('src/main/resources/static')
|
|
|
|
tasks.register('installFrontendDependencies', Exec) {
|
|
workingDir frontendDir
|
|
|
|
inputs.file(file('../frontend/package.json'))
|
|
inputs.file(file('../frontend/package-lock.json'))
|
|
outputs.dir(file('../frontend/node_modules'))
|
|
|
|
if (System.getProperty('os.name').toLowerCase().contains('windows')) {
|
|
commandLine 'cmd', '/c', 'npm', 'ci'
|
|
} else {
|
|
commandLine 'npm', 'ci'
|
|
}
|
|
}
|
|
|
|
tasks.register('buildFrontend', Exec) {
|
|
dependsOn 'installFrontendDependencies'
|
|
workingDir frontendDir
|
|
|
|
inputs.dir(file('../frontend/src'))
|
|
inputs.file(file('../frontend/angular.json'))
|
|
inputs.file(file('../frontend/tsconfig.json'))
|
|
|
|
outputs.dir(frontendDistDir)
|
|
|
|
if (System.getProperty('os.name').toLowerCase().contains('windows')) {
|
|
commandLine 'cmd', '/c', 'npm', 'run', 'build', '--', '--configuration', 'production'
|
|
} else {
|
|
commandLine 'npm', 'run', 'build', '--', '--configuration', 'production'
|
|
}
|
|
}
|
|
|
|
tasks.register('copyFrontend', Copy) {
|
|
dependsOn 'buildFrontend'
|
|
|
|
from(frontendDistDir)
|
|
into(springStaticDir)
|
|
}
|
|
|
|
tasks.named('processResources') {
|
|
dependsOn 'copyFrontend'
|
|
}
|