From 3b368a3125f770ab3e896911568c6f101466c4be Mon Sep 17 00:00:00 2001 From: Alexander Nozik Date: Tue, 16 Feb 2021 22:58:16 +0300 Subject: [PATCH 1/9] Fix sonatype publishing --- build.gradle.kts | 74 +++++++++++++++++++++++++++++++----------------- 1 file changed, 48 insertions(+), 26 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index 204701e..116e14c 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -2,8 +2,10 @@ plugins { `java-gradle-plugin` `kotlin-dsl` `maven-publish` + signing id("de.marcphilipp.nexus-publish") version "0.4.0" id("org.jetbrains.changelog") version "1.0.0" + id("org.jetbrains.dokka") version "1.4.20" } group = "ru.mipt.npm" @@ -38,13 +40,13 @@ dependencies { gradlePlugin { plugins { - create("kscience.common"){ + create("kscience.common") { id = "ru.mipt.npm.kscience" description = "The generalized kscience plugin that works in conjunction with any kotlin plugin" implementationClass = "ru.mipt.npm.gradle.KScienceCommonPlugin" } - create("kscience.project"){ + create("kscience.project") { id = "ru.mipt.npm.project" description = "The root plugin for multimodule project infrastructure" implementationClass = "ru.mipt.npm.gradle.KScienceProjectPlugin" @@ -89,35 +91,51 @@ gradlePlugin { } publishing { - val vcs = "https://github.com/mipt-npm/scientifik-gradle-tools" + val vcs = "https://github.com/mipt-npm/gradle-tools" + + val sourcesJar: Jar by tasks.creating(Jar::class) { + archiveClassifier.set("sources") + from(sourceSets.named("main").get().allSource) + } + + val javadocsJar: Jar by tasks.creating(Jar::class) { + group = "documentation" + archiveClassifier.set("javadoc") + from(tasks.dokkaHtml) + } // Process each publication we have in this project publications.filterIsInstance().forEach { publication -> - publication.pom { - name.set(project.name) - description.set(project.description) - url.set(vcs) + publication.apply { + artifact(sourcesJar) + artifact(javadocsJar) - licenses { - license { - name.set("The Apache Software License, Version 2.0") - url.set("http://www.apache.org/licenses/LICENSE-2.0.txt") - distribution.set("repo") - } - } - developers { - developer { - id.set("MIPT-NPM") - name.set("MIPT nuclear physics methods laboratory") - organization.set("MIPT") - organizationUrl.set("http://npm.mipt.ru") - } - - } - scm { + pom { + name.set(project.name) + description.set(project.description) url.set(vcs) - tag.set(project.version.toString()) + + licenses { + license { + name.set("The Apache Software License, Version 2.0") + url.set("http://www.apache.org/licenses/LICENSE-2.0.txt") + distribution.set("repo") + } + } + developers { + developer { + id.set("MIPT-NPM") + name.set("MIPT nuclear physics methods laboratory") + organization.set("MIPT") + organizationUrl.set("http://npm.mipt.ru") + } + + } + scm { + url.set(vcs) + tag.set(project.version.toString()) + } } } } @@ -128,7 +146,7 @@ publishing { if (sonatypeUser != null && sonatypePassword != null) { nexusPublishing { repositories { - sonatype{ + sonatype { username.set(sonatypeUser) password.set(sonatypePassword) } @@ -136,6 +154,10 @@ publishing { } } + signing { + useGpgCmd() + sign(publications) + } } -- 2.34.1 From 371a38f9c355868b92be65a951562b4bf9b2f366 Mon Sep 17 00:00:00 2001 From: darksnake Date: Wed, 17 Feb 2021 10:14:16 +0300 Subject: [PATCH 2/9] Update serialization to 1.1.0 --- build.gradle.kts | 63 +++++++++++++++---- .../ru/mipt/npm/gradle/KScienceVersions.kt | 4 +- 2 files changed, 54 insertions(+), 13 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index 116e14c..237100e 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -140,23 +140,64 @@ publishing { } } - val sonatypeUser: String? by project - val sonatypePassword: String? by project + val spaceRepo: String = "https://maven.pkg.jetbrains.space/mipt-npm/p/mipt-npm/maven" + val spaceUser: String? by project + val spaceToken: String? by project - if (sonatypeUser != null && sonatypePassword != null) { - nexusPublishing { - repositories { - sonatype { - username.set(sonatypeUser) - password.set(sonatypePassword) + if (spaceUser != null && spaceToken != null) { + project.logger.info("Adding mipt-npm Space publishing to project [${project.name}]") + repositories { + maven { + name = "space" + url = uri(spaceRepo) + credentials { + username = spaceUser + password = spaceToken } + } } } - signing { - useGpgCmd() - sign(publications) + val sonatypeUser: String? by project + val sonatypePassword: String? by project + +// if (sonatypeUser != null && sonatypePassword != null) { +// nexusPublishing { +// repositories { +// sonatype { +// username.set(sonatypeUser) +// password.set(sonatypePassword) +// } +// } +// } +// } + + if (sonatypeUser != null && sonatypePassword != null) { + val sonatypeRepo: String = if (project.version.toString().contains("dev")) { + "https://oss.sonatype.org/content/repositories/snapshots" + } else { + "https://oss.sonatype.org/service/local/staging/deploy/maven2" + } + + if (plugins.findPlugin("signing") == null) { + plugins.apply("signing") + } + + repositories { + maven { + name = "sonatype" + url = uri(sonatypeRepo) + credentials { + username = sonatypeUser + password = sonatypePassword + } + } + } + signing { + useGpgCmd() + sign(publications) + } } } diff --git a/src/main/kotlin/ru/mipt/npm/gradle/KScienceVersions.kt b/src/main/kotlin/ru/mipt/npm/gradle/KScienceVersions.kt index e867cce..a494578 100644 --- a/src/main/kotlin/ru/mipt/npm/gradle/KScienceVersions.kt +++ b/src/main/kotlin/ru/mipt/npm/gradle/KScienceVersions.kt @@ -9,7 +9,7 @@ object KScienceVersions { const val kotlinVersion = "1.4.30" const val kotlinxNodeVersion = "0.0.7" const val coroutinesVersion = "1.4.2" - const val serializationVersion = "1.1.0-RC" + const val serializationVersion = "1.1.0" const val atomicVersion = "0.15.1" const val ktorVersion = "1.5.1" const val htmlVersion = "0.7.2" @@ -17,7 +17,7 @@ object KScienceVersions { val JVM_TARGET = JavaVersion.VERSION_11 object Serialization{ - const val xmlVersion = "0.80.1" + const val xmlVersion = "0.81.0" const val bsonVersion = "0.4.4" const val yamlKtVersion = "0.9.0" } -- 2.34.1 From d8dc65da799229a3f2eb32cbe0079f8614b40dfe Mon Sep 17 00:00:00 2001 From: Alexander Nozik Date: Fri, 19 Feb 2021 21:25:05 +0300 Subject: [PATCH 3/9] Use file signing --- build.gradle.kts | 6 ++++-- .../ru/mipt/npm/gradle/KSciencePublishPlugin.kt | 11 +++++++++-- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index 237100e..2375d93 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -16,9 +16,11 @@ description = "Build tools for DataForge and kscience projects" repositories { gradlePluginPortal() jcenter() + maven("https://repo.kotlin.link") maven("https://kotlin.bintray.com/kotlinx") maven("https://dl.bintray.com/kotlin/kotlin-eap") maven("https://dl.bintray.com/kotlin/kotlin-dev") + } val kotlinVersion = "1.4.30" @@ -33,7 +35,7 @@ dependencies { implementation("org.jetbrains.kotlin:kotlin-serialization:$kotlinVersion") implementation("org.jetbrains.kotlinx:atomicfu-gradle-plugin:0.15.1") implementation("org.jetbrains.dokka:dokka-gradle-plugin:1.4.20") - implementation("org.jetbrains.dokka:dokka-base:1.4.20") +// implementation("org.jetbrains.dokka:dokka-base:1.4.20") implementation("org.jetbrains.intellij.plugins:gradle-changelog-plugin:1.0.0") implementation("org.jetbrains.kotlinx:binary-compatibility-validator:0.4.0") } @@ -195,7 +197,7 @@ publishing { } } signing { - useGpgCmd() + //useGpgCmd() sign(publications) } } diff --git a/src/main/kotlin/ru/mipt/npm/gradle/KSciencePublishPlugin.kt b/src/main/kotlin/ru/mipt/npm/gradle/KSciencePublishPlugin.kt index 3558c99..5c34659 100644 --- a/src/main/kotlin/ru/mipt/npm/gradle/KSciencePublishPlugin.kt +++ b/src/main/kotlin/ru/mipt/npm/gradle/KSciencePublishPlugin.kt @@ -14,7 +14,7 @@ import org.jetbrains.kotlin.gradle.dsl.KotlinJvmProjectExtension open class KSciencePublishPlugin : Plugin { override fun apply(project: Project): Unit = project.plugins.withId("ru.mipt.npm.kscience") { - project.run { + project.afterEvaluate { if (plugins.findPlugin("maven-publish") == null) { plugins.apply("maven-publish") } @@ -29,6 +29,7 @@ open class KSciencePublishPlugin : Plugin { // return // } + project.configure { plugins.withId("org.jetbrains.kotlin.js") { val kotlin = extensions.findByType()!! @@ -62,9 +63,15 @@ open class KSciencePublishPlugin : Plugin { } } + val dokkaJar: Jar by tasks.creating(Jar::class) { + group = "documentation" + archiveClassifier.set("javadoc") + from(tasks.findByName("dokkaHtml")) + } // Process each publication we have in this project publications.withType().forEach { publication -> + publication.artifact(dokkaJar) publication.pom { name.set(project.name) description.set(project.description) @@ -177,7 +184,7 @@ open class KSciencePublishPlugin : Plugin { } extensions.findByType()?.apply { - useGpgCmd() + //useGpgCmd() sign(publications) } -- 2.34.1 From c37ff35b4c96e68f551f3a2d7e0ebaa771ccfe14 Mon Sep 17 00:00:00 2001 From: Alexander Nozik Date: Fri, 19 Feb 2021 22:33:34 +0300 Subject: [PATCH 4/9] Use optional in-memory signing --- build.gradle.kts | 15 +---------- .../mipt/npm/gradle/KScienceProjectPlugin.kt | 3 +++ .../mipt/npm/gradle/KSciencePublishPlugin.kt | 25 +++++++++++++++---- 3 files changed, 24 insertions(+), 19 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index 2375d93..a214e29 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -3,13 +3,12 @@ plugins { `kotlin-dsl` `maven-publish` signing - id("de.marcphilipp.nexus-publish") version "0.4.0" id("org.jetbrains.changelog") version "1.0.0" id("org.jetbrains.dokka") version "1.4.20" } group = "ru.mipt.npm" -version = "0.7.7" +version = "0.7.8" description = "Build tools for DataForge and kscience projects" @@ -35,7 +34,6 @@ dependencies { implementation("org.jetbrains.kotlin:kotlin-serialization:$kotlinVersion") implementation("org.jetbrains.kotlinx:atomicfu-gradle-plugin:0.15.1") implementation("org.jetbrains.dokka:dokka-gradle-plugin:1.4.20") -// implementation("org.jetbrains.dokka:dokka-base:1.4.20") implementation("org.jetbrains.intellij.plugins:gradle-changelog-plugin:1.0.0") implementation("org.jetbrains.kotlinx:binary-compatibility-validator:0.4.0") } @@ -164,17 +162,6 @@ publishing { val sonatypeUser: String? by project val sonatypePassword: String? by project -// if (sonatypeUser != null && sonatypePassword != null) { -// nexusPublishing { -// repositories { -// sonatype { -// username.set(sonatypeUser) -// password.set(sonatypePassword) -// } -// } -// } -// } - if (sonatypeUser != null && sonatypePassword != null) { val sonatypeRepo: String = if (project.version.toString().contains("dev")) { "https://oss.sonatype.org/content/repositories/snapshots" diff --git a/src/main/kotlin/ru/mipt/npm/gradle/KScienceProjectPlugin.kt b/src/main/kotlin/ru/mipt/npm/gradle/KScienceProjectPlugin.kt index dd725d5..c728463 100644 --- a/src/main/kotlin/ru/mipt/npm/gradle/KScienceProjectPlugin.kt +++ b/src/main/kotlin/ru/mipt/npm/gradle/KScienceProjectPlugin.kt @@ -153,6 +153,9 @@ open class KScienceProjectPlugin : Plugin { group = RELEASE_GROUP description = "Publish development or production release based on version suffix" dependsOn(generateReadme) + tasks.findByName("publishAllPublicationsToSonatypeRepository")?.let { + dependsOn(it) + } tasks.findByName("publishAllPublicationsToBintrayRepository")?.let { dependsOn(it) } diff --git a/src/main/kotlin/ru/mipt/npm/gradle/KSciencePublishPlugin.kt b/src/main/kotlin/ru/mipt/npm/gradle/KSciencePublishPlugin.kt index 5c34659..8977420 100644 --- a/src/main/kotlin/ru/mipt/npm/gradle/KSciencePublishPlugin.kt +++ b/src/main/kotlin/ru/mipt/npm/gradle/KSciencePublishPlugin.kt @@ -11,6 +11,13 @@ import org.jetbrains.kotlin.gradle.dsl.KotlinJsProjectExtension import org.jetbrains.kotlin.gradle.dsl.KotlinJvmProjectExtension +/** + * From https://github.com/Kotlin/kotlinx.serialization/blob/master/buildSrc/src/main/kotlin/Publishing.kt + */ +private fun Project.getSensitiveProperty(name: String): String? { + return project.findProperty(name) as? String ?: System.getenv(name) +} + open class KSciencePublishPlugin : Plugin { override fun apply(project: Project): Unit = project.plugins.withId("ru.mipt.npm.kscience") { @@ -74,7 +81,7 @@ open class KSciencePublishPlugin : Plugin { publication.artifact(dokkaJar) publication.pom { name.set(project.name) - description.set(project.description) + description.set(project.description ?: project.name) vcs?.let { url.set(vcs) } licenses { @@ -169,10 +176,15 @@ open class KSciencePublishPlugin : Plugin { } } + val sonatypePublish: Boolean? by project val sonatypeUser: String? by project val sonatypePassword: String? by project - if (sonatypeUser != null && sonatypePassword != null) { + val keyId: String? by project + val signingKey: String? = getSensitiveProperty("signingKey") + val signingKeyPassphrase: String? by project + + if (sonatypePublish == true && sonatypeUser != null && sonatypePassword != null) { val sonatypeRepo: String = if (project.version.toString().contains("dev")) { "https://oss.sonatype.org/content/repositories/snapshots" } else { @@ -183,8 +195,12 @@ open class KSciencePublishPlugin : Plugin { plugins.apply("signing") } - extensions.findByType()?.apply { - //useGpgCmd() + extensions.configure("signing") { + if (!signingKey.isNullOrBlank()) { + //if key is provided, use it + @Suppress("UnstableApiUsage") + useInMemoryPgpKeys(keyId, signingKey, signingKeyPassphrase) + } // else use file signing sign(publications) } @@ -199,7 +215,6 @@ open class KSciencePublishPlugin : Plugin { } } } - } } } -- 2.34.1 From 5d20e54ea403ebb9a8a8759162c879c2d3e8cbf0 Mon Sep 17 00:00:00 2001 From: Alexander Nozik Date: Sun, 21 Feb 2021 12:11:54 +0300 Subject: [PATCH 5/9] Change package name and fix javadoc and sources publishing --- CHANGELOG.md | 7 +- README.md | 28 +-- build.gradle.kts | 217 +++++++++--------- .../ru/mipt/npm/gradle/KScienceExtension.kt | 2 +- .../mipt/npm/gradle/KScienceNativePlugin.kt | 73 +++--- ...hPlugin.kt => KSciencePublishingPlugin.kt} | 23 +- 6 files changed, 163 insertions(+), 187 deletions(-) rename src/main/kotlin/ru/mipt/npm/gradle/{KSciencePublishPlugin.kt => KSciencePublishingPlugin.kt} (92%) diff --git a/CHANGELOG.md b/CHANGELOG.md index cb72b40..b6ee23b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,8 +11,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Add sonatype publishing ### Changed -- Kotlin to 1.4.30 stable -- Added intermediate jsCommon main/test sourcesSet for node plugin +- Kotlin to 1.4.30 stable. +- Added intermediate jsCommon main/test sourcesSet for node plugin. +- Plugin names changed to `ru.mipt.npm` package. +- Common plugin id changed to `common` +- Plugins group changed to `ru.mipt.npm` with `gradle prefix ### Deprecated diff --git a/README.md b/README.md index 0bffb2b..fdcbf90 100644 --- a/README.md +++ b/README.md @@ -1,29 +1,29 @@ # KScience build tools -A collection of gradle plugins for building and publishin *kscience* and *dataforge* projects. +A collection of gradle plugins for building and publish in *kscience* and *dataforge* projects. -## ru.mipt.npm.kscience +## ru.mipt.npm.gradle.common A primary plugin. When used with kotlin-jvm, kotlin-js or kotlin-mulitplatform configures the project for appropriate target. -## ru.mipt.npm.project +## ru.mipt.npm.gradle.project Root project tool including JetBrains changelog plugin an kotlin binary compatibility validator tool. -## ru.mipt.npm.publish +## ru.mipt.npm.gradle.publish Enables publishing to maven-central, bintray, Space and github. -## ru.mipt.npm.mpp -`= kotlin("multiplatform") + ru.mipt.npm.kscience` +## ru.mipt.npm.gradle.mpp +`= kotlin("multiplatform") + ru.mipt.npm.gradle.common` Includes JVM-IR and JS-IR-Browser targets. -## ru.mipt.npm.jvm -`= kotlin("jvm") + ru.mipt.npm.kscience` +## ru.mipt.npm.gradle.jvm +`= kotlin("jvm") + ru.mipt.npm.gradle.common` -## ru.mipt.npm.js -`= kotlin("js + ru.mipt.npm.kscience` +## ru.mipt.npm.gradle.js +`= kotlin("js + ru.mipt.npm.gradle.common` -## ru.mipt.npm.native -add default native targets to `ru.mipt.npm.mpp` +## ru.mipt.npm.gradle.native +add default native targets to `ru.mipt.npm.gradle.mpp` -## ru.mipt.npm.node -add node target to `ru.mipt.npm.mpp` \ No newline at end of file +## ru.mipt.npm.gradle.node +add node target to `ru.mipt.npm.gradle.mpp` \ No newline at end of file diff --git a/build.gradle.kts b/build.gradle.kts index a214e29..cede88e 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -8,7 +8,7 @@ plugins { } group = "ru.mipt.npm" -version = "0.7.8" +version = "0.8.0" description = "Build tools for DataForge and kscience projects" @@ -38,156 +38,157 @@ dependencies { implementation("org.jetbrains.kotlinx:binary-compatibility-validator:0.4.0") } -gradlePlugin { +project.extensions.findByType()?.apply{ plugins { - create("kscience.common") { - id = "ru.mipt.npm.kscience" + create("common") { + id = "ru.mipt.npm.gradle.common" description = "The generalized kscience plugin that works in conjunction with any kotlin plugin" implementationClass = "ru.mipt.npm.gradle.KScienceCommonPlugin" } - create("kscience.project") { - id = "ru.mipt.npm.project" + create("project") { + id = "ru.mipt.npm.gradle.project" description = "The root plugin for multimodule project infrastructure" implementationClass = "ru.mipt.npm.gradle.KScienceProjectPlugin" } - create("kscience.publish") { - id = "ru.mipt.npm.publish" + create("publishing") { + id = "ru.mipt.npm.gradle.publish" description = "The publication plugin for bintray and github" - implementationClass = "ru.mipt.npm.gradle.KSciencePublishPlugin" + implementationClass = "ru.mipt.npm.gradle.KSciencePublishingPlugin" } - create("kscience.mpp") { - id = "ru.mipt.npm.mpp" + create("mpp") { + id = "ru.mipt.npm.gradle.mpp" description = "Pre-configured multiplatform project" implementationClass = "ru.mipt.npm.gradle.KScienceMPPlugin" } - create("kscience.jvm") { - id = "ru.mipt.npm.jvm" + create("jvm") { + id = "ru.mipt.npm.gradle.jvm" description = "Pre-configured JVM project" implementationClass = "ru.mipt.npm.gradle.KScienceJVMPlugin" } - create("kscience.js") { - id = "ru.mipt.npm.js" + create("js") { + id = "ru.mipt.npm.gradle.js" description = "Pre-configured JS project" implementationClass = "ru.mipt.npm.gradle.KScienceJSPlugin" } - create("kscience.native") { - id = "ru.mipt.npm.native" + create("native") { + id = "ru.mipt.npm.gradle.native" description = "Additional native targets to be use alongside mpp" implementationClass = "ru.mipt.npm.gradle.KScienceNativePlugin" } - create("kscience.node") { - id = "ru.mipt.npm.node" + create("node") { + id = "ru.mipt.npm.gradle.node" description = "Additional nodejs target to be use alongside mpp" implementationClass = "ru.mipt.npm.gradle.KScienceNodePlugin" } } } -publishing { - val vcs = "https://github.com/mipt-npm/gradle-tools" +afterEvaluate { + publishing { + val vcs = "https://github.com/mipt-npm/gradle-tools" - val sourcesJar: Jar by tasks.creating(Jar::class) { - archiveClassifier.set("sources") - from(sourceSets.named("main").get().allSource) - } + val sourcesJar: Jar by tasks.creating(Jar::class) { + archiveClassifier.set("sources") + from(sourceSets.named("main").get().allSource) + } - val javadocsJar: Jar by tasks.creating(Jar::class) { - group = "documentation" - archiveClassifier.set("javadoc") - from(tasks.dokkaHtml) - } + val javadocsJar: Jar by tasks.creating(Jar::class) { + group = "documentation" + archiveClassifier.set("javadoc") + from(tasks.dokkaHtml) + } - // Process each publication we have in this project - publications.filterIsInstance().forEach { publication -> + // Process each publication we have in this project + publications.filterIsInstance().forEach { publication -> + publication.apply { + artifact(sourcesJar) + artifact(javadocsJar) - publication.apply { - artifact(sourcesJar) - artifact(javadocsJar) - - pom { - name.set(project.name) - description.set(project.description) - url.set(vcs) - - licenses { - license { - name.set("The Apache Software License, Version 2.0") - url.set("http://www.apache.org/licenses/LICENSE-2.0.txt") - distribution.set("repo") - } - } - developers { - developer { - id.set("MIPT-NPM") - name.set("MIPT nuclear physics methods laboratory") - organization.set("MIPT") - organizationUrl.set("http://npm.mipt.ru") - } - - } - scm { + pom { + name.set(project.name) + description.set(project.description) url.set(vcs) - tag.set(project.version.toString()) + + licenses { + license { + name.set("The Apache Software License, Version 2.0") + url.set("http://www.apache.org/licenses/LICENSE-2.0.txt") + distribution.set("repo") + } + } + developers { + developer { + id.set("MIPT-NPM") + name.set("MIPT nuclear physics methods laboratory") + organization.set("MIPT") + organizationUrl.set("http://npm.mipt.ru") + } + + } + scm { + url.set(vcs) + tag.set(project.version.toString()) + } } } } + + val spaceRepo: String = "https://maven.pkg.jetbrains.space/mipt-npm/p/mipt-npm/maven" + val spaceUser: String? by project + val spaceToken: String? by project + + if (spaceUser != null && spaceToken != null) { + project.logger.info("Adding mipt-npm Space publishing to project [${project.name}]") + repositories { + maven { + name = "space" + url = uri(spaceRepo) + credentials { + username = spaceUser + password = spaceToken + } + + } + } + } + + val sonatypeUser: String? by project + val sonatypePassword: String? by project + + if (sonatypeUser != null && sonatypePassword != null) { + val sonatypeRepo: String = if (project.version.toString().contains("dev")) { + "https://oss.sonatype.org/content/repositories/snapshots" + } else { + "https://oss.sonatype.org/service/local/staging/deploy/maven2" + } + + if (plugins.findPlugin("signing") == null) { + plugins.apply("signing") + } + + repositories { + maven { + name = "sonatype" + url = uri(sonatypeRepo) + credentials { + username = sonatypeUser + password = sonatypePassword + } + } + } + signing { + //useGpgCmd() + sign(publications) + } + } } - val spaceRepo: String = "https://maven.pkg.jetbrains.space/mipt-npm/p/mipt-npm/maven" - val spaceUser: String? by project - val spaceToken: String? by project - - if (spaceUser != null && spaceToken != null) { - project.logger.info("Adding mipt-npm Space publishing to project [${project.name}]") - repositories { - maven { - name = "space" - url = uri(spaceRepo) - credentials { - username = spaceUser - password = spaceToken - } - - } - } - } - - val sonatypeUser: String? by project - val sonatypePassword: String? by project - - if (sonatypeUser != null && sonatypePassword != null) { - val sonatypeRepo: String = if (project.version.toString().contains("dev")) { - "https://oss.sonatype.org/content/repositories/snapshots" - } else { - "https://oss.sonatype.org/service/local/staging/deploy/maven2" - } - - if (plugins.findPlugin("signing") == null) { - plugins.apply("signing") - } - - repositories { - maven { - name = "sonatype" - url = uri(sonatypeRepo) - credentials { - username = sonatypeUser - password = sonatypePassword - } - } - } - signing { - //useGpgCmd() - sign(publications) - } - } } - diff --git a/src/main/kotlin/ru/mipt/npm/gradle/KScienceExtension.kt b/src/main/kotlin/ru/mipt/npm/gradle/KScienceExtension.kt index 27f0497..5f5a8e1 100644 --- a/src/main/kotlin/ru/mipt/npm/gradle/KScienceExtension.kt +++ b/src/main/kotlin/ru/mipt/npm/gradle/KScienceExtension.kt @@ -128,7 +128,7 @@ class KScienceExtension(val project: Project) { } fun publish() { - project.plugins.apply(KSciencePublishPlugin::class) + project.plugins.apply(KSciencePublishingPlugin::class) } } diff --git a/src/main/kotlin/ru/mipt/npm/gradle/KScienceNativePlugin.kt b/src/main/kotlin/ru/mipt/npm/gradle/KScienceNativePlugin.kt index 2eaeb6e..7486de0 100644 --- a/src/main/kotlin/ru/mipt/npm/gradle/KScienceNativePlugin.kt +++ b/src/main/kotlin/ru/mipt/npm/gradle/KScienceNativePlugin.kt @@ -1,6 +1,5 @@ package ru.mipt.npm.gradle -import org.gradle.api.GradleException import org.gradle.api.Plugin import org.gradle.api.Project import org.gradle.kotlin.dsl.* @@ -19,59 +18,45 @@ class KScienceNativePlugin : Plugin { } configure { - val ideaActive = System.getProperty("idea.active") == "true" + //deploy mode + linuxX64() + mingwX64() + macosX64() - if (ideaActive) { - //development mode - val hostOs = System.getProperty("os.name") + sourceSets { + val commonMain by getting + val commonTest by getting - when { - hostOs == "Mac OS X" -> macosX64("native") - hostOs == "Linux" -> linuxX64("native") - hostOs.startsWith("Windows") -> mingwX64("native") - else -> throw GradleException("Host OS is not supported in Kotlin/Native.") + val nativeMain by creating { + dependsOn(commonMain) } - } else { - //deploy mode - linuxX64() - mingwX64() - macosX64() - sourceSets{ - val commonMain by getting - val commonTest by getting + val nativeTest by creating { + dependsOn(commonTest) + } - val nativeMain by creating{ - dependsOn(commonMain) - } + val linuxX64Main by getting { + dependsOn(nativeMain) + } - val nativeTest by creating{ - dependsOn(commonTest) - } + val mingwX64Main by getting { + dependsOn(nativeMain) + } - val linuxX64Main by getting{ - dependsOn(nativeMain) - } + val macosX64Main by getting { + dependsOn(nativeMain) + } - val mingwX64Main by getting{ - dependsOn(nativeMain) - } + val linuxX64Test by getting { + dependsOn(nativeTest) + } - val macosX64Main by getting{ - dependsOn(nativeMain) - } + val mingwX64Test by getting { + dependsOn(nativeTest) + } - val linuxX64Test by getting{ - dependsOn(nativeTest) - } - - val mingwX64Test by getting{ - dependsOn(nativeTest) - } - - val macosX64Test by getting{ - dependsOn(nativeTest) - } + val macosX64Test by getting { + dependsOn(nativeTest) } } } diff --git a/src/main/kotlin/ru/mipt/npm/gradle/KSciencePublishPlugin.kt b/src/main/kotlin/ru/mipt/npm/gradle/KSciencePublishingPlugin.kt similarity index 92% rename from src/main/kotlin/ru/mipt/npm/gradle/KSciencePublishPlugin.kt rename to src/main/kotlin/ru/mipt/npm/gradle/KSciencePublishingPlugin.kt index 8977420..d4b5054 100644 --- a/src/main/kotlin/ru/mipt/npm/gradle/KSciencePublishPlugin.kt +++ b/src/main/kotlin/ru/mipt/npm/gradle/KSciencePublishingPlugin.kt @@ -11,16 +11,9 @@ import org.jetbrains.kotlin.gradle.dsl.KotlinJsProjectExtension import org.jetbrains.kotlin.gradle.dsl.KotlinJvmProjectExtension -/** - * From https://github.com/Kotlin/kotlinx.serialization/blob/master/buildSrc/src/main/kotlin/Publishing.kt - */ -private fun Project.getSensitiveProperty(name: String): String? { - return project.findProperty(name) as? String ?: System.getenv(name) -} +open class KSciencePublishingPlugin : Plugin { -open class KSciencePublishPlugin : Plugin { - - override fun apply(project: Project): Unit = project.plugins.withId("ru.mipt.npm.kscience") { + override fun apply(project: Project): Unit = project.plugins.withId("ru.mipt.npm.common") { project.afterEvaluate { if (plugins.findPlugin("maven-publish") == null) { plugins.apply("maven-publish") @@ -31,12 +24,6 @@ open class KSciencePublishPlugin : Plugin { val vcs = findProperty("vcs") as? String ?: githubProject?.let { "https://github.com/$githubOrg/$it" } -// if (vcs == null) { -// project.logger.warn("[${project.name}] Missing deployment configuration. Skipping publish.") -// return -// } - - project.configure { plugins.withId("org.jetbrains.kotlin.js") { val kotlin = extensions.findByType()!! @@ -149,7 +136,7 @@ open class KSciencePublishPlugin : Plugin { val bintrayOrg = project.findProperty("bintrayOrg") as? String ?: "mipt-npm" val bintrayUser: String? by project val bintrayApiKey: String? by project - + val bintrayPublish: Boolean? by project val bintrayRepo = if (project.version.toString().contains("dev")) { "dev" @@ -159,7 +146,7 @@ open class KSciencePublishPlugin : Plugin { val projectName = project.name - if (bintrayRepo != null && bintrayUser != null && bintrayApiKey != null) { + if (bintrayPublish == true && bintrayRepo != null && bintrayUser != null && bintrayApiKey != null) { project.logger.info("Adding bintray publishing to project [$projectName]") repositories { @@ -181,7 +168,7 @@ open class KSciencePublishPlugin : Plugin { val sonatypePassword: String? by project val keyId: String? by project - val signingKey: String? = getSensitiveProperty("signingKey") + val signingKey: String? = project.findProperty("signingKey") as? String ?: System.getenv("signingKey") val signingKeyPassphrase: String? by project if (sonatypePublish == true && sonatypeUser != null && sonatypePassword != null) { -- 2.34.1 From 7a2d5c40f1743f2f843e414c0ce598cd2d7ab912 Mon Sep 17 00:00:00 2001 From: Alexander Nozik Date: Sun, 21 Feb 2021 12:12:34 +0300 Subject: [PATCH 6/9] fix readme --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index fdcbf90..d313dda 100644 --- a/README.md +++ b/README.md @@ -20,7 +20,7 @@ Includes JVM-IR and JS-IR-Browser targets. `= kotlin("jvm") + ru.mipt.npm.gradle.common` ## ru.mipt.npm.gradle.js -`= kotlin("js + ru.mipt.npm.gradle.common` +`= kotlin("js") + ru.mipt.npm.gradle.common` ## ru.mipt.npm.gradle.native add default native targets to `ru.mipt.npm.gradle.mpp` -- 2.34.1 From ab259a5fb60805d44da560707d1f2f6768ed78cf Mon Sep 17 00:00:00 2001 From: Alexander Nozik Date: Sun, 21 Feb 2021 16:06:25 +0300 Subject: [PATCH 7/9] Version 0.8.0 --- CHANGELOG.md | 1 + build.gradle.kts | 2 +- .../mipt/npm/gradle/KScienceProjectPlugin.kt | 34 +-- .../mipt/npm/gradle/KSciencePublishPlugin.kt | 208 ++++++++++++++++++ .../npm/gradle/KSciencePublishingPlugin.kt | 208 ------------------ 5 files changed, 231 insertions(+), 222 deletions(-) create mode 100644 src/main/kotlin/ru/mipt/npm/gradle/KSciencePublishPlugin.kt delete mode 100644 src/main/kotlin/ru/mipt/npm/gradle/KSciencePublishingPlugin.kt diff --git a/CHANGELOG.md b/CHANGELOG.md index b6ee23b..d96c646 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added - Ktor version to versions - Add sonatype publishing +- Per-platform release publishing ### Changed - Kotlin to 1.4.30 stable. diff --git a/build.gradle.kts b/build.gradle.kts index cede88e..74501c7 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -55,7 +55,7 @@ project.extensions.findByType()?.apply{ create("publishing") { id = "ru.mipt.npm.gradle.publish" description = "The publication plugin for bintray and github" - implementationClass = "ru.mipt.npm.gradle.KSciencePublishingPlugin" + implementationClass = "ru.mipt.npm.gradle.KSciencePublishPlugin" } create("mpp") { diff --git a/src/main/kotlin/ru/mipt/npm/gradle/KScienceProjectPlugin.kt b/src/main/kotlin/ru/mipt/npm/gradle/KScienceProjectPlugin.kt index c728463..0a08997 100644 --- a/src/main/kotlin/ru/mipt/npm/gradle/KScienceProjectPlugin.kt +++ b/src/main/kotlin/ru/mipt/npm/gradle/KScienceProjectPlugin.kt @@ -56,11 +56,11 @@ open class KScienceProjectPlugin : Plugin { group = "documentation" description = "Generate a README file if stub is present" - if(readmeExtension.readmeTemplate.exists()) { + if (readmeExtension.readmeTemplate.exists()) { inputs.file(readmeExtension.readmeTemplate) } readmeExtension.additionalFiles.forEach { - if(it.exists()){ + if (it.exists()) { inputs.file(it) } } @@ -75,7 +75,7 @@ open class KScienceProjectPlugin : Plugin { } } } - tasks.withType{ + tasks.withType { dependsOn(generateReadme) } } @@ -90,11 +90,11 @@ open class KScienceProjectPlugin : Plugin { } } - if(rootReadmeExtension.readmeTemplate.exists()) { + if (rootReadmeExtension.readmeTemplate.exists()) { inputs.file(rootReadmeExtension.readmeTemplate) } rootReadmeExtension.additionalFiles.forEach { - if(it.exists()){ + if (it.exists()) { inputs.file(it) } } @@ -117,7 +117,7 @@ open class KScienceProjectPlugin : Plugin { appendln("> ${ext.description}") appendln(">\n> **Maturity**: ${ext.maturity}") val featureString = ext.featuresString(itemPrefix = "> - ", pathPrefix = "$name/") - if(featureString.isNotBlank()) { + if (featureString.isNotBlank()) { appendln(">\n> **Features:**") appendln(featureString) } @@ -142,30 +142,38 @@ open class KScienceProjectPlugin : Plugin { } } - tasks.withType{ + tasks.withType { dependsOn(generateReadme) } val patchChangelog by tasks.getting - val release by tasks.creating{ - afterEvaluate { + afterEvaluate { + val release by tasks.creating { group = RELEASE_GROUP description = "Publish development or production release based on version suffix" dependsOn(generateReadme) - tasks.findByName("publishAllPublicationsToSonatypeRepository")?.let { + + val publicationPlatform = project.findProperty("ci.publication.platform") as? String + val publicationName = if(publicationPlatform == null){ + "AllPublications" + } else { + publicationPlatform.capitalize() + "Publication" + } + tasks.findByName("publish${publicationName}ToSonatypeRepository")?.let { dependsOn(it) } - tasks.findByName("publishAllPublicationsToBintrayRepository")?.let { + tasks.findByName("publish${publicationName}ToBintrayRepository")?.let { dependsOn(it) } - tasks.findByName("publishAllPublicationsToSpaceRepository")?.let { + tasks.findByName("publish${publicationName}ToSpaceRepository")?.let { dependsOn(it) } } } } - companion object{ + + companion object { const val RELEASE_GROUP = "release" } } \ No newline at end of file diff --git a/src/main/kotlin/ru/mipt/npm/gradle/KSciencePublishPlugin.kt b/src/main/kotlin/ru/mipt/npm/gradle/KSciencePublishPlugin.kt new file mode 100644 index 0000000..a7412aa --- /dev/null +++ b/src/main/kotlin/ru/mipt/npm/gradle/KSciencePublishPlugin.kt @@ -0,0 +1,208 @@ +package ru.mipt.npm.gradle + +import org.gradle.api.Plugin +import org.gradle.api.Project +import org.gradle.api.publish.PublishingExtension +import org.gradle.api.publish.maven.MavenPublication +import org.gradle.jvm.tasks.Jar +import org.gradle.kotlin.dsl.* +import org.gradle.plugins.signing.SigningExtension +import org.jetbrains.kotlin.gradle.dsl.KotlinJsProjectExtension +import org.jetbrains.kotlin.gradle.dsl.KotlinJvmProjectExtension + + +private fun Project.isSnapshot() = version.toString().contains("dev") || version.toString().endsWith("SNAPSHOT") + +open class KSciencePublishingPlugin : Plugin { + + override fun apply(project: Project): Unit = project.afterEvaluate { + if (plugins.findPlugin("maven-publish") == null) { + plugins.apply("maven-publish") + } + + val githubOrg: String = project.findProperty("githubOrg") as? String ?: "mipt-npm" + val githubProject: String? by project + val vcs = findProperty("vcs") as? String + ?: githubProject?.let { "https://github.com/$githubOrg/$it" } + + configure { + plugins.withId("org.jetbrains.kotlin.js") { + val kotlin = extensions.findByType()!! + + val sourcesJar: Jar by project.tasks.creating(Jar::class) { + archiveClassifier.set("sources") + from(kotlin.sourceSets["main"].kotlin) + } + + publications { + create("js", MavenPublication::class) { + from(components["kotlin"]) + artifact(sourcesJar) + } + } + } + + plugins.withId("org.jetbrains.kotlin.jvm") { + val kotlin = extensions.findByType()!! + + val sourcesJar: Jar by project.tasks.creating(Jar::class) { + archiveClassifier.set("sources") + from(kotlin.sourceSets["main"].kotlin) + } + + publications { + create("jvm", MavenPublication::class) { + from(components["kotlin"]) + artifact(sourcesJar) + } + } + } + + val dokkaJar: Jar by tasks.creating(Jar::class) { + group = "documentation" + archiveClassifier.set("javadoc") + from(tasks.findByName("dokkaHtml")) + } + + // Process each publication we have in this project + publications.withType().forEach { publication -> + publication.artifact(dokkaJar) + publication.pom { + name.set(project.name) + description.set(project.description ?: project.name) + vcs?.let { url.set(vcs) } + + licenses { + license { + name.set("The Apache Software License, Version 2.0") + url.set("http://www.apache.org/licenses/LICENSE-2.0.txt") + distribution.set("repo") + } + } + developers { + developer { + id.set("MIPT-NPM") + name.set("MIPT nuclear physics methods laboratory") + organization.set("MIPT") + organizationUrl.set("http://npm.mipt.ru") + } + + } + vcs?.let { + scm { + url.set(vcs) + tag.set(project.version.toString()) + //developerConnection = "scm:git:[fetch=]/*ВАША ССЫЛКА НА .git файл*/[push=]/*Повторить предыдущую ссылку*/" + } + } + } + } + + val githubUser: String? by project + val githubToken: String? by project + + if (githubProject != null && githubUser != null && githubToken != null) { + project.logger.info("Adding github publishing to project [${project.name}]") + repositories { + maven { + name = "github" + url = uri("https://maven.pkg.github.com/mipt-npm/$githubProject/") + credentials { + username = githubUser + password = githubToken + } + } + } + } + + val spaceRepo: String? by project + val spaceUser: String? by project + val spaceToken: String? by project + + if (spaceRepo != null && spaceUser != null && spaceToken != null) { + project.logger.info("Adding mipt-npm Space publishing to project [${project.name}]") + repositories { + maven { + name = "space" + url = uri(spaceRepo!!) + credentials { + username = spaceUser + password = spaceToken + } + + } + } + } + + val bintrayOrg = project.findProperty("bintrayOrg") as? String ?: "mipt-npm" + val bintrayUser: String? by project + val bintrayApiKey: String? by project + val bintrayPublish: String? by project + + val bintrayRepo = if (isSnapshot()) { + "dev" + } else { + findProperty("bintrayRepo") as? String + } + + val projectName = project.name + + if (bintrayPublish == "true" && bintrayRepo != null && bintrayUser != null && bintrayApiKey != null) { + project.logger.info("Adding bintray publishing to project [$projectName]") + + repositories { + maven { + name = "bintray" + url = uri( + "https://api.bintray.com/maven/$bintrayOrg/$bintrayRepo/$projectName/;publish=1;override=1" + ) + credentials { + username = bintrayUser + password = bintrayApiKey + } + } + } + } + + val sonatypePublish: String? by project + val sonatypeUser: String? by project + val sonatypePassword: String? by project + + val keyId: String? by project + val signingKey: String? = project.findProperty("signingKey") as? String ?: System.getenv("signingKey") + val signingKeyPassphrase: String? by project + + if (sonatypePublish == "true" && sonatypeUser != null && sonatypePassword != null) { + val sonatypeRepo: String = if (isSnapshot()) { + "https://oss.sonatype.org/content/repositories/snapshots" + } else { + "https://oss.sonatype.org/service/local/staging/deploy/maven2" + } + + if (plugins.findPlugin("signing") == null) { + plugins.apply("signing") + } + + extensions.configure("signing") { + if (!signingKey.isNullOrBlank()) { + //if key is provided, use it + @Suppress("UnstableApiUsage") + useInMemoryPgpKeys(keyId, signingKey, signingKeyPassphrase) + } // else use file signing + sign(publications) + } + + repositories { + maven { + name = "sonatype" + url = uri(sonatypeRepo) + credentials { + username = sonatypeUser + password = sonatypePassword + } + } + } + } + } + } +} diff --git a/src/main/kotlin/ru/mipt/npm/gradle/KSciencePublishingPlugin.kt b/src/main/kotlin/ru/mipt/npm/gradle/KSciencePublishingPlugin.kt deleted file mode 100644 index d4b5054..0000000 --- a/src/main/kotlin/ru/mipt/npm/gradle/KSciencePublishingPlugin.kt +++ /dev/null @@ -1,208 +0,0 @@ -package ru.mipt.npm.gradle - -import org.gradle.api.Plugin -import org.gradle.api.Project -import org.gradle.api.publish.PublishingExtension -import org.gradle.api.publish.maven.MavenPublication -import org.gradle.jvm.tasks.Jar -import org.gradle.kotlin.dsl.* -import org.gradle.plugins.signing.SigningExtension -import org.jetbrains.kotlin.gradle.dsl.KotlinJsProjectExtension -import org.jetbrains.kotlin.gradle.dsl.KotlinJvmProjectExtension - - -open class KSciencePublishingPlugin : Plugin { - - override fun apply(project: Project): Unit = project.plugins.withId("ru.mipt.npm.common") { - project.afterEvaluate { - if (plugins.findPlugin("maven-publish") == null) { - plugins.apply("maven-publish") - } - - val githubOrg: String = project.findProperty("githubOrg") as? String ?: "mipt-npm" - val githubProject: String? by project - val vcs = findProperty("vcs") as? String - ?: githubProject?.let { "https://github.com/$githubOrg/$it" } - - project.configure { - plugins.withId("org.jetbrains.kotlin.js") { - val kotlin = extensions.findByType()!! - - val sourcesJar: Jar by project.tasks.creating(Jar::class) { - archiveClassifier.set("sources") - from(kotlin.sourceSets["main"].kotlin) - } - - publications { - create("js", MavenPublication::class) { - from(components["kotlin"]) - artifact(sourcesJar) - } - } - } - - plugins.withId("org.jetbrains.kotlin.jvm") { - val kotlin = extensions.findByType()!! - - val sourcesJar: Jar by project.tasks.creating(Jar::class) { - archiveClassifier.set("sources") - from(kotlin.sourceSets["main"].kotlin) - } - - publications { - create("jvm", MavenPublication::class) { - from(components["kotlin"]) - artifact(sourcesJar) - } - } - } - - val dokkaJar: Jar by tasks.creating(Jar::class) { - group = "documentation" - archiveClassifier.set("javadoc") - from(tasks.findByName("dokkaHtml")) - } - - // Process each publication we have in this project - publications.withType().forEach { publication -> - publication.artifact(dokkaJar) - publication.pom { - name.set(project.name) - description.set(project.description ?: project.name) - vcs?.let { url.set(vcs) } - - licenses { - license { - name.set("The Apache Software License, Version 2.0") - url.set("http://www.apache.org/licenses/LICENSE-2.0.txt") - distribution.set("repo") - } - } - developers { - developer { - id.set("MIPT-NPM") - name.set("MIPT nuclear physics methods laboratory") - organization.set("MIPT") - organizationUrl.set("http://npm.mipt.ru") - } - - } - vcs?.let { - scm { - url.set(vcs) - tag.set(project.version.toString()) - //developerConnection = "scm:git:[fetch=]/*ВАША ССЫЛКА НА .git файл*/[push=]/*Повторить предыдущую ссылку*/" - } - } - } - } - - val githubUser: String? by project - val githubToken: String? by project - - if (githubProject != null && githubUser != null && githubToken != null) { - project.logger.info("Adding github publishing to project [${project.name}]") - repositories { - maven { - name = "github" - url = uri("https://maven.pkg.github.com/mipt-npm/$githubProject/") - credentials { - username = githubUser - password = githubToken - } - } - } - } - - val spaceRepo: String? by project - val spaceUser: String? by project - val spaceToken: String? by project - - if (spaceRepo != null && spaceUser != null && spaceToken != null) { - project.logger.info("Adding mipt-npm Space publishing to project [${project.name}]") - repositories { - maven { - name = "space" - url = uri(spaceRepo!!) - credentials { - username = spaceUser - password = spaceToken - } - - } - } - } - - val bintrayOrg = project.findProperty("bintrayOrg") as? String ?: "mipt-npm" - val bintrayUser: String? by project - val bintrayApiKey: String? by project - val bintrayPublish: Boolean? by project - - val bintrayRepo = if (project.version.toString().contains("dev")) { - "dev" - } else { - findProperty("bintrayRepo") as? String - } - - val projectName = project.name - - if (bintrayPublish == true && bintrayRepo != null && bintrayUser != null && bintrayApiKey != null) { - project.logger.info("Adding bintray publishing to project [$projectName]") - - repositories { - maven { - name = "bintray" - url = uri( - "https://api.bintray.com/maven/$bintrayOrg/$bintrayRepo/$projectName/;publish=1;override=1" - ) - credentials { - username = bintrayUser - password = bintrayApiKey - } - } - } - } - - val sonatypePublish: Boolean? by project - val sonatypeUser: String? by project - val sonatypePassword: String? by project - - val keyId: String? by project - val signingKey: String? = project.findProperty("signingKey") as? String ?: System.getenv("signingKey") - val signingKeyPassphrase: String? by project - - if (sonatypePublish == true && sonatypeUser != null && sonatypePassword != null) { - val sonatypeRepo: String = if (project.version.toString().contains("dev")) { - "https://oss.sonatype.org/content/repositories/snapshots" - } else { - "https://oss.sonatype.org/service/local/staging/deploy/maven2" - } - - if (plugins.findPlugin("signing") == null) { - plugins.apply("signing") - } - - extensions.configure("signing") { - if (!signingKey.isNullOrBlank()) { - //if key is provided, use it - @Suppress("UnstableApiUsage") - useInMemoryPgpKeys(keyId, signingKey, signingKeyPassphrase) - } // else use file signing - sign(publications) - } - - repositories { - maven { - name = "sonatype" - url = uri(sonatypeRepo) - credentials { - username = sonatypeUser - password = sonatypePassword - } - } - } - } - } - } - } -} \ No newline at end of file -- 2.34.1 From 1dfdc7f76f681f7026922a7a145873725eaf4957 Mon Sep 17 00:00:00 2001 From: Alexander Nozik Date: Sun, 21 Feb 2021 20:14:01 +0300 Subject: [PATCH 8/9] Fix publishing plugin reference --- build.gradle.kts | 2 +- .../{KSciencePublishPlugin.kt => KSciencePublishingPlugin.kt} | 0 2 files changed, 1 insertion(+), 1 deletion(-) rename src/main/kotlin/ru/mipt/npm/gradle/{KSciencePublishPlugin.kt => KSciencePublishingPlugin.kt} (100%) diff --git a/build.gradle.kts b/build.gradle.kts index 74501c7..cede88e 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -55,7 +55,7 @@ project.extensions.findByType()?.apply{ create("publishing") { id = "ru.mipt.npm.gradle.publish" description = "The publication plugin for bintray and github" - implementationClass = "ru.mipt.npm.gradle.KSciencePublishPlugin" + implementationClass = "ru.mipt.npm.gradle.KSciencePublishingPlugin" } create("mpp") { diff --git a/src/main/kotlin/ru/mipt/npm/gradle/KSciencePublishPlugin.kt b/src/main/kotlin/ru/mipt/npm/gradle/KSciencePublishingPlugin.kt similarity index 100% rename from src/main/kotlin/ru/mipt/npm/gradle/KSciencePublishPlugin.kt rename to src/main/kotlin/ru/mipt/npm/gradle/KSciencePublishingPlugin.kt -- 2.34.1 From e54da4c7cd80f69a5eb47ed893b40deb5151d8c9 Mon Sep 17 00:00:00 2001 From: Alexander Nozik Date: Sun, 21 Feb 2021 20:16:25 +0300 Subject: [PATCH 9/9] patch changelog --- CHANGELOG.md | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d96c646..74574b1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,18 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] ### Added + +### Changed + +### Deprecated + +### Removed + +### Fixed + +### Security +## [0.8.0] +### Added - Ktor version to versions - Add sonatype publishing - Per-platform release publishing @@ -16,7 +28,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Added intermediate jsCommon main/test sourcesSet for node plugin. - Plugin names changed to `ru.mipt.npm` package. - Common plugin id changed to `common` -- Plugins group changed to `ru.mipt.npm` with `gradle prefix +- Plugins group changed to `ru.mipt.npm` with `gradle` prefix ### Deprecated -- 2.34.1