From 4d294bfee8cd5d269a1e58c85b6b0281bec4461c Mon Sep 17 00:00:00 2001 From: Adam <897017+aSemy@users.noreply.github.com> Date: Wed, 31 May 2023 21:18:10 +0200 Subject: [PATCH] tidy up build config --- build.gradle.kts | 1 - lib/build.gradle.kts | 24 +++++++++++------------- 2 files changed, 11 insertions(+), 14 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index 7b93509..3dd9d03 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -19,6 +19,5 @@ plugins { buildsrc.conventions.base } -description = "A simple defensive library to encode/decode URL components" group = "net.thauvin.erik" version = "1.3.1-SNAPSHOT" diff --git a/lib/build.gradle.kts b/lib/build.gradle.kts index 9b81aef..13e8a6a 100644 --- a/lib/build.gradle.kts +++ b/lib/build.gradle.kts @@ -18,12 +18,10 @@ plugins { buildsrc.conventions.sonarqube } -val mavenName = "UrlEncoder" +description = "A simple defensive library to encode/decode URL components" + val deployDir = project.layout.projectDirectory.dir("deploy") -val gitHub = "ethauvin/${rootProject.name}" -val mavenUrl = "https://github.com/$gitHub" -val publicationName = "mavenJava" -val myClassName = "$group.${rootProject.name}.$mavenName" +val mainClassName = "net.thauvin.erik.urlencoder.UrlEncoder" dependencies { // testImplementation("com.willowtreeapps.assertk:assertk-jvm:0.25") @@ -41,18 +39,18 @@ java { } application { - mainClass.set(myClassName) + mainClass.set(mainClassName) } tasks { jar { manifest { - attributes["Main-Class"] = myClassName + attributes["Main-Class"] = mainClassName } } - val fatJar = register("fatJar") { - group = "build" + val fatJar by registering(Jar::class) { + group = LifecycleBasePlugin.BUILD_GROUP dependsOn.addAll(listOf("compileJava", "compileKotlin", "processResources")) archiveClassifier.set("all") duplicatesStrategy = DuplicatesStrategy.EXCLUDE @@ -75,7 +73,7 @@ tasks { addTestListener(Rife2TestListener(project.properties["testsBadgeApiKey"]?.toString())) } - withType { + withType().configureEach { useJUnitPlatform() testLogging { exceptionFormat = TestExceptionFormat.FULL @@ -100,6 +98,8 @@ tasks { } val copyToDeploy by registering(Sync::class) { + description = "Copies all needed files to the 'deploy' directory." + group = PublishingPlugin.PUBLISH_TASK_GROUP from(configurations.runtimeClasspath) { exclude("annotations-*.jar") } @@ -110,9 +110,7 @@ tasks { register("deploy") { description = "Copies all needed files to the 'deploy' directory." group = PublishingPlugin.PUBLISH_TASK_GROUP - dependsOn(build, jar) - outputs.dir(deployDir) - inputs.files(copyToDeploy) + dependsOn(build, copyToDeploy) } "sonar" {