|
1 | 1 | import com.github.benmanes.gradle.versions.updates.DependencyUpdatesTask |
2 | | -import org.jetbrains.dokka.gradle.DokkaTask |
3 | | -import org.jetbrains.kotlin.gradle.tasks.KotlinCompile |
4 | | - |
5 | | -val ossrhUsername: String? by project |
6 | | -val ossrhPassword: String? by project |
7 | | - |
8 | | -val signingKeyId: String? by project // must be the last 8 digits of the key |
9 | | -val signingKey: String? by project |
10 | | -val signingPassword: String? by project |
11 | | - |
12 | | -description = "A library for interacting with blocking JDBC drivers using Kotlin Coroutines." |
| 2 | +import com.github.benmanes.gradle.versions.updates.gradle.GradleReleaseChannel |
| 3 | +import com.vanniktech.maven.publish.JavadocJar |
| 4 | +import com.vanniktech.maven.publish.KotlinJvm |
| 5 | +import org.gradle.api.JavaVersion.VERSION_1_8 |
| 6 | +import org.jetbrains.kotlin.gradle.dsl.JvmTarget.JVM_1_8 |
13 | 7 |
|
14 | 8 | plugins { |
15 | | - `maven-publish` |
16 | | - signing |
17 | | - kotlin("jvm") version "1.6.10" |
18 | | - id("com.github.ben-manes.versions") version "0.39.0" |
19 | | - id("org.jetbrains.dokka") version "1.6.0" |
20 | | -} |
21 | | - |
22 | | -repositories { |
23 | | - mavenCentral() |
24 | | - jcenter() |
25 | | -} |
26 | | - |
27 | | -dependencies { |
28 | | - implementation(kotlin("stdlib")) |
29 | | - implementation("com.michael-bull.kotlin-inline-logger:kotlin-inline-logger:1.0.4") |
30 | | - implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.5.2") |
31 | | - testImplementation("org.jetbrains.kotlinx:kotlinx-coroutines-test:1.5.2") |
32 | | - testImplementation("org.junit.jupiter:junit-jupiter:5.8.2") |
33 | | - testImplementation("io.mockk:mockk:1.12.1") |
| 9 | + alias(libs.plugins.kotlin.jvm) |
| 10 | + alias(libs.plugins.versions) |
| 11 | + alias(libs.plugins.maven.publish) |
34 | 12 | } |
35 | 13 |
|
36 | 14 | tasks.withType<DependencyUpdatesTask> { |
| 15 | + gradleReleaseChannel = GradleReleaseChannel.CURRENT.id |
| 16 | + |
37 | 17 | rejectVersionIf { |
38 | | - listOf("alpha", "beta", "rc", "cr", "m", "eap", "pr").any { |
| 18 | + listOf("alpha", "beta", "rc", "cr", "m", "eap", "pr", "dev").any { |
39 | 19 | candidate.version.contains(it, ignoreCase = true) |
40 | 20 | } |
41 | 21 | } |
42 | 22 | } |
43 | 23 |
|
44 | | -tasks.withType<KotlinCompile> { |
45 | | - kotlinOptions { |
46 | | - jvmTarget = "1.8" |
47 | | - freeCompilerArgs = listOf("-Xuse-experimental=kotlin.contracts.ExperimentalContracts") |
| 24 | +tasks.withType<Jar> { |
| 25 | + from(rootDir.resolve("LICENSE")) { |
| 26 | + into("META-INF") |
48 | 27 | } |
49 | 28 | } |
50 | 29 |
|
51 | | -tasks.withType<Test> { |
52 | | - useJUnitPlatform() |
| 30 | +java { |
| 31 | + sourceCompatibility = VERSION_1_8 |
| 32 | + targetCompatibility = VERSION_1_8 |
53 | 33 | } |
54 | 34 |
|
55 | | -val dokkaJavadoc by tasks.existing(DokkaTask::class) |
56 | | - |
57 | | -val javadocJar by tasks.registering(Jar::class) { |
58 | | - group = LifecycleBasePlugin.BUILD_GROUP |
59 | | - description = "Assembles a jar archive containing the Javadoc API documentation." |
60 | | - archiveClassifier.set("javadoc") |
61 | | - from(dokkaJavadoc) |
| 35 | +kotlin { |
| 36 | + compilerOptions { |
| 37 | + optIn.add("kotlin.contracts.ExperimentalContracts") |
| 38 | + optIn.add("kotlinx.coroutines.ExperimentalCoroutinesApi") |
| 39 | + jvmTarget.set(JVM_1_8) |
| 40 | + } |
62 | 41 | } |
63 | 42 |
|
64 | | -val sourcesJar by tasks.registering(Jar::class) { |
65 | | - group = LifecycleBasePlugin.BUILD_GROUP |
66 | | - description = "Assembles a jar archive containing the main classes with sources." |
67 | | - archiveClassifier.set("sources") |
68 | | - from(sourceSets["main"].allSource) |
| 43 | +dependencies { |
| 44 | + implementation(libs.kotlin.inline.logger) |
| 45 | + implementation(libs.kotlin.coroutines.core) |
| 46 | + testImplementation(libs.kotlin.test) |
| 47 | + testImplementation(libs.kotlin.coroutines.test) |
| 48 | + testImplementation(libs.mockk) |
69 | 49 | } |
70 | 50 |
|
71 | | -publishing { |
72 | | - repositories { |
73 | | - maven { |
74 | | - if (project.version.toString().endsWith("SNAPSHOT")) { |
75 | | - setUrl("https://oss.sonatype.org/content/repositories/snapshots") |
76 | | - } else { |
77 | | - setUrl("https://oss.sonatype.org/service/local/staging/deploy/maven2") |
| 51 | +mavenPublishing { |
| 52 | + publishToMavenCentral() |
| 53 | + signAllPublications() |
| 54 | + |
| 55 | + configure( |
| 56 | + KotlinJvm( |
| 57 | + javadocJar = JavadocJar.Empty(), |
| 58 | + sourcesJar = true, |
| 59 | + ) |
| 60 | + ) |
| 61 | + |
| 62 | + pom { |
| 63 | + name.set(project.name) |
| 64 | + description.set(project.description) |
| 65 | + url.set("https://github.com/michaelbull/kotlin-coroutines-jdbc") |
| 66 | + inceptionYear.set("2019") |
| 67 | + |
| 68 | + licenses { |
| 69 | + license { |
| 70 | + name.set("ISC License") |
| 71 | + url.set("https://opensource.org/licenses/isc-license.txt") |
78 | 72 | } |
| 73 | + } |
79 | 74 |
|
80 | | - credentials { |
81 | | - username = ossrhUsername |
82 | | - password = ossrhPassword |
| 75 | + developers { |
| 76 | + developer { |
| 77 | + name.set("Michael Bull") |
| 78 | + url.set("https://www.michael-bull.com") |
83 | 79 | } |
84 | 80 | } |
85 | | - } |
86 | 81 |
|
87 | | - publications { |
88 | | - register("mavenJava", MavenPublication::class) { |
89 | | - from(components["java"]) |
90 | | - artifact(javadocJar.get()) |
91 | | - artifact(sourcesJar.get()) |
92 | | - |
93 | | - pom { |
94 | | - name.set(project.name) |
95 | | - description.set(project.description) |
96 | | - url.set("https://github.com/michaelbull/kotlin-coroutines-jdbc") |
97 | | - inceptionYear.set("2019") |
98 | | - |
99 | | - licenses { |
100 | | - license { |
101 | | - name.set("ISC License") |
102 | | - url.set("https://opensource.org/licenses/isc-license.txt") |
103 | | - } |
104 | | - } |
105 | | - |
106 | | - developers { |
107 | | - developer { |
108 | | - name.set("Michael Bull") |
109 | | - url.set("https://www.michael-bull.com") |
110 | | - } |
111 | | - } |
112 | | - |
113 | | - contributors { |
114 | | - contributor { |
115 | | - name.set("huntj88") |
116 | | - url.set("https://github.com/huntj88") |
117 | | - } |
118 | | - } |
119 | | - |
120 | | - scm { |
121 | | - connection.set("scm:git:https://github.com/michaelbull/kotlin-coroutines-jdbc") |
122 | | - developerConnection.set( "scm:git:[email protected]:michaelbull/kotlin-coroutines-jdbc.git") |
123 | | - url.set("https://github.com/michaelbull/kotlin-coroutines-jdbc") |
124 | | - } |
125 | | - |
126 | | - issueManagement { |
127 | | - system.set("GitHub") |
128 | | - url.set("https://github.com/michaelbull/kotlin-coroutines-jdbc/issues") |
129 | | - } |
130 | | - |
131 | | - ciManagement { |
132 | | - system.set("GitHub") |
133 | | - url.set("https://github.com/michaelbull/kotlin-coroutines-jdbc/actions?query=workflow%3Aci") |
134 | | - } |
| 82 | + contributors { |
| 83 | + contributor { |
| 84 | + name.set("huntj88") |
| 85 | + url.set("https://github.com/huntj88") |
135 | 86 | } |
136 | 87 | } |
137 | | - } |
138 | | -} |
139 | 88 |
|
140 | | -signing { |
141 | | - useInMemoryPgpKeys(signingKeyId, signingKey, signingPassword) |
142 | | - sign(publishing.publications) |
| 89 | + scm { |
| 90 | + connection.set("scm:git:https://github.com/michaelbull/kotlin-coroutines-jdbc") |
| 91 | + developerConnection.set( "scm:git:[email protected]:michaelbull/kotlin-coroutines-jdbc.git") |
| 92 | + url.set("https://github.com/michaelbull/kotlin-coroutines-jdbc") |
| 93 | + } |
| 94 | + |
| 95 | + issueManagement { |
| 96 | + system.set("GitHub") |
| 97 | + url.set("https://github.com/michaelbull/kotlin-coroutines-jdbc/issues") |
| 98 | + } |
| 99 | + |
| 100 | + ciManagement { |
| 101 | + system.set("GitHub") |
| 102 | + url.set("https://github.com/michaelbull/kotlin-coroutines-jdbc/actions") |
| 103 | + } |
| 104 | + } |
143 | 105 | } |
0 commit comments