tidy up build config

This commit is contained in:
Adam 2023-05-31 21:18:10 +02:00
parent 93e113fa69
commit 4d294bfee8
2 changed files with 11 additions and 14 deletions

View file

@ -19,6 +19,5 @@ plugins {
buildsrc.conventions.base buildsrc.conventions.base
} }
description = "A simple defensive library to encode/decode URL components"
group = "net.thauvin.erik" group = "net.thauvin.erik"
version = "1.3.1-SNAPSHOT" version = "1.3.1-SNAPSHOT"

View file

@ -18,12 +18,10 @@ plugins {
buildsrc.conventions.sonarqube buildsrc.conventions.sonarqube
} }
val mavenName = "UrlEncoder" description = "A simple defensive library to encode/decode URL components"
val deployDir = project.layout.projectDirectory.dir("deploy") val deployDir = project.layout.projectDirectory.dir("deploy")
val gitHub = "ethauvin/${rootProject.name}" val mainClassName = "net.thauvin.erik.urlencoder.UrlEncoder"
val mavenUrl = "https://github.com/$gitHub"
val publicationName = "mavenJava"
val myClassName = "$group.${rootProject.name}.$mavenName"
dependencies { dependencies {
// testImplementation("com.willowtreeapps.assertk:assertk-jvm:0.25") // testImplementation("com.willowtreeapps.assertk:assertk-jvm:0.25")
@ -41,18 +39,18 @@ java {
} }
application { application {
mainClass.set(myClassName) mainClass.set(mainClassName)
} }
tasks { tasks {
jar { jar {
manifest { manifest {
attributes["Main-Class"] = myClassName attributes["Main-Class"] = mainClassName
} }
} }
val fatJar = register<Jar>("fatJar") { val fatJar by registering(Jar::class) {
group = "build" group = LifecycleBasePlugin.BUILD_GROUP
dependsOn.addAll(listOf("compileJava", "compileKotlin", "processResources")) dependsOn.addAll(listOf("compileJava", "compileKotlin", "processResources"))
archiveClassifier.set("all") archiveClassifier.set("all")
duplicatesStrategy = DuplicatesStrategy.EXCLUDE duplicatesStrategy = DuplicatesStrategy.EXCLUDE
@ -75,7 +73,7 @@ tasks {
addTestListener(Rife2TestListener(project.properties["testsBadgeApiKey"]?.toString())) addTestListener(Rife2TestListener(project.properties["testsBadgeApiKey"]?.toString()))
} }
withType<Test> { withType<Test>().configureEach {
useJUnitPlatform() useJUnitPlatform()
testLogging { testLogging {
exceptionFormat = TestExceptionFormat.FULL exceptionFormat = TestExceptionFormat.FULL
@ -100,6 +98,8 @@ tasks {
} }
val copyToDeploy by registering(Sync::class) { val copyToDeploy by registering(Sync::class) {
description = "Copies all needed files to the 'deploy' directory."
group = PublishingPlugin.PUBLISH_TASK_GROUP
from(configurations.runtimeClasspath) { from(configurations.runtimeClasspath) {
exclude("annotations-*.jar") exclude("annotations-*.jar")
} }
@ -110,9 +110,7 @@ tasks {
register("deploy") { register("deploy") {
description = "Copies all needed files to the 'deploy' directory." description = "Copies all needed files to the 'deploy' directory."
group = PublishingPlugin.PUBLISH_TASK_GROUP group = PublishingPlugin.PUBLISH_TASK_GROUP
dependsOn(build, jar) dependsOn(build, copyToDeploy)
outputs.dir(deployDir)
inputs.files(copyToDeploy)
} }
"sonar" { "sonar" {