diff --git a/build.gradle.kts b/build.gradle.kts index 852dd65..12919b7 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -8,7 +8,7 @@ plugins { } group = "ru.mipt.npm" -version = "0.8.3" +version = "0.8.4" description = "Build tools for DataForge and kscience projects" @@ -22,7 +22,7 @@ repositories { } -val kotlinVersion = "1.4.30" +val kotlinVersion = "1.4.31" java { targetCompatibility = JavaVersion.VERSION_1_8 diff --git a/src/main/kotlin/ru/mipt/npm/gradle/KScienceProjectPlugin.kt b/src/main/kotlin/ru/mipt/npm/gradle/KScienceProjectPlugin.kt index c9280ee..c513d17 100644 --- a/src/main/kotlin/ru/mipt/npm/gradle/KScienceProjectPlugin.kt +++ b/src/main/kotlin/ru/mipt/npm/gradle/KScienceProjectPlugin.kt @@ -8,8 +8,6 @@ import org.gradle.kotlin.dsl.* import org.jetbrains.changelog.ChangelogPlugin import org.jetbrains.dokka.gradle.DokkaPlugin import org.jetbrains.dokka.gradle.DokkaTask -import kotlin.collections.component1 -import kotlin.collections.component2 @Suppress("unused") class KSciencePublishingExtension(val project: Project) { @@ -104,20 +102,24 @@ open class KScienceProjectPlugin : Plugin { outputs.file(readmeFile) doLast { - val projects = subprojects.associate { - it.name to it.extensions.findByType() - } +// val projects = subprojects.associate { +// val normalizedPath = it.path.replaceFirst(":","").replace(":","/") +// it.path.replace(":","/") to it.extensions.findByType() +// } if (rootReadmeExtension.readmeTemplate.exists()) { val modulesString = buildString { - projects.entries.forEach { (name, ext) -> + subprojects.forEach { subproject-> + val name = subproject.name + val path = subproject.path.replaceFirst(":","").replace(":","/") + val ext = subproject.extensions.findByType() appendln("
") - appendln("\n* ### [$name]($name)") + appendln("\n* ### [$name]($path)") if (ext != null) { appendln("> ${ext.description}") appendln(">\n> **Maturity**: ${ext.maturity}") - val featureString = ext.featuresString(itemPrefix = "> - ", pathPrefix = "$name/") + val featureString = ext.featuresString(itemPrefix = "> - ", pathPrefix = "$path/") if (featureString.isNotBlank()) { appendln(">\n> **Features:**") appendln(featureString) @@ -145,28 +147,10 @@ open class KScienceProjectPlugin : Plugin { val patchChangelog by tasks.getting - afterEvaluate { - val release by tasks.creating { - group = RELEASE_GROUP - description = "Publish development or production release based on version suffix" - dependsOn(generateReadme) - - 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("publish${publicationName}ToBintrayRepository")?.let { - dependsOn(it) - } - tasks.findByName("publish${publicationName}ToSpaceRepository")?.let { - dependsOn(it) - } - } + val release by tasks.creating { + group = RELEASE_GROUP + description = "Publish development or production release based on version suffix" + dependsOn(generateReadme) } } diff --git a/src/main/kotlin/ru/mipt/npm/gradle/KSciencePublishingPlugin.kt b/src/main/kotlin/ru/mipt/npm/gradle/KSciencePublishingPlugin.kt index 52be9cf..109b065 100644 --- a/src/main/kotlin/ru/mipt/npm/gradle/KSciencePublishingPlugin.kt +++ b/src/main/kotlin/ru/mipt/npm/gradle/KSciencePublishingPlugin.kt @@ -60,6 +60,8 @@ open class KSciencePublishingPlugin : Plugin { //configure publications after everything is set in the root project project.rootProject.afterEvaluate { + //root project release task + val release by tasks.getting project.run { val githubOrg: String = project.findProperty("githubOrg") as? String ?: "mipt-npm" val githubProject: String? by project @@ -182,12 +184,8 @@ open class KSciencePublishingPlugin : Plugin { 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 (sonatypePublish == "true" && sonatypeUser != null && sonatypePassword != null && !isSnapshot()) { + val sonatypeRepo: String = "https://oss.sonatype.org/service/local/staging/deploy/maven2" if (plugins.findPlugin("signing") == null) { plugins.apply("signing") @@ -214,6 +212,22 @@ open class KSciencePublishingPlugin : Plugin { } } } + + + val publicationPlatform = project.findProperty("publication.platform") as? String + val publicationName = if (publicationPlatform == null) { + "AllPublications" + } else { + publicationPlatform.capitalize() + "Publication" + } + + tasks.findByName("publish${publicationName}ToSonatypeRepository")?.let { + release.dependsOn(it) + } + + tasks.findByName("publish${publicationName}ToSpaceRepository")?.let { + release.dependsOn(it) + } } } } diff --git a/src/main/kotlin/ru/mipt/npm/gradle/KScienceVersions.kt b/src/main/kotlin/ru/mipt/npm/gradle/KScienceVersions.kt index a494578..6e97280 100644 --- a/src/main/kotlin/ru/mipt/npm/gradle/KScienceVersions.kt +++ b/src/main/kotlin/ru/mipt/npm/gradle/KScienceVersions.kt @@ -6,18 +6,18 @@ import org.gradle.api.JavaVersion * Build constants */ object KScienceVersions { - const val kotlinVersion = "1.4.30" + const val kotlinVersion = "1.4.31" const val kotlinxNodeVersion = "0.0.7" - const val coroutinesVersion = "1.4.2" + const val coroutinesVersion = "1.4.3" const val serializationVersion = "1.1.0" const val atomicVersion = "0.15.1" - const val ktorVersion = "1.5.1" + const val ktorVersion = "1.5.2" const val htmlVersion = "0.7.2" val JVM_TARGET = JavaVersion.VERSION_11 object Serialization{ - const val xmlVersion = "0.81.0" + const val xmlVersion = "0.81.1" const val bsonVersion = "0.4.4" const val yamlKtVersion = "0.9.0" }