From ae8ffb91bb3aecbd6eac0810f3af98026cc805a5 Mon Sep 17 00:00:00 2001 From: Adam <897017+aSemy@users.noreply.github.com> Date: Wed, 31 May 2023 23:24:41 +0200 Subject: [PATCH] tidy up build config files --- app/build.gradle.kts | 47 +++++++------------------------------------- lib/build.gradle.kts | 46 +++++++++++++++++-------------------------- 2 files changed, 25 insertions(+), 68 deletions(-) diff --git a/app/build.gradle.kts b/app/build.gradle.kts index 9b2a918..5797ed2 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -15,30 +15,19 @@ * limitations under the License. */ -import buildsrc.utils.Rife2TestListener -import org.gradle.api.tasks.testing.logging.TestExceptionFormat -import org.gradle.api.tasks.testing.logging.TestLogEvent import org.jetbrains.dokka.gradle.DokkaTask -import org.jetbrains.kotlin.gradle.tasks.KotlinCompile - plugins { + buildsrc.conventions.lang.`kotlin-jvm` + buildsrc.conventions.publishing id("application") id("com.github.ben-manes.versions") - id("io.gitlab.arturbosch.detekt") - id("org.jetbrains.kotlin.jvm") - id("org.jetbrains.kotlinx.kover") - - buildsrc.conventions.publishing - buildsrc.conventions.sonarqube } -val mavenName = "UrlEncoder" +description = "A simple defensive application 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 { implementation(projects.lib) @@ -60,7 +49,6 @@ application { mainClass.set(myClassName) } - tasks { jar { manifest { @@ -84,22 +72,6 @@ tasks { dependsOn(fatJar) } - withType().configureEach { - kotlinOptions.jvmTarget = java.targetCompatibility.toString() - } - - test { - addTestListener(Rife2TestListener(project.properties["testsBadgeApiKey"]?.toString())) - } - - withType().configureEach { - useJUnitPlatform() - testLogging { - exceptionFormat = TestExceptionFormat.FULL - events = setOf(TestLogEvent.PASSED, TestLogEvent.SKIPPED, TestLogEvent.FAILED) - } - } - withType().configureEach { destination = file("$projectDir/pom.xml") } @@ -117,6 +89,7 @@ tasks { } val copyToDeploy by registering(Sync::class) { + group = PublishingPlugin.PUBLISH_TASK_GROUP from(configurations.runtimeClasspath) { exclude("annotations-*.jar") } @@ -127,13 +100,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) - } - - "sonar" { - dependsOn(koverReport) + dependsOn(build, copyToDeploy) } } diff --git a/lib/build.gradle.kts b/lib/build.gradle.kts index 7089640..ecb7ac2 100644 --- a/lib/build.gradle.kts +++ b/lib/build.gradle.kts @@ -1,9 +1,21 @@ -import buildsrc.utils.Rife2TestListener -import org.gradle.api.tasks.testing.logging.TestExceptionFormat -import org.gradle.api.tasks.testing.logging.TestLogEvent -import org.jetbrains.dokka.gradle.DokkaTask -import org.jetbrains.kotlin.gradle.tasks.KotlinCompile +/* + * Copyright 2001-2023 Geert Bevin (gbevin[remove] at uwyn dot com) + * Copyright 2022-2023 Erik C. Thauvin (erik@thauvin.net) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import org.jetbrains.dokka.gradle.DokkaTask plugins { buildsrc.conventions.lang.`kotlin-jvm` @@ -14,7 +26,6 @@ plugins { description = "A simple defensive library to encode/decode URL components" val deployDir = project.layout.projectDirectory.dir("deploy") -val mainClassName = "net.thauvin.erik.urlencoder.UrlEncoder" dependencies { // testImplementation("com.willowtreeapps.assertk:assertk-jvm:0.25") @@ -32,22 +43,6 @@ java { } tasks { - withType().configureEach { - kotlinOptions.jvmTarget = java.targetCompatibility.toString() - } - - test { - addTestListener(Rife2TestListener(project.properties["testsBadgeApiKey"]?.toString())) - } - - withType().configureEach { - useJUnitPlatform() - testLogging { - exceptionFormat = TestExceptionFormat.FULL - events = setOf(TestLogEvent.PASSED, TestLogEvent.SKIPPED, TestLogEvent.FAILED) - } - } - withType().configureEach { destination = file("$projectDir/pom.xml") } @@ -59,13 +54,12 @@ tasks { withType().configureEach { dokkaSourceSets { named("main") { - moduleName.set("UrlEncoder API") + moduleName.set("UrlEncoder Library") } } } 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") @@ -79,10 +73,6 @@ tasks { group = PublishingPlugin.PUBLISH_TASK_GROUP dependsOn(build, copyToDeploy) } - - "sonar" { - dependsOn(koverReport) - } } publishing {