From f040a90a7e62d0da88bc4300011f9b03dda8de0c Mon Sep 17 00:00:00 2001 From: kigawa Date: Mon, 25 Aug 2025 01:40:26 +0900 Subject: [PATCH 1/2] Update project to version 1.3.0 and synchronize dependencies, artifacts, and metadata --- build.gradle.kts | 72 ++++-------------------------------------------- 1 file changed, 6 insertions(+), 66 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index bab4492..2870596 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -3,8 +3,6 @@ import com.vanniktech.maven.publish.SonatypeHost plugins { kotlin("multiplatform") version "2.0.21" apply false kotlin("jvm") version "2.0.21" apply false - application - signing id("io.github.gradle-nexus.publish-plugin") version "1.3.0" id("com.vanniktech.maven.publish") version "0.29.0" } @@ -58,71 +56,13 @@ repositories { mavenCentral() } -// Root project - no source code, only module aggregation +// Root project - only manages subprojects and Maven Central publishing configuration - - -publishing { - // Configure all publications - publications.withType { - // disabled https://github.com/vanniktech/gradle-maven-publish-plugin/issues/754 - // and configured at library build.gradle.kts using `JavadocJar.Dokka("dokkaHtml")`. - /* - // Stub javadoc.jar artifact - artifact(tasks.register("${name}JavadocJar", Jar::class) { - archiveClassifier.set("javadoc") - archiveAppendix.set(this@withType.name) - })*/ - - // Provide artifacts information required by Maven Central - pom { - name = "net.kigawa.renlin-compiler.gradle.plugin" - description = "Kotlin Compiler Plugin for automatic value injection with @AutoFill annotation" - url = "https://github.com/Code-Sakura/renlin-compiler" - properties = mapOf( - ) - licenses { - license { - name.set("MIT License") - url.set("http://www.opensource.org/licenses/mit-license.php") - } - } - developers { - developer { - id.set("net.kigawa") - name.set("kigawa") - email.set("contact@kigawa.net") - } - developer { - id.set("io.github.seizavl") - name.set("seizavl") - email.set("") - } - } - scm { - connection.set("scm:git:https://github.com/Code-Sakura/renlin-compiler.git") - developerConnection.set("scm:git:https://github.com/Code-Sakura/renlin-compiler.git") - url.set("https://github.com/Code-Sakura/renlin-compiler") - } +nexusPublishing { + repositories { + sonatype { + nexusUrl.set(uri("https://s01.oss.sonatype.org/service/local/")) + snapshotRepositoryUrl.set(uri("https://s01.oss.sonatype.org/content/repositories/snapshots/")) } } -} - -signing { - if (project.hasProperty("mavenCentralUsername") || - System.getenv("ORG_GRADLE_PROJECT_mavenCentralUsername") != null - ) { - useGpgCmd() - // It is not perfect (fails at some dependency assertions), better handled as - // `signAllPublications()` (as in vanniktech maven publish plugin) at build.gradle.kts. - //sign(publishing.publications) - } -} - -mavenPublishing { - publishToMavenCentral(SonatypeHost.CENTRAL_PORTAL) - if (project.hasProperty("mavenCentralUsername") || - System.getenv("ORG_GRADLE_PROJECT_mavenCentralUsername") != null - ) - signAllPublications() } \ No newline at end of file From a4c09c23b0cd6e47a228cf10bbc703bba402e287 Mon Sep 17 00:00:00 2001 From: kigawa Date: Mon, 25 Aug 2025 02:05:20 +0900 Subject: [PATCH 2/2] Migrate build scripts to consolidate Maven publishing configurations and streamline signing process --- .gitignore | 3 +- build.gradle.kts | 66 ++++++++++++++++++++++++++++++--- gradle-plugin/build.gradle.kts | 53 +------------------------- kotlin-plugin/build.gradle.kts | 68 ++++------------------------------ 4 files changed, 71 insertions(+), 119 deletions(-) diff --git a/.gitignore b/.gitignore index b63da45..2f08700 100644 --- a/.gitignore +++ b/.gitignore @@ -39,4 +39,5 @@ bin/ .vscode/ ### Mac OS ### -.DS_Store \ No newline at end of file +.DS_Store +/.kotlin/ diff --git a/build.gradle.kts b/build.gradle.kts index 2870596..6a346b4 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,14 +1,17 @@ import com.vanniktech.maven.publish.SonatypeHost plugins { + `kotlin-dsl` kotlin("multiplatform") version "2.0.21" apply false kotlin("jvm") version "2.0.21" apply false + application + signing id("io.github.gradle-nexus.publish-plugin") version "1.3.0" id("com.vanniktech.maven.publish") version "0.29.0" } object Conf { - const val GROUP = "net.kigawa" + const val GROUP = "net.kigawa.renlin-compiler" // Base version - will be modified based on branch name if available const val BASE_VERSION = "1.3.0" @@ -48,6 +51,7 @@ val projectVersion = determineVersion() group = Conf.GROUP version = projectVersion + allprojects { group = Conf.GROUP version = projectVersion @@ -58,11 +62,61 @@ repositories { // Root project - only manages subprojects and Maven Central publishing configuration -nexusPublishing { - repositories { - sonatype { - nexusUrl.set(uri("https://s01.oss.sonatype.org/service/local/")) - snapshotRepositoryUrl.set(uri("https://s01.oss.sonatype.org/content/repositories/snapshots/")) + +publishing { + // Configure all publications + publications.withType { + pom { + artifactId = "net.kigawa.renlin-compiler.gradle.plugin" + name.set("net.kigawa.renlin-compiler.gradle.plugin") + description.set("Kotlin Compiler Plugin for automatic value injection with @AutoFill annotation") + url.set("https://github.com/Code-Sakura/renlin-compiler") + properties.set( + mapOf( + ) + ) + licenses { + license { + name.set("MIT License") + url.set("http://www.opensource.org/licenses/mit-license.php") + } + } + developers { + developer { + id.set("net.kigawa") + name.set("kigawa") + email.set("contact@kigawa.net") + } + developer { + id.set("io.github.seizavl") + name.set("seizavl") + email.set("") + } + } + scm { + connection.set("scm:git:https://github.com/Code-Sakura/renlin-compiler.git") + developerConnection.set("scm:git:https://github.com/Code-Sakura/renlin-compiler.git") + url.set("https://github.com/Code-Sakura/renlin-compiler") + } } } +} + +signing { + if (project.hasProperty("mavenCentralUsername") || + System.getenv("ORG_GRADLE_PROJECT_mavenCentralUsername") != null + ) { + useGpgCmd() + // It is not perfect (fails at some dependency assertions), better handled as + // `signAllPublications()` (as in vanniktech maven publish plugin) at build.gradle.kts. + //sign(publishing.publications) + } +} + +mavenPublishing { + publishToMavenCentral(SonatypeHost.CENTRAL_PORTAL) + if (project.hasProperty("mavenCentralUsername") || + System.getenv("ORG_GRADLE_PROJECT_mavenCentralUsername") != null + ) + signAllPublications() } \ No newline at end of file diff --git a/gradle-plugin/build.gradle.kts b/gradle-plugin/build.gradle.kts index 79d9b4c..45231de 100644 --- a/gradle-plugin/build.gradle.kts +++ b/gradle-plugin/build.gradle.kts @@ -1,8 +1,6 @@ plugins { kotlin("jvm") `java-gradle-plugin` - `maven-publish` - signing } group = "net.kigawa" @@ -16,7 +14,7 @@ repositories { gradlePlugin { website.set("https://github.com/Code-Sakura/renlin-compiler") vcsUrl.set("https://github.com/Code-Sakura/renlin-compiler.git") - + plugins { create("renlinCompiler") { id = "net.kigawa.renlin-compiler" @@ -46,52 +44,3 @@ java { } -publishing { - publications.withType { - pom { - name.set("Renlin Compiler Gradle Plugin") - description.set("Gradle plugin that enables automatic value injection for @AutoFill annotated parameters using Kotlin Compiler Plugin") - url.set("https://github.com/Code-Sakura/renlin-compiler") - - licenses { - license { - name.set("MIT License") - url.set("https://opensource.org/licenses/MIT") - } - } - - developers { - developer { - id.set("kigawa01") - name.set("kigawa") - email.set("kigawa.inbox@gmail.com") - } - } - - scm { - connection.set("scm:git:https://github.com/Code-Sakura/renlin-compiler.git") - developerConnection.set("scm:git:https://github.com/Code-Sakura/renlin-compiler.git") - url.set("https://github.com/Code-Sakura/renlin-compiler") - } - } - } - repositories { - mavenLocal() - } -} - - -signing { - val signingKey: String? by project - val signingPassword: String? by project - val hasSigningCredentials = (System.getenv("GPG_SIGNING_KEY") != null && System.getenv("GPG_SIGNING_PASSWORD") != null) || - (signingKey != null && signingPassword != null) - - if (hasSigningCredentials) { - useInMemoryPgpKeys( - System.getenv("GPG_SIGNING_KEY") ?: signingKey, - System.getenv("GPG_SIGNING_PASSWORD") ?: signingPassword - ) - sign(publishing.publications) - } -} \ No newline at end of file diff --git a/kotlin-plugin/build.gradle.kts b/kotlin-plugin/build.gradle.kts index e45892d..7528a17 100644 --- a/kotlin-plugin/build.gradle.kts +++ b/kotlin-plugin/build.gradle.kts @@ -1,7 +1,5 @@ plugins { kotlin("multiplatform") - `maven-publish` - signing } group = "net.kigawa" @@ -14,32 +12,32 @@ repositories { kotlin { jvmToolchain(17) - + jvm { compilations.all { kotlinOptions.jvmTarget = "17" } withJava() } - + js(IR) { browser() nodejs() } - + sourceSets { val commonMain by getting { dependencies { implementation("org.jetbrains.kotlin:kotlin-stdlib-common") } } - + val commonTest by getting { dependencies { implementation(kotlin("test")) } } - + val jvmMain by getting { dependencies { implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8") @@ -47,19 +45,18 @@ kotlin { compileOnly("com.google.auto.service:auto-service:1.1.1") } } - + val jvmTest by getting { dependencies { - implementation(kotlin("test-junit5")) } } - + val jsMain by getting { dependencies { implementation("org.jetbrains.kotlin:kotlin-stdlib-js") } } - + val jsTest by getting { dependencies { implementation(kotlin("test-js")) @@ -69,52 +66,3 @@ kotlin { } -publishing { - publications.withType { - pom { - name.set("Renlin AutoFill Annotation") - description.set("Multiplatform annotation library for automatic parameter value injection, supporting both JVM and JavaScript") - url.set("https://github.com/Code-Sakura/renlin-compiler") - - licenses { - license { - name.set("MIT License") - url.set("https://opensource.org/licenses/MIT") - } - } - - developers { - developer { - id.set("kigawa01") - name.set("kigawa") - email.set("kigawa.inbox@gmail.com") - } - } - - scm { - connection.set("scm:git:https://github.com/Code-Sakura/renlin-compiler.git") - developerConnection.set("scm:git:https://github.com/Code-Sakura/renlin-compiler.git") - url.set("https://github.com/Code-Sakura/renlin-compiler") - } - } - } - repositories { - mavenLocal() - } -} - - -signing { - val signingKey: String? by project - val signingPassword: String? by project - val hasSigningCredentials = (System.getenv("GPG_SIGNING_KEY") != null && System.getenv("GPG_SIGNING_PASSWORD") != null) || - (signingKey != null && signingPassword != null) - - if (hasSigningCredentials) { - useInMemoryPgpKeys( - System.getenv("GPG_SIGNING_KEY") ?: signingKey, - System.getenv("GPG_SIGNING_PASSWORD") ?: signingPassword - ) - sign(publishing.publications) - } -} \ No newline at end of file