1+ import org.ajoberstar.grgit.Grgit
2+ import java.util.*
3+
14plugins {
25 kotlin(" jvm" ) version " 1.8.20"
6+ `java- library`
7+ `maven- publish`
8+ signing
9+ id(" org.jetbrains.dokka" ) version " 1.8.10"
310}
411
512group = " dev.themeinerlp"
13+ var baseVersion by extra(" 1.0.0" )
14+ var extension by extra(" " )
15+ var snapshot by extra(" -SNAPSHOT" )
16+
17+ ext {
18+ val git: Grgit = Grgit .open {
19+ dir = File (" $rootDir /.git" )
20+ }
21+ val revision = git.head().abbreviatedId
22+ extension = " %s+%s" .format(Locale .ROOT , snapshot, revision)
23+ }
24+
25+
26+ version = " %s%s" .format(Locale .ROOT , baseVersion, extension)
627
728repositories {
829 mavenCentral()
@@ -30,4 +51,79 @@ kotlin {
3051 languageVersion = " 2.0"
3152 }
3253 }
33- }
54+ }
55+
56+ val sourceJar by tasks.register<Jar >(" kotlinJar" ) {
57+ from(sourceSets.main.get().allSource)
58+ archiveClassifier.set(" sources" )
59+ }
60+ val dokkaJavadocJar by tasks.register<Jar >(" dokkaHtmlJar" ) {
61+ dependsOn(rootProject.tasks.dokkaHtml)
62+ from(rootProject.tasks.dokkaHtml.flatMap { it.outputDirectory })
63+ archiveClassifier.set(" html-docs" )
64+ }
65+
66+ val dokkaHtmlJar by tasks.register<Jar >(" dokkaJavadocJar" ) {
67+ dependsOn(rootProject.tasks.dokkaJavadoc)
68+ from(rootProject.tasks.dokkaJavadoc.flatMap { it.outputDirectory })
69+ archiveClassifier.set(" javadoc" )
70+ }
71+
72+ publishing {
73+ publications {
74+ create<MavenPublication >(" mavenJava" ) {
75+ from(components.findByName(" java" ))
76+ groupId = " dev.themeinerlp.plugin-debug"
77+ artifactId = " bukkit-extension"
78+ version = " %s%s" .format(Locale .ROOT , baseVersion, snapshot)
79+ artifact(dokkaJavadocJar)
80+ artifact(dokkaHtmlJar)
81+ artifact(sourceJar)
82+ pom {
83+ name.set(" Bukkit Extension" )
84+ description.set(" The extension for bukkit/paper/spigot fir plugin debug" )
85+ url.set(" https://github.com/OneLiteFeatherNET/Plugin-Debug" )
86+ licenses {
87+ license {
88+ name.set(" AGPL-3.0" )
89+ url.set(" https://github.com/OneLiteFeatherNET/Plugin-Debug/blob/main/LICENSE" )
90+ }
91+ }
92+ issueManagement {
93+ system.set(" Github" )
94+ url.set(" https://github.com/OneLiteFeatherNET/Plugin-Debug/issues" )
95+ }
96+ developers {
97+ developer {
98+ id.set(" TheMeinerLP" )
99+ name.set(" Phillipp Glanz" )
100+ 101+ }
102+ }
103+ scm {
104+ connection.set(
" scm:[email protected] :OneLiteFeatherNET/Plugin-Debug.git" )
105+ developerConnection.set(
" scm:[email protected] :OneLiteFeatherNET/Plugin-Debug.git" )
106+ url.set(" https://github.com/OneLiteFeatherNET/Plugin-Debug" )
107+ }
108+ }
109+ }
110+ }
111+ repositories {
112+ maven {
113+ val releasesRepoUrl = " https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/"
114+ val snapshotsRepoUrl = " https://s01.oss.sonatype.org/content/repositories/snapshots/"
115+ url = if (version.toString().contains(" SNAPSHOT" )) uri(snapshotsRepoUrl) else uri(releasesRepoUrl)
116+ credentials {
117+ username = System .getenv(" OSSRH_USERNAME" )
118+ password = System .getenv(" OSSRH_PASSWORD" )
119+ }
120+ }
121+ }
122+ }
123+
124+ signing {
125+ val signingKey: String? by project
126+ val signingPassword: String? by project
127+ useInMemoryPgpKeys(signingKey, signingPassword)
128+ sign(publishing.publications)
129+ }
0 commit comments