1
0
mirror of https://github.com/octoleo/plantuml.git synced 2024-11-05 21:17:52 +00:00
plantuml/build.gradle.kts
soloturn e15c58d9a2 allow "gradle build -PjavacRelease=17" to build java-17 binary
for gradle now one could do:
gradle clean build -x test -x javaDoc -PjavacRelease=17

for maven something like this works to build a different target binary:
mvn clean package -Dmaven.test.skip=true -Dmaven.javadoc.skip=true -Dmaven.compiler.release=17
2022-02-08 11:12:24 +01:00

106 lines
2.1 KiB
Plaintext

val javacRelease: String by project
plugins {
java
`maven-publish`
signing
}
repositories {
mavenLocal()
mavenCentral()
}
dependencies {
compileOnly("org.apache.ant:ant:1.10.12")
testImplementation("org.assertj:assertj-core:3.22.0")
testImplementation("org.junit.jupiter:junit-jupiter:5.8.2")
testImplementation("org.scilab.forge:jlatexmath:1.0.7")
}
group = "net.sourceforge.plantuml"
description = "PlantUML"
java {
withSourcesJar()
withJavadocJar()
}
sourceSets {
main {
java {
srcDirs("src")
}
resources {
srcDirs("src")
include("**/graphviz.dat")
include("**/*.png")
include("**/*.svg")
include("**/*.txt")
}
}
test {
java {
srcDirs("test")
}
resources {
srcDirs(".")
include("skin/**/*.skin")
include("themes/**/*.puml")
}
}
}
tasks.compileJava {
options.release.set(Integer.parseInt(javacRelease))
}
tasks.withType<Jar> {
manifest {
attributes["Main-Class"] = "net.sourceforge.plantuml.Run"
attributes["Implementation-Version"] = archiveVersion
attributes["Build-Jdk-Spec"] = System.getProperty("java.specification.version")
from("manifest.txt")
}
dependsOn(configurations.runtimeClasspath)
from({
configurations.runtimeClasspath.get().filter { it.name.endsWith("jar") }.map { zipTree(it) }
})
// source sets for java and resources are on "src", only put once into the jar
duplicatesStrategy = org.gradle.api.file.DuplicatesStrategy.EXCLUDE
from("skin") { into("skin") }
from("stdlib") { into("stdlib") }
from("svg") { into("svg") }
from("themes") { into("themes") }
}
publishing {
publications.create<MavenPublication>("maven") {
from(components["java"])
}
}
tasks.withType<JavaCompile> {
options.encoding = "UTF-8"
}
tasks.withType<Javadoc> {
options {
this as StandardJavadocDocletOptions
addBooleanOption("Xdoclint:none", true)
addStringOption("Xmaxwarns", "1")
}
}
tasks.test {
useJUnitPlatform()
testLogging.showStandardStreams = true
}
signing {
useGpgCmd()
sign(publishing.publications["maven"])
}