Fix publishing with missing github repository

This commit is contained in:
Alexander Nozik 2021-01-27 22:16:56 +03:00
parent cdb3651b58
commit 3bb6f63748
3 changed files with 12 additions and 9 deletions

View File

@ -6,7 +6,7 @@ plugins {
} }
group = "ru.mipt.npm" group = "ru.mipt.npm"
version = "0.7.3-1.4.30-RC" version = "0.7.4"
repositories { repositories {
gradlePluginPortal() gradlePluginPortal()

View File

@ -13,6 +13,7 @@ import kotlin.collections.component1
import kotlin.collections.component2 import kotlin.collections.component2
class KSciencePublishingExtension(val project: Project) { class KSciencePublishingExtension(val project: Project) {
var vcs: String? by project.extra
var githubOrg: String? by project.extra var githubOrg: String? by project.extra
var githubProject: String? by project.extra var githubProject: String? by project.extra
var spaceRepo: String? by project.extra var spaceRepo: String? by project.extra

View File

@ -18,10 +18,10 @@ internal fun Project.configurePublishing() {
val vcs = findProperty("vcs") as? String val vcs = findProperty("vcs") as? String
?: githubProject?.let { "https://github.com/$githubOrg/$it" } ?: githubProject?.let { "https://github.com/$githubOrg/$it" }
if (vcs == null) { // if (vcs == null) {
project.logger.warn("[${project.name}] Missing deployment configuration. Skipping publish.") // project.logger.warn("[${project.name}] Missing deployment configuration. Skipping publish.")
return // return
} // }
project.configure<PublishingExtension> { project.configure<PublishingExtension> {
plugins.withId("org.jetbrains.kotlin.js") { plugins.withId("org.jetbrains.kotlin.js") {
@ -62,7 +62,7 @@ internal fun Project.configurePublishing() {
publication.pom { publication.pom {
name.set(project.name) name.set(project.name)
description.set(project.description) description.set(project.description)
url.set(vcs) vcs?.let{url.set(vcs)}
licenses { licenses {
license { license {
@ -80,12 +80,14 @@ internal fun Project.configurePublishing() {
} }
} }
vcs?.let {
scm { scm {
url.set(vcs) url.set(vcs)
tag.set(project.version.toString()) tag.set(project.version.toString())
} }
} }
} }
}
val githubUser: String? by project val githubUser: String? by project
val githubToken: String? by project val githubToken: String? by project