113 lines
2.5 KiB
Groovy
113 lines
2.5 KiB
Groovy
plugins {
|
|
id 'java'
|
|
id 'io.franzbecker.gradle-lombok' version '3.0.0'
|
|
id 'application'
|
|
id 'org.openjfx.javafxplugin' version '0.1.0'
|
|
id 'org.beryx.jlink' version '2.26.0'
|
|
}
|
|
|
|
group = project_group
|
|
version = project_version
|
|
|
|
repositories {
|
|
mavenCentral()
|
|
}
|
|
|
|
ext {
|
|
junitVersion = '5.10.0'
|
|
}
|
|
|
|
sourceCompatibility = '17'
|
|
targetCompatibility = '17'
|
|
|
|
tasks.withType(JavaCompile).configureEach {
|
|
options.release = 17 // 明确指定Java版本
|
|
options.encoding = 'UTF-8'
|
|
}
|
|
|
|
application {
|
|
mainModule = 'top.r3944realms.docchecktoolrefactored'
|
|
mainClass = 'top.r3944realms.docchecktoolrefactored.Main'
|
|
}
|
|
|
|
javafx {
|
|
version = '17.0.6'
|
|
modules = ['javafx.controls', 'javafx.fxml']
|
|
}
|
|
|
|
processResources {
|
|
// exclude 'logback.xml'
|
|
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
|
|
}
|
|
|
|
dependencies {
|
|
// Logback classic (included slf4j &)
|
|
implementation 'ch.qos.logback:logback-classic:1.5.6'
|
|
implementation 'org.apache.logging.log4j:log4j-slf4j2-impl:2.20.0'
|
|
|
|
// Lombok
|
|
compileOnly("org.projectlombok:lombok:1.18.38")
|
|
annotationProcessor("org.projectlombok:lombok:1.18.38")
|
|
|
|
testCompileOnly("org.projectlombok:lombok:1.18.38")
|
|
testAnnotationProcessor("org.projectlombok:lombok:1.18.38")
|
|
|
|
testImplementation("org.junit.jupiter:junit-jupiter-api:${junitVersion}")
|
|
testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:${junitVersion}")
|
|
}
|
|
|
|
test {
|
|
useJUnitPlatform()
|
|
configurations.configureEach {
|
|
exclude group: 'org.apache.logging.log4j', module: 'log4j-slf4j-impl'
|
|
}
|
|
}
|
|
|
|
tasks.register('createLogDir') {
|
|
doLast {
|
|
mkdir "${projectDir}/logs"
|
|
}
|
|
|
|
}
|
|
// 打包sourcesJar任务
|
|
tasks.register('sourcesJar', Jar) {
|
|
dependsOn classes
|
|
|
|
from sourceSets.main.allSource
|
|
}
|
|
// 打包javadocJar任务
|
|
tasks.register('javadocJar', Jar) {
|
|
dependsOn javadoc
|
|
|
|
from javadoc.destinationDir
|
|
}
|
|
|
|
// 解决javadoc打包乱码
|
|
javadoc {
|
|
options {
|
|
encoding "UTF-8"
|
|
charSet 'UTF-8'
|
|
author true
|
|
version true
|
|
title "DG_LAB"
|
|
}
|
|
}
|
|
|
|
|
|
jlink {
|
|
imageZip = project.file("${buildDir}/distributions/app-${javafx.platform.classifier}.zip")
|
|
options = ['--strip-debug', '--compress', '2', '--no-header-files', '--no-man-pages']
|
|
launcher {
|
|
name = 'DocCheckTool'
|
|
jvmArgs = ['-Dlogback.configurationFile=./config/logback.xml'] // 支持外部配置
|
|
}
|
|
mergedModule {
|
|
requires 'java.logging'
|
|
requires 'java.xml'
|
|
}
|
|
}
|
|
|
|
jlinkZip {
|
|
group = 'distribution'
|
|
}
|
|
processResources.dependsOn createLogDir |