diff --git a/build.gradle.kts b/build.gradle.kts index 74a1892..94174e6 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -37,6 +37,8 @@ dependencies { implementation(libs.kotlin.serialization) } +//declaring exported plugins + gradlePlugin { plugins { create("common") { @@ -83,6 +85,14 @@ gradlePlugin { } } +//publishing version catalog + +catalog.versionCatalog { + from(files("gradle/libs.versions.toml")) +} + +//publishing the artifact + val sourcesJar by tasks.creating(Jar::class) { archiveClassifier.set("sources") from(sourceSets.named("main").get().allSource) @@ -94,10 +104,6 @@ val javadocsJar by tasks.creating(Jar::class) { from(tasks.dokkaHtml) } -catalog.versionCatalog { - from(files("gradle/libs.versions.toml")) -} - afterEvaluate { publishing { val vcs = "https://github.com/mipt-npm/gradle-tools" @@ -195,3 +201,7 @@ afterEvaluate { } } } + +tasks.processResources.configure { + from("gradle/libs.versions.toml") +} \ No newline at end of file diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index f1037e9..d5e8579 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -3,7 +3,7 @@ atomicfu = "0.16.2" binary-compatibility-validator = "0.6.0" changelog = "1.2.1" dokka = "1.5.0" -kotlin = "1.5.21" +kotlin = "1.5.30" kotlin-jupyter = "0.10.0-184" kotlinx-benchmark = "0.3.1" kotlinx-cli = "0.3.2" @@ -13,11 +13,12 @@ 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" +kotlinx-serialization = "1.3.0-RC" +ktor = "1.6.3" +tools = "0.10.3" xmlutil = "0.82.0" -yamlkt = "0.10.0" +yamlkt = "0.10.2" +jsBom = "0.0.1-pre.243-kotlin-1.5.30" [libraries] atomicfu-gradle = { module = "org.jetbrains.kotlinx:atomicfu-gradle-plugin", version.ref = "atomicfu" } diff --git a/settings.gradle.kts b/settings.gradle.kts index 1a6e4a3..4de58c3 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -1,2 +1,3 @@ rootProject.name = "gradle-tools" + enableFeaturePreview("VERSION_CATALOGS") diff --git a/src/main/kotlin/ru/mipt/npm/gradle/KScienceVersions.kt b/src/main/kotlin/ru/mipt/npm/gradle/KScienceVersions.kt index 3609587..21d9094 100644 --- a/src/main/kotlin/ru/mipt/npm/gradle/KScienceVersions.kt +++ b/src/main/kotlin/ru/mipt/npm/gradle/KScienceVersions.kt @@ -1,26 +1,31 @@ package ru.mipt.npm.gradle import org.gradle.api.JavaVersion +import org.gradle.internal.impldep.org.tomlj.Toml /** * Build constants */ -@Deprecated("Use version catalog.") -object KScienceVersions { - const val kotlinVersion = "1.5.30" - const val kotlinxNodeVersion = "0.0.7" - const val coroutinesVersion = "1.5.1" - const val serializationVersion = "1.2.2" - const val atomicVersion = "0.16.2" - const val ktorVersion = "1.6.2" - const val htmlVersion = "0.7.3" - const val dateTimeVersion = "0.2.1" - const val jsBom = "0.0.1-pre.216-kotlin-1.5.20" +public object KScienceVersions { + + private val toml = + Toml.parse(KScienceVersions.javaClass.getResource("/libs.versions.toml")!!.readText()) + + + public val kotlinVersion: String = toml.getString("versions.kotlin")!! + public val kotlinxNodeVersion: String = toml.getString("versions.kotlinx-nodejs")!! + public val coroutinesVersion: String = toml.getString("versions.kotlinx-coroutines")!! + public val serializationVersion: String = toml.getString("versions.kotlinx-serialization")!! + public val atomicVersion: String = toml.getString("versions.atomicfu")!! + public val ktorVersion: String = toml.getString("versions.ktor")!! + public val htmlVersion: String = toml.getString("versions.kotlinx-html")!! + public val dateTimeVersion: String = toml.getString("versions.kotlinx-datetime")!! + public val jsBom: String = toml.getString("versions.jsBom")!! public val JVM_TARGET: JavaVersion = JavaVersion.VERSION_11 public object Serialization { - public const val xmlVersion: String = "0.82.0" - public const val yamlKtVersion: String = "0.10.0" + public val xmlVersion: String = toml.getString("versions.xmlutil")!! + public val yamlKtVersion: String = toml.getString("versions.yamlkt")!! } } diff --git a/src/main/kotlin/ru/mipt/npm/gradle/internal/common.kt b/src/main/kotlin/ru/mipt/npm/gradle/internal/common.kt index f4d8096..2d7fd7d 100644 --- a/src/main/kotlin/ru/mipt/npm/gradle/internal/common.kt +++ b/src/main/kotlin/ru/mipt/npm/gradle/internal/common.kt @@ -15,12 +15,13 @@ internal fun LanguageSettingsBuilder.applySettings() { languageVersion = "1.5" apiVersion = "1.5" progressiveMode = true - useExperimentalAnnotation("kotlin.Experimental") - useExperimentalAnnotation("kotlin.ExperimentalUnsignedTypes") - useExperimentalAnnotation("kotlin.ExperimentalStdlibApi") - useExperimentalAnnotation("kotlin.time.ExperimentalTime") - useExperimentalAnnotation("kotlin.contracts.ExperimentalContracts") - useExperimentalAnnotation("kotlin.js.ExperimentalJsExport") + + optIn("kotlin.Experimental") + optIn("kotlin.ExperimentalUnsignedTypes") + optIn("kotlin.ExperimentalStdlibApi") + optIn("kotlin.time.ExperimentalTime") + optIn("kotlin.contracts.ExperimentalContracts") + optIn("kotlin.js.ExperimentalJsExport") } internal fun RepositoryHandler.applyRepos() {