113 lines
3.9 KiB
Groovy
113 lines
3.9 KiB
Groovy
plugins {
|
|
id 'org.springframework.boot' version '3.2.5'
|
|
id 'io.spring.dependency-management' version '1.1.4'
|
|
id 'java'
|
|
}
|
|
|
|
group = 'com.kaidi'
|
|
version = providers.gradleProperty('releaseVersion')
|
|
.orElse(System.getenv('ERP_RELEASE_VERSION') ?: '0.1.0')
|
|
.get()
|
|
def productionBuild = providers.gradleProperty('productionBuild')
|
|
.map { it.toBoolean() }
|
|
.orElse(false)
|
|
|
|
java {
|
|
sourceCompatibility = JavaVersion.VERSION_17
|
|
targetCompatibility = JavaVersion.VERSION_17
|
|
}
|
|
|
|
repositories {
|
|
mavenCentral()
|
|
}
|
|
|
|
sourceSets {
|
|
installer {
|
|
java.srcDirs = ['src/installer/java']
|
|
resources.srcDirs = ['src/installer/resources']
|
|
}
|
|
installerTest {
|
|
java.srcDirs = ['src/installerTest/java']
|
|
resources.srcDirs = ['src/installerTest/resources']
|
|
compileClasspath += sourceSets.installer.output
|
|
runtimeClasspath += sourceSets.installer.output
|
|
}
|
|
}
|
|
|
|
configurations {
|
|
installerTestImplementation.extendsFrom testImplementation, installerImplementation
|
|
installerTestRuntimeOnly.extendsFrom testRuntimeOnly, installerRuntimeOnly
|
|
}
|
|
|
|
dependencies {
|
|
implementation 'org.springframework.boot:spring-boot-starter-web'
|
|
implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
|
|
implementation 'org.springframework.boot:spring-boot-starter-validation'
|
|
// Real-time collaboration (yjs CRDT relay) over WebSocket.
|
|
implementation 'org.springframework.boot:spring-boot-starter-websocket'
|
|
|
|
// Production database and versioned schema migrations.
|
|
implementation 'org.flywaydb:flyway-core:10.22.0'
|
|
runtimeOnly 'org.flywaydb:flyway-database-postgresql:10.22.0'
|
|
runtimeOnly 'org.postgresql:postgresql'
|
|
|
|
// SQLite remains available to source-tree development and tests, but is
|
|
// deliberately absent from PostgreSQL-only production release artifacts.
|
|
if (!productionBuild.get()) {
|
|
runtimeOnly 'org.xerial:sqlite-jdbc:3.45.3.0'
|
|
runtimeOnly 'org.hibernate.orm:hibernate-community-dialects'
|
|
}
|
|
|
|
// jackson-databind arrives transitively via starter-web; declared for clarity.
|
|
implementation 'com.fasterxml.jackson.core:jackson-databind'
|
|
|
|
// jsoup —— 富文本写入时的服务端 HTML 白名单净化(HtmlSanitizer)。像浏览器一样解析、
|
|
// 解码 HTML 实体后再按白名单判定标签/属性/协议,根除正则消毒被实体编码(: 等)绕过的整类 XSS。
|
|
implementation 'org.jsoup:jsoup:1.22.2'
|
|
|
|
testImplementation 'org.springframework.boot:spring-boot-starter-test'
|
|
|
|
installerImplementation 'org.springframework.boot:spring-boot-starter-web'
|
|
installerImplementation 'org.springframework.boot:spring-boot-starter-validation'
|
|
installerImplementation 'org.flywaydb:flyway-core:10.22.0'
|
|
installerRuntimeOnly 'org.flywaydb:flyway-database-postgresql:10.22.0'
|
|
installerRuntimeOnly 'org.postgresql:postgresql'
|
|
}
|
|
|
|
tasks.named('test') {
|
|
useJUnitPlatform()
|
|
}
|
|
|
|
tasks.named('processInstallerResources') {
|
|
from('src/main/resources') {
|
|
include 'db/migration/postgresql/**'
|
|
}
|
|
}
|
|
|
|
tasks.register('installerTest', Test) {
|
|
description = 'Runs tests for the standalone web installer.'
|
|
group = 'verification'
|
|
testClassesDirs = sourceSets.installerTest.output.classesDirs
|
|
classpath = sourceSets.installerTest.runtimeClasspath
|
|
useJUnitPlatform()
|
|
}
|
|
|
|
tasks.register('installerBootJar', org.springframework.boot.gradle.tasks.bundling.BootJar) {
|
|
description = 'Builds the standalone first-run web installer.'
|
|
group = 'build'
|
|
archiveBaseName = 'kaidi-erp-installer'
|
|
archiveVersion = project.version
|
|
mainClass = 'com.kaidi.oa.install.InstallerApplication'
|
|
targetJavaVersion = JavaVersion.VERSION_17
|
|
classpath = sourceSets.installer.runtimeClasspath
|
|
dependsOn tasks.named('installerClasses')
|
|
}
|
|
|
|
tasks.named('check') {
|
|
dependsOn tasks.named('installerTest')
|
|
}
|
|
|
|
springBoot {
|
|
buildInfo()
|
|
}
|