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)
}
//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")
}

View File

@ -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" }

View File

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

View File

@ -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")!!
}
}

View File

@ -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() {