Fix publication setup. Update changelog plugin

This commit is contained in:
Alexander Nozik 2021-03-08 22:00:06 +03:00
parent 757b609d26
commit 5d58767aa8
3 changed files with 41 additions and 37 deletions

View File

@ -3,12 +3,12 @@ plugins {
`kotlin-dsl` `kotlin-dsl`
`maven-publish` `maven-publish`
signing signing
id("org.jetbrains.changelog") version "1.0.0" id("org.jetbrains.changelog") version "1.1.2"
id("org.jetbrains.dokka") version "1.4.20" id("org.jetbrains.dokka") version "1.4.20"
} }
group = "ru.mipt.npm" group = "ru.mipt.npm"
version = "0.9.1" version = "0.9.2"
description = "Build tools for DataForge and kscience projects" description = "Build tools for DataForge and kscience projects"
@ -34,7 +34,7 @@ dependencies {
implementation("org.jetbrains.kotlin:kotlin-serialization:$kotlinVersion") implementation("org.jetbrains.kotlin:kotlin-serialization:$kotlinVersion")
implementation("org.jetbrains.kotlinx:atomicfu-gradle-plugin:0.15.1") 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-gradle-plugin:1.4.20")
implementation("org.jetbrains.intellij.plugins:gradle-changelog-plugin:1.0.0") implementation("org.jetbrains.intellij.plugins:gradle-changelog-plugin:1.1.2")
implementation("org.jetbrains.kotlinx:binary-compatibility-validator:0.4.0") implementation("org.jetbrains.kotlinx:binary-compatibility-validator:0.4.0")
} }

View File

@ -17,9 +17,11 @@ import ru.mipt.npm.gradle.internal.setupPublication
class KSciencePublishingExtension(val project: Project) { class KSciencePublishingExtension(val project: Project) {
private var initializedFlag = false private var initializedFlag = false
fun setup(vcsUrl: String){ fun configurePublications(vcsUrl: String){
project.setupPublication(vcsUrl) if(!initializedFlag) {
initializedFlag = true project.setupPublication(vcsUrl)
initializedFlag = true
}
} }
/** /**
@ -28,7 +30,7 @@ class KSciencePublishingExtension(val project: Project) {
fun github(githubProject: String, githubOrg: String = "mipt-npm") { fun github(githubProject: String, githubOrg: String = "mipt-npm") {
//automatically initialize vcs using github //automatically initialize vcs using github
if(!initializedFlag){ if(!initializedFlag){
setup("https://github.com/$githubOrg/$githubProject") configurePublications("https://github.com/$githubOrg/$githubProject")
} }
project.addGithubPublishing(githubOrg, githubProject) project.addGithubPublishing(githubOrg, githubProject)
} }
@ -37,7 +39,7 @@ class KSciencePublishingExtension(val project: Project) {
* Space publishing * Space publishing
*/ */
fun space(spaceRepo: String = "https://maven.pkg.jetbrains.space/mipt-npm/p/sci/maven") { fun space(spaceRepo: String = "https://maven.pkg.jetbrains.space/mipt-npm/p/sci/maven") {
require(initializedFlag){"The publishing is not set up use 'setup' method to do so"} require(initializedFlag){"The publishing is not set up use 'configurePublications' method to do so"}
project.addSpacePublishing(spaceRepo) project.addSpacePublishing(spaceRepo)
} }
@ -48,10 +50,10 @@ class KSciencePublishingExtension(val project: Project) {
// var bintrayRepo: String? by project.extra // var bintrayRepo: String? by project.extra
/** /**
* Sonatype publising * Sonatype publishing
*/ */
fun sonatype(){ fun sonatype(){
require(initializedFlag){"The publishing is not set up use 'setup' method to do so"} require(initializedFlag){"The publishing is not set up use 'configurePublications' method to do so"}
project.addSonatypePublishing() project.addSonatypePublishing()
} }
} }

View File

@ -59,35 +59,37 @@ internal fun Project.setupPublication(vcs: String) = allprojects {
} }
// Process each publication we have in this project // Process each publication we have in this project
publications.withType<MavenPublication>().forEach { publication -> afterEvaluate {
publication.artifact(dokkaJar) publications.withType<MavenPublication>().forEach { publication ->
publication.pom { publication.artifact(dokkaJar)
name.set(project.name) publication.pom {
description.set(project.description ?: project.name) name.set(project.name)
url.set(vcs) description.set(project.description ?: project.name)
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) url.set(vcs)
tag.set(project.version.toString())
//developerConnection = "scm:git:[fetch=]/*ВАША ССЫЛКА НА .git файл*/[push=]/*Повторить предыдущую ссылку*/"
}
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())
//developerConnection = "scm:git:[fetch=]/*ВАША ССЫЛКА НА .git файл*/[push=]/*Повторить предыдущую ссылку*/"
}
}
} }
} }
} }