@@ -2,15 +2,19 @@ import org.gradle.api.tasks.testing.logging.TestExceptionFormat.FULL
2
2
import org.gradle.api.tasks.testing.logging.TestLogEvent.*
3
3
4
4
plugins {
5
+ `java- library`
5
6
alias(libs.plugins.kotlinJvm)
6
7
alias(libs.plugins.spotless)
7
8
jacoco
8
9
alias(libs.plugins.jmh)
10
+ `maven- publish`
11
+ alias(libs.plugins.jreleaser)
12
+ alias(libs.plugins.dokka)
9
13
}
10
14
11
15
group = " earth.adi"
12
16
13
- version = " 0.0.3 "
17
+ version = " 0.0.4 "
14
18
15
19
repositories { mavenCentral() }
16
20
@@ -25,7 +29,10 @@ dependencies {
25
29
26
30
kotlin { jvmToolchain(17 ) }
27
31
28
- java { withSourcesJar() }
32
+ java {
33
+ withSourcesJar()
34
+ withJavadocJar()
35
+ }
29
36
30
37
tasks.withType<JavaCompile > { dependsOn(tasks.spotlessApply) }
31
38
@@ -45,6 +52,11 @@ configure<com.diffplug.gradle.spotless.SpotlessExtension> {
45
52
}
46
53
}
47
54
55
+ task<Exec >(" updateReadmeVersion" ) {
56
+ // mustRunAfter(tasks.build)
57
+ commandLine(" sh" , " ./scripts/updateReadmeVersion.sh" )
58
+ }
59
+
48
60
tasks.test {
49
61
useJUnitPlatform()
50
62
finalizedBy(tasks.jacocoTestReport, tasks.jacocoTestCoverageVerification)
@@ -82,7 +94,7 @@ tasks.jacocoTestReport { dependsOn(tasks.test) }
82
94
tasks.jacocoTestCoverageVerification {
83
95
dependsOn(tasks.jacocoTestReport)
84
96
85
- violationRules { rule { limit { minimum = " 1" .toBigDecimal() } } }
97
+ violationRules { rule { limit { minimum = " 1.00 " .toBigDecimal() } } }
86
98
}
87
99
88
100
jmh {
@@ -91,3 +103,81 @@ jmh {
91
103
threads.set(1 )
92
104
fork.set(2 )
93
105
}
106
+
107
+ val mavenArtifactId: String by project
108
+ val mavenArtifactDescription: String by project
109
+
110
+ tasks.jar {
111
+ manifest {
112
+ attributes(
113
+ mapOf (
114
+ " Implementation-Title" to mavenArtifactId, " Implementation-Version" to project.version))
115
+ }
116
+ }
117
+
118
+ val stagingDir: Provider <Directory > = layout.buildDirectory.dir(" staging-deploy" )
119
+
120
+ publishing {
121
+ publications {
122
+ create<MavenPublication >(" mavenJava" ) {
123
+ artifactId = mavenArtifactId
124
+ from(components[" java" ])
125
+ pom {
126
+ name.set(mavenArtifactId)
127
+ description.set(mavenArtifactDescription)
128
+ url.set(" https://github.com/aleris/typeid-kotlin" )
129
+ licenses {
130
+ license {
131
+ name.set(" The Apache License, Version 2.0" )
132
+ url.set(" http://www.apache.org/licenses/LICENSE-2.0.txt" )
133
+ }
134
+ }
135
+ developers {
136
+ developer {
137
+ id.set(" aleris" )
138
+ name.set(" Adrian Tosca" )
139
+ email.set(" adrian.tosca@gmail.com" )
140
+ }
141
+ }
142
+ scm {
143
+ connection.set(" scm:git:git@github.com:aleris/typeid-kotlin.git" )
144
+ developerConnection.set(" scm:git:git@github.com:aleris/typeid-kotlin.git" )
145
+ url.set(" https://github.com/aleris/typeid-kotlin/" )
146
+ }
147
+ }
148
+ }
149
+ }
150
+ repositories { maven { url = stagingDir.get().asFile.toURI() } }
151
+ }
152
+
153
+ tasks.publish { dependsOn(tasks.dokkaJekyll) }
154
+
155
+ jreleaser {
156
+ project {
157
+ description.set(mavenArtifactDescription)
158
+ authors.set(arrayListOf (" aleris" ))
159
+ license.set(" Apache-2.0" )
160
+ inceptionYear = " 2024"
161
+ }
162
+ release {
163
+ github {
164
+ repoOwner.set(" aleris" )
165
+ overwrite = true
166
+ }
167
+ }
168
+ signing {
169
+ active.set(org.jreleaser.model.Active .ALWAYS )
170
+ armored = true
171
+ }
172
+ deploy {
173
+ maven {
174
+ mavenCentral {
175
+ register(" sonatype" ) {
176
+ active.set(org.jreleaser.model.Active .ALWAYS )
177
+ url.set(" https://central.sonatype.com/api/v1/publisher" )
178
+ stagingRepository(stagingDir.get().toString())
179
+ }
180
+ }
181
+ }
182
+ }
183
+ }
0 commit comments