@@ -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
@@ -21,16 +23,15 @@ val pluginsDir: File? by rootProject.extra
2123
2224repositories {
2325 mavenCentral()
24- maven(" https://jitpack.io" )
2526}
2627
2728dependencies {
2829 if (bootstrap) {
2930 compileOnly(project(mapOf (" path" to " :Parsek" )))
3031 compileOnly(project(mapOf (" path" to " :plugins:parsek-plugin-database" )))
3132 } else {
32- compileOnly(" com.github.parsekdev: parsek:v1 .0.0-beta.7 " )
33- compileOnly(" com.github.parsekdev :parsek-plugin-database:v1 .0.0-dev.1 " )
33+ compileOnly(" dev. parsek:core:1 .0.0-beta.18 " )
34+ compileOnly(" dev.parsek :parsek-plugin-database:1 .0.0-dev.3 " )
3435 }
3536
3637 compileOnly(kotlin(" stdlib-jdk8" ))
@@ -53,6 +54,12 @@ dependencies {
5354}
5455
5556tasks {
57+ build {
58+ dependsOn(" copyJar" )
59+ // Ensure standard jar is built for Maven publishing (stays in build/libs)
60+ dependsOn(jar)
61+ }
62+
5663 shadowJar {
5764 val pluginId: String by project
5865 val pluginClass: String by project
@@ -75,6 +82,10 @@ tasks {
7582 it.moduleGroup == " io.netty" || it.moduleGroup == " org.slf4j"
7683 }
7784 }
85+
86+ if (project.gradle.startParameter.taskNames.contains(" publish" )) {
87+ archiveFileName.set(archiveFileName.get().lowercase())
88+ }
7889 }
7990
8091 register(" copyJar" ) {
@@ -90,43 +101,34 @@ tasks {
90101 outputs.upToDateWhen { false }
91102 mustRunAfter(shadowJar)
92103 }
93-
94- jar {
95- enabled = false
96- dependsOn(shadowJar)
97- dependsOn(" copyJar" )
98- }
99104}
100105
101- publishing {
102- repositories {
103- maven {
104- name = " parsek-plugin-token"
105- url = uri(" https://maven.pkg.github.com/StatuParsek/parsek-plugin-token" )
106- credentials {
107- username = project.findProperty(" gpr.user" ) as String? ? : System .getenv(" USERNAME_GITHUB" )
108- password = project.findProperty(" gpr.token" ) as String? ? : System .getenv(" TOKEN_GITHUB" )
109- }
110- }
111- }
112-
113- publications {
114- create<MavenPublication >(" shadow" ) {
115- project.extensions.configure< com.github.jengelman.gradle.plugins.shadow.ShadowExtension > {
116- artifactId = " parsek-plugin-token"
117- component(this @create)
118- }
119- }
106+ java {
107+ // Use Java 21 for compilation
108+ toolchain {
109+ languageVersion.set(JavaLanguageVersion .of(21 ))
120110 }
121- }
122111
123- java {
124112 withJavadocJar()
125113 withSourcesJar()
114+ }
126115
127- // Use Java 21 for compilation
128- toolchain {
129- languageVersion.set(JavaLanguageVersion .of(21 ))
116+ // Configure sources and javadoc jars after they are created
117+ tasks.named<Jar >(" sourcesJar" ) {
118+ // Add custom naming: v before version and -api before .jar
119+ if (version != " unspecified" ) {
120+ archiveFileName.set(" ${rootProject.name} -v${version} -api-sources.jar" )
121+ } else {
122+ archiveFileName.set(" ${rootProject.name} -api-sources.jar" )
123+ }
124+ }
125+
126+ tasks.named<Jar >(" javadocJar" ) {
127+ // Add custom naming: v before version and -api before .jar
128+ if (version != " unspecified" ) {
129+ archiveFileName.set(" ${rootProject.name} -v${version} -api-javadoc.jar" )
130+ } else {
131+ archiveFileName.set(" ${rootProject.name} -api-javadoc.jar" )
130132 }
131133}
132134
@@ -143,4 +145,108 @@ tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile> {
143145tasks.withType<JavaCompile > {
144146 sourceCompatibility = " 1.8"
145147 targetCompatibility = " 1.8"
148+ }
149+
150+ // Publishing configuration
151+ publishing {
152+ publications {
153+ create<MavenPublication >(" maven" ) {
154+ groupId = " dev.parsek"
155+ artifactId = " parsek-plugin-database"
156+ version = project.version.toString()
157+
158+ // Use the standard jar task output
159+ artifact(tasks.named(" jar" ))
160+ artifact(tasks.named(" sourcesJar" ))
161+ artifact(tasks.named(" javadocJar" ))
162+
163+ pom {
164+ name.set(" Parsek Database Plugin" )
165+ description.set(" Open-source modular backend in Kotlin" )
166+ url.set(" https://github.com/ParsekDev/parsek-plugin-database" )
167+ inceptionYear.set(" 2025" )
168+
169+ licenses {
170+ license {
171+ name.set(" MIT License" )
172+ url.set(" https://opensource.org/licenses/MIT" )
173+ }
174+ }
175+
176+ developers {
177+ developer {
178+ id.set(" Statu" )
179+ name.set(" Statu" )
180+ email.set(" info@statu.co" )
181+ }
182+ }
183+
184+ scm {
185+ connection.set(" scm:git:git://github.com/ParsekDev/parsek-plugin-database.git" )
186+ developerConnection.set(" scm:git:ssh://github.com/ParsekDev/parsek-plugin-database.git" )
187+ url.set(" https://github.com/ParsekDev/parsek-plugin-database" )
188+ }
189+ }
190+ }
191+ }
192+
193+ repositories {
194+ maven {
195+ url = layout.buildDirectory.dir(" staging-deploy" ).get().asFile.toURI()
196+ }
197+ }
198+ }
199+
200+ // Signing configuration
201+ signing {
202+ val signingKey = System .getenv(" GPG_PRIVATE_KEY" )
203+ val signingPassword = System .getenv(" GPG_PASSPHRASE" )
204+
205+ if (signingKey != null && signingPassword != null ) {
206+ useInMemoryPgpKeys(signingKey, signingPassword)
207+ sign(publishing.publications[" maven" ])
208+ }
209+ }
210+
211+ // JReleaser configuration
212+ jreleaser {
213+ project {
214+ name.set(" parsek-plugin-database" )
215+ description.set(" Open-source modular backend in Kotlin" )
216+ authors.add(" Statu" )
217+ license.set(" MIT" )
218+ links {
219+ homepage.set(" https://github.com/ParsekDev/parsek-plugin-database" )
220+ }
221+ inceptionYear.set(" 2025" )
222+ }
223+
224+ // Configure GitHub release provider (required by JReleaser even for deploy-only)
225+ release {
226+ github {
227+ overwrite.set(false )
228+ skipTag.set(true )
229+ skipRelease.set(true )
230+ changelog {
231+ enabled.set(false )
232+ }
233+ }
234+ }
235+
236+ signing {
237+ active.set(org.jreleaser.model.Active .ALWAYS )
238+ armored.set(true )
239+ }
240+
241+ deploy {
242+ maven {
243+ mavenCentral {
244+ create(" sonatype" ) {
245+ active.set(org.jreleaser.model.Active .ALWAYS )
246+ url.set(" https://central.sonatype.com/api/v1/publisher" )
247+ stagingRepository(" build/staging-deploy" )
248+ }
249+ }
250+ }
251+ }
146252}
0 commit comments