1
0
mirror of https://github.com/octoleo/plantuml.git synced 2024-11-22 21:15:09 +00:00
plantuml/build.gradle.kts

173 lines
4.3 KiB
Plaintext
Raw Normal View History

// 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
val javacRelease = (project.findProperty("javacRelease") ?: "8") as String
plugins {
java
`maven-publish`
signing
}
group = "net.sourceforge.plantuml"
description = "PlantUML"
java {
withSourcesJar()
withJavadocJar()
2022-02-12 23:34:33 +00:00
registerFeature("pdf") {
usingSourceSet(sourceSets["main"])
}
}
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")
2022-02-14 10:30:35 +00:00
"pdfRuntimeOnly"("org.apache.xmlgraphics:fop:2.7")
2022-02-12 23:34:33 +00:00
"pdfRuntimeOnly"("org.apache.xmlgraphics:batik-all:1.14")
}
repositories {
mavenLocal()
mavenCentral()
}
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 {
if (JavaVersion.current().isJava8) {
java.targetCompatibility = JavaVersion.VERSION_1_8
} else {
options.release.set(Integer.parseInt(javacRelease))
}
}
tasks.withType<Jar>().configureEach {
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") }
// source sets for java and resources are on "src", only put once into the jar
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
}
publishing {
publications.create<MavenPublication>("maven") {
from(components["java"])
pom {
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")
}
}
suppressAllPomMetadataWarnings()
}
repositories {
maven {
name = "fstest"
url = uri(layout.buildDirectory.dir("repo"))
}
maven {
name = "OSSRH"
url = uri("https://oss.sonatype.org/service/local/staging/deploy/maven2/")
credentials {
username = System.getenv("MAVEN_USERNAME")
password = System.getenv("MAVEN_PASSWORD")
}
}
}
}
tasks.withType<JavaCompile>().configureEach {
options.encoding = "UTF-8"
}
2022-01-06 23:36:03 +00:00
tasks.withType<Javadoc>().configureEach {
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-01-06 23:36:03 +00:00
}
tasks.test {
useJUnitPlatform()
testLogging.showStandardStreams = true
}
2022-01-15 09:23:57 +00:00
val pdfJar by tasks.registering(Jar::class) {
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")
}
signing {
if (hasProperty("signing.gnupg.keyName") && hasProperty("signing.gnupg.passphrase")) {
useGpgCmd()
} 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")) {
sign(publishing.publications["maven"])
sign(closureOf<SignOperation> { sign(pdfJar.get()) })
}
}