y9-build-logic/risenet-gradle-build-logic/src/main/kotlin/net.risesoft.y9.java-conven...

52 lines
1.3 KiB
Plaintext

plugins {
id("java-library")
id("net.risesoft.y9.management")
id("net.risesoft.y9.java-publish")
}
group = "net.risesoft"
version = findProperty("Y9_VERSION").toString()
java {
sourceCompatibility = JavaVersion.VERSION_21
toolchain {
languageVersion.set(JavaLanguageVersion.of(21))
}
withJavadocJar()
withSourcesJar()
}
tasks.withType<JavaCompile> {
//sourceCompatibility = JavaVersion.VERSION_21.toString()
//targetCompatibility = JavaVersion.VERSION_21.toString()
options.encoding = "UTF-8"
val compilerArgs = options.compilerArgs
compilerArgs.add("-parameters")
compilerArgs.add("-Xlint:all")
compilerArgs.add("-Xdiags:verbose")
}
tasks.withType<Javadoc> {
//enabled = false
isFailOnError = false
val doclet = options as StandardJavadocDocletOptions
doclet.encoding = "UTF-8"
doclet.docEncoding = "UTF-8"
doclet.addBooleanOption("html5", true)
//doclet.addStringOption("Xdoclint:all,-missing", "-quiet")
doclet.addStringOption("Xdoclint:none", "-quiet") // 禁用所有文档检查
}
tasks.test {
useJUnitPlatform()
//exclude("**/*")
}
tasks.withType<Test> { // OR tasks.test {
onlyIf {
properties["testsEnabled"].toString().toBoolean()
}
//enabled = false
}