2022-02-10 16:10:52 +00:00
|
|
|
// permits to start the build setting the javac release parameter, no parameter means build for java8:
|
|
|
|
// gradle clean build -x javaDoc -PjavacRelease=8
|
|
|
|
// gradle clean build -x javaDoc -PjavacRelease=17
|
|
|
|
// also supported is to build first, with java17, then switch the java version, and run the test with java8:
|
|
|
|
// gradle clean build -x javaDoc -x test
|
|
|
|
// gradle test
|
2023-05-17 19:19:43 +00:00
|
|
|
println("Running build.gradle.kts")
|
|
|
|
println(project.version)
|
|
|
|
|
2022-02-10 16:10:52 +00:00
|
|
|
val javacRelease = (project.findProperty("javacRelease") ?: "8") as String
|
2022-02-08 08:18:17 +00:00
|
|
|
|
2022-01-05 17:28:46 +00:00
|
|
|
plugins {
|
2022-02-11 10:13:46 +00:00
|
|
|
java
|
|
|
|
`maven-publish`
|
|
|
|
signing
|
2023-10-02 19:30:50 +00:00
|
|
|
// id("com.adarshr.test-logger") version "3.2.0"
|
2022-01-05 17:28:46 +00:00
|
|
|
}
|
|
|
|
|
2022-02-12 17:49:30 +00:00
|
|
|
group = "net.sourceforge.plantuml"
|
|
|
|
description = "PlantUML"
|
|
|
|
|
|
|
|
java {
|
|
|
|
withSourcesJar()
|
|
|
|
withJavadocJar()
|
2022-02-12 23:34:33 +00:00
|
|
|
registerFeature("pdf") {
|
|
|
|
usingSourceSet(sourceSets["main"])
|
|
|
|
}
|
2022-01-05 17:28:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
dependencies {
|
2023-10-05 09:28:45 +00:00
|
|
|
compileOnly("org.apache.ant:ant:1.10.14")
|
2023-10-02 19:15:20 +00:00
|
|
|
|
|
|
|
testImplementation("io.github.glytching:junit-extensions:2.6.0")
|
2024-02-05 02:49:43 +00:00
|
|
|
testImplementation("org.assertj:assertj-core:3.25.3")
|
2023-11-06 02:25:05 +00:00
|
|
|
testImplementation("org.junit.jupiter:junit-jupiter:5.10.1")
|
2023-12-04 09:53:01 +00:00
|
|
|
testImplementation("org.xmlunit:xmlunit-core:2.9.+")
|
2023-10-05 18:09:06 +00:00
|
|
|
if (JavaVersion.current().isJava8) {
|
|
|
|
testImplementation("org.mockito:mockito-core:4.+")
|
|
|
|
testImplementation("org.mockito:mockito-junit-jupiter:4.+")
|
|
|
|
} else {
|
|
|
|
testImplementation("org.mockito:mockito-core:5.+")
|
|
|
|
testImplementation("org.mockito:mockito-junit-jupiter:5.+")
|
|
|
|
}
|
2022-02-11 10:13:46 +00:00
|
|
|
testImplementation("org.scilab.forge:jlatexmath:1.0.7")
|
2023-10-02 19:15:20 +00:00
|
|
|
|
2023-10-05 09:41:06 +00:00
|
|
|
"pdfRuntimeOnly"("org.apache.xmlgraphics:fop:2.9")
|
2023-10-05 01:55:45 +00:00
|
|
|
"pdfRuntimeOnly"("org.apache.xmlgraphics:batik-all:1.17")
|
2022-01-05 17:28:46 +00:00
|
|
|
}
|
|
|
|
|
2022-02-12 17:49:30 +00:00
|
|
|
repositories {
|
|
|
|
mavenLocal()
|
|
|
|
mavenCentral()
|
2022-01-05 17:28:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
sourceSets {
|
2022-02-11 10:13:46 +00:00
|
|
|
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")
|
|
|
|
}
|
|
|
|
}
|
2022-01-05 17:28:46 +00:00
|
|
|
}
|
|
|
|
|
2022-02-04 00:06:44 +00:00
|
|
|
tasks.compileJava {
|
2022-02-10 16:10:52 +00:00
|
|
|
if (JavaVersion.current().isJava8) {
|
|
|
|
java.targetCompatibility = JavaVersion.VERSION_1_8
|
|
|
|
} else {
|
|
|
|
options.release.set(Integer.parseInt(javacRelease))
|
|
|
|
}
|
2022-02-04 00:06:44 +00:00
|
|
|
}
|
|
|
|
|
2022-02-13 06:08:34 +00:00
|
|
|
tasks.withType<Jar>().configureEach {
|
2022-02-11 10:13:46 +00:00
|
|
|
manifest {
|
|
|
|
attributes["Main-Class"] = "net.sourceforge.plantuml.Run"
|
|
|
|
attributes["Implementation-Version"] = archiveVersion
|
|
|
|
attributes["Build-Jdk-Spec"] = System.getProperty("java.specification.version")
|
|
|
|
from("manifest.txt")
|
|
|
|
}
|
|
|
|
from("skin") { into("skin") }
|
|
|
|
from("stdlib") { into("stdlib") }
|
|
|
|
from("svg") { into("svg") }
|
|
|
|
from("themes") { into("themes") }
|
2022-02-12 17:49:30 +00:00
|
|
|
// source sets for java and resources are on "src", only put once into the jar
|
|
|
|
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
|
2022-01-05 17:28:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
publishing {
|
2022-02-11 10:13:46 +00:00
|
|
|
publications.create<MavenPublication>("maven") {
|
|
|
|
from(components["java"])
|
2022-03-13 09:37:03 +00:00
|
|
|
pom {
|
2023-03-09 18:44:20 +00:00
|
|
|
name.set("PlantUML")
|
|
|
|
description.set("PlantUML is a component that allows to quickly write diagrams from text.")
|
2022-09-28 23:49:41 +00:00
|
|
|
groupId = project.group as String
|
|
|
|
artifactId = project.name
|
|
|
|
version = project.version as String
|
2022-03-13 09:37:03 +00:00
|
|
|
url.set("https://plantuml.com/")
|
|
|
|
licenses {
|
|
|
|
license {
|
|
|
|
name.set("The GNU General Public License")
|
|
|
|
url.set("http://www.gnu.org/licenses/gpl.txt")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
developers {
|
|
|
|
developer {
|
|
|
|
id.set("arnaud.roques")
|
|
|
|
name.set("Arnaud Roques")
|
|
|
|
email.set("plantuml@gmail.com")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
scm {
|
|
|
|
connection.set("scm:git:git://github.com:plantuml/plantuml.git")
|
|
|
|
developerConnection.set("scm:git:ssh://git@github.com:plantuml/plantuml.git")
|
|
|
|
url.set("https://github.com/plantuml/plantuml")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
repositories {
|
2022-03-13 10:43:33 +00:00
|
|
|
maven {
|
|
|
|
name = "OSSRH"
|
2023-05-12 18:44:57 +00:00
|
|
|
val releasesRepoUrl = "https://oss.sonatype.org/service/local/staging/deploy/maven2/"
|
|
|
|
val snapshotsRepoUrl = "https://oss.sonatype.org/content/repositories/snapshots/"
|
|
|
|
url = uri(if (version.toString().endsWith("SNAPSHOT")) snapshotsRepoUrl else releasesRepoUrl)
|
2022-03-13 10:43:33 +00:00
|
|
|
credentials {
|
2022-09-26 23:51:52 +00:00
|
|
|
username = System.getenv("OSSRH_USERNAME")
|
|
|
|
password = System.getenv("OSSRH_PASSWORD")
|
2022-03-13 10:43:33 +00:00
|
|
|
}
|
|
|
|
}
|
2022-02-11 10:13:46 +00:00
|
|
|
}
|
2022-01-05 17:28:46 +00:00
|
|
|
}
|
|
|
|
|
2022-02-13 06:08:34 +00:00
|
|
|
tasks.withType<JavaCompile>().configureEach {
|
2022-02-11 10:13:46 +00:00
|
|
|
options.encoding = "UTF-8"
|
2022-01-05 17:28:46 +00:00
|
|
|
}
|
2022-01-06 23:36:03 +00:00
|
|
|
|
2022-02-13 06:08:34 +00:00
|
|
|
tasks.withType<Javadoc>().configureEach {
|
2022-02-11 10:13:46 +00:00
|
|
|
options {
|
|
|
|
this as StandardJavadocDocletOptions
|
|
|
|
addBooleanOption("Xdoclint:none", true)
|
|
|
|
addStringOption("Xmaxwarns", "1")
|
2022-02-13 05:47:22 +00:00
|
|
|
encoding = "UTF-8"
|
|
|
|
isUse = true
|
2022-02-11 10:13:46 +00:00
|
|
|
}
|
2022-01-06 23:36:03 +00:00
|
|
|
}
|
2022-01-07 01:51:54 +00:00
|
|
|
|
|
|
|
tasks.test {
|
2023-10-05 15:05:30 +00:00
|
|
|
doFirst {
|
|
|
|
println("Java Home:" + System.getProperty("java.home"));
|
|
|
|
println("Java Version: " + System.getProperty("java.version"));
|
|
|
|
}
|
2022-02-11 10:13:46 +00:00
|
|
|
useJUnitPlatform()
|
|
|
|
testLogging.showStandardStreams = true
|
2022-01-07 01:51:54 +00:00
|
|
|
}
|
2022-01-15 09:23:57 +00:00
|
|
|
|
2022-02-14 09:29:34 +00:00
|
|
|
val pdfJar by tasks.registering(Jar::class) {
|
2022-02-13 13:54:25 +00:00
|
|
|
group = "build" // OR for example, "build"
|
|
|
|
description = "Assembles a jar containing dependencies to create PDFs."
|
|
|
|
manifest.attributes["Main-Class"] = "net.sourceforge.plantuml.Run"
|
|
|
|
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
|
|
|
|
val dependencies = configurations.runtimeClasspath.get().map(::zipTree)
|
|
|
|
from(dependencies)
|
|
|
|
with(tasks.jar.get())
|
|
|
|
archiveAppendix.set("pdf")
|
|
|
|
}
|
2022-02-14 09:29:34 +00:00
|
|
|
|
|
|
|
signing {
|
2022-02-14 11:04:03 +00:00
|
|
|
if (hasProperty("signing.gnupg.keyName") && hasProperty("signing.gnupg.passphrase")) {
|
2022-02-14 09:29:34 +00:00
|
|
|
useGpgCmd()
|
2022-02-14 11:04:03 +00:00
|
|
|
} else if (hasProperty("signingKey") && hasProperty("signingPassword")) {
|
|
|
|
val signingKey: String? by project
|
|
|
|
val signingPassword: String? by project
|
|
|
|
useInMemoryPgpKeys(signingKey, signingPassword)
|
|
|
|
}
|
|
|
|
if (hasProperty("signing.gnupg.passphrase") || hasProperty("signingPassword")) {
|
2022-02-14 09:29:34 +00:00
|
|
|
sign(publishing.publications["maven"])
|
|
|
|
sign(closureOf<SignOperation> { sign(pdfJar.get()) })
|
|
|
|
}
|
|
|
|
}
|