Fix inner use of version catalog

This commit is contained in:
Alexander Nozik 2021-09-12 19:32:35 +03:00
parent f67f1bf4f0
commit 6fa4b264a2
5 changed files with 46 additions and 28 deletions

View File

@ -37,6 +37,8 @@ dependencies {
implementation(libs.kotlin.serialization) implementation(libs.kotlin.serialization)
} }
//declaring exported plugins
gradlePlugin { gradlePlugin {
plugins { plugins {
create("common") { 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) { val sourcesJar by tasks.creating(Jar::class) {
archiveClassifier.set("sources") archiveClassifier.set("sources")
from(sourceSets.named("main").get().allSource) from(sourceSets.named("main").get().allSource)
@ -94,10 +104,6 @@ val javadocsJar by tasks.creating(Jar::class) {
from(tasks.dokkaHtml) from(tasks.dokkaHtml)
} }
catalog.versionCatalog {
from(files("gradle/libs.versions.toml"))
}
afterEvaluate { afterEvaluate {
publishing { publishing {
val vcs = "https://github.com/mipt-npm/gradle-tools" val vcs = "https://github.com/mipt-npm/gradle-tools"
@ -195,3 +201,7 @@ afterEvaluate {
} }
} }
} }
tasks.processResources.configure {
from("gradle/libs.versions.toml")
}

View File

@ -3,7 +3,7 @@ atomicfu = "0.16.2"
binary-compatibility-validator = "0.6.0" binary-compatibility-validator = "0.6.0"
changelog = "1.2.1" changelog = "1.2.1"
dokka = "1.5.0" dokka = "1.5.0"
kotlin = "1.5.21" kotlin = "1.5.30"
kotlin-jupyter = "0.10.0-184" kotlin-jupyter = "0.10.0-184"
kotlinx-benchmark = "0.3.1" kotlinx-benchmark = "0.3.1"
kotlinx-cli = "0.3.2" kotlinx-cli = "0.3.2"
@ -13,11 +13,12 @@ kotlinx-datetime = "0.2.1"
kotlinx-html = "0.7.3" kotlinx-html = "0.7.3"
kotlinx-knit = "0.2.3" kotlinx-knit = "0.2.3"
kotlinx-nodejs = "0.0.7" kotlinx-nodejs = "0.0.7"
kotlinx-serialization = "1.2.2" kotlinx-serialization = "1.3.0-RC"
ktor = "1.6.2" ktor = "1.6.3"
tools = "0.10.2" tools = "0.10.3"
xmlutil = "0.82.0" xmlutil = "0.82.0"
yamlkt = "0.10.0" yamlkt = "0.10.2"
jsBom = "0.0.1-pre.243-kotlin-1.5.30"
[libraries] [libraries]
atomicfu-gradle = { module = "org.jetbrains.kotlinx:atomicfu-gradle-plugin", version.ref = "atomicfu" } atomicfu-gradle = { module = "org.jetbrains.kotlinx:atomicfu-gradle-plugin", version.ref = "atomicfu" }

View File

@ -1,2 +1,3 @@
rootProject.name = "gradle-tools" rootProject.name = "gradle-tools"
enableFeaturePreview("VERSION_CATALOGS") enableFeaturePreview("VERSION_CATALOGS")

View File

@ -1,26 +1,31 @@
package ru.mipt.npm.gradle package ru.mipt.npm.gradle
import org.gradle.api.JavaVersion import org.gradle.api.JavaVersion
import org.gradle.internal.impldep.org.tomlj.Toml
/** /**
* Build constants * Build constants
*/ */
@Deprecated("Use version catalog.") public object KScienceVersions {
object KScienceVersions {
const val kotlinVersion = "1.5.30" private val toml =
const val kotlinxNodeVersion = "0.0.7" Toml.parse(KScienceVersions.javaClass.getResource("/libs.versions.toml")!!.readText())
const val coroutinesVersion = "1.5.1"
const val serializationVersion = "1.2.2"
const val atomicVersion = "0.16.2" public val kotlinVersion: String = toml.getString("versions.kotlin")!!
const val ktorVersion = "1.6.2" public val kotlinxNodeVersion: String = toml.getString("versions.kotlinx-nodejs")!!
const val htmlVersion = "0.7.3" public val coroutinesVersion: String = toml.getString("versions.kotlinx-coroutines")!!
const val dateTimeVersion = "0.2.1" public val serializationVersion: String = toml.getString("versions.kotlinx-serialization")!!
const val jsBom = "0.0.1-pre.216-kotlin-1.5.20" 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 val JVM_TARGET: JavaVersion = JavaVersion.VERSION_11
public object Serialization { public object Serialization {
public const val xmlVersion: String = "0.82.0" public val xmlVersion: String = toml.getString("versions.xmlutil")!!
public const val yamlKtVersion: String = "0.10.0" public val yamlKtVersion: String = toml.getString("versions.yamlkt")!!
} }
} }

View File

@ -15,12 +15,13 @@ internal fun LanguageSettingsBuilder.applySettings() {
languageVersion = "1.5" languageVersion = "1.5"
apiVersion = "1.5" apiVersion = "1.5"
progressiveMode = true progressiveMode = true
useExperimentalAnnotation("kotlin.Experimental")
useExperimentalAnnotation("kotlin.ExperimentalUnsignedTypes") optIn("kotlin.Experimental")
useExperimentalAnnotation("kotlin.ExperimentalStdlibApi") optIn("kotlin.ExperimentalUnsignedTypes")
useExperimentalAnnotation("kotlin.time.ExperimentalTime") optIn("kotlin.ExperimentalStdlibApi")
useExperimentalAnnotation("kotlin.contracts.ExperimentalContracts") optIn("kotlin.time.ExperimentalTime")
useExperimentalAnnotation("kotlin.js.ExperimentalJsExport") optIn("kotlin.contracts.ExperimentalContracts")
optIn("kotlin.js.ExperimentalJsExport")
} }
internal fun RepositoryHandler.applyRepos() { internal fun RepositoryHandler.applyRepos() {