@@ -4,10 +4,12 @@ plugins {
44 kotlin(" jvm" ) version " 2.0.21"
55 kotlin(" kapt" ) version " 2.0.21"
66 id(" com.github.johnrengelman.shadow" ) version " 8.1.1"
7+ id(" org.jreleaser" ) version " 1.14.0"
78 `maven- publish`
9+ signing
810}
911
10- group = " co.statu .parsek"
12+ group = " dev .parsek"
1113version =
1214 (if (project.hasProperty(" version" ) && project.findProperty(" version" ) != " unspecified" ) project.findProperty(" version" ) else " local-build" )!!
1315
@@ -19,16 +21,15 @@ val pluginsDir: File? by rootProject.extra
1921
2022repositories {
2123 mavenCentral()
22- maven(" https://jitpack.io" )
2324}
2425
2526dependencies {
2627 if (bootstrap) {
2728 compileOnly(project(mapOf (" path" to " :Parsek" )))
2829 compileOnly(project(mapOf (" path" to " :plugins:parsek-plugin-database" )))
2930 } else {
30- compileOnly(" com.github.parsekdev: parsek:v1 .0.0-beta.7 " )
31- compileOnly(" com.github.parsekdev :parsek-plugin-database:v1 .0.0-dev.1 " )
31+ compileOnly(" dev. parsek:core:1 .0.0-beta.18 " )
32+ compileOnly(" dev.parsek :parsek-plugin-database:1 .0.0-dev.3 " )
3233 }
3334
3435 compileOnly(kotlin(" stdlib-jdk8" ))
@@ -42,6 +43,13 @@ dependencies {
4243}
4344
4445tasks {
46+ build {
47+ dependsOn(shadowJar)
48+ dependsOn(" copyJar" )
49+ // Ensure standard jar is built for Maven publishing (stays in build/libs)
50+ dependsOn(jar)
51+ }
52+
4553 shadowJar {
4654 val pluginId: String by project
4755 val pluginClass: String by project
@@ -56,7 +64,15 @@ tasks {
5664 attributes[" Plugin-Dependencies" ] = pluginDependencies
5765 }
5866
59- archiveFileName.set(" $pluginId -$version .jar" )
67+ if (version != " unspecified" ) {
68+ archiveFileName.set(" $pluginId -v${version} .jar" )
69+ } else {
70+ archiveFileName.set(" $pluginId .jar" )
71+ }
72+
73+ if (project.gradle.startParameter.taskNames.contains(" publish" )) {
74+ archiveFileName.set(archiveFileName.get().lowercase())
75+ }
6076
6177 dependencies {
6278 exclude(dependency(" io.vertx:vertx-core" ))
@@ -67,6 +83,9 @@ tasks {
6783 }
6884
6985 register(" copyJar" ) {
86+ outputs.upToDateWhen { false }
87+ mustRunAfter(shadowJar)
88+
7089 pluginsDir?.let {
7190 doLast {
7291 copy {
@@ -75,47 +94,35 @@ tasks {
7594 }
7695 }
7796 }
78-
79- outputs.upToDateWhen { false }
80- mustRunAfter(shadowJar)
81- }
82-
83- jar {
84- enabled = false
85- dependsOn(shadowJar)
86- dependsOn(" copyJar" )
8797 }
8898}
8999
90- publishing {
91- repositories {
92- maven {
93- name = " parsek-plugin-system-property"
94- url = uri(" https://maven.pkg.github.com/StatuParsek/parsek-plugin-system-property" )
95- credentials {
96- username = project.findProperty(" gpr.user" ) as String? ? : System .getenv(" USERNAME_GITHUB" )
97- password = project.findProperty(" gpr.token" ) as String? ? : System .getenv(" TOKEN_GITHUB" )
98- }
99- }
100- }
101-
102- publications {
103- create<MavenPublication >(" shadow" ) {
104- project.extensions.configure< com.github.jengelman.gradle.plugins.shadow.ShadowExtension > {
105- artifactId = " parsek-plugin-system-property"
106- component(this @create)
107- }
108- }
100+ java {
101+ // Use Java 21 for compilation
102+ toolchain {
103+ languageVersion.set(JavaLanguageVersion .of(21 ))
109104 }
110- }
111105
112- java {
113106 withJavadocJar()
114107 withSourcesJar()
108+ }
115109
116- // Use Java 21 for compilation
117- toolchain {
118- languageVersion.set(JavaLanguageVersion .of(21 ))
110+ // Configure sources and javadoc jars after they are created
111+ tasks.named<Jar >(" sourcesJar" ) {
112+ // Add custom naming: v before version and -api before .jar
113+ if (version != " unspecified" ) {
114+ archiveFileName.set(" ${rootProject.name} -v${version} -api-sources.jar" )
115+ } else {
116+ archiveFileName.set(" ${rootProject.name} -api-sources.jar" )
117+ }
118+ }
119+
120+ tasks.named<Jar >(" javadocJar" ) {
121+ // Add custom naming: v before version and -api before .jar
122+ if (version != " unspecified" ) {
123+ archiveFileName.set(" ${rootProject.name} -v${version} -api-javadoc.jar" )
124+ } else {
125+ archiveFileName.set(" ${rootProject.name} -api-javadoc.jar" )
119126 }
120127}
121128
@@ -132,4 +139,109 @@ tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile> {
132139tasks.withType<JavaCompile > {
133140 sourceCompatibility = " 1.8"
134141 targetCompatibility = " 1.8"
142+ }
143+
144+
145+ // Publishing configuration
146+ publishing {
147+ publications {
148+ create<MavenPublication >(" maven" ) {
149+ groupId = " dev.parsek"
150+ artifactId = " parsek-plugin-system-property"
151+ version = project.version.toString()
152+
153+ // Use the standard jar task output
154+ artifact(tasks.named(" jar" ))
155+ artifact(tasks.named(" sourcesJar" ))
156+ artifact(tasks.named(" javadocJar" ))
157+
158+ pom {
159+ name.set(" Parsek System Property Plugin" )
160+ description.set(" System property system for Parsek" )
161+ url.set(" https://github.com/ParsekDev/parsek-plugin-system-property" )
162+ inceptionYear.set(" 2025" )
163+
164+ licenses {
165+ license {
166+ name.set(" MIT License" )
167+ url.set(" https://opensource.org/licenses/MIT" )
168+ }
169+ }
170+
171+ developers {
172+ developer {
173+ id.set(" Statu" )
174+ name.set(" Statu" )
175+ email.set(" info@statu.co" )
176+ }
177+ }
178+
179+ scm {
180+ connection.set(" scm:git:git://github.com/ParsekDev/parsek-plugin-system-property.git" )
181+ developerConnection.set(" scm:git:ssh://github.com/ParsekDev/parsek-plugin-system-property.git" )
182+ url.set(" https://github.com/ParsekDev/parsek-plugin-system-property" )
183+ }
184+ }
185+ }
186+ }
187+
188+ repositories {
189+ maven {
190+ url = layout.buildDirectory.dir(" staging-deploy" ).get().asFile.toURI()
191+ }
192+ }
193+ }
194+
195+ // Signing configuration
196+ signing {
197+ val signingKey = System .getenv(" GPG_PRIVATE_KEY" )
198+ val signingPassword = System .getenv(" GPG_PASSPHRASE" )
199+
200+ if (signingKey != null && signingPassword != null ) {
201+ useInMemoryPgpKeys(signingKey, signingPassword)
202+ sign(publishing.publications[" maven" ])
203+ }
204+ }
205+
206+ // JReleaser configuration
207+ jreleaser {
208+ project {
209+ name.set(" parsek-plugin-system-property" )
210+ description.set(" System property system for Parsek" )
211+ authors.add(" Statu" )
212+ license.set(" MIT" )
213+ links {
214+ homepage.set(" https://github.com/ParsekDev/parsek-plugin-system-property" )
215+ }
216+ inceptionYear.set(" 2025" )
217+ }
218+
219+ // Configure GitHub release provider (required by JReleaser even for deploy-only)
220+ release {
221+ github {
222+ overwrite.set(false )
223+ skipTag.set(true )
224+ skipRelease.set(true )
225+ changelog {
226+ enabled.set(false )
227+ }
228+ }
229+ }
230+
231+ signing {
232+ active.set(org.jreleaser.model.Active .ALWAYS )
233+ armored.set(true )
234+ }
235+
236+ deploy {
237+ maven {
238+ mavenCentral {
239+ create(" sonatype" ) {
240+ active.set(org.jreleaser.model.Active .ALWAYS )
241+ url.set(" https://central.sonatype.com/api/v1/publisher" )
242+ stagingRepository(" build/staging-deploy" )
243+ }
244+ }
245+ }
246+ }
135247}
0 commit comments