From dc2ff2efb31c352bf08e93eaf1fbea2839c2cb7f Mon Sep 17 00:00:00 2001 From: Iaroslav Postovalov Date: Sun, 8 Aug 2021 00:05:08 +0700 Subject: [PATCH] Publish a version catalog --- build.gradle.kts | 48 ++++-- gradle/libs.versions.toml | 154 +++++++++++++++++- gradle/wrapper/gradle-wrapper.properties | 2 +- .../ru/mipt/npm/gradle/KScienceExtension.kt | 5 + .../ru/mipt/npm/gradle/KScienceVersions.kt | 1 + 5 files changed, 184 insertions(+), 26 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index 97c5cfd..09cb3c6 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,15 +1,15 @@ plugins { + alias(libs.plugins.changelog) + alias(libs.plugins.dokka) `java-gradle-plugin` `kotlin-dsl` `maven-publish` signing - alias(libs.plugins.changelog) - alias(libs.plugins.dokka) + `version-catalog` } group = "ru.mipt.npm" -version = "0.10.2" - +version = libs.versions.tools.get() description = "Build tools for DataForge and kscience projects" changelog.version.set(project.version.toString()) @@ -78,29 +78,41 @@ gradlePlugin { } } +val sourcesJar by tasks.creating(Jar::class) { + archiveClassifier.set("sources") + from(sourceSets.named("main").get().allSource) +} + +val javadocsJar by tasks.creating(Jar::class) { + group = JavaBasePlugin.DOCUMENTATION_GROUP + archiveClassifier.set("javadoc") + from(tasks.dokkaHtml) +} + +catalog.versionCatalog { + from(files("gradle/libs.versions.toml")) +} + afterEvaluate { publishing { val vcs = "https://github.com/mipt-npm/gradle-tools" - val sourcesJar by tasks.creating(Jar::class) { - archiveClassifier.set("sources") - from(sourceSets.named("main").get().allSource) - } - - val javadocsJar by tasks.creating(Jar::class) { - group = "documentation" - archiveClassifier.set("javadoc") - from(tasks.dokkaHtml) - } - // Process each publication we have in this project - publications.filterIsInstance().forEach { publication -> - publication.apply { + publications { + create("catalog") { + from(components["versionCatalog"]) + this.artifactId = "version-catalog" + + pom { + name.set("version-catalog") + } + } + + withType { artifact(sourcesJar) artifact(javadocsJar) pom { - name.set(project.name) description.set(project.description) url.set(vcs) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 403fa86..f1037e9 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -4,23 +4,163 @@ binary-compatibility-validator = "0.6.0" changelog = "1.2.1" dokka = "1.5.0" kotlin = "1.5.21" -kotlin-jupyter = "0.10.0-173" +kotlin-jupyter = "0.10.0-184" +kotlinx-benchmark = "0.3.1" +kotlinx-cli = "0.3.2" +kotlinx-collections-immutable = "0.3.4" +kotlinx-coroutines = "1.5.1" +kotlinx-datetime = "0.2.1" +kotlinx-html = "0.7.3" +kotlinx-knit = "0.2.3" +kotlinx-nodejs = "0.0.7" +kotlinx-serialization = "1.2.2" +ktor = "1.6.2" +tools = "0.10.2" +xmlutil = "0.82.0" +yamlkt = "0.10.0" [libraries] atomicfu-gradle = { module = "org.jetbrains.kotlinx:atomicfu-gradle-plugin", version.ref = "atomicfu" } +atomicfu = { module = "org.jetbrains.kotlinx:atomicfu", version.ref = "atomicfu" } + +binary-compatibility-validator = { module = "org.jetbrains.kotlinx:binary-compatibility-validator", version.ref = "binary-compatibility-validator" } + changelog-gradle = { module = "org.jetbrains.intellij.plugins:gradle-changelog-plugin", version.ref = "changelog" } + dokka-gradle = { module = "org.jetbrains.dokka:dokka-gradle-plugin", version.ref = "dokka" } + kotlin-gradle = { module = "org.jetbrains.kotlin:kotlin-gradle-plugin", version.ref = "kotlin" } kotlin-serialization = { module = "org.jetbrains.kotlin:kotlin-serialization", version.ref = "kotlin" } -[libraries.kotlin-jupyter-gradle] -module = "org.jetbrains.kotlin:kotlin-jupyter-api-gradle-plugin" -version.ref = "kotlin-jupyter" +kotlin-jupyter-gradle = { module = "org.jetbrains.kotlin:kotlin-jupyter-api-gradle-plugin", version.ref = "kotlin-jupyter" } -[libraries.binary-compatibility-validator] -module = "org.jetbrains.kotlinx:binary-compatibility-validator" -version.ref = "binary-compatibility-validator" +kotlinx-benchmark-runtime = { module = "org.jetbrains.kotlinx:kotlinx-benchmark-runtime", version.ref = "kotlinx-benchmark" } + +kotlinx-collections-immutable = { module = "org.jetbrains.kotlinx:kotlinx-collections-immutable", version.ref = "kotlinx-collections-immutable" } + +kotlinx-coroutines-core = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-core", version.ref = "kotlinx-coroutines" } +kotlinx-coroutines-test = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-test", version.ref = "kotlinx-coroutines" } +kotlinx-coroutines-debug = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-debug", version.ref = "kotlinx-coroutines" } +kotlinx-coroutines-reactive = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-reactive", version.ref = "kotlinx-coroutines" } +kotlinx-coroutines-reactor = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-reactor", version.ref = "kotlinx-coroutines" } +kotlinx-coroutines-rx2 = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-rx2", version.ref = "kotlinx-coroutines" } +kotlinx-coroutines-rx3 = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-rx3", version.ref = "kotlinx-coroutines" } +kotlinx-coroutines-android = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-android", version.ref = "kotlinx-coroutines" } +kotlinx-coroutines-javafx = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-javafx", version.ref = "kotlinx-coroutines" } +kotlinx-coroutines-swing = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-swing", version.ref = "kotlinx-coroutines" } +kotlinx-coroutines-jdk8 = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-jdk8", version.ref = "kotlinx-coroutines" } +kotlinx-coroutines-guava = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-guava", version.ref = "kotlinx-coroutines" } +kotlinx-coroutines-slf4j = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-slf4j", version.ref = "kotlinx-coroutines" } +kotlinx-coroutines-play-services = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-play-services", version.ref = "kotlinx-coroutines" } + +kotlinx-cli = { module = "org.jetbrains.kotlinx:kotlinx-cli", version.ref = "kotlinx-cli" } + +kotlinx-datetime = { module = "org.jetbrains.kotlinx:kotlinx-datetime", version.ref = "kotlinx-datetime" } + +kotlinx-html = { module = "org.jetbrains.kotlinx:kotlinx-html", version.ref = "kotlinx-html" } + +kotlinx-knit = { module = "org.jetbrains.kotlinx:kotlinx-knit", version.ref = "kotlinx-knit" } + +kotlinx-nodejs = { module = "org.jetbrains.kotlinx:kotlinx-nodejs", version.ref = "kotlinx-nodejs" } + +kotlinx-serialization-cbor = { module = "org.jetbrains.kotlinx:kotlinx-serialization-cbor", version.ref = "kotlinx-serialization" } +kotlinx-serialization-core = { module = "org.jetbrains.kotlinx:kotlinx-serialization-core", version.ref = "kotlinx-serialization" } +kotlinx-serialization-hocon = { module = "org.jetbrains.kotlinx:kotlinx-serialization-hocon", version.ref = "kotlinx-serialization" } +kotlinx-serialization-json = { module = "org.jetbrains.kotlinx:kotlinx-serialization-json", version.ref = "kotlinx-serialization" } +kotlinx-serialization-protobuf = { module = "org.jetbrains.kotlinx:kotlinx-serialization-protobuf", version.ref = "kotlinx-serialization" } +kotlinx-serialization-properties = { module = "org.jetbrains.kotlinx:kotlinx-serialization-properties", version.ref = "kotlinx-serialization" } + +ktor-bom = { module = "io.ktor:ktor-bom", version.ref = "ktor" } +ktor-client-android = { module = "io.ktor:ktor-client-android", version.ref = "ktor" } +ktor-client-apache = { module = "io.ktor:ktor-client-apache", version.ref = "ktor" } +ktor-client-cio = { module = "io.ktor:ktor-client-cio", version.ref = "ktor" } +ktor-client-core = { module = "io.ktor:ktor-client-core", version.ref = "ktor" } +ktor-client-curl = { module = "io.ktor:ktor-client-curl", version.ref = "ktor" } +ktor-client-auth-basic = { module = "io.ktor:ktor-client-auth-basic", version.ref = "ktor" } +ktor-client-auth = { module = "io.ktor:ktor-client-auth", version.ref = "ktor" } +ktor-client-encoding = { module = "io.ktor:ktor-client-encoding", version.ref = "ktor" } +ktor-client-json = { module = "io.ktor:ktor-client-json", version.ref = "ktor" } +ktor-client-gson = { module = "io.ktor:ktor-client-gson", version.ref = "ktor" } +ktor-client-jackson = { module = "io.ktor:ktor-client-jackson", version.ref = "ktor" } +ktor-client-serialization = { module = "io.ktor:ktor-client-serialization", version.ref = "ktor" } +ktor-client-logging = { module = "io.ktor:ktor-client-loggin", version.ref = "ktor" } +ktor-client-tracing = { module = "io.ktor:ktor-client-tracing", version.ref = "ktor" } +ktor-client-websockets = { module = "io.ktor:ktor-client-websockets", version.ref = "ktor" } +ktor-client-java = { module = "io.ktor:ktor-client-java", version.ref = "ktor" } +ktor-client-jetty = { module = "io.ktor:ktor-client-jetty", version.ref = "ktor" } +ktor-client-js = { module = "io.ktor:ktor-client-js", version.ref = "ktor" } +ktor-client-mock = { module = "io.ktor:ktor-client-mock", version.ref = "ktor" } +ktor-client-okhttp = { module = "io.ktor:ktor-client-okhttp", version.ref = "ktor" } +ktor-auth-jwt = { module = "io.ktor:ktor-auth-jwt", version.ref = "ktor" } +ktor-auth-ldap = { module = "io.ktor:ktor-auth-ldap", version.ref = "ktor" } +ktor-auth = { module = "io.ktor:ktor-auth", version.ref = "ktor" } +ktor-freemaker = { module = "io.ktor:ktor-freemaker", version.ref = "ktor" } +ktor-gson = { module = "io.ktor:ktor-gson", version.ref = "ktor" } +ktor-html-builder = { module = "io.ktor:ktor-html-builder", version.ref = "ktor" } +ktor-jackson = { module = "io.ktor:ktor-jackson", version.ref = "ktor" } +ktor-locations = { module = "io.ktor:ktor-locations", version.ref = "ktor" } +ktor-metrics-micrometer = { module = "io.ktor:ktor-metrics-micrometer", version.ref = "ktor" } +ktor-metrics = { module = "io.ktor:ktor-metrics", version.ref = "ktor" } +ktor-mustache = { module = "io.ktor:ktor-mustache", version.ref = "ktor" } +ktor-pebble = { module = "io.ktor:ktor-pebble", version.ref = "ktor" } +ktor-serialization = { module = "io.ktor:ktor-serialization", version.ref = "ktor" } +ktor-server-sessions = { module = "io.ktor:ktor-server-sessions", version.ref = "ktor" } +ktor-thymeleaf = { module = "io.ktor:ktor-thymeleaf", version.ref = "ktor" } +ktor-velocity = { module = "io.ktor:ktor-velocity", version.ref = "ktor" } +ktor-webjars = { module = "io.ktor:ktor-webjars", version.ref = "ktor" } +ktor-websockets = { module = "io.ktor:ktor-websockets", version.ref = "ktor" } +ktor-http = { module = "io.ktor:ktor-http", version.ref = "ktor" } +ktor-http-cio = { module = "io.ktor:ktor-http-cio", version.ref = "ktor" } +ktor-io = { module = "io.ktor:ktor-io", version.ref = "ktor" } +ktor-network = { module = "io.ktor:ktor-network", version.ref = "ktor" } +ktor-network-tls = { module = "io.ktor:ktor-network-tls", version.ref = "ktor" } +ktor-network-tls-certificates = { module = "io.ktor:ktor-network-tls-certificates", version.ref = "ktor" } +ktor-server-cio = { module = "io.ktor:ktor-server-cio", version.ref = "ktor" } +ktor-server-core = { module = "io.ktor:ktor-server-core", version.ref = "ktor" } +ktor-server-host-common = { module = "io.ktor:ktor-server-host-common", version.ref = "ktor" } +ktor-server-jetty = { module = "io.ktor:ktor-server-jetty", version.ref = "ktor" } +ktor-server-netty = { module = "io.ktor:ktor-server-netty", version.ref = "ktor" } +ktor-server-servlet = { module = "io.ktor:ktor-server-servlet", version.ref = "ktor" } +ktor-server-test-host = { module = "io.ktor:ktor-server-test-host", version.ref = "ktor" } +ktor-server-tomcat = { module = "io.ktor:ktor-server-tomcat", version.ref = "ktor" } +ktor-test-dispatcher = { module = "io.ktor:ktor-test-dispatcher", version.ref = "ktor" } +ktor-utils = { module = "io.ktor:ktor-utils", version.ref = "ktor" } + +xmlutil-core = { module = "io.github.pdvrieze.xmlutil:core", version.ref = "xmlutil" } +xmlutil-ktor = { module = "io.github.pdvrieze.xmlutil:ktor", version.ref = "xmlutil" } +xmlutil-serialization = { module = "io.github.pdvrieze.xmlutil:serialization", version.ref = "xmlutil" } + +yamlkt = { module = "net.mamoe.yamlkt:yamlkt", version.ref = "yamlkt" } [plugins] changelog = { id = "org.jetbrains.changelog", version.ref = "changelog" } + dokka = { id = "org.jetbrains.dokka", version.ref = "dokka" } + +gradle-common = { id = "ru.mipt.npm.gradle.common", version.ref = "tools" } +gradle-project = { id = "ru.mipt.npm.gradle.project", version.ref = "tools" } +gradle-mpp = { id = "ru.mipt.npm.gradle.mpp", version.ref = "tools" } +gradle-jvm = { id = "ru.mipt.npm.gradle.jvm", version.ref = "tools" } +gradle-js = { id = "ru.mipt.npm.gradle.js", version.ref = "tools" } +gradle-native = { id = "ru.mipt.npm.gradle.native", version.ref = "tools" } +gradle-node = { id = "ru.mipt.npm.gradle.node", version.ref = "tools" } + +kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" } +kotlin-android-extensions = { id = "org.jetbrains.kotlin.android.extensions", version.ref = "kotlin" } +kotlin-js = { id = "org.jetbrains.kotlin.js", version.ref = "kotlin" } +kotlin-jvm = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" } +kotlin-kapt = { id = "org.jetbrains.kotlin.kapt", version.ref = "kotlin" } +kotlin-multiplatform = { id = "org.jetbrains.kotlin.multiplatform", version.ref = "kotlin" } +kotlin-native-cocoapods = { id = "org.jetbrains.kotlin.native.cocoapods", version.ref = "kotlin" } +kotlin-plugin-allopen = { id = "org.jetbrains.kotlin.plugin.allopen", version.ref = "kotlin" } +kotlin-plugin-jpa = { id = "org.jetbrains.kotlin.plugin.jpa", version.ref = "kotlin" } +kotlin-plugin-lombok = { id = "org.jetbrains.kotlin.plugin.lombok", version.ref = "kotlin" } +kotlin-plugin-noarg = { id = "org.jetbrains.kotlin.plugin.noarg", version.ref = "kotlin" } +kotlin-plugin-parcelize = { id = "org.jetbrains.kotlin.plugin.parcelize", version.ref = "kotlin" } +kotlin-plugin-scripting = { id = "org.jetbrains.kotlin.plugin.scripting", version.ref = "kotlin" } +kotlin-plugin-serialization = { id = "org.jetbrains.kotlin.plugin.serialization", version.ref = "kotlin" } +kotlin-plugin-spring = { id = "org.jetbrains.kotlin.plugin.spring", version.ref = "kotlin" } + +kotlin-jupyter-api = { id = "org.jetbrains.kotlin.jupyter.api", version.ref = "kotlin-jupyter" } + +kotlinx-benchmark = { id = "org.jetbrains.kotlinx.benchmark", version.ref = "kotlinx-benchmark" } diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index cbfbc41..ffed3a2 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-rc-2-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/src/main/kotlin/ru/mipt/npm/gradle/KScienceExtension.kt b/src/main/kotlin/ru/mipt/npm/gradle/KScienceExtension.kt index dee6d7d..c03ced0 100644 --- a/src/main/kotlin/ru/mipt/npm/gradle/KScienceExtension.kt +++ b/src/main/kotlin/ru/mipt/npm/gradle/KScienceExtension.kt @@ -44,6 +44,7 @@ class KScienceExtension(val project: Project) { /** * Use coroutines-core with default version or [version] */ + @Deprecated("Use version catalog.") fun useCoroutines( version: String = KScienceVersions.coroutinesVersion, sourceSet: DependencySourceSet = DependencySourceSet.MAIN, @@ -57,6 +58,7 @@ class KScienceExtension(val project: Project) { /** * Use kotlinx-atmicfu plugin and library */ + @Deprecated("Use version catalog.") fun useAtomic( version: String = KScienceVersions.atomicVersion, sourceSet: DependencySourceSet = DependencySourceSet.MAIN, @@ -73,6 +75,7 @@ class KScienceExtension(val project: Project) { /** * Use core serialization library and configure targets */ + @Deprecated("Use version catalog.") fun useSerialization( version: String = KScienceVersions.serializationVersion, sourceSet: DependencySourceSet = DependencySourceSet.MAIN, @@ -106,6 +109,7 @@ class KScienceExtension(val project: Project) { /** * Add dependency on kotlinx-html library */ + @Deprecated("Use version catalog.") fun useHtml( version: String = KScienceVersions.htmlVersion, sourceSet: DependencySourceSet = DependencySourceSet.MAIN, @@ -119,6 +123,7 @@ class KScienceExtension(val project: Project) { /** * Use kotlinx-datetime library with default version or [version] */ + @Deprecated("Use version catalog.") fun useDateTime( version: String = KScienceVersions.dateTimeVersion, sourceSet: DependencySourceSet = DependencySourceSet.MAIN, diff --git a/src/main/kotlin/ru/mipt/npm/gradle/KScienceVersions.kt b/src/main/kotlin/ru/mipt/npm/gradle/KScienceVersions.kt index b8acdb4..df7a1ba 100644 --- a/src/main/kotlin/ru/mipt/npm/gradle/KScienceVersions.kt +++ b/src/main/kotlin/ru/mipt/npm/gradle/KScienceVersions.kt @@ -5,6 +5,7 @@ import org.gradle.api.JavaVersion /** * Build constants */ +@Deprecated("Use version catalog.") object KScienceVersions { const val kotlinVersion = "1.5.21" const val kotlinxNodeVersion = "0.0.7"