From 931d69ec1d5fe63fcfbda2a2d03d5d4c50837c74 Mon Sep 17 00:00:00 2001 From: Alexander Nozik Date: Tue, 28 Sep 2021 12:12:03 +0300 Subject: [PATCH] 0.10.4 --- CHANGELOG.md | 3 +++ build.gradle.kts | 12 ++---------- .../ru/mipt/npm/gradle/KScienceProjectPlugin.kt | 8 ++++---- .../ru/mipt/npm/gradle/internal/publishing.kt | 13 ++++++------- 4 files changed, 15 insertions(+), 21 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 426e500..33e37e1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,12 +9,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added ### Changed +- Kotlin 1.6 ### Deprecated ### Removed ### Fixed +- Some issues with opt-ins ### Security ## [0.10.2] @@ -22,6 +24,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Experimental automatic JS project bundling in MPP ### Changed +- Remove vcs requirement for Space publication ### Deprecated diff --git a/build.gradle.kts b/build.gradle.kts index 747c39e..44b20d5 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -34,6 +34,8 @@ dependencies { implementation(libs.kotlin.jupyter.gradle) implementation(libs.kotlin.serialization) implementation("org.tomlj:tomlj:1.0.0") +// // nexus publishing plugin +// implementation("io.github.gradle-nexus:publish-plugin:1.1.0") testImplementation(kotlin("test")) } @@ -189,16 +191,6 @@ afterEvaluate { apply() } - 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/KScienceProjectPlugin.kt b/src/main/kotlin/ru/mipt/npm/gradle/KScienceProjectPlugin.kt index cafd95a..a6224f7 100644 --- a/src/main/kotlin/ru/mipt/npm/gradle/KScienceProjectPlugin.kt +++ b/src/main/kotlin/ru/mipt/npm/gradle/KScienceProjectPlugin.kt @@ -32,7 +32,7 @@ public class KSciencePublishingExtension(public val project: Project) { } /** - * Configures Git repository for the publication. + * Configures Git repository (sources) for the publication. * * @param vcsUrl URL of the repository's web interface. * @param connectionUrl URL of the Git repository. @@ -69,8 +69,9 @@ public class KSciencePublishingExtension(public val project: Project) { */ public fun github(githubProject: String, githubOrg: String = "mipt-npm", release: Boolean = false, publish: Boolean = true) { // Automatically initialize VCS using GitHub - if (!isVcsInitialized) + if (!isVcsInitialized) { git("https://github.com/$githubOrg/${githubProject}", "https://github.com/$githubOrg/${githubProject}.git") + } if (publish) project.addGithubPublishing(githubOrg, githubProject) if (release) linkPublicationsToReleaseTask("github") @@ -87,7 +88,6 @@ public class KSciencePublishingExtension(public val project: Project) { * @param release whether publish packages in the `release` task to the Space repository. */ public fun space(spaceRepo: String = "https://maven.pkg.jetbrains.space/mipt-npm/p/sci/maven", release: Boolean = true) { - require(isVcsInitialized) { "The project vcs is not set up use 'vcs' method to do so" } project.addSpacePublishing(spaceRepo) if (release) linkPublicationsToReleaseTask("space") @@ -105,7 +105,7 @@ public class KSciencePublishingExtension(public val project: Project) { * @param release whether publish packages in the `release` task to the Sonatype repository. */ public fun sonatype(release: Boolean = true) { - require(isVcsInitialized) { "The project vcs is not set up use 'vcs' method to do so" } + require(isVcsInitialized) { "The project vcs is not set up use 'git' method to do so" } project.addSonatypePublishing() if (release) linkPublicationsToReleaseTask("sonatype") diff --git a/src/main/kotlin/ru/mipt/npm/gradle/internal/publishing.kt b/src/main/kotlin/ru/mipt/npm/gradle/internal/publishing.kt index 7185bec..43c7d67 100644 --- a/src/main/kotlin/ru/mipt/npm/gradle/internal/publishing.kt +++ b/src/main/kotlin/ru/mipt/npm/gradle/internal/publishing.kt @@ -25,7 +25,7 @@ internal fun Project.setupPublication(mavenPomConfiguration: MavenPom.() -> Unit plugins.withId("org.jetbrains.kotlin.js") { val kotlin: KotlinJsProjectExtension = extensions.findByType()!! - val sourcesJar by tasks.creating(Jar::class) { + val sourcesJar by tasks.creating(Jar::class) { archiveClassifier.set("sources") kotlin.sourceSets.all { @@ -155,7 +155,7 @@ internal fun Project.addGithubPublishing( internal fun Project.addSpacePublishing(spaceRepo: String) { if (requestPropertyOrNull("publishing.enabled") != "true") { - logger.info("Skipping github publishing because publishing is disabled") + logger.info("Skipping space publishing because publishing is disabled") return } @@ -188,7 +188,7 @@ internal fun Project.addSpacePublishing(spaceRepo: String) { internal fun Project.addSonatypePublishing() { if (requestPropertyOrNull("publishing.enabled") != "true") { - logger.info("Skipping github publishing because publishing is disabled") + logger.info("Skipping sonatype publishing because publishing is disabled") return } @@ -204,18 +204,16 @@ internal fun Project.addSonatypePublishing() { val sonatypeUser: String = requestProperty("publishing.sonatype.user") val sonatypePassword: String = requestProperty("publishing.sonatype.password") - val signingId: String? = requestPropertyOrNull("publishing.signing.id") allprojects { plugins.withId("maven-publish") { configure { - val sonatypeRepo = "https://oss.sonatype.org/service/local/staging/deploy/maven2" - - if (!plugins.hasPlugin("signing") ) { + if (!plugins.hasPlugin("signing")) { apply() } extensions.configure("signing") { + val signingId: String? = requestPropertyOrNull("publishing.signing.id") if (!signingId.isNullOrBlank()) { val signingKey: String = requestProperty("publishing.signing.key") val signingPassphrase: String = requestProperty("publishing.signing.passPhrase") @@ -227,6 +225,7 @@ internal fun Project.addSonatypePublishing() { } repositories.maven { + val sonatypeRepo = "https://oss.sonatype.org/service/local/staging/deploy/maven2" name = "sonatype" url = uri(sonatypeRepo)