split up app/lib
This commit is contained in:
parent
d90fe5a7c8
commit
b2316b0029
11 changed files with 477 additions and 152 deletions
|
@ -1,17 +1,20 @@
|
|||
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")
|
||||
}
|
||||
|
||||
description = "A simple defensive library to encode/decode URL components"
|
||||
|
||||
val deployDir = project.layout.projectDirectory.dir("deploy")
|
||||
val urlEncoderMainClass = "net.thauvin.erik.urlencoder.UrlEncoder"
|
||||
val mainClassName = "net.thauvin.erik.urlencoder.UrlEncoder"
|
||||
|
||||
dependencies {
|
||||
// testImplementation("com.willowtreeapps.assertk:assertk-jvm:0.25")
|
||||
|
@ -22,37 +25,37 @@ base {
|
|||
archivesName.set(rootProject.name)
|
||||
}
|
||||
|
||||
application {
|
||||
mainClass.set(urlEncoderMainClass)
|
||||
java {
|
||||
sourceCompatibility = JavaVersion.VERSION_11
|
||||
targetCompatibility = JavaVersion.VERSION_11
|
||||
withSourcesJar()
|
||||
}
|
||||
|
||||
tasks {
|
||||
jar {
|
||||
manifest {
|
||||
attributes["Main-Class"] = urlEncoderMainClass
|
||||
withType<KotlinCompile>().configureEach {
|
||||
kotlinOptions.jvmTarget = java.targetCompatibility.toString()
|
||||
}
|
||||
|
||||
test {
|
||||
addTestListener(Rife2TestListener(project.properties["testsBadgeApiKey"]?.toString()))
|
||||
}
|
||||
|
||||
withType<Test>().configureEach {
|
||||
useJUnitPlatform()
|
||||
testLogging {
|
||||
exceptionFormat = TestExceptionFormat.FULL
|
||||
events = setOf(TestLogEvent.PASSED, TestLogEvent.SKIPPED, TestLogEvent.FAILED)
|
||||
}
|
||||
}
|
||||
|
||||
val fatJar by registering(Jar::class) {
|
||||
group = LifecycleBasePlugin.BUILD_GROUP
|
||||
dependsOn.addAll(listOf("compileJava", "compileKotlin", "processResources"))
|
||||
archiveClassifier.set("all")
|
||||
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
|
||||
manifest { attributes(mapOf("Main-Class" to application.mainClass)) }
|
||||
val sourcesMain = sourceSets.main.get()
|
||||
val contents = configurations.runtimeClasspath.get()
|
||||
.map { if (it.isDirectory) it else zipTree(it) } + sourcesMain.output
|
||||
from(contents)
|
||||
}
|
||||
|
||||
build {
|
||||
dependsOn(fatJar)
|
||||
}
|
||||
|
||||
withType<GenerateMavenPom>().configureEach {
|
||||
destination = file("$projectDir/pom.xml")
|
||||
}
|
||||
|
||||
clean {
|
||||
delete(deployDir)
|
||||
}
|
||||
|
||||
withType<DokkaTask>().configureEach {
|
||||
dokkaSourceSets {
|
||||
named("main") {
|
||||
|
@ -77,8 +80,8 @@ tasks {
|
|||
dependsOn(build, copyToDeploy)
|
||||
}
|
||||
|
||||
clean {
|
||||
delete(deployDir)
|
||||
"sonar" {
|
||||
dependsOn(koverReport)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -86,7 +89,7 @@ publishing {
|
|||
publications {
|
||||
create<MavenPublication>("mavenJava") {
|
||||
from(components["java"])
|
||||
artifactId = rootProject.name
|
||||
artifactId = "${rootProject.name}-lib"
|
||||
artifact(tasks.javadocJar)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue