1
+ import com.vanniktech.maven.publish.JavadocJar
2
+ import com.vanniktech.maven.publish.KotlinJvm
3
+ import com.vanniktech.maven.publish.SonatypeHost
1
4
import org.jetbrains.dokka.gradle.DokkaTask
2
5
import java.net.URI
3
6
4
7
plugins {
5
- kotlin(" jvm" ) version " 2.0.0"
6
- alias(libs.plugins.dokka)
7
- `java- library`
8
+ kotlin(" jvm" ) version " 2.0.0"
9
+ alias(libs.plugins.dokka)
10
+ alias(libs.plugins.maven.publishing)
11
+ `java- library`
8
12
}
9
13
10
14
group = " io.github.cybercodernaj"
@@ -13,33 +17,70 @@ version = libs.versions.lib.get()
13
17
val docsDir = layout.projectDirectory.dir(" docs/" )
14
18
15
19
repositories {
16
- mavenCentral()
20
+ mavenCentral()
17
21
}
18
22
19
23
dependencies {
20
- testImplementation(kotlin(" test" ))
24
+ testImplementation(kotlin(" test" ))
21
25
}
22
26
23
27
tasks.test {
24
- useJUnitPlatform()
28
+ useJUnitPlatform()
25
29
}
26
30
kotlin {
27
- jvmToolchain(18 )
31
+ jvmToolchain(18 )
28
32
}
29
33
30
34
tasks.withType<DokkaTask >().configureEach {
31
- moduleName.set(project.name)
32
- moduleVersion.set(project.version.toString())
33
- outputDirectory.set(docsDir)
34
- dokkaSourceSets.configureEach {
35
- sourceLink {
36
- localDirectory.set(projectDir.resolve(" src" ))
37
- remoteUrl.set(URI .create(" https://github.com/cybercoder-naj/Parkour/blob/main/src" ).toURL())
38
- remoteLineSuffix.set(" #L" )
39
- }
35
+ moduleName.set(project.name)
36
+ moduleVersion.set(project.version.toString())
37
+ outputDirectory.set(docsDir)
38
+ dokkaSourceSets.configureEach {
39
+ sourceLink {
40
+ localDirectory.set(projectDir.resolve(" src" ))
41
+ remoteUrl.set(URI .create(" https://github.com/cybercoder-naj/Parkour/blob/main/src" ).toURL())
42
+ remoteLineSuffix.set(" #L" )
40
43
}
44
+ }
41
45
}
42
46
43
47
tasks.clean {
44
- delete = setOf (docsDir, layout.buildDirectory)
48
+ delete = setOf (docsDir, layout.buildDirectory)
49
+ }
50
+
51
+ mavenPublishing {
52
+ configure(KotlinJvm (
53
+ javadocJar = JavadocJar .Dokka (" dokkaHtml" ),
54
+ sourcesJar = true
55
+ ))
56
+
57
+ publishToMavenCentral(SonatypeHost .CENTRAL_PORTAL , automaticRelease = true )
58
+
59
+ coordinates(project.group.toString(), project.name, project.version.toString())
60
+
61
+ pom {
62
+ name.set(" Parkour" )
63
+ description.set(" Parser Combinator library for Kotlin" )
64
+ inceptionYear.set(" 2024" )
65
+ url.set(" https://github.com/cybercoder-naj/Parkour/" )
66
+ licenses {
67
+ license {
68
+ name.set(" MIT License" )
69
+ url.set(" https://github.com/cybercoder-naj/Parkour/blob/main/LICENSE" )
70
+ distribution.set(" repo" )
71
+ }
72
+ }
73
+ developers {
74
+ developer {
75
+ id.set(" cybercoder-naj" )
76
+ name.set(" Nishant Aanjaney Jalan" )
77
+ url.set(" https://github.com/cybercoder-naj/" )
78
+ }
79
+ }
80
+ scm {
81
+ url.set(" https://github.com/cybercoder-naj/Parkour/" )
82
+ connection.set(" scm:git:git://github.com/cybercoder-naj/Parkour.git" )
83
+ developerConnection.set(
" scm:git:ssh://[email protected] /cybercoder-naj/Parkour.git" )
84
+ }
85
+ }
45
86
}
0 commit comments