|
| 1 | +import org.gradle.api.tasks.testing.logging.TestExceptionFormat |
| 2 | +import org.jetbrains.kotlin.gradle.tasks.KotlinCompile |
| 3 | + |
| 4 | +plugins { |
| 5 | + `java-library` |
| 6 | + signing |
| 7 | + `maven-publish` |
| 8 | + kotlin("jvm") version "1.6.21" |
| 9 | +} |
| 10 | + |
| 11 | +group = "io.kotest.extensions" |
| 12 | +version = Ci.version |
| 13 | + |
| 14 | +repositories { |
| 15 | + mavenCentral() |
| 16 | + maven { |
| 17 | + url = uri("https://oss.sonatype.org/content/repositories/snapshots") |
| 18 | + } |
| 19 | +} |
| 20 | + |
| 21 | +dependencies { |
| 22 | + api("io.ktor:ktor-server-core:2.1.2") |
| 23 | + testImplementation("io.ktor:ktor-client-apache:2.1.2") |
| 24 | +} |
| 25 | + |
| 26 | +tasks.test { |
| 27 | + useJUnitPlatform() |
| 28 | + testLogging { |
| 29 | + showExceptions = true |
| 30 | + showStandardStreams = true |
| 31 | + exceptionFormat = TestExceptionFormat.FULL |
| 32 | + } |
| 33 | +} |
| 34 | + |
| 35 | +tasks.withType<KotlinCompile> { |
| 36 | + kotlinOptions.jvmTarget = "11" |
| 37 | +} |
| 38 | + |
| 39 | +val signingKey: String? by project |
| 40 | +val signingPassword: String? by project |
| 41 | + |
| 42 | +val publications: PublicationContainer = (extensions.getByName("publishing") as PublishingExtension).publications |
| 43 | + |
| 44 | +signing { |
| 45 | + useGpgCmd() |
| 46 | + if (signingKey != null && signingPassword != null) { |
| 47 | + @Suppress("UnstableApiUsage") |
| 48 | + useInMemoryPgpKeys(signingKey, signingPassword) |
| 49 | + } |
| 50 | + if (Ci.isRelease) { |
| 51 | + sign(publications) |
| 52 | + } |
| 53 | +} |
| 54 | + |
| 55 | +java { |
| 56 | + withJavadocJar() |
| 57 | + withSourcesJar() |
| 58 | +} |
| 59 | + |
| 60 | +publishing { |
| 61 | + repositories { |
| 62 | + maven { |
| 63 | + val releasesRepoUrl = uri("https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/") |
| 64 | + val snapshotsRepoUrl = uri("https://s01.oss.sonatype.org/content/repositories/snapshots/") |
| 65 | + name = "deploy" |
| 66 | + url = if (Ci.isRelease) releasesRepoUrl else snapshotsRepoUrl |
| 67 | + credentials { |
| 68 | + username = System.getenv("OSSRH_USERNAME") ?: "" |
| 69 | + password = System.getenv("OSSRH_PASSWORD") ?: "" |
| 70 | + } |
| 71 | + } |
| 72 | + } |
| 73 | + |
| 74 | + publications { |
| 75 | + register("mavenJava", MavenPublication::class) { |
| 76 | + from(components["java"]) |
| 77 | + pom { |
| 78 | + name.set("kotest-extensions-ktor-openapi") |
| 79 | + description.set("Kotest extension for generating open-API docs") |
| 80 | + url.set("https://www.github.com/kotest/kotest-extensions-ktor-openapi") |
| 81 | + |
| 82 | + scm { |
| 83 | + connection.set("scm:git:http://www.github.com/kotest/kotest-extensions-ktor-openapi") |
| 84 | + developerConnection.set("scm:git:http://github.com/sksamuel") |
| 85 | + url.set("https://www.github.com/kotest/kotest-extensions-ktor-openapi") |
| 86 | + } |
| 87 | + |
| 88 | + licenses { |
| 89 | + license { |
| 90 | + name.set("The Apache 2.0 License") |
| 91 | + url.set("https://opensource.org/licenses/Apache-2.0") |
| 92 | + } |
| 93 | + } |
| 94 | + |
| 95 | + developers { |
| 96 | + developer { |
| 97 | + id.set("sksamuel") |
| 98 | + name.set("Stephen Samuel") |
| 99 | + |
| 100 | + } |
| 101 | + } |
| 102 | + } |
| 103 | + } |
| 104 | + } |
| 105 | +} |
0 commit comments