From 3bb6f63748debc864ef43fce8d296599ba5f1010 Mon Sep 17 00:00:00 2001 From: Alexander Nozik Date: Wed, 27 Jan 2021 22:16:56 +0300 Subject: [PATCH] Fix publishing with missing github repository --- build.gradle.kts | 2 +- .../mipt/npm/gradle/KScienceProjectPlugin.kt | 1 + .../ru/mipt/npm/gradle/internal/publish.kt | 18 ++++++++++-------- 3 files changed, 12 insertions(+), 9 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index 435a040..c06e675 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -6,7 +6,7 @@ plugins { } group = "ru.mipt.npm" -version = "0.7.3-1.4.30-RC" +version = "0.7.4" repositories { gradlePluginPortal() diff --git a/src/main/kotlin/ru/mipt/npm/gradle/KScienceProjectPlugin.kt b/src/main/kotlin/ru/mipt/npm/gradle/KScienceProjectPlugin.kt index 942334a..6fe1644 100644 --- a/src/main/kotlin/ru/mipt/npm/gradle/KScienceProjectPlugin.kt +++ b/src/main/kotlin/ru/mipt/npm/gradle/KScienceProjectPlugin.kt @@ -13,6 +13,7 @@ import kotlin.collections.component1 import kotlin.collections.component2 class KSciencePublishingExtension(val project: Project) { + var vcs: String? by project.extra var githubOrg: String? by project.extra var githubProject: String? by project.extra var spaceRepo: String? by project.extra diff --git a/src/main/kotlin/ru/mipt/npm/gradle/internal/publish.kt b/src/main/kotlin/ru/mipt/npm/gradle/internal/publish.kt index 12bb161..58f8b02 100644 --- a/src/main/kotlin/ru/mipt/npm/gradle/internal/publish.kt +++ b/src/main/kotlin/ru/mipt/npm/gradle/internal/publish.kt @@ -18,10 +18,10 @@ internal fun Project.configurePublishing() { 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 - } +// if (vcs == null) { +// project.logger.warn("[${project.name}] Missing deployment configuration. Skipping publish.") +// return +// } project.configure { plugins.withId("org.jetbrains.kotlin.js") { @@ -62,7 +62,7 @@ internal fun Project.configurePublishing() { publication.pom { name.set(project.name) description.set(project.description) - url.set(vcs) + vcs?.let{url.set(vcs)} licenses { license { @@ -80,9 +80,11 @@ internal fun Project.configurePublishing() { } } - scm { - url.set(vcs) - tag.set(project.version.toString()) + vcs?.let { + scm { + url.set(vcs) + tag.set(project.version.toString()) + } } } }